def _do_execute(self, cmd: Command):
if len(cmd.args) != 1:
await self.client.send_message(
cmd.channel,
'{0}: I was unable to parse your timezone because you gave the wrong number of arguments. '
'See <{1}> for a list of timezones.'.format(cmd.author.mention, self._timezone_loc))
return
tz_name = cmd.args[0]
if tz_name in pytz.common_timezones:
user = await userlib.get_user(discord_id=int(cmd.author.id), register=True)
user.set(timezone=tz_name, commit=True)
await self.client.send_message(
cmd.channel,
'{0}: Timezone set as {1}.'.format(cmd.author.mention, tz_name))
else:
await self.client.send_message(
cmd.channel,
'{0}: I was unable to parse your timezone. See <{1}> for a list of timezones.'.format(
cmd.author.mention, self._timezone_loc))
评论列表
文章目录