#discord-bots
1 messages · Page 238 of 1
anyone able to help me
Yeah that's what I meant though don't you have to give a specific date and time? Which leads to it being executed once only and then when it gets executed you can just set the new interval?
Kind of forgot how dpy handles tasks with the time 
Nah it even expects datetime.time object, I don't think it would only execute it once
Makes sense then it's every day at the given time
And I have sort of "daily reset" task in my bot with time=time(0) it executes correctly
But that's disnake
Yeah probably very similar
.
Returns True if a user can read messages from all or specific text channels.
Yes
wrong my friend, same issue
Is that if clause the only where you create channel
channel = await support.create_text_channel(name = f"{interaction.user.name}-{interaction.user.discriminator}-ticket", overwrites=overwrites, reason=f"Ticket Opened for: {interaction.user}")
I am mentioning the overwrites every other overwrite works
just not that one
Does the category have permissions
It does
Apologies, view_channel is an alias for read_messages
Unless you are creating channel in different guild than interaction was created in I see no other issues except interaction.user and interaction.guild.me should be same things
same issue
anyone able to help me out
hmmm I'm stumped
https://paste.pythondiscord.com/pixoxacesa
errors + goal?
you still don't really seem to grasp the difference between an object and a class
discord.TextChannel.get_partial_message(...)
an object is an instance of a class
I like how you use the docs, but when they're showing how to use certain methods like
get_partial_message
they refer to discord.TextChannel as an object of that class
that why you want to do stuff like
text_channel = client.get_channel(<channel_id>)
partial_msg = text_channel.get_partial_message(<message_id>)```
anyoine
so what's the difference if an object is an instance of a class? it's still the class data for that item. no?
how are you testing that the default role can still see it? you're not giving yourself (as an admin) no roles, right? 🧠
just spot the difference
discord.TextChannel.get_partial_message(self, message_id)
a_channel.get_partial_message(id)
you see its simplicity?
first 1 goes through the class structure and the 2nd is self-defined variables as objects? but they return the same value?
what if you wanted to get a partial message of a specific channel?
you know what I mean now?
that's why you want to call methods on instances of these classes
by name or ID?
wait, explain your main goal first
maybe getting the channel isn't even needed
id or it would be harder to find by name
role react buttons and custom embed that i can dynamically add/remove roles to. i got the embed to add/remove from, but it sends a new one each time currently
instead of editing 1
so your message ID will always be the same, correct?
right
then you'll have to store that message ID in a database to persist it. are you doing this already?
yes
that's good
one issue though
why are you casting it to an int?
haven't you stored it as an integer?
if it was stored as a string, you should rewrite your database structure
note that a txt isn't a database
that isn't a message ID though...
so I ask you again, how are you storing the message ID?
oops
yup, should be an int
it allows input as a slash command.
Does anyone know how to make your discord bot give an user a role
that's something else
then you might want to map the output to cast / store it as an int
yes,
you get the role object first
then the member object
then you do await member.add_roles(<your_role_object>)
anyways, the storing of the data should be done correctly
most info you'll ask will probably be a string...
fixed just did ```py
await channel.edit(sync_permissions=True)
well done 👍
So when the command calls for the input of the message id, i should just convert it straight to an int and use int instead of str after that point?
correct
you cast it to its correct type and move on from there
also, I highly discourage you to except all errors, try except a specific error you're expecting
im trying to make an api to interact with my discord bot, just to get how many guilds, channels & users it has, how would i start this. im using dpy
is there a reference for what type of errors each function would throw though? I've just been using the whole error to figure out whats wrong.
wdym
in the case you're trying it, there's no need for a try except
ok
so whenever an API call is made for example
GET_GUILD_MEMBER_COUNT, it would return an int with that?
are you sure you even need a discord bot for this?
ok. tyvm
you're thinking about this the wrong way
you should make a database which stores the message ID with all info of each guild
if there's no message ID set up in the database for a specific guild the bot joined, the bot will ask the authorized members (most likely the owner of the guild) to give it a channel and message ID to create this info message.
If the bot notices the channel or message got deleted, it'll ask the guild owner AGAIN to set up a new message ID etc
$help
MemberJoinMonitoring:
creation_time All commands related to the Creation time trigger.
No Category:
help Shows this message
Type $help command for more info on a command.
You can also type $help category for more info on a category.
ohhhh and use the db to avoid api calls.
correct
you would check in on_channel_delete events if the setup channel of that guild got deleted
so you'd only have to do an API call when you were editing the message, since it would already know beforehand if the message got deleted (or the channel)... unless the bot was offline while that happened, then you'd have to use some sort of system you currently tried to set up, but way simpler
that system would look like
setup_channel_id = get the channel ID out of the database for this guild
message_id = get the message ID out of the database for this guild
setup_channel = client.get_channel(setup_channel_id)
if setup_channel is None:
1. update the database and reset all setup info of that guild, as the channel wasn't found anymore
2. notify the guild owner to set up a new channel and info message
same thing in case the setup_message got deleted while the bot was offline (which means the get_partial_message wouldn't find anything in the given channel)
hmm ok. so use that data stored more than I am. less API calls = better all around.
well, idk when you'd make API calls now, but yeah, idk where you'd otherwise get all the setup INFO from besides a DB
nonono i mean that i have the bot, and i just want to be able to see the guild ands stuff on the website for statistics
I think there's already some packages / tools for this
you don't have to reinvent the wheel 🙂
do u know name or link?
no, google does probably
what would you google in this case?
yes you do
how
by thinking about it
i thought and i cant think of it
so far I haven't made slash commands till this past week. Now that I finally have a grasp on it a bit, I plan on using the db more, but wasn't sure what to use it for yet. this is just some basic command to edit the roles on an embed. then the button view will follow the dataset for the role names in the embed. I was just thinking of setting up the buttons knowledge for a persistent view to be in a db. not the editing the embed part.
try by typing in the same thing as you did here
all that comes up is the discord api or dsicord.py api
what did you try?
what i send
something along the lines of "show discord server statistics on website"
firstly
this isn't discord bot related
...
A persistent view already exists (meaning the buttons will keep on working after a bot restart)
https://github.com/Rapptz/discord.py/blob/master/examples/views/persistent.py
someone mentioned to use custom id's for the buttons to remain persistent right?
correct
you can see them in the link shared above
so would I have to setup like a query for the custom id to assign the right role from there then?
well, I think you're worried to much of what's coming
have you been able to add / remove a role from a user by clicking on a button in the first place?
if that's the case, adding a custom_id to that button would be a piece of cake
not yet. that was my next step after editing the message
well, you're thinking too much ahead, try making simple buttons first before thinking about the persistency
i looked onlin and it says to make an api or websocket or something which i dont understand
already did that 🤣
try making a #❓|how-to-get-help out of it, and be as descriptive as possible
you'll get help in no time
thank you sniperglitcherz
well, based on how you made that and the link shared above, it wouldn't be hard implementing persistency I think
these change both text and voice channels associated with em. So yeah it should be fine.
that was my first project
making this as user-friendly as possible for users is the main challenge usually
took me like 2 mo then i learned python basics after I made this. converted everything to a sqlite db then to postgres via docker. now im just wanting to get this finished then twitch api stuff is next.
yeahhh aside from self implementation, making it user-friendly and ""smart"" is the fun challenge.
this is a little bit confusing tbh
use an aiohttp web server and host it on the same event loop as your bot
ok
what do u mean event loop
asyncio event loop
its a voice channel generator.
which is what runs async tasks
^this is a custom mockup of terraria's world generator. that's all.
thread
just curious. with slash command interactions. what can u use to get the thread.id?
Does anyone know how to make your bot give an user an role
Hi guys, was self bot removed in discord.py 2.0?
all user endpoints were removed in 2.0
Hello everyone! Is anyone enable to give me a hand?
I need help with this part of my bot.
https://paste.pythondiscord.com/nipavimowa
what about it
so, the command is not working. It doesn't send errors, but also doesn't do its function. Function suppose to send +75 to population in table users and +25 in reserves per purchase and it suppose to send +5 citizen in population as well per hour per residential own and +1 to reserves.
I send the command, but no errors, but neither do the function properly. It doesn't send the 75 or 25 and it doesn't add the hours either.
Hi, this is a Python server so we only help with Python code. Perhaps you could try a JavaScript server for help?
well this is a Python server but I can guess that you're not providing any error handlers for the event
path = None
################################################3
@tree.command(name="choose", description="c", guild=discord.Object(guildid))
@app_commands.choices(account=[
app_commands.Choice(name="roblox", value="r"),
app_commands.Choice(name="minecraft", value="m"),
])
async def rbx(ctx, account: app_commands.Choice[str]):
if app_commands.Choice == "roblox":
path = robloxpath
this still continues as if path is still none despite me looking at the user choice? im new to slash commands i dont understand
well, u need to use 'global' keyword ig, coz u gotta access the global variable
Your if statement is also incorrect
path = None
################################################3
@tree.command(name="choose", description="c", guild=discord.Object(guildid))
@app_commands.choices(account=[
app_commands.Choice(name="roblox", value="r"),
app_commands.Choice(name="minecraft", value="m"),
])
async def rbx(ctx, account: app_commands.Choice[str]):
global path
if account.name == "roblox" :
path = robloxpath
Add account.name instead of app_commands.Choice as the choices are formed as key value pair.
hope now it is working for u
Is there any way to pick custom color for discord embed? I mean I want a color code for discord embed color, so is there any website which will provide me with all the codes?
discord.Embed(description = "custom color embed", color = 0xFF0000)
you can use hex for colors
Oh ok, thanks!
And is there any way to make name and value in add_field side by side?
class discord.Embed(*, colour=None, color=None, title=None, type='rich', url=None, description=None, timestamp=None)```
Represents a Discord embed.
len(x) Returns the total size of the embed. Useful for checking if it’s within the 6000 character limit.
bool(b) Returns whether the embed has any data set.
New in version 2.0.
x == y Checks if two embeds are equal.
New in version 2.0...
I want the output like this -
name : value
But I am getting this
value```
I tried that but it actually controls the fields and not the pairs, isn't it?
"inline (bool) – Whether the field should be displayed inline."
try
1 inline one dont
alright
Also, is there any way to create an empty gap in embed?
like there is <br> in html
try making a field that it's name is a space
and \n in python
idk
thanks though, Imma try it
it works now thanks
hi just started learning
import discord
import os
from discord.ext import commands
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv("DISCORD_TOKEN")
intents = discord.Intents.default()
intents.message_content = True
# client = MyClient(intents=intents)
client = commands.Bot(command_prefix="$", intents=intents)
@client.event
async def on_message(message):
print(f"Message from {message.author}: {message.content}")
if message.author == client.user:
return
if message.content.startswith("$hello"):
await message.channel.send("Hi")
@client.event
async def on_ready():
print(f"{client.user} has connected.")
@commands.command(
name="say",
)
async def say(ctx):
await ctx.send("Hi Snowman")
client.add_command(say)
client.run(TOKEN)
what am i doing wrong here?
the command is not working
@client.command(
name="say",
)
async def say(ctx):
await ctx.send("Hi Snowman")
``` i tried it like this as well
nvm i will go to https://discord.com/channels/267624335836053506/1035199133436354600
on_message blocks the commands
if you haven't gotten an answer yet
ohhhh
he/she can use @client.listen() instead
yes i didnt
since actually it's a Bot object
client.listen is a method so you will have to call it with brackets
instead of @client.event ?
yes
yes, with the parenthesis as Dani said
discord is restricting my bot from sending interaction to info command. (other commands are interacted), why?
how do you know that? is there an error?
The console throws a restricted message that only occurs when the info slash command is runned
and the interaction to the info command is not sent
can you show it then?
can be
error: code: https://paste.pythondiscord.com/ovepoyopib
The bot is hosted on a private server not repl it, So theres no chances of ip being shared
How do you know
What do you mean how do you know?
Its literally in the console and also seen when the bot is not sending interaction
How do you know that the IP isn't shared
It's a private server
looking at the error looks like you are rate limited
other commands works fine
they do send interaction
Doesn't mean the IP can't be shared
but my other commands are working
its only restricting the info command
Why would they just rate limit a single command
also @unkempt mauve i would recommend removing the error paste link
since it reveals your ip
btw I am on a vpn
🤣
the error comes from the server so its server ip i belive
did you try reseting the token? or rebooting your bot?
Okay what do I do? Could it be one of the following reasons?
- The for loop that counts guild members and channels
- The bot is banned from sending interaction to info command
I did restarted the server.
I should probably reset the token
If the bot was restricted, it should not be sending any interaction but it's only not sending to info command and other commands are working fine. thats so weird
it does not you need to reset it on developer portal manually
and replace in your code
thats what I meant with resetting the token lul
okay then
the bot is still being restricted from sending interaction to info command
breh
Why the other commands working then
its so weird
The first one doesn't matter, you didn't do any requests except for responding
no idea first one seeing this error you may want to ask at discord.py support server
discord.gg/dpy
Is discord having issues with guild things
Ofc its also first time for me. cuz I have never seen this happened. What I always saw was the whole bot was restricted
but the bot is now only restricted to a command
How can I attach a local image to my embed to send in someones dm for example a captcha code and have them reply to the interaction with the correct code like as a select menu but where the user can input the correct code
do you know how I can do the second part?
class discord.ui.Modal(*, title=..., timeout=None, custom_id=...)```
Represents a UI modal.
This object must be inherited to create a modal popup window within discord.
New in version 2.0.
Examples...
Hi guys, i want to make a discord.py game bot, can anyone suggest me what type of game should I make, like which discord.py games are famous these days
I know this is probably a stupid question, but do we like, need our own server to keep our bot online or will Discord provide us with one?
You need your own
Ok thank you for letting me know
Can someone help me out, heres my capatcha embed:
I want the user to be able to respond to that with a drop down menu as an input but in dms with the correct capatcha code or just respond saying the code how can I do this
use a modal
I can't in dms
!d discord.InteractionResponse.send_modal
await send_modal(modal, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Responds to this interaction by sending a modal.
can I
since when
how can I send this in dms when a user joins my server
maybe use a button to open the modal
thanks mate
guys how can i make discord.py do hot reload?
!d discord.ext.commands.Bot.reload_extension
await reload_extension(name, *, package=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Atomically reloads an extension.
This replaces the extension with the same extension, only refreshed. This is equivalent to a [`unload_extension()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.unload_extension "discord.ext.commands.Bot.unload_extension") followed by a [`load_extension()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.load_extension "discord.ext.commands.Bot.load_extension") except done in an atomic way. That is, if an operation fails mid-reload then the bot will roll-back to the prior working state.
no,i mean to restart bot on file change or in any other files within folders
restart it completely?
because reloading an extension is like ten times quicker than restarting your bot
i guess you not able to get what i mean
i mean something like nodemon(node js)
yes i know what hot reload means
so how to do that?
discord.py doesn't have any native support for it, the closest you can get is extension reloading which can be done on the fly, so you will need to build your own program that reloads extensions when their file changes
i tried watchdog bt its not working
import time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
import subprocess
class FileHandler(FileSystemEventHandler):
def on_any_event(self, event) -> None:
cmd = "python bot.py"
subprocess.call(cmd, shell=True)
subprocess.call("python bot.py", shell=True)
event_handler = FileHandler()
observer = Observer()
observer.schedule(event_handler, path=".", recursive=True)
observer.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()
observer.join()
then how do you make bot? i mean any suggestion from your experience?
like i said reload an extension within the bot, you could do it by running watchdog inside a separate thread
do you know why the watchdog runs command only once when i save file in the code i provided
i wouldn't know i haven't touched watchdog
How do I get the contents of the input from my modal>
what library do you use?
discord py
examples/modals/basic.py lines 57 to 58
async def on_submit(self, interaction: discord.Interaction):
await interaction.response.send_message(f'Thanks for your feedback, {self.name.value}!', ephemeral=True)```
'CapatchaModal' object has no attribute 'name'
look at the whole example how they did it
How can I get the capatcha code to my modal:
data = Capgen(member.display_name)
modal = CapatchaModal()
modal.code = data
yo, can someone help me with something?
floppa
yep
pass it as an argument
how
def __init__(self, argument: ArgumentType) -> None:
super().__init__()
self.argument = argument
why use discord_slash? discord.py 2 has slash command support
yes do not use discord_slash
so, discord_slash is trash right?
yes
do i need still implement watchdog to reload extension?
that would be the best solution
'NoneType' object has no attribute 'roles'
role = discord.utils.get(interaction.guild.roles, name="ᴹᴱᴹᴮᴱᴿ")
await interaction.user.add_roles(role)
Why am i getting that error
your interaction is in a DM, therefore the guild is None
oh yes
you should also at least be checking if the role exists, because otherwise you will get another error if the role is ever deleted or the wrong server is used
even if it's a private bot it's best not to hardcode it and put it as something configurable
how can I give the user the role in the server from the guild id
get the guild first
yes got that
remember the user isn't in a guild while in the dm
if you have the original member object you can use that since it will have a guild attribute
look on discord.py’s github examples
uhm okay
thanks
how can i add option with @ decorator for slash command ?
what
what is slash command option
then you aren't using discord.py
yeah
i'm searching to use options with @ decorator bcz i need to add autocomplete but i need an information
in discord.py you would need to use choices, literal, or autocomplete
from discord.Member selector if you know what i mean x)
hm ?
that's not what i'm searching for :/
@smoky sinew
i want to await ctx.respond("jsp sah") for first async
line 125
but how can i process ?
what is option
slash command option
does that exist
pycord
ok
could you help me about that ?
bruh use discord.py instead
true
there is no difference for that circumstance bcz it's python syntax

doesnt matter
discord.py is best
😑
bruh
it's not the prob now ....
i just need to await something to the first async function
in 125th line
i dont think everyone here knows about the library u using
no..
. . . . . . .
???
decorators can only go on classes or functions
is it discord.py
no
no
Indentation boi, add some space in that await line so that it comes under async function ig
like i said decorators can only go on classes or functions
okok but how can i get the result i want with a correct syntax ?
decorators can only go on classes or functions
okok but how can i get the result i want with a correct syntax ?
okok but how can i get the result i want with a correct syntax ?
okok but how can i get the result i want with a correct syntax ?
Use the @Option above async and then align await with other code lines
Maybe that would work
Hmm, that would be really complicated. Though, I would check out if I can help u with that
question should i use visual studio with discord py
or use something else
like replit
replit isn't recommended: #965291480992321536 message
visual studio code or any other IDE/editor you like is fine
oh okay thanks
I would also recommend taking the time to learn basic python first, since discord bots can be quite complex
yuh i am doing that right now but just wanted to know the options I would have
question
can I use pycharm
Sure
These are just tools to write the python program
It doesn't matter which one you use
:D
How do i create a button cooldown per user in discord.py?
just create a dictionary within the view
Unless it's minecraft enchantment table editor
can some one help me with tasks.loops. It's not running.
You need to start it
You done that?
Not a good way to do startup task
You need to subclass the bot and do setup in overwritten setup_hook() method
Although regarding tasks I think they can be started literally after they've been defined
Like ```py
@tasks.loop(...)
async def your_task():
...
your_task.start()```
hmm alright, thank you. I'll check the classes.
Thanks a lot!
wait, actually when I call the commands it sends it's function, but it suppose to do it by every 5 sec by itself.
if I don't call the commands it won't update what it suppose to update.
!d discord.ext.commands.Bot.wait_until_ready
await wait_until_ready()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits until the client’s internal cache is all ready.
Warning
Calling this inside [`setup_hook()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Bot.setup_hook "discord.ext.commands.Bot.setup_hook") can lead to a deadlock.
Just add this at the beginning of loop and it won't execute anything until bot is ready
Thanks mate!
How do i run a function in discord.py that takes a while to finish? It throws some error saying something took too long or something
The function works fine when it doesn't need to run for long
Its the gpt-4 api btw
use depher ig
!d discord.InteractionResponse.defer
await defer(*, ephemeral=False, thinking=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Defers the interaction response.
This is typically used when the interaction is acknowledged and a secondary action will be done later.
This is only supported with the following interaction types...
Although some more information about the issue would be nice; is the GPT4 api wrapper async? Are you using slash commands at all? Etc
i cant use my clear command, is there anything wrong on my code?
Do you get any errors?
use the channel.history() method in discord.py
example: python @client.event async def on_message(message): if message.content.startswith('!recent'): member = message.author channel = message.channel async for msg in channel.history(limit=100): if msg.author == member: print(f"Most recent message from {member}: {msg.content}") break
lemme check rq
send the code over
line 443, in delete_messages
raise ClientException('Can only bulk delete messages up to 100 messages')
discord.errors.ClientException: Can only bulk delete messages up to 100 messages
The above exception was the direct cause of the following exception:
send the script here
the whole thing?
You got answer
Can't delete more than 100 in one go
i was only trying to clear 10 messages
alrighty thankyou so much
np
Giving straight answers isn't going to make him understand
use the bulk_delete() method instead of delete_messages()
!d discord.TextChannel.purge - or just this 🫠
await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=None, bulk=True, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.
You must have [`manage_messages`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") to delete messages even if they are your own. Having [`read_message_history`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") is also needed to retrieve message history.
Changed in version 2.0: The `reason` keyword-only parameter was added.
Examples
Deleting bot’s messages...
yez
Does anyone have any resources on how could I make my own cooldown handler?
wdym?
@commands.command()
@commands.dynamic_cooldown(self.db.config.get_cooldown(ctx.author))
async def fpp(self, ctx: commands.Context):```
I want to do that, but I can't for pretty obvious reasons
so instead of using the decorator is there any funciton I could use for checking the cooldown?
rate or per ig
@commands.cooldown(rate=1, per=30, type=commands.BucketType.user)
like this ig
shall i ping?
@thin raftsry for ping i just wanna know does this work i learned it currently tho
lol sry
k back
dw lol
I need a dynamic cooldown
but I can't use self in the decorator
ic
sry but i didnt got the answer for this sry🙇
ill make my own cooldown handler
umm how do u store data of users?
I use a database
start with sqlite3
??
take a look at it
ty
any question ping me
ty sir
depending on what its for and how many users, you could just go a simple route which is just having a json file you store data in
?
its for storing data ig.....
yes but on how big of a scale and whats the purpose of the program
oh wait its a discord bot?
then i dont see any problem storing it in a json file, depending on how large of a scale you'd be saving though
want an example of how to do so?
meh, for a discord bot it doesn't really matter lets be frank
bruh wht is dynamic data'
In data management, dynamic data or transactional data is information that is periodically updated
i understand that but for a small scale discord bot, storing data in a json file is not a bad idea. i know plenty of people who do it, and frankly, it results in faster response times when grabbing the information out of the json file instead of a MySQL database for example, could purely be hosting and specifications of the server its hosted on but I'm not sure.
ic
meaning you will update it once something happens
oohh
like getting coins and when u lose in gamble it will update it right?
plenty people do it doesnt mean its correct and if querying json is faster for them it possibly means that they dont use async driver for database
yes
ic
in short terms you should not update json file from code
oki
@slate swan ^
no pls
they should ake that a tag
ill actually make issue about this
yeah
how can i get 'voice_client' using interaction: discord.Interaction
interaction.guild.voice_client
File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\client.py", line 490, in _run_event
await coro(*args, **kwargs)
File "c:\Discord\Maja Projekt\Maja-Beta\bot.py", line 241, in on_application_command_error
raise error
File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py", line 890, in invoke_callback_with_hooks
await self(interaction, *args, **kwargs)
File "c:\Discord\Maja Projekt\Maja-Beta\modules\voice\cog.py", line 25, in voice_join
await inter.user.voice.channel.connect()
File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\abc.py", line 1768, in connect
voice = cls(client, self)
File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\voice_client.py", line 212, in __init__
raise RuntimeError("PyNaCl library needed in order to use voice")
RuntimeError: PyNaCl library needed in order to use voice```
Did you install pip install discord.py[voice]
Dont use dpy
What do you use then?
nextcord
I wanna create a music bot which will search through keywords, so anybody has a good idea who can provide me tutorial or something like that?
can someone give me eample discord_components code?
here's an example of how to use the discord_components library to create a button in a Discord bot using Python and Discord.py:
import discord
from discord_components import DiscordComponents, Button, ButtonStyle
client = discord.Client()
DiscordComponents(client)
@client.event
async def on_ready():
print('Logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.content.startswith('!button'):
btn = Button(style=ButtonStyle.blue, label="Click me!")
await message.channel.send("Here's a button:", components=[btn])
@client.event
async def on_button_click(interaction):
if interaction.component.label == "Click me!":
await interaction.respond(content="Button clicked!")
client.run('your_token_here')
In this example, the on_message() event handler checks if the message starts with !button. If it does, it creates a Button object with the label "Click me!" and a blue style, and sends a message to the channel containing the button using the components parameter.
When the button is clicked, the on_button_click() event handler checks if the label of the clicked button is "Click me!" and responds with a message saying that the button was clicked using the interaction.respond() method.
Note that you need to install the discord-components library using pip in order to use it in your bot:
pip install discord-components
Also, make sure to enable the SERVER MEMBERS INTENT and GUILD MESSAGE REACTIONS intents in your bot's Discord Developer Portal in order to use the discord_components library.
You shouldn't really use discord_components since it's already built in to discord.py
Also it's outdated
!rule 10
@fierce crag
chat gpt
Rule 10
Do not copy and paste answers from ChatGPT or similar AI tools.
Oh didnt see that
it's alright, just avoid copy+pasting answers from chatgpt next time.
Ok
Chatgpt is not very good for Discord.py
Since it's completely different now
It often sends outdated info
!discord buttons
Using free hosting options like repl.it or Heroku for continuous 24/7 bot hosting is strongly discouraged.
Instead, opt for a virtual private server (VPS) or use your own spare hardware if you'd rather not pay for hosting.
See our Discord Bot Hosting Guide on our website that compares many hosting providers, both free and paid.
You may also use #965291480992321536 to discuss different discord bot hosting options.
Do you ever find yourself writing something like this?
>>> squares = []
>>> for n in range(5):
... squares.append(n ** 2)
[0, 1, 4, 9, 16]
Using list comprehensions can make this both shorter and more readable. As a list comprehension, the same code would look like this:
>>> [n ** 2 for n in range(5)]
[0, 1, 4, 9, 16]
List comprehensions also get an if clause:
>>> [n ** 2 for n in range(5) if n % 2 == 0]
[0, 4, 16]
For more info, see this pythonforbeginners.com post.
class list([iterable])```
Lists may be constructed in several ways:
• Using a pair of square brackets to denote the empty list: `[]`
• Using square brackets, separating items with commas: `[a]`, `[a, b, c]`
• Using a list comprehension: `[x for x in iterable]`
• Using the type constructor: `list()` or `list(iterable)`...
!d discord.ui.Button
class discord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.
New in version 2.0.
how to use?
can you provide me simple code?
Why's replit not favoured for 24/7 bot hosting?
How can i force the bot to mute his in and ouput in a vc
wdym?
Selfmute in a vc
!d discord.Member.edit
await edit(*, nick=..., mute=..., deafen=..., suppress=..., roles=..., voice_channel=..., timed_out_until=..., bypass_verification=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the member’s data.
Depending on the parameter passed, this requires different permissions listed below...
set the mute attr to True
So await inter.client.edit(mute=True)
Yes
Wrong error sry
Lmao
Here we go
File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\client.py", line 490, in _run_event
await coro(*args, **kwargs)
File "c:\Discord\Maja Projekt\Maja-Beta\bot.py", line 241, in on_application_command_error
raise error
File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py", line 890, in invoke_callback_with_hooks
await self(interaction, *args, **kwargs)
File "c:\Discord\Maja Projekt\Maja-Beta\modules\voice\cog.py", line 82, in voice_join
await inter.client.edit(mute=True)
AttributeError: 'Bot' object has no attribute 'edit'
@upbeat otter
And i want that the bot is deaf
property me```
Similar to [`Client.user`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.user "discord.Client.user") except an instance of [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member"). This is essentially used to get the member version of yourself.
!d nextcord.ext.commands.Bot.user
property user```
Represents the connected client. `None` if not logged in.
or this
Read the Error xD
from here File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py"
Mhh Traceback (most recent call last): File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\client.py", line 490, in _run_event await coro(*args, **kwargs) File "c:\Discord\Maja Projekt\Maja-Beta\bot.py", line 241, in on_application_command_error raise error File "C:\Users\domin\AppData\Local\Programs\Python\Python310\lib\site-packages\nextcord\application_command.py", line 890, in invoke_callback_with_hooks await self(interaction, *args, **kwargs) File "c:\Discord\Maja Projekt\Maja-Beta\modules\voice\cog.py", line 82, in voice_join await self.bot.edit(mute=True, deafen=True) AttributeError: 'Bot' object has no attribute 'edit'
Confused
self.bot.**user.**edit()
deafen got an error
how can i can send message and edit other at the same time? (exaclty in view)
await interaction.response.edit_message(view=self)
await interaction.response.send_message(embed=embed, ephemeral=True)
this doesnt work
i have this code:
import discord
from discord.ext import commands
client = commands.Bot(command_prefix="=", intents=discord.Intents.all())
@client.event
async def on_ready():
print("Bot connected!")
@client.command()
async def ping(ctx):
await ctx.send("Pong")
print('\033[37mThe ping command has been ran by {0}\033[0m'.format(ctx.author.id))
client.run("token")
it works fine when ran in vsc but when i run it directly from the folder (as a .py) it just closes the window instantly
!d discord.Interaction.edit_original_response
await edit_original_response(*, content=..., embeds=..., embed=..., attachments=..., view=..., allowed_mentions=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the original interaction response message.
This is a lower level interface to [`InteractionMessage.edit()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.InteractionMessage.edit "discord.InteractionMessage.edit") in case you do not want to fetch the message and save an HTTP request.
This method is also the only way to edit the original message if the message sent was ephemeral.
@slate swan do you mayb know
when you run in vscode it actually runs a command for you try to copy this command and run in your command line
alr wait
i mean i know i can just do python -i code.py
then how are you trying to run it?
by double clicking the python file
when i do that it instantly closes
also the text isnt grey idfk why it should be
looks like the command line you used doesnt support this formatting
well i'll fix that another time for now but what do i do about the closing
dont know actually
i know this happens when the program exits but with discord bot its not closing
maybe you run into errors but that shouldnt happen since you dont get any when running in vs code
i would just say to run it using command line
yeah i will, probably just gonna make a batch file to do it for me
or this
yep
AttributeError: 'Interaction' object has no attribute 'edit_original_response'
thats strange actually
what discord.py version are you using?
print(discord.__version__)
2nd version
or just pip show discord.py
update to the newest version current one is 2.2.3 i belive
Okay bruh
personally JavaScript is better in every way possible for making discord bots but for some reason idk how to make a command prompt console print like python has
how can i fix this: cannot import name Mapping' from 'nextcord.utils'
import nextcord, aiosqlite, os, wavelink
there is no such thing in nextcord are you trying to import it or this is caused by the lib?
im trying to import wavelink and i get that error
!pypi wavelink
A robust and powerful Lavalink wrapper for discord.py
I literally copied the example and same issue with importing wavelink
try updating both nextcord and wavelink to latest version then
pip install -U nextcord wavelink
no idea then it says it was designed for discord.py but it does not have Mapping as well
so its possibly outdated
does anyone know the fix
!pypi lavalink
what?
!pypi mafic
A properly typehinted lavalink client for discord.py, nextcord, disnake and py-cord.
where can I find node pools to use
TypeError: Invalid class <class 'discord.message.Attachment'> used as an input type for an Option
can anyone help me with this?
are you using a fork
nope its in cmd
that's not what i asked
sorry im new to python
which discord library are you using
im new to python
can you explain better?
which python package are you using for your discord bot
not my bot just trying to use it so i dont know
can you figure out
Pex: Is good to tell what you tried to do and what you exactly did and When the error came up. Otherwise not easy for them to help sometime. 😉
i ran the command python main.py then the error message came up
i dont know how to sorry
that doesn't help at all
you had to have something installed to run it in the first pllace
i installed a load off modules
which ones
tls_client httpx discord discord_webhook colorama flask fade
can you do pip list and look if you see any of these:
discord.py
nextcord
disnake
py-cord
yes, discord.py and py-cord
so you are using py-cord
yes i think so then
py-cord
try discord.Attachment instead
wdym? sorry, do i add that somewhere? or install it?
Can show Down the code you wrote maybe?
i would prefer not to share my code sorry i know that will not help
can you at least show the command that throws the error
or send it him in private?!
this is an error
im asking for the code that throws it
i dont know thats why im asking in here hoping for help
show line 79 from main.py
Can't sell a pair of gloves if only offer the left one ^ ^
okay and whats below it?
please come dms
bruh
i dont want to reveal
i am making discord bots with python which db should i use
any is good
depends if you want sql or nosql
i can show in dms or in your server?
his bot was against tos lmao
Writing to channel.
import discord
client = discord.Client()
TOKEN = 'your_bot_token_here'
CHANNEL_ID = 'your_channel_id_here'
def send_to_channel(message):
channel = client.get_channel(CHANNEL_ID)
return channel.send(message)
@client.event
async def on_ready():
print('Bot is ready.')
client.run(TOKEN)
How can I write to a channel without using events?
I want to use it like print().
probably cant
you're already doing that?
get_channel -> channel.send
is there any good tutorial, i can refer to create a music bot which will search using keywords and link both?
Search using keywords on what platform?
His own music database with license obtained for each track obviously
channel_id = 1234567890123456789 # notice it's a number
channel = client.get_channel(channel_id)
await channel.send("stuff")```
spotify and youtube
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
Recently, I switched my bot's library from discord.py to py-cord (a fork of discord.py) and I am finding it to be better so far with less modules being depreciated.
Better in what way?
Imho all 3 main forks are better than dpy itself lol, I personally use disnake
I ran into issues with a few modules being depreciated and having to look for different solutions around it or what not, haven't ran into that so far with py-cord.
For example in disnake you have the following pros
- Automatic handling of common stuff, i.e. tree syncing
- If in dpy you gotta do
interaction.response.send_messageandinteraction.followup.send, in disnake you have it too + automaticinter.send(and yeahintername there is conventional) - Disnake has interaction events and errors differentiation, eg.
on_button_click, different classes for different interactions,on_slash_command_error,on_message_command_errorwhile dpy doesn't even have event for app commands error handling, it has@tree.error - Universal checks, you don't have to write
discord.app_commands.checks.has_role, it's justcommands.has_role, just as for prefix commands
However some cons
- I don't like disnake modals implementation (I use my own)
- No
setup_hook, but you can just overwritestartso not a big deal
For the "no setup_hook point", couldn't you just start your bot in an async context and do whatever you need to do before awaiting .start()?
i would like to share this massive traceback
https://paste.pythondiscord.com/akilitokak
I typically just override start() it's more elegant imo
Have own music database with license obtained for each track 😃
You have blocking code somewhere. It's typically image processing (should be runned in executor), database (should use async wrapper), or requests (use aiohttp instead)
The request returned html, you can't convert it to json
🧐
?
I have a bot with some commands and a cog with a couple commands in it as well, would it be better to move all commands to cogs?
yes its better to categorize your commands
I am having another issue with some API, can't pull out some data from a HTML url
This will be sent
You have to await the coroutine
Doesn't work
I know its a number...
Well in your code it was a string
To retrieve html you have to await response.body.read() iirc
And typically for webscraping you would use selenium or beautifulsoup
Hi Everyone, I'm Jasper!
I'm Looking To Start A New Project(Discord Bot) I Already Have Some Bot's Commands If Anyone Wants To Join The Project, Feel Free To Join & Make, If You Want More About Details About The Bot DM Me I'll Be Sharing You A Server Where We Test The Server, We'll Be Using replit.com for the writing code of the bot, at it will be easier, Just A Quick REMINDER NOTE: I'm Not Gonna Be Paying Anyone This Is Just A Fun Discord Bot Project Which Will Be Made And Used By Other Users & Servers, For More Details & Discussion About How It's Gonna Go With Bot, All of Your Questions Can Be Asked In Dm's, If Your A Beginner in discord.py No Problem As While You Develop The Bot You Can Learn More While Coding It, I Would Be Really Hoping Anyone Would Join This Project And Work Together. : D
!rules advertising
i'm not sure if it is, but comes off like it
Hi Dude!, It's Not Advertising, I'm Just Asking Others To Join The Project I Noted That I'm Not Paying Anyone So It Dos Not Come In Jobs, And This Is Not Advertising As I Did Not Say Anyone To Use This Or That, This Is Just, "Hiring Other People To Make A Project For Fun Without Payment, No Matter What Stage Of Learning Your In Discord.py".
Should Be Banned For Capitalization In Any Case
But Why Type Everything From Capital Letter It's Literally Impossible To Read
That's Just My Way For Typing
Why So?
btw anyone is joining
"we'll be using replit to write code" already prevented most of experienced developers from joining your project
No offense
Maybe. Add. A. Period. After. Every. Word. As. Well. To. Make. Your. Style. Even. More. Stylisher.
Pydis should add an lfg channel specifically for those looking for contributors
Live coding is very inconvenient, trust me, when I was inexperienced and still showing my leadership skills it failed real hard. Git is the way for collaboration and now I am managing bobux bot project with like 6 other developers
Ofc learning from own mistakes is more efficient but it's better just to take recommendations into account
Fr
It's been suggested many times, but it gets abused by people who are paying/buying, and it's more effort to police that than we can expect volunteers to contribute.
Then We Can Do In VScode, Dos'nt Matter In Which Editor Your Doing, Only The "Discord Bot" Is Important
"Live coding" is the thing you should avoid (for this case)
"Version control system" is what you need to learn
Can I have functions other than setup in an extension
Well It's Not Live Coding As Different People Will Be Doing Different Things For The Bot, And Then Combine The Code To The Bot Code, Anyways It's Just Command Or Any Other Things
Uh sure why not, but generally it's better to bring them into separate modules in sort of utils directory and import from there
But Really Anyone Wants To Join???
Yeah that's the good way
Well, Will You Join @vale wing ?
Nah thanks as I already mentioned I am project manager of bobux bot
Awwww, Please???
Your Choice, The Bot We're Working On Is'nt Going To Be Big Like bobux bot, It's Just A Simple Bot Not Very Big Something Like Dank Or Bobux.
Is there a bot that will play a random yt video from a playlist at a random time?
No ig?
What do you mean by "play" a video
What is ig
I Guess
I meant like youtube
Do you want it to send YouTube links from a playlist periodically?
already Youtube Has One Button, "Play Random Video From Playlist"
Aaah, no I meant play the song at random times and not at the start
We can't help with bots that use ytdl
Yeah
@vocal snow ?
ah ok thanks anyway, if you know another way to that without bots please share so
YouTube ToS prohibit streaming of their content on other platforms so there's no other legal way
Yes, Recently Groovy Got Banned For Premium Members, As Youtube Has To Pay
@vocal snow will u join???
Could Anyone Really Just Join The Project? It Will Be A Fun Now, Please?
stop continously asking, if someone is interested he'll respond
Okay
Lol
It's definitely a cult, enclosed and unrecognized lol
oh man I sure do love hosting all of my Discord bots on Replit
hopefully nothing goes wrong when my bot gets big
Also make sure not to use secrets
of course, I love hardcoding my secrets into my 2k+ line main.py
and using f-strings to place user input into SQL queries
Obviously
Will You Join?
Join?
The Project
We Were Talk'in About this
It Will Be Really Good If You Join @slate swan
?
Look the message above
damn sir u found that for me
thts so kind of u
btw i forgot the site from where i was learning sqlite3
how many people are you going to ask?
Max. 5
Right Now 2 ppl are there
me & @robust fulcrum
can i?
.....
little
guess i am not worthy currently to work sry for wasting ur time
Can You Do Some Commands From That Type Of Bot???
heh np
sry
Join, your accepted
@fossil abyss send the github repo
@slate swan, You Can Join 😄
there is still many things i have to learn ig
Well, We'll Be Using replit.com so no need, but if you want Github Only I'll Make One
I just want to see the code
you can learn while we make, it even makes you learn form us
is tht okay to you if someone as dumb as me join ur crew?
sry for saying crew
🙇
Yo, I'm Not so much learnt Discord.py
either, i'm making this bot with same expierence in bot like u
so no problem, @slate swan any more question?
@thin raft is this ok? or shall i use paste and send here in discord???
you should check what classes and cogs are
???
nope but how are we going to get started like at which platform
sry for asking these types of questions so early sry
wdym?
one humble request pls don't say sorry everyone time
no GitHub?
You leaked your token

sry for sying sry f
oof
kinda weird hosting it on replit and no on github
im changing it
ok i will do that
github
I know man
yo sir ''
@fossil abyss And please look at the date of the tutorial you used to make the current code. This is from 2019 or smth.
sir wht is replit i mean i can google it but......
No, The Tutorial is 2022
its a wesite to write code smthing like vscode
No need to know you shouldn't host bots there that's all you need to know about it
bruh
then why we dont use vs code
uhmm, in github how do you make a new file in github?
i use both
You should prolly clone repo to your pc
Yeah if you work in a team just use Docker then you are certain everyone has the same environment.
Then add files and push them to GitHub
sry sir but am asking cant we work in vs code?
yes we can work in vscode
no problem we can use vscode, if u want let's use it
So, @slate swan your joining or not???
one sec
plz don't call me "sir"
dm check pls
@slate swan check ur dms plz
Hey, can someone help me with my bot?
don't ask to ask
So, i just made 'Bridge' bot
You send a message to #channel1
Bot copies the message and send it to #channel2
And i need to add 'Owner WhiteList' - Normal user can't use it, only WhiteListed user can.
DM's open.
How can i force a bot to deaf him his self on a vc join
!d discord.VoiceState.self_deaf
Indicates if the user is currently deafened by their own accord.
I tried but its not possible
!d discord.Member.edit
await edit(*, nick=..., mute=..., deafen=..., suppress=..., roles=..., voice_channel=..., timed_out_until=..., bypass_verification=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the member’s data.
Depending on the parameter passed, this requires different permissions listed below...
You are probably doing it wrong then since you give a voice state after it.
I mean you could but why make an extra call.
So can anyone help me? 😄
What's the extra call?
The member edit
If you define a voice client you can just pass the self_deaf.
self.voice_client = await inter.user.voice.channel.connect(reconnect=True, timeout=None, self_deaf=True)
how to fix error? Traceback (most recent call last): File "C:\Users\KokoG\PycharmProjects\Logger\venv\Lib\site-packages\discord\ui\view.py", line 427, in _scheduled_task await item.callback(interaction) File "C:\Users\KokoG\PycharmProjects\Logger\main.py", line 86, in button_callback await interaction.response.send_message('test') ^^^^^^^^^^^^^^^^^^^^ AttributeError: 'Button' object has no attribute 'response' code: class Whitelist(discord.ui.View): # Create a class called MyView that subclasses discord.ui.View @discord.ui.button(label="Whitelist", style=discord.ButtonStyle.primary, emoji="📃") # Create a button with the label "😎 Click me!" with color Blurple async def button_callback(self, button, interaction): await interaction.response.send_message('test')
oh i see
interaction param comes before button
how to fix?
the error says the interaction variable is Button object, which should make that clear
put the interaction param before button??
which library are you using?
I didn't understand the question
are you using discord.py or some other wrapper
not working @bot.tree.command(name="ping", description="...") async def _ping(interaction: discord.Interaction) -> None: await interaction.response.send_message("pong")
Please keep reading. This tutorial is good.
Which tutorial? The discordpy docs ?
Doesn't exist in nextcord
Are people still creating bots with prefix checks or is it better to just purely use slash commands now?
Seen with slash commands could be hard to test stuff if using global slash commands cause of the time it takes to register them?
Just use guild specific ones for testing as an alternative?
it doesn't take much time to register them anymore
and for testing, you should just sync the commands to your testing guild instead of globally
Thanks 🙂
Ah see i can just use hybrid commands also
So offers prefixed and slash command
And how he deafs himself when he doesn't become deaf
What
I got no clue but i think he’s on about how music bots will join a channel deafened and if you try undeafen them they will just deafen themselves
this is how to join it deafened, to keep it deafened after being undeafened you'd need to use an event like on_voice_state_update
I'm using nextcord IPC, I can't seem to find what commands I can use like py await ipcClient.request("get_guild_count") in the get_guid_count
!d nextcord.VoiceState.self_deaf
Indicates if the user is currently deafened by their own accord.
It does.
Yeah but i need a bot event if a user undeafs the bot
prolly wants to be server deafen
True but that would make 0 sense.
it's what most bots did I don't know what's up with them
Oh yeah forgot that
I use a music bot and it used to be server deafened
But it’s actually self deaf now
Yeah idk why people still server deaf it.
Just do that so much easier and you won’t need the extra code for change
Saves so much trouble
If i’m looking to write a bot will be first one in python done one in JS before tho it was basic, should I Integrate postgres from the start if i want to use it down the line like is it hard to put in at a later date
Basically wanna add some fun gambling games into the bot so will need to store UID and a integer for balance
But then can obviously build to like per guild prefix and setting log channels
If you already have plans, why not preparing the database from the start already?
Yeah i will was basically asking if that’s best
I’m gonna do the basic commands first though
But i’ll just implement the database and prepare it from start
is there such a thing of a bot generating random numbers in a number range ?
Like picking a number between 1-1000?
similar but like 2,5,19,23,45,31
random.choice(range(10000000))
Can just use pythons random module and use a for loop
either you think a module's gonna reduce the abilities of python or you don't know how to choose a random number in python at all
neither of the cases is really good
we gonna go with I dont know how to use python at all and the last time i tried learning a programming language was back in the 90's
holy
lol
he could be my father
yes im old
you can use numpy also i believe
it has: random.randomint(1,100, size=(1,5))
would give you an array of 5 integers
