Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can i get guild name using discord.py

@client.command()
async def kick(ctx, member : discord.Member, *, reason=None):
    await member.kick(reason=reason)
    await ctx.send(f"{member.name} has been kicked by {ctx.author.name}\nReason: {reason}")
    await ctx.send(member, f"You have been kicked from {member.guild.name} reason: {reason}"

This is the return

from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Messageable.send() takes from 1 to 2 positional arguments but 3 were given

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The error message says that ctx.send() takes 1 or 2 positional arguments, and you’ve provided 3. In python, methods implicitly pass self, so this line:

await ctx.send(member, f"You have been kicked from {member.guild.name} reason: {reason}"

Actually is passing three arguments, because there’s an implicit self at the start. Since ctx.send() needs either 0 or 1 parameters of your own, what you probably actually want is this:

await ctx.send(f"{member}, you have been kicked from {member.guild.name} reason: {reason}"
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading