简体   繁体   中英

Discord Bot ctx only capturing first word

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")

the bot only safes the first word entered as ctx, so if i type?idea this is a great idea, only "this" is getting written down. the bot shoud write down "this is a great idea" I never coded a bot before and cant figure out how to fix it.

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")

the bot only safes the first word entered as ctx, so if i type?idea this is a great idea, only "this" is getting written down. the bot shoud write down "this is a great idea" I never coded a bot before and cant figure out how to fix it.

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")

the bot only safes the first word entered as ctx, so if i type?idea this is a great idea, only "this" is getting written down. the bot shoud write down "this is a great idea" I never coded a bot before and cant figure out how to fix it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM