def create(message: discord.Message, tag: tag_arg, *time, timezone: tz_arg="UTC"):
""" Create a countdown with the specified tag, using the same format as `{pre}when`. """
assert tag not in time_cfg.data["countdown"], "Countdown with tag `{}` already exists.".format(tag)
timezone_name = timezone
dt, timezone = await init_dt(message, " ".join(time), timezone)
seconds = int((dt - pendulum.now(tz=timezone)).total_seconds())
assert seconds > 0, "A countdown has to be set in the future."
cd = dict(time=dt.to_datetime_string(), tz=timezone, tz_name=timezone_name, tag=tag,
author=message.author.id, channel=message.channel.id)
time_cfg.data["countdown"][tag] = cd
time_cfg.save()
await client.say(message, "Added countdown with tag `{}`.".format(tag))
client.loop.create_task(wait_for_reminder(cd, seconds))
评论列表
文章目录