return False
@asyncio.coroutine
+def help_announcements(message, command = None):
+ if command is None:
+ lines = [
+ 'Commands to manage announcements are:',
+ '```',
+ 'asap',
+ 'create',
+ 'delete',
+ 'list',
+ 'pause',
+ 'show',
+ 'resume',
+ '```',
+ 'Send `announce help COMMAND` for help on a specific command.'
+ ]
+ elif command == 'create':
+ lines = [
+ 'Create a new announcement.',
+ '```announce create OPTIONS: MESSAGE```',
+ 'Use the `OPTIONS` to define when and where to send the announcement. The `MESSAGE` can be omitted if you just want me to play a sound.',
+ 'You need to include the **:** after the OPTIONS. Anything you include after it will be part of the MESSAGE!',
+ '',
+ 'Here are the OPTIONS you can use:',
+ '',
+ '```every INTERVAL```',
+ 'Specify the interval at which the announcement will be sent. You can include **d**ays, **h**ours, **m**inutes or **s**econds. `every 6h` means every six hours. `every 10m30s` means every ten minutes and thirty seconds.',
+ '',
+ '```from DATE```',
+ "Don't start giving the announcement until at least this date. The date must be specified as YYYY-MM-DDThh:mm:ss, eg {}, and is in **UTC**. Send me the `time` command and I'll tell you the current time in UTC.".format(iso8601(int(time.time()))),
+ '',
+ '```to DATE```',
+ 'Stop giving the announcement after this date. See the notes on `from` for how to specify the date.',
+ '',
+ '```tell MENTION```',
+ 'Mention `@user`, `@role` or `#channel` in the announcement.',
+ '',
+ '```in CHANNEL```',
+ 'Send the announcement to the specified \#channel.',
+ '',
+ '```voice CHANNEL```',
+ 'Play a sound to the specified voice \#CHANNEL.',
+ '',
+ '```sound FILE```',
+ "File to play. I won't play sounds in private messages!",
+ '',
+ 'I also accept some shortcuts:',
+ '',
+ "`tell me` means to mention you in the announcement. If you don't specify a channel with `in` the announcement will be sent in a private message.",
+ '',
+ "`in here` means to send the message to the channel in which you sent `announce create`. If you send it in a private message the announcement will also be private.",
+ '',
+ '`once` is equivalent to `interval 0` and means to give the announcement just once.',
+ '',
+ '`at DATE` is equivalent to `from DATE to DATE once` and means to give the announcement just once at the specified time.',
+ '',
+ 'Example: `announce create every 12h in #channel: This message will be sent twice a day.`'
+ ]
+ elif command == 'delete':
+ lines = [
+ 'Delete the announcement with the given ID.',
+ '```announcement delete ID```',
+ 'You can only delete your own announcements or public announcements created by someone in a lower role.'
+ ]
+ elif command == 'help':
+ lines = ['grr!']
+ elif command == 'list':
+ lines = [
+ 'List all announcements, one `ID` per line. You can use the `ID` in other commands.',
+ "When listing IDs to a public channel I won't show IDs for announcements that are for channels on another server. Send `announce list` to me in a private message to see them.",
+ "I'll never show the IDs of another user's announcements, even in private."
+ ]
+ elif command == 'show':
+ lines = [
+ 'Show the announcement with the given ID.',
+ '```announcement show ID```',
+ 'I will tell you the details in a format which you could copy and paste to create a new announcement.',
+ "I'll never show details of another user's private announcements."
+ ]
+ elif command in ['asap', 'pause', 'resume']:
+ lines = [
+ 'Schedule the announcement with the given ID.',
+ '```',
+ 'announcement asap ID',
+ 'announcement pause ID',
+ 'announcement resume ID',
+ '```',
+ 'Use `asap` to give the announcement as soon as possible regardless of scheduling.',
+ 'Use `pause` and `resume` to put an announcement on hold temporarily.'
+ ]
+ else:
+ lines = ['*shrugs*']
+ yield from say_many(message.channel, lines)
+
+@asyncio.coroutine
def list_announcements(message):
result = yield from can_manage_announcements(message.author, message.channel, 'list')
if not result:
if command == 'list':
yield from list_announcements(message)
return
+ elif command == 'help':
+ yield from help_announcements(message)
+ return
else:
yield from say(message.channel, 'yelp!')
return
if command == 'show':
yield from show_announcement(message, args[1])
+ elif command == 'help':
+ yield from help_announcements(message, args[1])
elif command == 'delete':
yield from delete_announcement(message, args[1])
elif command == 'asap':