0
votes

Im trying to make a discord bot take a name input and add that name to a google sheet. All i get rn is an error whenever i use the command. Error: Command raised an exception: AttributeError: 'Bot' object has no attribute 'wait_for_message'

@client.command()
async def addguildmember(ctx):
  await ctx.send('Enter member name: ')
  nameMessage = client.wait_for_message(author=ctx.message.author, timeout=30) 
  await ctx.send('PaidY/N: ')
  paidMessage = client.wait_for_message(author=ctx.message.author, timout=30)
  row = [nameMessage,paidMessage,]
  index = 2
  sheet.insert_row(row , index)

So i have made some changes, it still does not work but it uses the new library you told me about. Now it gives me the error: /usr/lib/python3.8/asyncio/events.py:81: RuntimeWarning: coroutine 'wait_for' was never await ed self._context.run(self._callback, *self._args)

@client.command()
async def addguildmember(ctx): 
 nameMessage = 'placeholder'
 paidMessage = 'placeholder'
 await ctx.send('Enter member name: ')
 nameMessage = client.wait_for('message', timeout = 30) 
 #msg = await client.wait_for('message', check=check)
 #await ctx.send('Hello {.author}!'.format(msg))
 await ctx.send('PaidY/N: ')
 paidMessage = client.wait_for('message', timeout = 30)
 row = [nameMessage,paidMessage]
 index = 2
 sheet.insert_row(row , index)
1
Are you using the discord.py module? Where is your variable client created? - Hymns For Disco
near the top of the program below the imports and opening of the google sheets - Minejosh80

1 Answers

0
votes

It's possible you are using the code from the older version of the library. If you are using the rewrite branch, which I would suggest using if you aren't. It is now bot.wait_for('message')

This is the link to the documentation.