Random gif after command

RickRoll =  ["https://tenor.com/view/things-that-you-shouldnt-stare-at-for-too-long-the-sun-winnie-the-pooh-rickroll-rick-astley-gif-16585085","https://tenor.com/view/rickroll-rick-roll-rickastley-spongebob-gif-19367765"]

async def rickroll(ctx):
  await message.channel.send(random.choice(RickRoll))
So i made this code and its somehow not working and i dont understand what i do wrong

In what way is it not working? We don’t really have any context. The thing I notice is that those are not urls to image files, but I don’t know if that’s the problem you’re talking about.

So my problem is that when i press on Run (repl.com) it will stop immediatly without doing anything. When i remove the code it works again sorry about not telling you. Those URLS are gifs and videos.

The repl should be erroring out since the code awaits message.channel.send() however, the message variable isn’t defined. While defining commands, since you’re getting the ctx variable, you could directly send messages using → await ctx.send()

I think this should help-

import random
RickRoll =  ["https://tenor.com/view/things-that-you-shouldnt-stare-at-for-too-long-the-sun-winnie-the-pooh-rickroll-rick-astley-gif-16585085", "https://tenor.com/view/rickroll-rick-roll-rickastley-spongebob-gif-19367765"]

async def rickroll(ctx):
  await ctx.send(random.choice(RickRoll))
1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.