Discord bot python - async def picks up a sentence and the ID

Asked

Viewed 32 times

2

I wanted to know how to send several sentences at once, example

?Say Hello World (Idchannel)

what happens is that I can only send a sentence and then the ID, I wanted to add as many phrases as I want and then the ID

@client.command(
    pass_context=True)
async def say(ctx, mensagem : str, id : int):
    amount = 1
    channel = client.get_channel(id)
    await ctx.channel.purge(limit=amount)
    await channel.send(mensagem)

1 answer

0


I managed to find out with a help, and to help whoever is in this post

async def say(ctx, id : int, *, mensagem : str, ):
   amount = 1 
   channel = client.get_channel(id) 
   await ctx.channel.purge(limit=amount) 
   await channel.send(mensagem)```
  • 1

    Just remembering that Ids on Discord are the type unsigned long. If you are using Python version 2, you will have to change this. If you are Python3+, you are right because integers are infinite

Browser other questions tagged

You are not signed in. Login or sign up in order to post.