welcome.py 文件源码

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

项目:Chiaki-Nanami 作者: Ikusaba-san 项目源码 文件源码
def _do_command(*, thing):
        _toggle_help = f"""
        Sets whether or not I announce when someone {thing.action}s the server.

        Specifying with no arguments will toggle it.
        """

        _channel_help = f"""
            Sets the channel where I will {thing}.
            If no arguments are given, it shows the current channel.

            This **must** be specified due to the fact that default channels
            are no longer a thing. ([see here]({_DEFAULT_CHANNEL_CHANGE_URL}))

            If this isn't specified, or the channel was deleted, the message
            will not show.
            """

        _delete_after_help = f"""
            Sets the time it takes for {thing} messages to be auto-deleted.
            Passing it with no arguments will return the current duration.

            A number less than or equal 0 will disable automatic deletion.
            """

        _message_help = f"""
            Sets the bot's message when a member {thing.action}s this server.

            The following special formats can be in the message:
            `{{{{user}}}}`     = The member that {thing.past_tense}. If one isn't placed,
                                 it's placed at the beginning of the message.
            `{{{{uid}}}}`      = The ID of member that {thing.past_tense}.
            `{{{{server}}}}`   = The name of the server.
            `{{{{count}}}}`    = How many members are in the server now.
            `{{{{countord}}}}` = Like `{{{{count}}}}`, but as an ordinal,
                                 (e.g. instead of `5` it becomes `5th`.)
            `{{{{time}}}}`     = The date and time when the member {thing.past_tense}.
            """

        @commands.group(name=thing.command_name, help=_toggle_help, invoke_without_command=True)
        @_server_message_check()
        async def group(self, ctx, enable: bool=None):
            await self._toggle_config(ctx, enable, thing=thing)

        @group.command(name='message', help=_message_help)
        @_server_message_check()
        async def group_message(self, ctx, *, message: special_message):
            await self._message_config(ctx, message, thing=thing)

        @group.command(name='channel', help=_channel_help)
        @_server_message_check()
        async def group_channel(self, ctx, *, channel: discord.TextChannel):
            await self._channel_config(ctx, channel, thing=thing)

        @group.command(name='delete', help=_delete_after_help)
        @_server_message_check()
        async def group_delete(self, ctx, *, duration: int):
            await self._delete_after_config(ctx, duration, thing=thing)

        return group, group_message, group_channel, group_delete
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号