pythonbotsdiscordctx

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.


Solution

  • this is possible by using the following .join feature.

    @bot.command()
    async def idea(ctx, content):
        """Repeats a message multiple times."""
        message = (" ").join(content)
        await ctx.send(message)