Issue
I have a command in my bot that allows a user to dm an anonymous message to me. However, when I tested the command my bot only sends the first word of the message to me.
@commands.command(name='msgetika', aliases=['msgmax'])
async def msgetika(self, ctx, message1=None):
'''Send an annonymous message to discord'''
if message1 is None:
await ctx.send('Please specify a message')
maxid = await self.bot.fetch_user('643945264868098049')
await maxid.send('Anonymous message: ' + message1)
msg = await ctx.send('Sending message to max.')
await ctx.message.delete()
await asyncio.sleep(5)
await msg.delete()
Solution
You need to add a *
if you want to catch the entire phrase. View the docs here about using this and have a look at the example working beneath the code.
@commands.command(name='msgetika', aliases=['msgmax'])
async def msgetika(self, ctx, *, message1=None):
Also, unless you are using an older version of discord.py, user ids are int
s.
maxid = await self.bot.fetch_user(USER ID HERE)
Answered By - Bagle
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.