'can't use random in @client.command for discord.py
Hi if anyone could help with this code i want to use response = random.choice(img) in @client.command for discord.py but it keeps giving me error discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: object of type 'Command' has no len() I don't know how to use random with @client.command please help thanks.
@client.command(pass_context=True)
async def img(ctx):
embed = discord.Embed(
title = 'Image',
description = 'Image',
colour = discord.Colour.blue()
)
response = random.choice(img)
embed.add_field(name="Image", value=response, inline=False)
embed.set_footer(text="I love you all <3")
await ctx.send(embed=embed)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
