#discord-bots
1 messages Β· Page 43 of 1
How to make that?
@commands.is_owner() ;-;
he wants to give access to the owner to all commands, not to bind the to the owner ;-;
huh? then this is same as isowner meaning only owner can use this command
add*
add something like {owner check}
can use that cmd but the owner of the bot has a special privieldge (spelt correctly)
@robust fulcrum You would roughly need to do this. (https://discordpy.readthedocs.io/en/latest/api.html#permissions)
- Make a command that only people with certain roles on the server can use ( for eg. manage_nicknames)
@bot.command()
@has_permissions(manage_nicknames=True)
async def c_nick(ctx):
await ctx.send("blah")
- Make an error for that command that sends an error for people who dont have that required permission but checks if the bot owner used it
@c_nick.error
async def c_error(ctx, error):
if isinstance(error, commands.MissingPermissions):
if ctx.author == bot.application.owner:
return await ctx.send("blah")
await ctx.send("No perms")
else:
raise error
- Altogether it should look like this
@bot.command()
@commands.has_permissions(manage_nicknames=True)
async def c_nick(ctx):
await ctx.send("blah")
@c_nick.error
async def c_error(ctx, error):
if isinstance(error, commands.MissingPermissions):
if ctx.author == bot.application.owner:
return await ctx.send("blah")
await ctx.send("No perms")
else:
raise error
Hey guys. With discord modals, is it possible to put the question into a list or dictionary?
This is what I have tried ```python
question_set.append(discord.ui.TextInput(
label=f"{i['label']}",
style=discord.TextStyle.long,
placeholder='Placeholder',
required=i['required'],
max_length=1000,
))
Apparently doesnt work π€
Is buttons with reaction role good idea , like no. Of reaction appear in button label ?
reaction roles via buttons is gud if you mean that
wdym put the question into a list or dict?
what exactly do you want to do
Will timeout= None , work ?
Infinite time for buttons ?
yes
Oh k k
In a modal, if you want an input/question, you create a variable and do the discord.ui.TextInput() thing.
I want to put the selected input/question into a dictionary so I can have a single class to handle it and allow as many questions as possible.
That can be used to keep link buttons for example too
still can't really understand, but I got something. So what do you want to happen, and what happens instead?
Alright. Let me go back to the beginning. from the very very very start.
If I want to send a discord modal, that popup that asks for input such as what is your name? I have to set the question what is your name into a variable that contains ```python
discord.ui.TextInput(
label="What is your name",
style=discord.TextStyle.long,
placeholder='Placeholder',
required=True,
max_length=1000,
)
And if I want another question (Up to I believe 5 or 6?), i need another variable and so on, basically repeating the same code.
I want to put the first block into a loop and pull the questions from a `json file`. so the I don't need to rummage through my code, but also I don't need to remove variables just to remove a question. I can just remove it from a `json file`
and from there, if there's more than 5 questions, I can send another modal.
Traceback (most recent call last):
File "main.py", line 12, in <module>
client = discord.Client()
TypeError: init() missing 1 required keyword-only argument: 'intents'
getting this error
u r 2nd
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
import discord
from discord.ext import commands, tasks
import B
import os
key=os.getenv('key')
wkey=os.getenv('wkey')
client = discord.Client()
client = commands.bot(command_prefix="(prefix)")
client.remove_command('help')
@client.command()
async def command(ctx):
await ctx.send('This command was successful!')
@client.command()
async def help(ctx):
embed = discord.Embed(name="Help", value="help command", color=0xFFFFFF)
embed.add_field(name="command", value="command description")
await ctx.send(embed=embed)
B.b()
client.run(os.getenv('TOKEN'))
what?
In discord.Client() u need to insert the intents u want
nice, so... what's the problem? your question was if you can insert a question inside a list or dict... so that is possible of course, you can put anything that is subscriptable into a dict or a list
can u correct my code and tell. i didnt quite understand what u mean
I dont think u are either understanding or able to help..
i mean not subscriptable... idk
I tried to put it into a dict.. I tried putting it into a list..
intense immersive bruh noises
probably
have you ever used discord modals @silk fulcrum ?
π
Alright I'll wait until someone else can answer then
probably i am missunderstanding something(
Until I can figure out a shorter way of doing it, I'll have to do it the long way
i have a line of code
super().__init__(150, 5, 5, 3, 'Dark', 'Light', 'Tank')
which returns an error
raise TypeError(f"expected Item not {item.__class__!r}")
TypeError: expected Item not <class 'int'>
in my command but when i try it outside of my classes it works fine? my command is for a combat menu with buttons and i have my combat stats (hp, atk, etc) in a Combat view and my view in CombatView(discord.ui.View, Combat)
I think i have a solution to ur problem
Lots and lots and lots of if statements ;-;
But i didn't quite understand what u want to achieve
lmao same
There is a simpler way to put dynamic discord.py modals in a loop
Without classes and stuff
Well this is what I have atm..
class TestForm(discord.ui.Modal, title='Testing'):
def __init__(self):
super().__init__()
self.currentform = {}
question_set = {}
questioncount = 0
with open("questions.json", "r") as f:
questions = json.load(f)
for i in questions['questions']:
if i['long']:
print("Adding a long question..")
print(i['label'])
question_set[i] = discord.ui.TextInput(
label=f"{i['label']}",
style=discord.TextStyle.long,
placeholder='Placeholder',
required=i['required'],
max_length=1000,
)
else:
print("Adding a short question..")
print(i['label'])
question_set[i] = discord.ui.TextInput(
label=f"{i['label']}",
style=discord.TextStyle.long,
placeholder='Placeholder',
required=i['required'],
max_length=1000,
)
questioncount += 1
async def on_submit(self, interaction: discord.Interaction):
await interaction.response.send_message(f"Thank you {interaction.user} for applying for staff!", ephemeral=True)
``` It errors out ofc
you are calling __init__ function of a super class, super class is an instance of the class that you are subclassing (discord.ui.View), View class does not get ANY args at all, only kwargs
im still noob with classes but in that case would i just need to make my *args into **kwags?
didn't realize i couldn't pass *args into the view
import something from Something
It's a keyword which can't be used as a variable name
Use From isntead
Instead*
arguments (args):
# in function
def func(arg1, arg2, arg3):
print(f"you passed args: {[arg1, arg2, arg3]}")
# usage
func(123, 231, 321) # output: you passed args: [123, 231, 321]
keyword arguments (kwargs):
# in function
def func(*, kwarg1, kwarg2, kwarg3):
print(f"you passed kwargs: {[kwarg1, kwarg2, kwarg3]}")
# usage
func(kwarg1=123, kwarg2=231, kwarg3=321) # output: you passed kwargs: [123, 231, 321]
multiple arguments (*args):
# in function
def func(*args):
print(f"you passed *args: {args}")
# usage
func(123, 231, 321) # output: you passed *args: [123, 231, 321]
multiple keyword arguments (**kwargs):
# in function
def func(**kwargs):
print(f"you passed **kwargs: {kwargs}")
# usage
func(this=123, that=231, those=321) # output: you passed **kwargs: {"this": 123, "that": 231, "those": 321}
wut
async def moveFrom(interaction:nextcord.Interaction, From, etc)
oh
He is trying to use from in a function
yeah, shadowing names is bad
from is shadowing a built-in name
Yea basically just fixing it in a wacky way
kwags is key pair?
it's just a pep
thank you for the info by the way
line length must be not longer than 120 symbols
wtf are you talking about
i just explained what they all are, and so... View takes kwargs
not **kwargs btw
pep 8
alr thank you for the help!
pep s are just guidelines
respect guidelines
im Russian what r u talking about
im talking about meek
who asked
dumbass read the conversation i had with him
From is literally a keyword not even a builitin
He wants to implement slash cmds
absolutely correct
You will get syntax error if you tryna use it as a var
ok
Master32 where is Master64
why do you need him
My brain works in 64bit architecture
Where are all other bit versions
In his basemwnt
hey...
MasterARM64
That one Russian kid named Dimitri who is always better than you
I base64 encoded my name
aight reboot work
here?
here
I don't speak any of those languages
here
these are all i have
But you don't
Your skills in English is a bit too low
To comprehend what I wish to teach you
i speak russian, english and very very poor french
Slavic
trad
dies from Google trad
trad emeralds with google
aight gotta make RPS command with modes: single, with friend, online
what are you problems?
description that is on the right?
what lib are you using? discord.py? please not pycord
uhm.... okay
idk how slash commands are made in it
but im sure there is description kwarg in them
app_commands?
bruh
uhm... there is description
what's the problem
it doesnt show up?
oh, i forgot
this
"""
Parameters
----------
your params in that format
"""``` in command body
waht
no
whats the diff between nextcord and discordpy 2.0?
discord.py is better
- There is no such method get_member, and also you can just typehint User to a discord.Member so you dont need to get it
- Same with To, you can typehint it to discord.VoiceChannel
yea just found out that there are interaction buttons
i just told you everything you need
How to check if emoji is default, not custom?
i am using disnake.ext.commands.EmojiConverter.convert thing and on standart emoji it gives:
disnake.ext.commands.errors.EmojiNotFound: Emoji "π"not found.
discord.errors.Forbidden: 403 Forbidden (error code: 50001): Missing Access
What access is the bot missing
It is having admin + above my role
above my role
Are you by chance the owner of the server? Bots can do nothing to server owners
Um, actually, they can
my reaction role works for me
and im an owner
so idk maybe im dumb
but bot gives me a role
Maybe they can add roles
and that's what he's doin
How do you know
Nope
Did change this
- this: interaction.user.add_roles
Is the role you're trying to add above the highest role the bot has
Itβs below the botβs role
Is it in the same server
Yes
would raise other error
!paste can you show the current code
Pasting large amounts of code
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
class PersistentView(discord.ui.View):
def __init__(self):
super().__init__(timeout=None)
@discord.ui.button(style=discord.ButtonStyle.grey, emoji=":blackOne:", custom_id='persistent_view:green')
async def idk123123(self, interaction: discord.Interaction, button: discord.ui.Button):
eman = interaction.user.guild.get_role(960601299529904218)
if eman not in interaction.user.roles:
await interaction.user.add_roles(eman)
await interaction.response.send_message(f"I've added <@&960601299529904218> role to you!", ephemeral=True)
else:
if eman in interaction.user.roles:
await interaction.user.remove_roles(eman)
await interaction.response.send_message(f"I've removed <@&960601299529904218> role to you!", ephemeral=True)
useless if still here
I think you need to pass an iterable into add_roles
Itβs not there
nop
Union[Role, Iterable[Role]]
.
is the role below the bot's highest role?
Yes
and the person the bot is trying to give it to?
*abc.Snowflake
yes
Yes my role is below the botβs highest role
hmmm
Then it's an issue with the server
wtf is your nick
did you change the role id?
async def register(ctx):
conn = sqlite3.connect("userinfo.db")
conn = conn.cursor()
cursor.execute("INSERT INTO userinfo (userid, balance) VALUES (?, '0')", ({ctx.author.id}))
con.commit()
cursor.close()
em=discord.Embed(title=f"You've successfully registered!", description=f"Now you can use currency commands :)")
await ctx.send(embed=em)```
ive updated the code, but still not working :/ this is sqlite3
It's Exenifix but base64 encoded
Itβs the correct role id
wtf π
?
and one last question, the bot has the correct permissions on the server correct?
so how esactly do i do it then?
rewriting conn with .cursor() and then using undefined cursor
Yes sir
Every single permission
π
change ({ctx.author.id}) to ({ctx.author.id}, )
Why even put it into set bruh
no wait, why do you have a set
that wont help with cursor is not defined btw π
.
they thought it was an f string ig π
then can someone just help me fix the code, ive looked at so many tutorials online and I JUST dont know
that too
this might be silly, but maybe add a defer?
You've looked at the tutorials that's good but before you looked at them, have you had python knowledge and on what level was it
And that would fix the error? π
Where to add it like in command or view?
i had, but do u mind giving me the code for this one and ill understand it
Is it possible with discord.py interactions to get the custom_id of the button that was pressed using a callback function?
Nope I do things in more elegant way and it requires several files
I normally defer everything, and that way it doesn't freak out, so hopefully, but I'm not 100% sure
how deferring would help π
then give example code?
changed it and then?
in the view
Pasting large amounts of code
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
remove curved brackets π
check ur dm
conn = sqlite3.connect("userinfo.db")
conn = conn.cursor()
this is the problem, you reassigned conn to conn.cursor and you are using cursor inside your code which doesn't exist
Anyone know?
What even ctx.defer does?
Set's it aside for later if I'm not wrong (aka secondary action)
then how do i fix it?
**ctx.**defer if ctx is interaction based context allows response to be sent in 15 mins instead of 3 secs
I don't really like this method "give me the code and I will understand it". It's like me learning bootstrap - putting random stuff until it works (screw frontend). You better look at docs and try to make a thing by yourself. You can also check some open-source repositories on github, you may check mine for examples if you'd like to
dont use conn twice
if it's taking a little bit to assign the role, you'd respond to the interaction before it's too late? I really don't know, just suggesting it in hopes it'll fix to be 100% honest
make ur cursor just con
And what if it goes bot is thinking for 15 minutes with same error
Is there a way to get the component from an interaction?
Or will it stop on error?
Or just any way to identify what caused the interaction
Yeah if it's message interaction
I'm using buttons
Idk dpy types
And I need to get the custom_id or a way to get the button's identifier
async def register(ctx):
cursor = sqlite3.connect("userinfo.db")
cursor.execute("INSERT INTO userinfo (userid, balance) VALUES (?, '0')", ({ctx.author.id}, ))
cursor.close()
em=discord.Embed(title=f"You've successfully registered!", description=f"Now you can use currency commands :)")
await ctx.send(embed=em)```
is it like this??
!d discord.MessageInteraction
sure, can i see yours?
class discord.MessageInteraction```
Represents the interaction that a [`Message`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Message "discord.Message") is a response to.
New in version 2.0.
x == y Checks if two message interactions are equal.
x != y Checks if two message interactions are not equal.
hash(x) Returns the message interactionβs hash.
Check my connections
but is this corrent now?
discord.Interaction
I'm using button callbacks
!d disnake.MessageInteraction.component
The component the user interacted with
There should be a way to get the identifier shouldn't there be?
Disnake has that
it would take 5 seconds to learn how to assign variables
No idea about dpy
Gotcha
async def register(ctx):
cursor = sqlite3.connect("userinfo.db")
cursor.execute("INSERT INTO userinfo (userid, balance) VALUES (?, '0')", ({ctx.author.id}, ))
cursor.close()
em=discord.Embed(title=f"You've successfully registered!", description=f"Now you can use currency commands :)")
await ctx.send(embed=em)```
is this correct?
instead you're spending ages in chat asking for people to show you code
Who are you talking to
pika, he keeps doing this
Ah
!d discord.Message.components @slate swan
A list of components in the message. If Intents.message_content is not enabled this will always be an empty list unless the bot is mentioned or the message is a direct message.
New in version 2.0.
i think this is what you want
what- why cant yall just tell me the code :/
π
'0' π
async def register(ctx):
cursor = sqlite3.connect("userinfo.db")
cursor.execute("INSERT INTO userinfo (userid, balance) VALUES (?, 0)", ({ctx.author.id}, ))
cursor.close()
em=discord.Embed(title=f"You've successfully registered!", description=f"Now you can use currency commands :)")
await ctx.send(embed=em)```
is this correct?
Because we aren't workers lol?
!rule 8
8. Do not help with ongoing exams. When helping with homework, help people learn how to do the assignment without doing it for them.
^
alr then
so how can i fix it then?
cursor = sqlite3.connect("userinfo.db") is this a cursor or a connection pika?
connection
then why are you using it as a cursor
lemme fix that
async def register(ctx):
conn = sqlite3.connect("userinfo.db")
cursor.execute("INSERT INTO userinfo (userid, balance) VALUES (?, 0)", ({ctx.author.id}, ))
cursor.close()
em=discord.Embed(title=f"You've successfully registered!", description=f"Now you can use currency commands :)")
await ctx.send(embed=em)```
fixed, and then?
you should ask that to tutorials that do client = commands.Bot
but i have to do that to annoy people
π
pika, when you removed cursor = something from existance, do you think cursor.execute is possible?
priorities
cursor.execute("INSERT INTO userinfo (userid, balance) VALUES (?, 0)", ({ctx.author.id}, )) okay but how does it know what the cursor is now
is there a module/function that can align the text below such that the colons are in a line?
Time : 1700h Time : 1700h
Place : Here -> Place : Here
Date: 01/01 Date : 01/01
i seriously doubt it, you'd have to make one
async def register(ctx):
db = sqlite3.connect("userinfo.db")
cursor = db.cursor()
cursor.execute("INSERT INTO userinfo (userid, balance) VALUES (?, 0)", ({ctx.author.id}, ))
cursor.close()
em=discord.Embed(title=f"You've successfully registered!", description=f"Now you can use currency commands :)")
await ctx.send(embed=em)```
getting better
i ran into a similar problem, you have to consider things like the font that discord uses
now what are brackets used for in {ctx.author.id}?
to let it get author id?
pika what do {} brackets do
not inside the f string
so is it not needed?
WHAT DO THEY DO PIKA
you're gonna run into the same thing on the next line of code you write if you don't bother googling the most basic things
variable?
btw does anyone know what to do with this shit? π₯²
note: that's not full shit
Is it await ctx.defer or ctx.defer?
wrong. try again
wdym
complex variable expressions?
what do you think if that's async function?
await
then what's the problem?
It still says missing access π
i have no idea, you can try going to official dpy server
ah yes so i need to remove the {}
so what do they do?
why do you need to remove it pika
if you don't know why then you've failed
You don't want to use sqlite3 for discord.py development because sqlite3 does not provide an asynchronous way to do things. Also, you don't want to open a new connection in every command, saving a connection object as a bot variable in the setup_hook coroutine function and using it thru the bot is preferable
you're now at 2nd million year
he cant even secure with this, dont give even more problems
because it is not sql3?
πͺ
lol
not even close
it can not convert a dictionary item directly in a string.
:medium_knife:
bruh
why not just use pickle instead
who is that
a module which lets u store py objects as is in a file
quick off load and on load
For what
idk, i didnt even know bout this module
oh :0
You had your snarky lmgtfy link blocked twice and you think it's a good idea to bypass that with a screen shot.
oh?
instead of sql3 since they are taking stuff out and using a dictionary in the end
so why not just store it as a dictionary
from the get go
pickle is not asynchronous
aiopickle :lmao:
Is that a thing
idk
async def register(ctx):
db = sqlite3.connect("userinfo.db")
cursor = db.cursor()
cursor.execute("INSERT INTO userinfo (userid, balance) VALUES (?, 0)", (ctx.author.id, ))
cursor.close()
em=discord.Embed(title=f"You've successfully registered!", description=f"Now you can use currency commands :)")
await ctx.send(embed=em)```
To a result which doesn't even apply for the case they were in, as the cherry on top (the brackets make a set not a dict for their case) 
I suggest you save a database connection object as a bot variable in the setup_hook function of the bot and use the database connection object thru the bot
it doesnt has to be if you load the whole dictionary once
in the beginning
and dump everything in the end
Also, use an asynchronous database SQLite library
so how do i fix this
you get the O(logn) time complexity too π€
okay ill just be quiet
what is wrong? error?
its not working
pikaa pikapi
π π someone?
you forgot to close your socket?
how do i close it(/them) now?
that_socket_object.close()
it has a .close() method
But you should use a with statement
^
async def register(ctx):
db = sqlite3.connect("userinfo.db")
cursor = db.cursor()
cursor.execute("INSERT INTO userinfo (userid, balance) VALUES (?, 0)", (ctx.author.id, ))
cursor.close()
em=discord.Embed(title=f"You've successfully registered!", description=f"Now you can use currency commands :)")
await ctx.send(embed=em)```
so how do i fix it? its not working
share the error
There is no error, they simply haven't committed the transaction
there isnt any error
then how?
db.commit() in your case
oh lol
put that where?
But again, please read these
before cursor.close() ?
Maybe
idt they care much about blocking and non blocking code
yes
They should
ok π
Should I use replit or vscode for the bot devolopment?
I have in no way the intention to enforce anything on anybody
for god sake use vscode
vscode
on vscode I don't know how to stop the bot
that's the problem
async def register(ctx):
db = sqlite3.connect("userinfo.db")
cursor = db.cursor()
cursor.execute("INSERT INTO userinfo (userid, balance) VALUES (?, 0)", (ctx.author.id, ))
db.commit()
cursor.close()
em=discord.Embed(title=f"You've successfully registered!", description=f"Now you can use currency commands :)")
await ctx.send(embed=em)```
still not working :/
click on the terminal and just press ctrl+c
Ctrl + C if opening in terminal
how do i fix it
When does it occur
when I do that the bot stops after a few minutes
not instantly
i wonder how much connections he created π
thats normal
ok
It stops after approximately 45 seconds, when gateway doesn't receive HEARTBEAT payload from client
when I run python3.10 launch.py db initialise
async def register(ctx):
db = sqlite3.connect("userinfo.db")
cursor = db.cursor()
cursor.execute("INSERT INTO userinfo (userid, balance) VALUES (?, 0)", (ctx.author.id, ))
db.commit()
cursor.close()
em=discord.Embed(title=f"You've successfully registered!", description=f"Now you can use currency commands :)")
await ctx.send(embed=em)```
still not working :/ how to fix?
ok
What exactly does it do
Can you like send its code
like :lmao:
That thing probably happens because of unclosed database connection
And useful info is most likely on top of traceback or in the bottom
Might be a bug in the Discord API wrapper library that they are using
can someone pls help π
@commands.command(name="translate", aliases=["trs"])
async def translate(self,ctx,lang:str):
reply = ctx.message.reference
conten = (reply.cached_message or await ctx.fetch_message(reply.message_id)).content
try:
translated = GoogleTranslator(source='auto', target=lang).translate(conten)
trans = discord.Embed(title=f"Translator | Translated to {lang}", description=translated,color=discord.Color.green())
await ctx.send(embed=trans)
except:
await ctx.send("pls send the text you want to translate")
def check(msg):
return msg.author == ctx.author and msg.channel == ctx.channel
text = await self.bot.wait_for("message", check=check, timeout=5)
text = text.content
translated = GoogleTranslator(source='auto', target=lang).translate(text)
trans = discord.Embed(title=f"Translator | Translated to {lang}", description=translated,color=discord.Color.green())
await ctx.send(embed=trans)
Guys i made this translation comamdn but when the try statement is false the except statement not excecutes
why is it not working?
decided to put it on hastebin: https://hastebin.com/esuxejukey.py
I don't see anything wrong with it but I don't think you should close the cursor, you close the connection
cursor can also be closed
well connection is pretty much also should be closed cus he creates new one in every single command
its not INSERTING the data into table, when people use the register command, and embed is not showing
so how do i close these things?
About this thing, why not just make the entire function async and then call it from non async with asyncio? That traceback is surely about some loops weed
db.close() maybe
ok
do i actually need it?
async def register(ctx):
db = sqlite3.connect("userinfo.db")
cursor = db.cursor()
cursor.execute("INSERT INTO userinfo (userid, balance) VALUES (?, 0)", (ctx.author.id, ))
db.commit()
db.close()
cursor.close()
em=discord.Embed(title=f"You've successfully registered!", description=f"Now you can use currency commands :)")
await ctx.send(embed=em)```
its still not working
Personally I wouldn't call every async function from non async with asyncio tools, it's better to make the whole thing async and run it one single time
Anyway try it and see
ok...
Fun fact: I know sqlite3.Connection instances can be used in with statements but sqlite3.Cursor instances cannot
can someone help me pls π
lol
Do you like refresh it
yes i did, no work
Does it work if you run SQL inside that db manager
so how do i fix it
Does it work or no
no
now gives this π³ py Failed to create connection pool. Traceback (most recent call last): File "/home/bogdan/HokkerBot/launch.py", line 70, in db_initialise run(Table.create_pool(config["DATABASE"]["uri"])) File "/usr/lib/python3.10/asyncio/base_events.py", line 622, in run_until_complete self._check_running() File "/usr/lib/python3.10/asyncio/base_events.py", line 584, in _check_running raise RuntimeError( RuntimeError: Cannot run the event loop while another loop is running
how do i change it
Then it's an issue with your DB
well it does work on the DB Browser for SQLite - execute SQL tab
Instead of using your run just await the coroutines
uh oh stupid me
Write a script that executes a single statement in your db and check
getting a lot of these unclosed things again
async def register(ctx):
db = sqlite3.connect("userinfo.db")
cursor = db.cursor()
cursor.execute("INSERT INTO userinfo (userid, balance) VALUES (?, 0)", (ctx.author.id, ))
db.commit()
db.close()
cursor.close()
em=discord.Embed(title=f"You've successfully registered!", description=f"Now you can use currency commands :)")
await ctx.send(embed=em)```
so this is 100% correct? then why its not working
so i put db.close after it
probably?
Is there a way to ensure the database connection gets closed
async def register(ctx):
db = sqlite3.connect("userinfo.db")
cursor = db.cursor()
cursor.execute("INSERT INTO userinfo (userid, balance) VALUES (?, 0)", (ctx.author.id, ))
db.commit()
cursor.close()
db.close()
em=discord.Embed(title=f"You've successfully registered!", description=f"Now you can use currency commands :)")
await ctx.send(embed=em)```
what else isnt correct here ?
@slate swan you don't even need to close the cursor
i think we already know that it does not
It will be garbage collected
Anyway what is used for those migrations or smth, I mean where is the Table class from
The use of sqlite3 and the fact you open a database connection in the command
async def register(ctx):
db = sqlite3.connect("userinfo.db")
cursor = db.cursor()
cursor.execute("INSERT INTO userinfo (userid, balance) VALUES (?, 0)", (ctx.author.id, ))
db.commit()
db.close()
em=discord.Embed(title=f"You've successfully registered!", description=f"Now you can use currency commands :)")
await ctx.send(embed=em)```
is this correct now?
from db.structures (stole it from RDanny's db.py to be honest)
wheres the problem at? so what should i do instead?
π
Could you link me that class
For the first problem, use any asynchronous SQLite library
...
I use aiosqlite because I just picked it
im using sqlite3
It does not provide asynchronous functionality
He doesn't really get the common sqlite3 yet, I would suggest understanding it first and then going to aiosqlite (in a short time ofc cause migration is aids)
so how can i fix the code?
As for the second problem, I recommend opening a database connection in the setup_hook function of the bot and saving it as a bot variable
From what I could see the Table has protected member _pool, try closing it in the end of your function
sure
I'd also point out that it's perfectly fine to use something that isn't SQL like a dictionary storage that's synced to a JSON file via a background process
If that's sufficient for your current use case, at least
I feel like transacted IO is safer in case of sudden disconnection
uhm.. btw.. im doing create_pool which returns pool object, so i guess i should close it
Yeah surely
no, json cant make massive databases
works π³
Well no, that's why I said if it's sufficient for your use case
wth and that's it? it just works?
Depends on the functions that read from and write to the JSON file
Easy
bruh
That's what I said at first β "unclosed connection"
hey I want to ask that how to host my bot for 24/7 free
I was using replit till now
but its bad
yes
offline
get another pc and host it locally 24/7
FREE
virtual pc
- Get a VPS
- Connect to VPS
- Find config guide (I have one) and follow it
free pls
hmmmm
iiiiiimpossible
well, almost
why?!?!!?!
Unless you are from Russia or Belarus and you don't have Kazakhstan card
π
π indeed
bruh I am a teen and I don't have lot of money to spend on a discord bot
I literally listed 3 free tier services
how lucky that my dad is a programmer and he has the host:)
Not free, but I host a couple off a Raspberry Pi 2A
AWS requires credit card info
I made a server from old computer parts and it's ok
Makes sense
i have free nitro but i cant get it cus of this issue
It's a shame I can't get a Kazakhstan card without going to Kazakhstan
So I'd imagine a Raspberry Pi 4 would have all the compute you could possibly want for a well written bot
I run 5 bots on intel pentium and 3gb of DDR3 RAM
How does a machine have anything to do with "well written-ness"
such a shame that we cant get a visa to USA by anything
For example sync db wrapper may easily cause 100% CPU load
If it's not optimised, it'll need more compute to brute force whatever you're doing
Personal experience btw
π©
Thx god I managed to rewrite it to async one
Well written implies you already wrote an optimal program that works well on your machine
Yes, which is why I said if it was well written then a Pi should be plenty for whatever you're trying to do
If it is well written it doesn't matter the machine
If it's not well written, because you're doing stuff in cubic time that should be linear, then you're not going to have a good time
that happens in only potato laptop otherwise no matter how hard u try u won't go 100% usage
But you might still be able to get it to run on your gaming rig or whatever
why is getting a credit card to pay an issue
Well if you run tensorflow training on some low-end thing with 1gb RAM and no GPU it will take ages
Some people don't have it
how bad written would have to be to make cpu 100% almost impossible
ask your parents
Really bad
Have you tried using concurrent.futures.ProcessPoolExecutor
minecraft java
Easily
rpi 4b+ has like 8gb
I'd say 1gb is ok
4GB is too much I think
yeah 1gb ok if it's unverified
i meant verified bots
Why does it matter
Also yeah some countries are restricted from international payments now, I hope I don't have to tell which ones are
concurrency πΏ
Unless you mean for the system the bot runs in
yep
4GB for the bot process is too much
ic, now that's an issue
some big bots of some friends i know uses 16gb
What concurrency eats up that much RAM
What the?!
Extra might help if you're running on 2000+ servers
yeah
depends on the scale π But for most it's definitely < 1GB
People could easily run a bot using a couple hundred MB even at millions of servers if they use the webhook slash commands
This is concerningly high
What the hell, is there like images generation
yeah quite a lot of stuff it's a big bog
bot*
Understandable
I mean when you get up to scales like Carl, you shard onto multiple servers
It's just a matter of responding to the gateway, no?
Discord API wise
On top of registering the slash commands
But that's like a one time thing
Dropping the ws gateway just makes the amount of load you need to deal with much much lower unless you actually physically need the gateway events like on_message. But realistically that probably works better in it's own service
at scale the difference between handling 5,000 events/s vs just handling a few events when people actually trigger commands, is bigggg
What Discord API mechanism handles executing slash commands
To use slash commands you'd still need the gateway wouldn't you
But for something that runs on <75 servers then 1GB is likely fine, 4GB if you're doing something really complicated
no, you either have a webhook setup, or use the gateway
Everyone is just using the gateway because most libraries use it, even though in reality it's easier to use the webhook system unless you absolutely need live events
how can I fix this? Extension 'cogs.fun' raised an error: DeprecationWarning: ssl.PROTOCOL_TLS is deprecated
Couldn't everything be web hooked
commands wise? yeah
You'd need to host a server with static IP to accept the incoming requests
Everything, including event payloads
they're different payloads. But webhooks are only triggered when commands are triggered. Rather than unconditionally like on_message, or member updates, etc...
Anyway, having accidentally diverted the conversation, all I was trying to say was that for the a cost of Raspberry Pi you should be able to run pretty much what you want, as long as you're not writing stupidly unperformant code
β
And it'll be as stable as your ISP
Slash commands don't seem conditional
and you're power generation π
Oof, yeah, living in a capital city I take that for granted
just keep a backup power and run rpi on that to prevent frying it due to voltage fluctuations in power cuts
I run mine through a surge protector
I mean along the lines, the if you have a command lets say called foo and I call it with /foo, then it'll trigger my webhook. Because someone has used my command.
But if I wanted to get the messages of everything going on in the server lets say, I wont be able to. Because it only sends interaction events via the webhook.
yeah all cool then
UPS are expensive, running through a permanently plugged in power bank is a fire risk, but a surge protected power strip is <Β£10
i mean u don't need an ups i made my own pack from 2 Li ion batteries and a charging module
How do I make it so
If the user says
,timer 1h
It should wait for 1h and then edit the message
How's that different to using a power bank?
also rpi itself is a fire risk if u don't have fans or heat sinks when u use long term perfomance drops also due to temp altho they throttle the pc its not completely safe
cheaper than a ups and power bank by like a lot Li ion batteries very easy to find 
I did try aasnycio.sleep(3600)
But I donβt want the user to use seconds
!pypi durations-nlp
parse get seconds then use asyncio
Any sugar example?
@bot.command()
async def timer(ctx, time):
Msg =await ctx.send(βLet the timer beginβ)
duration = Duration(time)
await asyncio.sleep(one_hour_duration.to_seconds())
await Meg.edit(βendedβ)
duration.to_seconds()*
CTX, *, time
Unless you're bypassing the battery when it's fully charged, you're going to wear out those cells pretty fast, and they're going to run hot, both of which increase risk of battery explosion
Doing this is correct or it requires me to store duration.to_seconds() in a far?
Var*
it's fine
k ty
altho one_hour_duration is undefined here
^
Hey! I want to send this mostly in a general chat but if there is no general chat because it has a other name it doesnt send anything
You're passing the same reference whether you assign a label to it or not
Could be better and easier to make a command so that server owners or admins can choose the channel it sends in
Well how, its sends a message when the bot is added to the server
time1 = datetime.now() + timedelta(minutes=mins)
``` what do i do here if the user used 1h ?
I wouldn't send a message on joining unless it has vital info
You probably want to use discord.utils.utcnow() instead of datetime.now()
and what about discord.utils.now() + discord.utils . . ?
discord.utils.utcnow() simply returns a UTC aware datetime.datetime object
So you can obviously use datetime.timedelta objects as you normally would
What are the benefits of that?
discord.py wants its users to use UTC aware datetime objcets
but i mean if the user uses 1h it wont work at (minutes=mins) right?
I don't know whether they have enforced using them everywhere datetime objects are used
in simple word show can i create a timestamp for x minutes from now?
bruh convert to seconds then add to timedelta
aka the time user sent
I don't know what your use of the datetime object is
Oh okay, probably doesn't effect me then 
oh, ye
This will create a UTC timestamp which is ten seconds into the future
(discord.utils.utcnow() + timedelta(seconds=10)).timestamp()
You used datetime.now() so it might break things
Hi, I'm making a warn command, and all works fine, when I send the data in a channel, all gets displayed properly, but I want to store it into a database, I'm using sqlite3, but I've tried it all, it does not store anything into the database... Can't figure out what's wrong
data = [member, reason, case_number, ctx.author]
cursor.execute(f'INSERT INTO warns (member, reason, id, moderator) VALUES (?,?,?,?)', data)
I am doing connection.commit()...
Is table even created
Also use aiosqlite
I'll check it out
ur storing member id as int? is it even fitting?
Why are you using f string tho
not member id, case id
a random int
wait no u are even storing Member object
Yes
Is it not good?
is that even a decent thing to do is it a good practice 
injection attacks
what happens if like discord makes changes to member object will the previously stored member object even be valid
also if it's member object why are u storing it as string ie text
Because I want to have it like this KiKi#4876
Isn't that good?
No
just store member id and fetch in ur code later
You should be storing IDs
Yeah ik, but I'm just testing rn, and nothing is getting stored in the db
Maybe an exception was raised that was silently ignored by the default exception handler
Yea, problem is it doesn't display errors
For the db
You can register exceptions to be handled in discord.py exception handling mechanisms
Or just do a try-except sqlite3.Error
I think it should actually print it anyway
Since it isn't registered as an exception type to be handled by discord.py
So no SQLite error has occurred
What is the code
async def warn(ctx,
member: disnake.Member = commands.Param(name="member", description="The member you want to warn."),
reason: str = commands.Param(name="reason", description="The reason for the warn.")):
connection = sqlite3.connect("databases/warns.sqlite")
cursor = connection.cursor()
# cursor.execute("CREATE table warns (member varchar, reason varchar, case int, moderator varchar)")
case_number = random.randint(101, 100000)
await ctx.send(f"Member: {member}, Reason: {reason}, id: {case_number}, Moderator = {ctx.author}")
data = [member, reason, case_number, ctx.author]
cursor.execute(f'INSERT INTO warns (member, reason, id, moderator) VALUES (?,?,?,?)', data)```
I tried inserting like regular strings and int without the f strings, still didn't work..
The database connection object will be garbage collected anyway
In the way you do this
First of all use an asynchronous library like aiosqlite
sqlite3 is synchronous and this means it blocks
Alright
Secondly, you should open a database connection once and save it in the bot as an attribute of the bot
That way, you can use the database connection object thru the bot variable
How do I define the attribute of the bot?
I don't know much about disnake, but I do this
async def setup_hook() -> None:
conn = aiosqlite.connect("database.db")
await initialize_database()
bot.db = conn
bot.setup_hook = setup_hook
or this if I subclass the bot class and instantiate my subclass:
async def setup_hook(self) -> None:
conn = aiosqlite.connect("database.db")
await initialize_database()
bot.db = conn
Basically this
aiosqlite.connect is an awaitable
Is it
yessir
Well then await it in your code
Yea, in the docs yes
I actually pip installed it real quick on my local machine right now to see if it is awaitable
I didn't see anything that says it is
In disnake you gotta overwrite start
If it is then it is
@commands.command(name="translate", aliases=["trs"])
async def translate(self,ctx,lang:str):
reply = ctx.message.reference
conten = (reply.cached_message or await ctx.fetch_message(reply.message_id)).content
try:
translated = GoogleTranslator(source='auto', target=lang).translate(conten)
trans = discord.Embed(title=f"Translator | Translated to {lang}", description=translated,color=discord.Color.green())
await ctx.send(embed=trans)
except:
await ctx.send("pls send the text you want to translate")
def check(msg):
return msg.author == ctx.author and msg.channel == ctx.channel
text = await self.bot.wait_for("message", check=check, timeout=5)
text = text.content
translated = GoogleTranslator(source='auto', target=lang).translate(text)
trans = discord.Embed(title=f"Translator | Translated to {lang}", description=translated,color=discord.Color.green())
await ctx.send(embed=trans)
Guys i made this translation comamdn but when the try statement is false the except statement not excecutes
why is it not working?
async def register(ctx):
db = sqlite3.connect("userinfo.db")
cursor = db.cursor()
cursor.execute("INSERT INTO userinfo(userid, balance) VALUES(?,?)", (ctx.author.id, 0))
db.commit()
db.close()
await ctx.send("Registered!")```
why is my code not working? :/
its not connecting to database
Except executes on error also how "try statement is false"
database seems to be locked, how to unlock?
Ye my try statement is false but till except not working
then whats the issue
Try this @slate swan
And don't create the file manually
Let the code create it
?
I hope you are executing setup statement in setup_hook or start
I don't think that's an issue but still
that method returns an aiosqlite.core.Connection class which is not ready to perform operations yet.
that class has a __await__ method which makes it ready to function
Weird logic
Anyone help pls
async def setup_hook(self) -> None:
conn = aiosqlite.connect("userinfo.db")
bot.db = conn
cursor.execute("INSERT INTO userinfo(userid, balance) VALUES(?,?)", (ctx.author.id, 0))
db.commit()
db.close()
await ctx.send("Registered!")```
like this?
This is indeed the weirdest asynchronous interface I've seen in Python
Now you messed it up
ctx.send in setup hook?
This thing makes no sense
lol
then how,
aiosqlite/core.py line 153
def __await__(self) -> Generator[Any, None, "Connection"]:```
oh
An asynchronous one
mhmmmm
The entire library is written weirdly
just use asyncpg 
using already
json gang where
swas server
Anyone help pls
I asking from so much time
wth is try statement and how can it be false
i just realized your name is in base64
ill find every single one of you and make you a False boolean value
Why?
still says Exenifix though :P
I trying to make that if the replied message is None it takes input from user
Hi peepz, so i made a bot that stores the message date in a MySQL DB.
Code write to MySQL:
global cursor
global db
global guild
cursor.execute("select * from members_message WHERE member_id = '{}'".format(m.author.id))
db_get_user = cursor.fetchall()
print(db_get_user)
if len(db_get_user) == 0:
cursor.execute("INSERT INTO `members_message` (`member_id`, `members_message_date`) VALUES ('{}', '{}')".format(m.author.id, date_now))
db.commit()
print("Insert nieuwe user")
else:
cursor.execute("UPDATE members_message set members_message_date = '{}' WHERE member_id = '{}'".format(date_now, m.author.id))
db.commit()
print("Update bestaande user")
```
Now i have a thread loop that gets the user ID, if last message was send longer then 1 month.
Code:
def Minute():
global member_from_DB_to_kick
threading.Timer(4, Minute).start()
cursor.execute("SELECT * from members_message where members_message_date < now() - INTERVAL 4 week")
db.commit()
show_date = cursor.fetchall()
member = show_date[0][0]```
Now i need to kick the user from the server.
I want that to do with:
async def kick_member(member):
guild_id = 1002208148930691172
member_id = member
reason_str = "..."
guild = await bot.fetch_guild(1002208148930691172)
member = await guild.fetch_member(member_id)
await member.kick(reason = reason_str) ```
but i can't, because it's `async`
So i can't call it.
How can i let them work together?
omg
this is wrong in so many levels
- MySQL is sync u need async
- don't use threads use a task loop
- don't use global
- prolly others which i will know when i read the code thoroughly
honestly this isn't even a way to make a discord bot
hey i was trying to make a meme command everything is working fine but i want the bot to react on the meme it just sent idk how to do that please help me
@bot.command()
async def meme(ctx):
content = get("https://meme-api.herokuapp.com/gimme").text
data = json.loads(content,)
meme = discord.Embed(title=f"{data['title']}", Color = discord.Color.random()).set_image(url=f"{data['url']}")
await ctx.reply(embed=meme)```
await message.add_reaction('emoji')
um its not working
Don't fully get this
@client.event
async def on_message(message):
if message.author.client:
return
msg = await CTX.reply()
await msg.add_reaction()
relax
pip install requests
ty
also bruh if u gonna ask help with a nuker atleast change the file name
lul
GANG-Nuker lol
okkk
@bot.command()
async def meme(ctx):
content = get("https://meme-api.herokuapp.com/gimme").text
data = json.loads(content,)
meme = discord.Embed(title=f"{data['title']}", Color = discord.Color.random()).set_image(url=f"{data['url']}")
await ctx.reply(embed=meme)
await message.add_reaction(reaction1)
await message.add_reaction(reaction2)``` is this the same thing?
u think πΏ
...
how it the same?
Does it need to be message.author.bot: ?
o
if message.author.bot:
return
Yeah but I use client? Or doesn't that matter
trans π³π³
how to update pip
erm
guy is making a nuker i saw a bit too late π
;))
u need bot u can't just use whatever u want
Yeah okay
wdym is demon is back making a god damn nuker
^^
wdym?
BRUHJ
not making he prolly cloned or installed from somewhere
dont report it, its not a nuker
anyone?
its a self bot
the file clearly says so?
and its cloned
thats tos
from GANG Nuker github
pls dont i was testing it please dont report
It's dpy though
doesnt really matter if it was testing we cant know for sure and it is used against tos
where
i dont want to get reported again
since when SQLite is discord.py
@bot.command()
async def meme(ctx):
content = get("https://meme-api.herokuapp.com/gimme").text
data = json.loads(content,)
meme = discord.Embed(title=f"{data['title']}", Color = discord.Color.random()).set_image(url=f"{data['url']}")
await ctx.reply(embed=meme)
msg = await CTX.reply()
await message.add_reaction(reaction1)
await message.add_reaction(reaction2)``` ```raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'CTX' is not defined```
i left that goddam stuff
not saying that
um
it's ctx in your case, man read your parameters
I don't get the issue
Simple steps to fix SQLite Error Database is Locked including Error Code 5 using either manual method or alternate solution.
you're using a non asynchronous library in an asynchronous context
i did ctx
it didnt work either
you did CTX
i did ctx aagain
- it's
ctx - it's
msgnotmessageread your code π
CTX <-- this is just my keyboard messing up
ERROR: Could not find a version that satisfies the requirement PIL (from versions: none)
ERROR: No matching distribution found for PIL
whenever i type CTX it makes it CTX see
HELP
im so dumb
...
help pls
u clearly know no python at this rate u just gonna come back for stuff again and again
the error is pretty self explanatory
yes
fact fr
how u can say that with a straight face beats me πΏ
its pillow
Still don't really get it how I would fix it :(
How would you do it then?
the PIL project has been discontinued iirc
you should use aiosqlite https://readthedocs.org/projects/aiosqlite/
'' ERROR: Could not find a version that satisfies the requirement ultrarequests (from versions: none)
ERROR: No matching distribution found for ultrarequests ''
help\
I use aiosqlite?
you're currently using sqlite3
Where does it say that
your error says sqlite3, and then you should know what you are using since you have downloaded and imported the module into your code
help guys
aiosqlite just wraps sqlite3, so most of it errors would be sqlite3 errors itself
db is locked thats like pretty big indication he is using sync db driver sqlite3
he attempted two writes to the db at same time
error is being raised by aiosqlite
its more of a multiple connection issue, probably creating connections everytime they need to write
yes.
ERROR: Could not find a version that satisfies the requirement ultrarequests (from versions: none)
ERROR: No matching distribution found for ultrarequests
HELP ME
I wouldn't say that falls under common sense, how are you to know something is a bad practice to begin with if people don't tell you that? Saying it's a lack of common sense discourages people from programming or asking for help
that library simply doesn't exist
first time i read that as ultra-rare-requests
It was running on 2 screens in my vps
Yeah
ModuleNotFoundError: No module named 'ultrarequests'
hmm fair enough my bad
But its saying that
I think I broke my bot with an on_message lol its not responding to anything rn
but docs exist for examples u can avoid such situations just by reading up a bit
change the .event decorator to .listen()
fr
client.listen?
if you use client for commands.Bot,yes
u could also add process_commands
!d discord.ext.commands.Bot.listen
@listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_ready "discord.on_ready")
The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.10)").
Example...
and work with event also
because it doesn't override the default on_message method
do you commit to the database after writing stuff?
How to do you make a discord bot mention someone? Like for example I typed !cool @member and the bot said "@member is cool" or something
argument?
what? sorry im kinda new so i dont know what u mean
oh if u mean just put it in an argument i dont want that i want if someone doesnt mention a user it sends an error
typehint an argument as discord.Member
well... Member takes a name too...
hmmm
oh wait
you can check message.mentions
he could also use if isinstance(member, discord.Member)
that works?
yes
ok
you can compare any object with the base class
sup
ill just use an argument but thanks for the help guys
AttributeError: loop attribute cannot be accessed in non-async contexts. Consider using either an asynchronous main function and passing it to asyncio.run or using asynchronous initialisation hooks such as Client.setup_hook
self.pool = self.loop.run_until_complete(asyncpg.create_pool(dsn=self.get_env("URL"), min_size=1, max_size=5))
I think it worked for me a while back, what should I do?
self is commands.bot
you shall do that said in the error
Consider using either an asynchronous main function and passing it to asyncio.run or using asynchronous initialisation hooks such as Client.setup_hook
And how do I do that
create the setup_hook method ad handle it there
what concretely you do not understand?
Everything about it. It used to work once did something change?
Yes, asyncio's programming guidelines changed and discord.py changed to conform to them
eithet use the setup_hook
or just do
async with self:
self.pool = await self.loop...```
But I am doing it in a non-async function
async with in non async function :cat_dance:
then use a setup hook ....
the _init_ of what?
just dont do it then
It's a method of Client/Bot called prior to connecting to the ws
in short terms, in the subclass or Client/Bot, just have an async function called setup_hook and do your stuff there
Uh ok ok I get it
How to defer interaction without Bot is thinking...?
defer(with_message=False) doesn't work
!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...
thinking kwarg
p.s. using disnake )
!d disnake.InteractionResponse.defer
await defer(*, with_message=..., ephemeral=...)```
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.
Changed in version 2.5: Raises [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") when an interaction cannot be deferred.
profile_picture = await load_image_async(str(member.avatar.url))
``` What's wrong here?
with_message: Whether the response will be a message with thinking state (bot is thinkingβ¦). This only applies to interactions of type InteractionType.component. @buoyant quail
what to do with modal? :p
what lib are you using?
idk... i use dpy, as seems from docs - nothing...
easy_pil
dpy
are you using 2.0?
then it's avatar_url
guys do you have any suggestions for features to implement in my bot . Also is there any server where you can basically show your bot to others?
prob not
because selfbots do the funny
Also is there any server where you can basically show your bot to others?
top.gg is a site for that (just in case you don't know)
guys do you have any suggestions for features to implement in my bot
Levelling, logging systems
Isn't there the discord.py server bot channel or smth?
nope
They removed it?
there is discord.py server
and you can add your bot to there if you get verified by.. Danny? iirc
How can i use:
await prune_members(*, days, compute_prune_count=True, roles=..., reason=None)
It doest get the prune_members and invalid syntax after ,
b-b-bruh
that's your code?
I see this on the site:
ohkay
Is there any way to see your vps his ram with a command? like .ram 500mb/1gb for example
Idk how i can inplement it
depends on what OS vps is using
