Skip to content

Commit

Permalink
Continuing from 85ec3e1, show what the current values for paginate an…
Browse files Browse the repository at this point in the history
…d private (and all other fields) are.

Fixes #41.
  • Loading branch information
nmlorg committed May 14, 2019
1 parent 85ec3e1 commit 8da60c2
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 17 deletions.
4 changes: 2 additions & 2 deletions metabot/modules/test_echo.py
Expand Up @@ -146,7 +146,7 @@ def test_admin(conversation): # pylint: disable=redefined-outer-name
Bot Admin \u203a modulestestbot \u203a echo \u203a echotest: <b>Choose a field</b>
Set <code>text</code> to <code>my message</code>.
[text \u2022 The message, sticker, or image to send in response to /echotest. | /admin modulestestbot echo echotest text]
[text (my message) \u2022 The message, sticker, or image to send in response to /echotest. | /admin modulestestbot echo echotest text]
[paginate \u2022 For multiline messages, display just one line at a time? | /admin modulestestbot echo echotest paginate]
[private \u2022 Send the message in group chats, or just in private? | /admin modulestestbot echo echotest private]
[Back | /admin modulestestbot echo]
Expand All @@ -157,7 +157,7 @@ def test_admin(conversation): # pylint: disable=redefined-outer-name
Bot Admin \u203a modulestestbot \u203a echo \u203a echotest: <b>Choose a field</b>
Changed <code>text</code> from <code>my message</code> to <code>new message</code>.
[text \u2022 The message, sticker, or image to send in response to /echotest. | /admin modulestestbot echo echotest text]
[text (new messa\u2026) \u2022 The message, sticker, or image to send in response to /echotest. | /admin modulestestbot echo echotest text]
[paginate \u2022 For multiline messages, display just one line at a time? | /admin modulestestbot echo echotest paginate]
[private \u2022 Send the message in group chats, or just in private? | /admin modulestestbot echo echotest private]
[Back | /admin modulestestbot echo]
Expand Down
22 changes: 11 additions & 11 deletions metabot/modules/test_events.py
Expand Up @@ -197,13 +197,13 @@ def test_group(conversation, monkeypatch): # pylint: disable=redefined-outer-na
Bot Admin \u203a modulestestbot \u203a moderator \u203a -1001000001000: <b>Choose a field</b>
Set timezone to <code>US/Pacific</code>.
[calendars \u2022 Which calendars should be listed in /events? | /admin modulestestbot moderator -1001000001000 calendars]
[calendars (6fc2c510) \u2022 Which calendars should be listed in /events? | /admin modulestestbot moderator -1001000001000 calendars]
[daily \u2022 Should I announce upcoming events once a day? If so, at what hour? | /admin modulestestbot moderator -1001000001000 daily]
[dailytext \u2022 One or more messages (one per line) to use/cycle through for the daily announcement. | /admin modulestestbot moderator -1001000001000 dailytext]
[greeting \u2022 How should I greet people when they join? | /admin modulestestbot moderator -1001000001000 greeting]
[maxeventscount \u2022 How many events should be listed in /events? | /admin modulestestbot moderator -1001000001000 maxeventscount]
[maxeventsdays \u2022 How many days into the future should /events look? | /admin modulestestbot moderator -1001000001000 maxeventsdays]
[timezone \u2022 What time zone should be used in /events? | /admin modulestestbot moderator -1001000001000 timezone]
[timezone (US/Pacific) \u2022 What time zone should be used in /events? | /admin modulestestbot moderator -1001000001000 timezone]
[Back | /admin modulestestbot moderator]
"""

Expand All @@ -219,13 +219,13 @@ def test_group(conversation, monkeypatch): # pylint: disable=redefined-outer-na
Bot Admin \u203a modulestestbot \u203a moderator \u203a -1001000001000: <b>Choose a field</b>
Set timezone to <code>UTC</code>.
[calendars \u2022 Which calendars should be listed in /events? | /admin modulestestbot moderator -1001000001000 calendars]
[calendars (6fc2c510) \u2022 Which calendars should be listed in /events? | /admin modulestestbot moderator -1001000001000 calendars]
[daily \u2022 Should I announce upcoming events once a day? If so, at what hour? | /admin modulestestbot moderator -1001000001000 daily]
[dailytext \u2022 One or more messages (one per line) to use/cycle through for the daily announcement. | /admin modulestestbot moderator -1001000001000 dailytext]
[greeting \u2022 How should I greet people when they join? | /admin modulestestbot moderator -1001000001000 greeting]
[maxeventscount \u2022 How many events should be listed in /events? | /admin modulestestbot moderator -1001000001000 maxeventscount]
[maxeventsdays \u2022 How many days into the future should /events look? | /admin modulestestbot moderator -1001000001000 maxeventsdays]
[timezone \u2022 What time zone should be used in /events? | /admin modulestestbot moderator -1001000001000 timezone]
[timezone (UTC) \u2022 What time zone should be used in /events? | /admin modulestestbot moderator -1001000001000 timezone]
[Back | /admin modulestestbot moderator]
"""

Expand All @@ -243,13 +243,13 @@ def test_group(conversation, monkeypatch): # pylint: disable=redefined-outer-na
Bot Admin \u203a modulestestbot \u203a moderator \u203a -1001000001000: <b>Choose a field</b>
Set <code>maxeventscount</code> to <code>1</code>.
[calendars \u2022 Which calendars should be listed in /events? | /admin modulestestbot moderator -1001000001000 calendars]
[calendars (6fc2c510) \u2022 Which calendars should be listed in /events? | /admin modulestestbot moderator -1001000001000 calendars]
[daily \u2022 Should I announce upcoming events once a day? If so, at what hour? | /admin modulestestbot moderator -1001000001000 daily]
[dailytext \u2022 One or more messages (one per line) to use/cycle through for the daily announcement. | /admin modulestestbot moderator -1001000001000 dailytext]
[greeting \u2022 How should I greet people when they join? | /admin modulestestbot moderator -1001000001000 greeting]
[maxeventscount \u2022 How many events should be listed in /events? | /admin modulestestbot moderator -1001000001000 maxeventscount]
[maxeventscount (1) \u2022 How many events should be listed in /events? | /admin modulestestbot moderator -1001000001000 maxeventscount]
[maxeventsdays \u2022 How many days into the future should /events look? | /admin modulestestbot moderator -1001000001000 maxeventsdays]
[timezone \u2022 What time zone should be used in /events? | /admin modulestestbot moderator -1001000001000 timezone]
[timezone (UTC) \u2022 What time zone should be used in /events? | /admin modulestestbot moderator -1001000001000 timezone]
[Back | /admin modulestestbot moderator]
"""

Expand Down Expand Up @@ -313,8 +313,8 @@ def test_private(conversation, monkeypatch): # pylint: disable=redefined-outer-
Events \u203a Settings: <b>Choose a field</b>
Set timezone to <code>US/Pacific</code>.
[calendars \u2022 Which calendars do you want to see? | /events set calendars]
[timezone \u2022 What time zone are you in? | /events set timezone]
[calendars (6fc2c510) \u2022 Which calendars do you want to see? | /events set calendars]
[timezone (US/Pacific) \u2022 What time zone are you in? | /events set timezone]
[Back | /events]
"""

Expand Down Expand Up @@ -377,8 +377,8 @@ def test_inline(conversation, monkeypatch): # pylint: disable=redefined-outer-n
Events \u203a Settings: <b>Choose a field</b>
Set timezone to <code>US/Pacific</code>.
[calendars \u2022 Which calendars do you want to see? | /events set calendars]
[timezone \u2022 What time zone are you in? | /events set timezone]
[calendars (6fc2c510) \u2022 Which calendars do you want to see? | /events set calendars]
[timezone (US/Pacific) \u2022 What time zone are you in? | /events set timezone]
[Back | /events]
"""

Expand Down
4 changes: 2 additions & 2 deletions metabot/modules/test_moderator.py
Expand Up @@ -90,7 +90,7 @@ def test_admin(conversation): # pylint: disable=redefined-outer-name
[calendars \u2022 Which calendars should be listed in /events? | /admin modulestestbot moderator -1001000001000 calendars]
[daily \u2022 Should I announce upcoming events once a day? If so, at what hour? | /admin modulestestbot moderator -1001000001000 daily]
[dailytext \u2022 One or more messages (one per line) to use/cycle through for the daily announcement. | /admin modulestestbot moderator -1001000001000 dailytext]
[greeting \u2022 How should I greet people when they join? | /admin modulestestbot moderator -1001000001000 greeting]
[greeting (Welcome! \u2026) \u2022 How should I greet people when they join? | /admin modulestestbot moderator -1001000001000 greeting]
[maxeventscount \u2022 How many events should be listed in /events? | /admin modulestestbot moderator -1001000001000 maxeventscount]
[maxeventsdays \u2022 How many days into the future should /events look? | /admin modulestestbot moderator -1001000001000 maxeventsdays]
[timezone \u2022 What time zone should be used in /events? | /admin modulestestbot moderator -1001000001000 timezone]
Expand Down Expand Up @@ -156,7 +156,7 @@ def test_admin(conversation): # pylint: disable=redefined-outer-name
[calendars \u2022 Which calendars should be listed in /events? | /admin modulestestbot moderator -1001000001000 calendars]
[daily \u2022 Should I announce upcoming events once a day? If so, at what hour? | /admin modulestestbot moderator -1001000001000 daily]
[dailytext \u2022 One or more messages (one per line) to use/cycle through for the daily announcement. | /admin modulestestbot moderator -1001000001000 dailytext]
[greeting \u2022 How should I greet people when they join? | /admin modulestestbot moderator -1001000001000 greeting]
[greeting (Welcome! \u2026) \u2022 How should I greet people when they join? | /admin modulestestbot moderator -1001000001000 greeting]
[maxeventscount \u2022 How many events should be listed in /events? | /admin modulestestbot moderator -1001000001000 maxeventscount]
[maxeventsdays \u2022 How many days into the future should /events look? | /admin modulestestbot moderator -1001000001000 maxeventsdays]
[timezone \u2022 What time zone should be used in /events? | /admin modulestestbot moderator -1001000001000 timezone]
Expand Down
15 changes: 14 additions & 1 deletion metabot/util/adminui.py
Expand Up @@ -2,6 +2,11 @@

from __future__ import absolute_import, division, print_function, unicode_literals

try:
import builtins
except ImportError:
import __builtin__ as builtins

import math

import pytz
Expand Down Expand Up @@ -68,7 +73,15 @@ def fields(ctx, msg, subconf, fieldset, field, text): # pylint: disable=too-man
else:
msg.action = 'Choose a field'
for fieldname, unused_uifunc, fielddesc in fieldset:
msg.button('%s \u2022 %s' % (fieldname, fielddesc), fieldname)
value = subconf.get(fieldname)
if isinstance(value, builtins.bool):
value = value and 'yes' or 'no'
elif value is not None:
value = '%s' % value
if len(value) > 10:
value = value[:9] + '\u2026'
label = value and '%s (%s)' % (fieldname, value) or fieldname
msg.button('%s \u2022 %s' % (label, fielddesc), fieldname)


def freeform(unused_ctx, msg, subconf, field, desc, text):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -3,7 +3,7 @@

setuptools.setup(
name='metabot',
version='0.1.0.3',
version='0.1.0.4',
author='Daniel Reed',
author_email='nmlorg@gmail.com',
description='Modularized, multi-account bot.',
Expand Down

0 comments on commit 8da60c2

Please sign in to comment.