Skip to content

how to add a command to custom client inheriting the commands.Bot object #6112

Answered by i11matic
i11matic asked this question in Q&A
Discussion options

You must be logged in to vote

figured it out myself. ill leave this here for reference

class DiscordRssClient(commands.Bot):
    async def on_ready(self):
        print('Logged in as')
        print(self.user.name)
        print(self.user.id)
        print('------')
        self.add_command(self.echo)
    @commands.command(name='echo')
    async def echo(ctx, message: str):
        await ctx.send(message)

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Rapptz
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant