Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Data Science by (18.4k points)

I am making the moderation bot for discord and want to add the kick command. I did some research on kick commands but none of them work. The error is:

discord.ext.commands.errors.CommandNotFound: Command "kick" is not found

This is the code:

@commands.command()

@commands.has_permissions(kick_members=True)

async def kick(ctx, member: discord.Member, *, reason=None):

    await client.kick(member)

    await ctx.send(f'User {member} has been kick')

2 Answers

0 votes
by (36.8k points)
edited by

There is nothing like the client.kick(member). I think you are trying to do member.kick(). Here is the example of kick command:

@client.command()

async def kick(ctx, member: discord.Member, *, reason=None):

    await member.kick(reason=reason)

    await ctx.send(f'User {member} has kicked.')

Do check out Python for Data Science Course

If you wish to learn more about Python, visit the Python tutorial and Python Certification course by Intellipaat.

0 votes
by (1.3k points)

In python regular expressions(regex) groups() method is used to fetch the captured groups from a match object. The groups() method returns all the captured groups as tuples.

Sample Code:

import re
text = “Hello Everyone, This is Ajay and i am 30 year old”

pattern= r”Hello Everyone, This is (\w+) and i am (\d+) year old”

match=re.search(pattern,text)

if match:
groups=match.groups()
print(groups)

Output -> (‘Ajay’, ‘30’)

The Groups used in the pattern are:
(\w+) : captures one or more word characters
(\d+): captures one or more digits

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...