cmd_user.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:necrobot 作者: incnone 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号