Rohan
Rohan

Reputation: 1

Wikipedia Command Discord.py

@commands.command()
@commands.cooldown(1,10,BucketType.user)
async def wiki(self,ctx,*,word):
    def sum(arg):
        definition = wikipedia.summary(arg,sentences=3,chars=1000)
        return sum(word)
    await ctx.send(sum)

I am making a Wiki command, it doesn't work as expected and responds with this:

Bot Response

Upvotes: 0

Views: 136

Answers (1)

loloToster
loloToster

Reputation: 1413

That's because you are using sum the wrong way. Instead of this:

await ctx.send(sum)

you have to do this:

await ctx.send(sum(word))

Also, why are you invoking the function from within itself? In sum you should return definition.

Try not to shadow the builtin sum. You should rename the function to be get_definition or something else instead.

Upvotes: 1

Related Questions