{SOLVED} discord.py random function | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

{SOLVED} discord.py random function

I have this code: https://www.sololearn.com/post/1618690/?ref=app But when I input this command in Discord, in the Python console I get this: AttributeError: 'Command' object has no attribute 'randint' How can I fix it?

10th Apr 2022, 5:35 PM
Kind_Cat
Kind_Cat - avatar
2 Answers
+ 1
By using "def random(...)" you overwrite the name "random" which then no longer refers to the random module.
10th Apr 2022, 5:46 PM
Simon Sauter
Simon Sauter - avatar
0
Thanks, I will try import random as r
10th Apr 2022, 5:46 PM
Kind_Cat
Kind_Cat - avatar