def toggle_countdown(self, ctx: commands.Context, toggle=None):
""" Turns the timer's countdown setting on or off. If no state is
specified, it will toggle it
:param toggle: True, yes or on to turn the setting on. False, no or off
to turn the setting off. If not specified, or None is given,
it will toggle the setting.
"""
author = ctx.message.author
channel = self.bot.spoof(author, lib.get_channel(ctx))
interface = self.bot.get_interface(channel)
timer = interface.timer
toggle = lib.to_boolean(toggle)
if timer.countdown == toggle:
return # No need to edit it if it's the same.
timer.toggle_countdown(toggle)
await self.bot.edit_message(interface.time_message, timer.time())
await self.bot.say("Successfully toggled the countdown setting {}!"
.format("on" if timer.countdown else "off"),
delete_after=self.bot.ans_lifespan)
评论列表
文章目录