如何解决调用输入显示通道和用户参数
所以我的代码基本上是显示一条消息,然后告诉用户复制并粘贴该消息,并将其作为输入,以便稍后调用。
await ctx.author.send('Random message not related ')
await ctx.author.send('Random message not related.')
await ctx.author.send(" Message to be copied and pasted")
await ctx.author.send('Please copy and answer the quesitons above,after you have answered everything,paste the form in this chat with the answers written.')
answerApplication = await client.wait_for('message',timeout=100.0)
applicationTicketChannel = await guild.create_text_channel('%s' % ctx.author,overwrites=overwrites,category=category)
await applicationTicketChannel.send('This is the form filled out by %s please wait patiently until one of our Managers can review your application' % ctx.author.mention)
print(answerApplication)
await applicationTicketChannel.send(answerApplication)
await ctx.author.send('Your staff application ticket has been opened.')
await ctx.author.send("Your ticket is <#%s>" % applicationTicketChannel.id)
一旦您粘贴了消息,问题就会出现,由于某种原因,将被调用的消息如下:https://prnt.sc/u0v9v8
任何帮助将不胜感激。
解决方法
answerApplication
是discord.Message
对象,因此,如果您打印或发送answerApplication
,它将返回该对象,而不是消息内容。
如果要返回邮件内容,只需使用answerApplication.content
而不是answerApplication
:
await ctx.author.send('Random message not related ')
await ctx.author.send('Random message not related.')
await ctx.author.send(" Message to be copied and pasted")
await ctx.author.send('Please copy and answer the quesitons above,after you have answered everything,paste the form in this chat with the answers written.')
answerApplication = await client.wait_for('message',timeout=100.0)
applicationTicketChannel = await guild.create_text_channel(f'{ctx.author}',overwrites=overwrites,category=category)
await applicationTicketChannel.send(f'This is the form filled out by {ctx.author.mention} please wait patiently until one of our Managers can review your application')
print(answerApplication) #Will print the object
print(answerApplication.content) #Will print the message content
await applicationTicketChannel.send(answerApplication.content)
await ctx.author.send('Your staff application ticket has been opened.')
await ctx.author.send(f"Your ticket is <#{applicationTicketChannel.id}>")
PS:我使用f strings代替%s格式化字符串。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。