from discord.ext import commands
import random
description = '''An example bot to showcase the discord.ext.commands extension
module.
There are a number of utility commands being showcased here.'''
bot = commands.Bot(command_prefix='?', description=description)
@bot.event
async def on_ready():
print('Logged in as')
print(bot.user.name)
print(bot.user.id)
print('------')
#here i need the help
@bot.command()
async def idea(ctx, content):
"""Repeats a message multiple times."""
await ctx.send(content)
f= open("supersmartidea.txt","a")
f.write("¦" + content + "\n")
机器人只保护第一个输入为ctx的单词,因此如果我输入思想是一个好主意,只有“ this”被记录下来。机器人应该写下“这是个好主意”我以前从未编写过机器人程序,也无法弄清楚如何修复它。
有两种方法可以获取全部内容。
这将给出他们所说的一串话。例如,?idea A good idea
将返回:A good idea
@bot.command()
async def idea(ctx, *, content):
#code
这将返回每个单词的元组。例如:?idea A good idea
将返回:('A', 'good', 'idea')
然后可以通过执行content = ' '.join(content)
@bot.command()
async def idea(ctx, *content):
#code