diff --git a/metabot/modules/test_echo.py b/metabot/modules/test_echo.py index 0e80e12..8f1ae86 100644 --- a/metabot/modules/test_echo.py +++ b/metabot/modules/test_echo.py @@ -146,7 +146,7 @@ def test_admin(conversation): # pylint: disable=redefined-outer-name Bot Admin \u203a modulestestbot \u203a echo \u203a echotest: Choose a field Set text to my message. -[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] @@ -157,7 +157,7 @@ def test_admin(conversation): # pylint: disable=redefined-outer-name Bot Admin \u203a modulestestbot \u203a echo \u203a echotest: Choose a field Changed text from my message to new message. -[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] diff --git a/metabot/modules/test_events.py b/metabot/modules/test_events.py index 1ae0118..1bed10e 100644 --- a/metabot/modules/test_events.py +++ b/metabot/modules/test_events.py @@ -197,13 +197,13 @@ def test_group(conversation, monkeypatch): # pylint: disable=redefined-outer-na Bot Admin \u203a modulestestbot \u203a moderator \u203a -1001000001000: Choose a field Set timezone to US/Pacific. -[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] """ @@ -219,13 +219,13 @@ def test_group(conversation, monkeypatch): # pylint: disable=redefined-outer-na Bot Admin \u203a modulestestbot \u203a moderator \u203a -1001000001000: Choose a field Set timezone to UTC. -[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] """ @@ -243,13 +243,13 @@ def test_group(conversation, monkeypatch): # pylint: disable=redefined-outer-na Bot Admin \u203a modulestestbot \u203a moderator \u203a -1001000001000: Choose a field Set maxeventscount to 1. -[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] """ @@ -313,8 +313,8 @@ def test_private(conversation, monkeypatch): # pylint: disable=redefined-outer- Events \u203a Settings: Choose a field Set timezone to US/Pacific. -[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] """ @@ -377,8 +377,8 @@ def test_inline(conversation, monkeypatch): # pylint: disable=redefined-outer-n Events \u203a Settings: Choose a field Set timezone to US/Pacific. -[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] """ diff --git a/metabot/modules/test_moderator.py b/metabot/modules/test_moderator.py index 9034fb3..f445091 100644 --- a/metabot/modules/test_moderator.py +++ b/metabot/modules/test_moderator.py @@ -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] @@ -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] diff --git a/metabot/util/adminui.py b/metabot/util/adminui.py index 686b5f1..f650240 100644 --- a/metabot/util/adminui.py +++ b/metabot/util/adminui.py @@ -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 @@ -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): diff --git a/setup.py b/setup.py index 8ddcc09..f3f685c 100644 --- a/setup.py +++ b/setup.py @@ -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.',