#discord-bots
1 messages Ā· Page 1110 of 1
python just sleeping instead of waiting for the prey, async programming
yes you love me pls
time.sleepš³
yuppp
thats python waiting for prey
lmao
are you python, sleep or rust? š¤š¤
dont fall for the trap
!ot
Off-topic channel: #ot2-never-nesterās-nightmare
Please read our off-topic etiquette before participating in conversations.
what trapš
i love traps
š
are you one? :0 hot
okimii's love aint fake, i know that fine enough (ssriously)
now take this to an ot channel
how off topic lol
lmao
china is typing š³ šØš³
š³
š³
u got any rust repos? lol
nope i need ideas for a project
async socket server for CRUD on an async database
i was thinkin a cli for random cat pics cuz why not
ascii cats
good idea
!ot
Off-topic channel: #ot2-never-nesterās-nightmare
Please read our off-topic etiquette before participating in conversations.
.topic
Suggest more topics here!
woah youre a rust fan too š
š³ š
menus for modals ffs
something that pings okimii every 5 seconds and tells him that he's cutely annoying
easy peasy
Yep
@commands.Cog.listener()
async def on_member_remove(self, member: discord.Member):
channel = self.client.get_channel( 977252614498582538)
await channel.send (f"{member.mention}, Š£ŃŠµŠ» Ń ŃŠµŃŠ²ŠµŃŠ°")
Please tell me why it worked a week ago and now it doesn't
rust is superior to c++
cuz the channel changed
did you check the id of the channel?
can you guys stop or move to an off topic channel if you want to discuss about rust now?
done sorry lol
get_channel might be returning None
make a getch instesd
channel = self.client.get_channel(channel_id) or await self.client.fetch_channel(channel_id)```
how will it fetch something that can be inexistent
what if the channel exists and isnt in the cache?
He still does not write anything in the channel. It doesn't show any error in the panel either. id match(((
if the channel was deleted, then it will not exist, not in the cache or anywhere.
if it is just not in the cache, then sure, fetching it answers the cache
and how do you know the channel is inexistent
all message components in modals would be cool
i dont, im just saying lol
omg buttons too
then how is my answer wrong
ratelimits go brrrr
did i say it was?
yep
you said it doesnt answer the question but a different one
elaborate
my question lol
is it discord.py and did you upgrade it?
did you check if the channel ids match? did someone change the channels in 1 week lol
"elaborate" on how you know that the channel is inexistent, it'll either raise a 404 error or return the TextChannel object, so that settles it
channel ids dont change
Yes, I just checked the id. they match (
you have members intent enabled?
yes
created_at returns datetime.datetime object
member.created_at.timestamp()
!d datetime.datetime.timestamp referring to the replied message
datetime.timestamp()```
Return POSIX timestamp corresponding to the [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instance. The return value is a [`float`](https://docs.python.org/3/library/functions.html#float "float") similar to that returned by [`time.time()`](https://docs.python.org/3/library/time.html#time.time "time.time").
Naive [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instances are assumed to represent local time and this method relies on the platform C `mktime()` function to perform the conversion. Since [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") supports wider range of values than `mktime()` on many platforms, this method may raise [`OverflowError`](https://docs.python.org/3/library/exceptions.html#OverflowError "OverflowError") for times far in the past or far in the future.
For aware [`datetime`](https://docs.python.org/3/library/datetime.html#datetime.datetime "datetime.datetime") instances, the return value is computed as:
```py
(dt - datetime(1970, 1, 1, tzinfo=timezone.utc)).total_seconds()
``` New in version 3.3.
Changed in version 3.6: The [`timestamp()`](https://docs.python.org/3/library/datetime.html#datetime.datetime.timestamp "datetime.datetime.timestamp") method uses the [`fold`](https://docs.python.org/3/library/datetime.html#datetime.datetime.fold "datetime.datetime.fold") attribute to disambiguate the times during a repeated interval.
You smart man
oh no
is the cog loaded successfully?
||she/her|| but yes, smart
it's okay lmao
see who's denying
I'm now completely in denial of you being in denial of something you shouldnt deny about
š
yes, other commands work but farewell and hello do not
that "oh no" was more of a scared oh no than a denial one
@commands.Cog.listener()
async def on_member_remove(self, member: discord.Member):
channel = self.client.get_channel(977252614498582538) or await self.client.fetch_channel(977252614498582538)
await channel.send (f"{member.mention}, Š£ŃŠµŠ» Ń ŃŠµŃŠ²ŠµŃŠ°")
lmao
did you try restarting the bot?
Just restarted still 0 reaction. maybe the command structure changed after the python update?
Wat ye tryna do?
If I log out from the server, then write a message in the chat that I'm logged out
do objects randomly disappear from the cache? if not, load the channel once, store it someone in a bot variable or something and use that, why getch everytime
deleted channel
cz it's not cached by your client
Sometimes if u donāt have access to view those servers , it appears like that
Should work
[#977252614498582538](/guild/267624335836053506/channel/977252614498582538/)
wait
they should name it something like unkown channel or invalid channel, this is bs error handling by discord
Channels^
try printing something in that event and see if it even gets triggered or not
Ye fr , but it is what it is , cause most of the time itās just a deleted channel
^ that's why they appear as deleted-channels
oh
still, discord needs to be better at that, i dont like it
Inarguable
why not try something like:
inside of the cog
class Cog(commands.Cog):
def __init__(self, client):
self.client = client
self.leave_channel = channel
self.leave_channel_id = 977252614498582538
@commands.Cog.listener()
async def on_ready(self):
self.leave_channel = self.client.get_channel(self.leave_channel_id) or await self.client.fetch_channel(self.leave_channel_id)
@commands.Cog.listener()
async def on_member_remove(self, member: discord.Member):
await self.leave_channel.send(f"{member.mention}, Š£ŃŠµŠ» Ń ŃŠµŃŠ²ŠµŃŠ°")
that's not a cog :)
subclass commands.Cog first
this is not real code :D its an example :DDDD
Itās just probably a class in his main file
still....
imagine having errors in examples
fetch your dependencies inside of on_ready
and dont do shit in on_ready, since it is triggered multiple times and making requests in the event makes the app prone to disconnectivity from the gateway
that... has never happened to me lol :D
"makes it prone"
so it's not a good idea
nor a good practice as suggested
the only time I see on_ready getting triggered multiple times is when i sleep my pc and turn it back on :D
s.m.h.
i never saw it lol
it only gets triggered once after the pc is up
plus centralization so
agreed, I used to be a C++ dev and then discovered Rust
C++ ++
@commands.Cog.listener()
async def on_member_remove(self, member: discord.Member):
print("123")
await self.leave_channel.send(f"{member.mention}, Š£ŃŠµŠ» Ń ŃŠµŃŠ²ŠµŃŠ°")
@commands.Cog.listener()
async def on_ready(self):
self.leave_channel = self.client.get_channel(977252614498582538) or await self.client.fetch_channel(977252614498582538)
print("READY!")
await self.client.change_presence( status= discord.Status.online, activity= discord.Game(".Ń
елп"))
He didn't even write "123" print...
Rusts syntax imo is better than cpp
Don't make API calls in on_ready within your Bot or Client.
Discord has a high chance to completely disconnect you during the READY or GUILD_CREATE events (1006 close code) and there is nothing you can do to prevent it.
Basically: don't do shit in on_ready.
(This comes straight from the discord.py server)
can u link the source
Python's syntax is better than Rust š³
then the event is getting triggered, hm, that's weird, does everything else in that cog work?
Python is my fav interpreter lang and my fav compiler lang is Rust so i cant really agree
thx
Everything works. and mut and clean and run. hello and goodbye no
mut?
let mut ok = "bro";
š³
the high chance there is as high as people smoking weed for the first time, non-existent lol....
ok = "bruh";
ban kick mutš
u looking for mute?

its mutable, i will change it
No. the event does not work for me when it leaves the serverš
i know
but if i remove mut compiler goes boom
too late, its already changed, now ok is "bruh" in the memory
dont make me brake rusts memory safe check
what if u make a singleton run file, u can run the file only once, other times u try to run it runs the previous compiled file
debug--
doesnt rust already do that
huh?
like even if u edit the file, it just runs the old compiled one
doesnt rust run the previous conpiled file if you havent compiled anything?
iirc it gets stored in the debug folder thats made when you do cargo new package_name
ya but when u edit ur code, it recompiles and runs it
yup
ya, i dont want that, hence why singleton-run
well idk maybe deleting the debug folder
why am i still talking, i dont even code in rust lol
šæ
if on_ready gets called more than once, why doesnt "{botname} is online" get printed multiple times??? it never repeats does it š¤š¤
it gets called many times as the client can disconnect many times from the gateway hence the connection being interrupted so then you need to send a RESUME Gateway event payload iirc and so the event gets called again as the cache would get restarted as well
it does
It does, I've observed it myself
hi I have this code and it is running, but the slash command doesn't work and I dont know why
and of course i put client.run(token)
AND i am using discord.py 2.0
u need to sync the tree for slash commands to work
like tree.sync()?
ya that syncs globally, so it might take a few mins for it to load. u can do implicit syncing using the guild keyword arg, thats faster
yes
it should be instant
okay
does startup ever get called?
idk
i doubt that method gets called by default and you are not calling it either
u can also change the name of that function from startup to setup_hook because, that is an async function that gets called internally
Hi, I have another question. I have a command group called helpcommands and a command called help in it. How do I only display the command, not the command group?
I originally had a bunch of cogs and I am making it into slash commands, so do I have to move all the commands out of the cog?
Hey guys i'm trying to make a bot with a task in it
@tasks.loop(seconds=1)
async def send_message():
channel_id = 981276650975158275
channel = client.fetch_guild(channel_id)
message = f"""
Example Message
"""
await channel.send(message)
send_message.start()```
for some reason the client object isn't being recognized
i did some research and people are saying something about cache, anyone know how to solve this issue?
fetching a guild is a coroutine
also, fetching a guild with a channel id? š§
Most libs provide support for slash commands in cogs
Hey any body idea why it is not working?
AttributeError: 'Member' object has no attribute 'avatar_url'
if user.is_avatar_animated():
async def test(ctx, user: discord.User):
I tried it with member to
you're on v2, I suppose?
Yes
does discord.py?
since v2, it's member.avatar.url
(2.0)
Ohhh
!d discord.Member.avatar
property avatar```
Equivalent to [`User.avatar`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.avatar "discord.User.avatar")
And whats about is_animated
the docs will tell you š
Thanks bro
thank the docs
yeah it does
though it's somewhat a confusing kind of implementation if you compare it with the forks, but it's usable
@commands.Cog.listener()
async def on_ready(self):
cursor.execute("""CREATE TABLE IF NOT EXISTS users(
name TEXT,
id INT,
gems BIGINT,
lvl INT
)""")
for guild in self.client.guilds:
for member in guild.members:
if cursor.execute(f"SELECT id FROM users WHERE id = {member.id}").fetchone() is None:
cursor.execute(f"INSERT INTO users VALUES ({member.name}, {member.id}, 0, 1 )")
else:
pass
conn.commit()
print("READY!")
await self.client.change_presence( status= discord.Status.online, activity= discord.Game(".Ń
елп"))
Dear please tell me what is the problem. "ŠŠ°Ńак" is the server principal name
hey this is python with discord.py but the command doesnt run
import imp
import discord
from discord.ext import commands
from Tokens import DiscordToken
import discord.ui
from discord.ui import Button, View, view
intents = discord.Intents.default()
bot = commands.Bot(command_prefix="!",intents=intents)
@bot.event
async def on_ready():
print("HigherBot Succesfully Logged in :green_circle:")
@bot.command()
async def config(ctx):
SetupButton = Button(label="Setup",style=discord.ButtonStyle.green,emoji=":screwdriver:")
view = View()
View.add_item(SetupButton)
await ctx.send("Interact with the Following", view=view)
bot.run(DiscordToken)
Doesn't run how?
don't do shit in on_ready, use a startup task instead
thank you, I searched the Internet and found what the problem is now everything works))))
import discord
from discord import Interaction, app_commands
from discord.ext import commands
from discord import member
from discord.ext.commands import has_permissions, MissingPermissions
import os
from discord import Intents
intents = Intents.default()
intents.members = True
intents.message_content = True
class aclient(discord.Client):
def __init__(self):
super().__init__(intents=discord.Intents.default())
self.synced = False
async def on_ready(self):
await self.wait_until_ready()
if not self.synced:
await tree.sync(guild = discord.Object(id = 984317836094746624))
self.synced = True
print(f'Logged in as {self.user}.')
client = aclient()
tree = app_commands.CommandTree(client)
@tree.command(name="help", description='Help command.', guild = discord.Object(id = 984317836094746624))
async def self(interaction: discord.Interaction):
embed = discord.Embed(title="Help", color=0x03f4fc)
embed.add_field(name='**IP**', value="Shows server's IP.", inline=False)
embed.add_field(name='**TS**', value="Shows server's TeamSpeak.", inline=False)
embed.add_field(name='**MODERATION**', value="Shows moderation commands.")
await interaction.response.send_message(embed=embed)
@tree.command(name="ip", description="Shows server's IP.", guild = discord.Object(id = 984317836094746624))
async def self(interaction: discord.Interaction):
embed = discord.Embed(color=0x03f4fc)
embed.add_field(name="**Server's IP**", value="There's no defined IP yet!", inline=False)
await interaction.response.send_message(embed=embed)
@tree.command(name='ts', description='Shows teamspeak adress.', guild = discord.Object(id = 984317836094746624))
async def self(interaction: discord.Interaction):
embed = discord.Embed(color=0x03f4fc)
embed.add_field(name = "**Server's TS**", value="There's no TS yet!", inline=False)
await interaction.response.send_message(embed=embed)
@tree.command(name='moderation', description='Shows moderation commands.', guild = discord.Object(id = 984317836094746624))
async def self(interaction: discord.Interaction):
embed = discord.Embed(title = "Moderation commands", color=0x03f4fc)
embed.add_field(name = "**Ban**", value="Bans a user permanently.")
embed.add_field(name = "**Kick**", value="Kicks people from the server..")
await interaction.response.send_message(embed=embed)
@tree.command(name="kick", description='Kicks people from the server.', guild = discord.Object(id = 984317836094746624))
async def self(interaction: discord.Interaction, member : discord.Member, *, reason=None):
await interaction.member.send(f"You were kicked for: {reason}")
embed = discord.Embed(title = "Moderation command was issued", color=0x03f4fc)
embed.add_field(name="**A user was kicked!**", value=f"{member.mention} was kicked from the server.")
await interaction.response.send_message(embed=embed)
await member.kick(reason=reason)```
it worked before
@azure nebula please do not post that URL
I wouldn't use self as a function name
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.
if you need to share something
lemme change it a sec
it's an image hosting, im sorry
@tree.command(name="kick", description='Kicks people from the server.', guild = discord.Object(id = 984317836094746624))
async def self(interaction: discord.Interaction, member : discord.Member, *, reason:str=None):
await interaction.member.send(f"You were kicked for: {reason}")
embed = discord.Embed(title = "Moderation command was issued", color=0x03f4fc)
embed.add_field(name="**A user was kicked!**", value=f"{member.mention} was kicked from the server.")
await interaction.response.send_message(embed=embed)
await member.kick(reason:str=reason)```
it's working
you don't need to :str there
only in the function definition
hello, can I mention someone with their ID ?
also please rename, don't call it self that's a reserved variale
yup
just
f"@{member.id}"
since the syntax @<user_id> will mention him
thank you!
def update(arg):
con = sqlite3.connect(os.path.join(BASE_DIR, "example.sqlite"))
cur = con.cursor()
update = "UPDATE table SET value1 = ?, value2 = ?, value3 = ?, WHERE entry_id = ?;"
payload = (
arg['value1'],
arg['value2'],
arg['value3'],
arg['subject_id']
)
cur.execute(update, payload)
con.commit()
cur.close()
con.close()
return True
Is the the correct way of doing things? I'm starting to doubt XD
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: near "WHERE": syntax error
remove the , before the WHERE
ohhh thanks !
@tree.command(name="kick", description='Kicks users from the server.', guild = discord.Object(id = guild_id_goes_here))
@has_permissions(kick_members=True)
async def kick(interaction: discord.Interaction, member : discord.Member, *, reason:str=None):
try:
await interaction.member.send(f"You were kicked for: {reason}")
embed = discord.Embed(title = "A moderation command was issued!", color=0x03f4fc)
embed.add_field(name="**A user was kicked!**", value=f"{member.mention} was kicked.")
await interaction.response.send_message(embed=embed)
await member.kick(reason=reason)
except:
await interaction.response.send_message(f"I couldn't ban {member}!")
@kick.error
async def kick_error(interaction: discord.Interaction, error):
if isinstance(error, commands.MissingPermissions):
await interaction.reply("You don't have permission to: Kick Members")```
ik this is not valid
but idk why it is not and how can i make it do what i want it to
in your kick_error
add
else: raise error
and it'll probably show you
@azure nebula can you just copy/paste your text code? no one enjoys reading screenshots
line 69 howart.py
you're looking at the wrong part of the code
and next time you accidentally post that link you'll be banned, last warning
ok
self is not a reserved variable
in fact, you can name self anything in a method
since all Python does is pass the current instance there
just a bad variable in general
i agree, self tends to be used in methods
@tree.command(name="ban", description='Bans people from the server.', guild = discord.Object(id = guild_id_goes_here))
@has_permissions(ban_members=True)
async def ban(interaction: discord.Interaction, member : discord.Member, *, reason:str=None):
if has_permissions(ban_members=True) == True:
try:
await interaction.member.send(f"You were banned from Example_Server for: {reason}")
embed = discord.Embed(title = "A moderation command was issued.", color=0x03f4fc)
embed.add_field(name="**A user was banned!**", value=f"{member.mention} was permanently banned.")
await interaction.response.send_message(embed=embed)
await member.ban(reason=reason)
except:
await interaction.response.send_message(f"I couldn't ban {member.mention}!")
else:
await interaction.response.send_message(f"You cannot ___ban members___")``` this works but when I try to ban someone __with__ permissions, it replies ``You cannot ___ban members___`` instead of ``I couldn't ban @user!``
has_permissions is meant to be used a decorator on commands. It's not going to return a boolean.
I also tried doing it like this but it didn't work either
@tree.command(name="ban", description='Bans people from the server.', guild = discord.Object(id = guild_id_goes_here))
@has_permissions(ban_members=True)
async def ban(interaction: discord.Interaction, member : discord.Member, *, reason:str=None):
try:
await interaction.member.send(f"You were banned from Example_Server for: {reason}")
embed = discord.Embed(title = "A moderation command was issued.", color=0x03f4fc)
embed.add_field(name="**A user was banned!**", value=f"{member.mention} was banned from the server.")
await interaction.response.send_message(embed=embed)
await member.ban(reason=reason)
except:
await interaction.response.send_message(f"I couldn't ban {member.mention}!")
@ban.error
async def ban_error(interaction: discord.Interaction, error):
if isinstance(error, commands.MissingPermissions):
await interaction.reply("You cannot ban members!")```
You are already decorating the ban command with it. I guess your goal is to have a custom error message when someone doesn't have permission?
Yeah okay
That would be the appropriate way to do it
What does "doesn't work mean". Are you getting an error, or just not seeing "You cannot ban members!" replied?
Maybe you didn't save the file or reload your bot. Something like that.
import pynput
state = True
while state:
def on_press(key):
global pressed
while not pressed:
if pos == 1 and aim == 1 and res == 1:
pyautogui.click(x=1080, y=1020)
pyautogui.click(x=650, y=500)
pyautogui.click(x=840, y=1020)
pyautogui.click(x=650, y=500, clicks=hit, interval=0.25)
else:
break
how would i make it keep looping unless "P" is pressed
How can I add a cog with slash commands to the client object in discord.py 2.0
just like a normal cog use app_commands.command() instead of commands.command()
okay
import slash_command
@slash_command(name = "membercount")
async def membercount(self, ctx):
embedmem = discord.Embed(title=f"**Members**", description=f"{ctx.guild.member_count}", color = 0x0000)
embedmem.set_footer(text=f"{ctx.guild.name}")
await ctx.respond(embed=embedmem)
``` this is correct?
what library is this?
oh nvm
what's the main library you're using for your bot?
Client doesnt support cogs...?
replit everywhere..
Yes discord.py
@slate swan 1.7.3
@slate swan what happened?
Code is wrong?
Anyone?
discord 1.7.3 doesnt supoort slash commands, upgrade to discord.py 2.0 for that
run ?tag install dev in the dpy server cz im too lazy to do it
then read about the breaking changes (?tag mg2)
just use pycord or sm lol
lmfao true
buy a vps lmao
if they can buy one why would they use replit?
that's not the point
it's that swas.py teaches people to host their bots in repl.it+uptimerobot
and i find that concerning
at least.... let your viewers know there is a better alternative if you can afford it
Code with swastik, i think it was
yes
Never heard of him
search yt dpy economy bot
I think I should make a yt tutorial with sqlite
No
š
but im lazy
i was thinking abt that too make a decent yt tutorial on dpy but my accent...
nobody understands mine.....
accent doesn't matter
You miss all the shots you dont take :))
people wont even bother opening otherwise gist have most of em
Voice reveal š³
nah not heavy slightly reigonal thats it
Why not
as long as they can understand what ur saying it's fine
coz beginners will just search yt first which beginner actually opens the docs and reads?
an experienced beginner š
me: 
unfortunately its tough to find those most people just jump headfirst š
pygame/tkinter/and some bots
Isn't that dating advice
lmfao
dont doubt my advice
oki is experienced
no
you shot miss take dont
hunter hasnt accepted my proposal for marriage š
well saidš
arent both of u boysš
idk find out ;))
"it dont matter"
- okimii 2022, in his head
i would rather not i got goosebumps
ohhhh am i spookyš¤Ŗ
okimii x hunter fanfic confirmed
Docs are not begginers friendly then š
ugh i hate puberty
"Getting started" sections are IMO
!resources this is trash
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
I can't even find anything
it's not your preferred way of learning
trash docs doesnt mean all docs are trash
mhm
In order to work with the library and the Discord API in general, we must first create a Discord Bot account.
Creating a Bot account is a pretty straightforward process.
docs brokey broke broke
Its an advance lib
possible to set the chance of random.choice?
Ex:
`e = [70ā10ā,
1ā20ā,
33ā29ā]
await ctx.send(random.coice(e))`
1% chance for 20
70 for 10 and 33 for 29
!d random.choice
random.choice(seq)```
Return a random element from the non-empty sequence *seq*. If *seq* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
im pretty sure it has a kwarg for the chances
which iirc you would pass a list and then all the chances
Still not working
!d random.sample
random.sample(population, k, *, counts=None)```
Return a *k* length list of unique elements chosen from the population sequence or set. Used for random sampling without replacement.
Returns a new list containing elements from the population while leaving the original population unchanged. The resulting list is in selection order so that all sub-slices will also be valid random samples. This allows raffle winners (the sample) to be partitioned into grand prize and second place winners (the subslices).
Members of the population need not be [hashable](https://docs.python.org/3/glossary.html#term-hashable) or unique. If the population contains repeats, then each occurrence is a possible selection in the sample.
Make a list then do random.choice and put the extra chance thing twice š
pass the chances to the counts kwarg
IIRC that's what passing counts does
yo
š
Irdk
the docs say so
This is for eval
Huh
what library is that?
there's no ext.buttons in any fork afaik
2.0
Yeah
it doesn't have an ext.buttons either
import app_commands = this is correct?
where did you get this code from?
So?
yeah from discord import app_commands
GitHub the eval code
you need to do that urself
send me the link to that repo
app_commands doesn't have paginator
send it here smh
how do u make a lightbulb plugin work with classes? got it
checks sarths git repo i think he used it
any help with this error?
hmm, all i see is subclassing plugin to type hint the bot attr
i was it to be like completely oop
class disnake.ext.commands.Cooldown(rate, per)```
Represents a cooldown for a command.
lmao
.-.
remove bucktype.user
!d discord.ext.commands.cooldown
@discord.ext.commands.cooldown(rate, per, type=discord.ext.commands.BucketType.default)```
A decorator that adds a cooldown to a [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command")
A cooldown allows a command to only be used a specific amount of times in a specific time frame. These cooldowns can be based either on a per-guild, per-channel, per-user, per-role or global basis. Denoted by the third argument of `type` which must be of enum type [`BucketType`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.BucketType "discord.ext.commands.BucketType").
If a cooldown is triggered, then [`CommandOnCooldown`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.CommandOnCooldown "discord.ext.commands.CommandOnCooldown") is triggered in [`on_command_error()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") and the local error handler.
A command can only have a single cooldown.
that is not the class lmao
or use this
class uwuCog(commands.Cog):
'''
My uwu description of the cog
'''
it's been here for a long time
uh nvmd
and it sucks
i typed something and i got that then i checked
it is older than the server itself
just --word the restricted word easy peasy
lol
rip
why want a class though?
I'm getting hex colour from a json api, how can I use it in my embed colour?
colour=0xhexcode (without the hastag)
can't use in this way
uh?
color=0x + data["cpkHexColor"])
hm
go to the bot tab and switch off requires Oauth2...
and this will give an error
can I see what the key cpxhexcolor returns
"cpkHexColor":"3DFF00"```
now it even removed
reload
hm, cuz that is a string
yes
@slate swan :white_check_mark: Your eval job has completed with return code 0.
10
lemme check again
@commands.Cog.listener()
async def on_member_join(self, member: discord.Member):
channel = self.client.get_channel( 977252614498582538)
role = discord.utils.get ( member.guild.roles, id = 977252174964871258)
await member.add_roles (role)
await channel.send (f"{member.mention}, Š“Š¾Š±ŃŠ¾ пожаловаŃŃ Š½Š° ŃŠµŃвеŃ")
for guild in self.client.guilds:
for member in guild.members:
if cursor.execute(f"SELECT id FROM users WHERE id = {member.id}").fetchone() is None:
cursor.execute(f"INSERT INTO users VALUES (?, ?, ?, ?, ? )", ({member.id}, f'{member}', 0, 'Š±ŠµŠ·ŃŠ°Š±Š¾ŃŠ½ŃŠ¹', 1 ))
else:
pass
conn.commit()
Dear, please tell me why he writes in an error that 4 only gave values balthough there are 5?
but still, making a class would be pointless
no? saying its pointless is too broad, you don't know what im doing
broad*
@slate swan
š¤¦
well, that's your choice
sorry ryuga
forgib
why...
themks
i forgot
š„²
š
@slate swan :x: Your eval job has completed with return code 1.
001 | File "<string>", line 1
002 | print(0x#3DFF00)
003 | ^
004 | SyntaxError: invalid hexadecimal literal
there's no #
here's the raw data https://neelpatel05.pythonanywhere.com/element/atomicnumber?atomicnumber=20
!e
print(int('0xffffff', 16))
@shrewd apex :white_check_mark: Your eval job has completed with return code 0.
16777215
remove 0x lmao
@commands.Cog.listener()
async def on_ready(self):
cursor.execute("""CREATE TABLE IF NOT EXISTS users(
id INT,
name TEXT,
gems BIGINT,
work TEXT
lvl INT
)""")
for guild in self.client.guilds:
for member in guild.members:
if cursor.execute(f"SELECT id FROM users WHERE id = {member.id}").fetchone() is None:
cursor.execute(f"INSERT INTO users VALUES (?, ?, ?, ?, ? )", ({member.id}, f'{member}', 0, 'Š±ŠµŠ·ŃŠ°Š±Š¾ŃŠ½ŃŠ¹', 1 ))
else:
pass
conn.commit()
print("READY!")
await self.client.change_presence( status= discord.Status.online, activity= discord.Game(".Ń
елп"))
oh. I meant this event
0xcolor tries to make in int, it doesn't access the variable colo
just do int(colo, 16)
we cannot set color in embed then
oh
can someone give me a "say" command code
i've been trying for 2 daysand it doesn't work
Just py async def cmd(ctx, *, text)
Delete original message (optionally) and send the text
just that?
Yeah
The body of a command is required too
ah
If you get that
aight
ty
oh and for some reason
when i make a command and test it
sometimes it works and sometimes it doesn't
Could you show the body of a command
the code?
Yeah
just that
I mean say command
raise HTTPException(response, data)
disnake.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In embeds.0.fields.17.value: This field is required```
it didn't specify which field, I think I filled all the necessary ones 
embed.add_field make sure you have all the value kwargs filled
class MyHelpCommand(commands.HelpCommand):
async def command_callback(self, ctx, *,command=None):
if command:
await ctx.send(f"This the help page for the command {command} ")
else:
await ctx.send("This is the front pagea for the bots help command")
bot.help_command=MyHelpCommand()```
they are
this?
Dear, tell me how to add a new value to the table without deleting the database.
that's how it was
@commands.Cog.listener()
async def on_ready(self):
cursor.execute("""CREATE TABLE IF NOT EXISTS users(
id INT,
name TEXT,
gems BIGINT,
work TEXT,
lvl INT,
)""")
for guild in self.client.guilds:
for member in guild.members:
if cursor.execute(f"SELECT id FROM users WHERE id = {member.id}").fetchone() is None:
cursor.execute(f"INSERT INTO users VALUES (?, ?, ?, ?, ?)", (f'{member.id}', f'{member}', 0, 'Š±ŠµŠ·ŃŠ°Š±Š¾ŃŠ½ŃŠ¹', 1))
else:
pass
conn.commit()
This is how I want it to be. add gold. but so that the values āāof all participants are preserved
@commands.Cog.listener()
async def on_ready(self):
cursor.execute("""CREATE TABLE IF NOT EXISTS users(
id INT,
name TEXT,
gems BIGINT,
gold BIGINT,
work TEXT,
lvl INT
)""")
for guild in self.client.guilds:
for member in guild.members:
if cursor.execute(f"SELECT id FROM users WHERE id = {member.id}").fetchone() is None:
cursor.execute(f"INSERT INTO users VALUES (?, ?, ?, ?, ?, ?)", (f'{member.id}', f'{member}', 0, 0, 'Š±ŠµŠ·ŃŠ°Š±Š¾ŃŠ½ŃŠ¹', 1))
else:
pass
conn.commit()
how do i rename this?
Right click and rename it
like i haven't tried that
Use your file manager then
Go to your file location and rename
Its Weird
from discord import app_commands
@app_commands(name = "membercount")
async def membercount(self, ctx):
embedmem = discord.Embed(title=f"**Members**", description=f"{ctx.guild.member_count}", color = 0x0000)
embedmem.set_footer(text=f"{ctx.guild.name}")
await ctx.respond(embed=embedmem)
``` this is correct means import
?
Yea
@lyric apex
Which dpy version you are using
2.0
Import is correct
Ohh
Did you add it to your bot decorator?
INSTALL DISCORD.PY 2.0 (OR ABOVE)
pip install -U git+https://github.com/Rapptz/discord.py
NOTE: If you get an error such as: 'git' not added to path. Visit https://git-scm.com/downloads and install git for your required platform. Go through the required steps for installing git and make sure to enable add to path while in the installation wizard. After installing git you can run pip install -U git+https://github.com/Rapptz/discord.py again to install discord.py 2.0.
If any issues still persist, consider the issue on Stackoverflow (or the web) as help with git is easily found.
Discord.py 2.0 (or above) implements a few breaking changes to the library. Few common examples are-
User.avatar_url has been re-considered as User.avatar.url
Guild.icon_url has been re-considered as Guild.icon.url
Bot.add_cog and Bot.load_extension are now asynchronous methods
You can read the full list of changes here - https://discordpy.readthedocs.io/en/latest/migrating.html
EXAMPLES
Slash Commands - https://gist.github.com/AbstractUmbra/a9c188797ae194e592efe05fa129c57f
Buttons, Select Menus, etcetera - https://github.com/Rapptz/discord.py/tree/master/examples/views
Modals - https://github.com/Rapptz/discord.py/blob/master/examples/modal.py
A complete slash command bot - https://github.com/Rapptz/discord.py/blob/master/examples/app_commands/basic.py
embed = discord.Embed(title="title",description="description")
embed.set_footer(text="text")
await ctx.send(embed=embed)
@slate swan
!d discord.Embed.set_footer
set_footer(*, text=None, icon_url=None)```
Sets the footer for the embed content.
This function returns the class instance to allow for fluent-style chaining.
yes
helo
i just want to ask something
can we trigger an event from a cmd?
u can use hex codes
they starts from 0x
@slate swan
yeah just add the colour kwarg to the embed constructor and pass in a hexcode or a rgb format
can we get this pinned btw
hey asher š
lmao
u can trigger commands from events u can trigger some command specific events like reaction add etc
hello everyone
embed = discord.Embed(title="title",description="description",color= hexcode)
embed.set_footer(text="text")
await ctx.send(embed=embed)
i dont have any hex code now sorry
u can get them from google
embed = Embed(colour=0xffffff) #hexcode
embed = Embed(colour=discord.Colour.from_rgb(255, 200, 100)) #rgb colours
embed = Embed(colour=discord.Colour.random()) #random colour
umm not that i mean
from a cmd
trigger
on ready
š
more brief
we need it fr, a lot of people ask the same question
detailed*
why would u trigger on_ready from a command?
we will use it like raven's paragraph
don't put the hex in. a string btw
What is the entire function of this command
it's not even in an command thats like line 1š
of the cmd / slash cmd
maybe 11
no it's 1
0 ?
import discord
embed = ...
await ctx.send(embed=embed)
:D
maybe its only showing 1 digit
whatever u say :p
wait
put it in a comment
let me check vsc have 0 line or not
It has to be inside a command function definition you know
lmao Ashley...
lol
What library are you using?
ye it doesnt
@bot.command()
async def com(ctx):
#embed stuff
com
oh, how
i don't get why people send msesages with just a dot in them
What is the name of the wrapper you are using? discord.py?
hikari and hikari-lightbulb
lmao
I was kidding, dont take me seriously
fine now?
i am trying to keep quiet somehow
Trolling?
no i'm genuinely curious why
pfft
absolutely not
just to get attention
.
you just want attention
yeah
you dont want my looooooove
š
Maybe to reply
lmao
f
hi asher
to reply
yes hello sparky
what
lol
.
mer-man...
Like this
merman
With the sole purpose to reply
yeah but i don't get it, they're replying with nothing, that's kind of useless
imagine making a ppt ;-; - school holiday homework
they should give like code projects it will be fun :D
I reply with nonsense content to my own messages to waste no time for the other person to look for it
If this happens to be how the conversation plays out
yeah, it does make sense if you're referring to another message
merman?
Traceback (most recent call last):
File "main.py", line 49, in <module>
from discord.ext.buttons import Paginator
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/buttons/init.py", line 1, in <module>
from .buttons import *
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/buttons/buttons.py", line 194, in <module>
class Paginator(Session):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/buttons/buttons.py", line 228, in Paginator
colour: Union[int, discord.Colour] = discord.Embed.Empty,
AttributeError: type object 'Embed' has no attribute 'Empty'
anyone?
Embed.Empty doesn't exist anymore i think
yeah, its None now
yeah, 3rd party libs overriding the main package.
it may be pycord
pycord doesnt have that either
ext.commands, ext.pages, ext.tasks, ext.bridges is all they have
cursor.execute(f"UPDATE users SET gold = gold + 100 WHERE id = {member.id}")
Dear, tell me how to add a value to all participants on the server?
do you save the guild ids too>?
yk how to delete a message via button
the button is in class, so what should i use to delete the message the view it sent with?
remove the WHERE clause
UPDATE users SET gold = gold + 100
will add 100 gold to all users
you can pass the message inside the view's init, make it an attribute of the view, and then use self.message.delete() to delete it
mhm
or you dont even need to pass it in the init, you can make it an attribute directly if its not a slash command
and Paginator?
!d discord.ext.commands.Paginator
class discord.ext.commands.Paginator(prefix='```', suffix='```', max_size=2000, linesep='\n')```
A class that aids in paginating code blocks for Discord messages.
len(x) Returns the total number of characters in the paginator.
broken embed lmao š³
class discord.ext.commands.Paginator(prefix='`\`\`', suffix='`\`\`', max_size=2000, linesep='\n')
How can i create a custom URL link to access a member account with a bot??
The purpose of this is for:
It's for the antinuke basically.. if a nuker comes to mass ban what we want to do is to ban the nuker then unban all the members then trying to rejoin with they're accounts
def __init__(self,message, *, timeout=180)
```?
and why do you need to access the member account for this? 
actually that method wont work... ,
is that a message command or a slash command?
command
great then you can just ```py
view = YourView()
view.message = await send('stuff', view=view)
inside the view;
await self.message.delete() # to delete the message
cursor.execute(f"""ALTER TABLE users DELITE COLUMN {qwer};""")
Oh, did I spell it wrong?
yep, DELETE
š
what value did you supply for qwer, try changing this to "{qwer}"
how could the bot join back with the user if not by accessing his account?
also this will be just a optional thing
they can chose if they want it or not
Use sqlite injections instead (or whatever ? insertions are called idrk)
requires me to keep the message in view?
i read somewhere.. u can give perms to the bot to access ur acc / guilds so it can join back
nope, the view would just be a normal one
!d discord.Guild.bans 
async for ... in bans(*, limit=1000, before=..., after=...)```
Retrieves an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") of the users that are banned from the guild as a [`BanEntry`](https://discordpy.readthedocs.io/en/latest/api.html#discord.BanEntry "discord.BanEntry").
You must have the [`ban_members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to get this information.
Changed in version 2.0: Due to a breaking change in Discordās API, this now returns a paginated iterator instead of a list.
Examples
Usage...
not what im looking for
If there is such thing it is some complicated scopes stuff
what im looking for is to join back with the user if they allow the bot perms to access they're guild/acc
im free to do that
What fields of account do you want to access
got enough time
all i need should be guild
right?... to join back with the user
that's my point
@commands.command(aliases = ["Š“ŠæŠµŃŠ¼", "dperm"])
async def command_Dperm(self, ctx, qwer):
cursor.execute(f"""ALTER TABLE users DELETE COLUMN '{qwer}';""")
conn.commit()
await ctx.send("УГаленно")
Still doesn't work
A bot can't join a guild on it's own, the OAUTH link is required and the owner or an admin of the guild should open it
Then what is your problem? 
just read the entire messages i sent to understand...
āhelpowo1ā object has no attribute āmessageā
Ignore the viewās name š
show code
Of view?
nah, the cmd
Using it in default help command š
I read it 5 times already, you are not giving so much context, and if you want your bot to force a user to join a guild that is not possible either
fr?
so i own this antinuke bot.. right? some nukers are going to "MASS BAN" or mass kick whatever.. doesn't matter.. what the bot should do is ban the NUKER then unban all the banned members then if the members did allow permission to the bot to manage they're guilds the bot to automatically join with they're account
Wonder how I join servers which I didnāt even get invited to 
you allowed "add me to servers" in the auth maybe for some bot
considering the bot is already in the server.. what the bot should do is bring u back in.. lol
He can't.
can check that from settings>authorised apps
so if u just get hit by the nuker.. they will bring u back
āJoin servers for youā
The bot can only unban the member, it can't force an user to join a server
it can if the user allows it lol
BRUH
This guy š
https://discord.com/developers/docs/intro
Look those are discord API
Integrate your service with Discord ā whether it's a bot or a game or whatever your wildest imagination can come up with.
How can you unban an user and force them to join a guild
that's where im spending my time to read
Read them all and then tell us if you find something to force an user to join a guild
how can u unban? that's pretty simple
š
make?
All you can do is to send them an invitation link to the guild
but the bot must see the user, and to see the user they must share a guild
otherwise the bot can't even DM the user
If they have there dms on or have mutual servers
Same ^
not even "make"
.
In simple words
Unban them and try if your bot can dm him/her
And send the invite link
Ex:
ā you were banned by a nuker in x guild, please rejoinā
ok so this will make more sense
how to make guilds.join work so when a user authorizes a link, you can make them join servers on their behalf
Guilds doesn't have a join method 
That is for the OAUTH process
that's what im trying to do lol
Just use this method
Bruh OAUTH is used to make a bot join a guild, it doesn't work for users
nope because imagine DMing 50 banned members
Mutual(s)
yeah if 50 are mutuals..
it's a good idea but i prefer reading to see if i can make this possible
Go to the disnake server, there you will find the owner, ask him 
He will say the same exact thing that i said 
@commands.command(aliases = ["Š“ŠæŠµŃŠ¼", "dperm"])
async def command_Dperm(self, ctx, qwer):
cursor.execute(f"""ALTER TABLE users DELETE COLUMN '{qwer}';""")
conn.commit()
await ctx.send("УГаленно")
Dear, tell me what could be the problem?
š ** **
DROP, not DELETE
Note that this will remove the column itself
Not sure if that's what you intend
!SQL injection
SQL & f-strings
Don't use f-strings (f"") or other forms of "string interpolation" (%, +, .format) to inject data into a SQL query. It is an endless source of bugs and syntax errors. Additionally, in user-facing applications, it presents a major security risk via SQL injection.
Your database library should support "query parameters". A query parameter is a placeholder that you put in the SQL query. When the query is executed, you provide data to the database library, and the library inserts the data into the query for you, safely.
For example, the sqlite3 package supports using ? as a placeholder:
query = "SELECT * FROM stocks WHERE symbol = ?;"
params = ("RHAT",)
db.execute(query, params)
Note: Different database libraries support different placeholder styles, e.g. %s and $1. Consult your library's documentation for details.
See Also
⢠Extended Example with SQLite (search for "Instead, use the DB-API's parameter substitution")
⢠PEP-249 - A specification of how database libraries in Python should work
You should also take care of this
Yes. I need to delete a column because it is not relevant. Everything worked Thank you
Yes. thanks for noticing)
Then ask them āhowā
Most probably you will have to do this through API requests or you can search if hikari has that, btw it requires the user to interact with the OAUTH anyways
it's the oauth token for the user
yep
they cant provide column names thru placeholders tho, can they?
Oh that's true
Yeah the placeholders only work for DML commands. Usually you wouldn't dynamically change the schema like that
Sarth ^
oh, are you overriding HelpCommand class?
Yah-
Trying to send a button with help embed so the user can delete the embed
On interaction
show the part where you initialise that view and send the message
view = helpowo1()
view.message = await self.send(embed=embed,view=helpowo1())
how can i create a list in the models ? im using postgreSQL
view=view, in the .send
like a list of ids
Oh-
should be members ids
mb i didnt notice it
āhelpowo1ā is not callable
view = helpowo1()
view.message = await self.send(embed=embed,view=view())
@commands.command(aliases = ["Š°ŠæŠµŃŠ¼", "aperm"])
async def command_Aperm(self, ctx, qwer, rewq, *, amount):
cursor.execute(f"""ALTER TABLE users ADD COLUMN {qwer} {rewq};""")
cursor.execute(f"UPDATE users SET gems = {amount}")
conn.commit()
await ctx.send("ŠŠ¾Š±Š°Š²Š»ŠµŠ½Š½Š¾")
@commands.command(aliases = ["баланŃ"])
async def command_ballans(self, ctx, qwer):
gems = cursor.execute("SELECT {} From users WHERE id = {}".format(qwer, ctx.author.id)).fetchone()[0]
await ctx.send(
f"""Твой Š±Š°Š»Š°Š½Ń **{gems}** гемов"""
)
Dear, tell me why, after the command and the output of the balance, it shows that I do not have this value
Traceback (most recent call last):
File "main.py", line 55, in <module>
async def membercount(self, ctx):
File "/home/runner/slash-code/venv/lib/python3.8/site-packages/discord/app_commands/commands.py", line 1592, in decorator
return Command(
File "/home/runner/slash-code/venv/lib/python3.8/site-packages/discord/app_commands/commands.py", line 523, in init
self._params: Dict[str, CommandParameter] = _extract_parameters_from_callback(callback, callback.globals)
File "/home/runner/slash-code/venv/lib/python3.8/site-packages/discord/app_commands/commands.py", line 380, in _extract_parameters_from_callback
raise TypeError(f'parameter {parameter.name!r} is missing a type annotation in callback {func.qualname!r}')
TypeError: parameter 'ctx' is missing a type annotation in callback 'membercount'
anyone?
App commands don't get a context
?
App command callbacks don't get a CTX parameter
Ty
I wanted the link too
dont call it, just view=view,
@client.tree.command()
@app_commands.rename(text_to_send='text')
@app_commands.describe(text_to_send='Text to send in the current channel')
async def send(interaction: discord.Interaction, text_to_send: str):
"""Sends the text into the current channel."""
await interaction.response.send_message(text_to_send)
```@vocal snow this is correct for slash command?
āNoneTypeā has no attribute ādeleteā
@vocal snow say please
what's the self instance there?
if its the help class, you could probably do self.context.send() to get a discord.Message object.
Works ty :D

does someone know a capybara api?
tbh default help command is better than custom help command
that depends on how you customise, there's much more you can do with a custom help command, like making a paginator for all command categories, using markdown for command names, and more...
there's no check for that but
!d discord.Client.application_info
await application_info()```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves the botās application information.
!d discord.AppInfo.owner
The application owner.
this might help, if you want it to be dynamic
else use a if statement with manually typed id lol
nvm , bot has a is_owner method too
you can do that by changing guild settings..
sarthak is so smort š I wish we were all like him
i need help š¦ :
`@tasks.loop()
async def autocircle():
voice_channel = client.get_channel(988413546343841802)
print(voice_channel.members)
for member in voice_channel.members:
oldmembercount = membercount
membercount = oldmembercount + one
if membercount > 3:
await voice_channel.edit(name="Closed Circle1")
await asyncio.sleep(2)`
error :
[<Member id=456443941169004545 name='Space_Banane' discriminator='5444' bot=False nick=None guild=<Guild id=986758318175449088 name='Losti-Cord' shard_id=None chunked=False member_count=10>>] Unhandled exception in internal background task 'autocircle'. Traceback (most recent call last): File "C:\Users\marku\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\tasks\__init__.py", line 101, in _loop await self.coro(*args, **kwargs) File "e:\Dc bot\Beta.py", line 513, in autocircle oldmembercount = membercount
can you show the full traceback please?
ok
Ashley
[<Member id=456443941169004545 name='Space_Banane' discriminator='5444' bot=False nick=None guild=<Guild id=986758318175449088 name='Losti-Cord' shard_id=None chunked=False member_count=10>>] Unhandled exception in internal background task 'autocircle'. Traceback (most recent call last): File "C:\Users\marku\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\ext\tasks\__init__.py", line 101, in _loop await self.coro(*args, **kwargs) File "e:\Dc bot\Beta.py", line 513, in autocircle oldmembercount = membercount UnboundLocalError: local variable 'membercount' referenced before assignment
websi
oldmembercount = membercount
membercount = oldmembercount + one
you have referenced membercount before declaring it
ok thanks
Why is len() not used?
where are those in the docs? btw it's a thread not a channel
i don't know because the names in the docs are pretty weird
nice what lol
the archive is just confusing me
What do you want to change or archive?
!d discord.Thread.auto_archive_duration
The duration in minutes until the thread is automatically archived due to inactivity. Usually a value of 60, 1440, 4320 and 10080.
nvm
there's nothing i want to change lol.. i just want to check whenever a change is being made to any of these
so the bot is just going to set them back
!d discord.on_guild_update
discord.on_guild_update(before, after)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild") updates, for example:
⢠Changed name
⢠Changed AFK channel
⢠Changed AFK timeout
⢠etc...
the names in pycord docs are just being confusing ... so i don't really know which archive is which š
that's not my question
Define "change is made".

u just replied to that
.....
please limit your question up to one message with all the details, this makes it easier to read
auto_archive_duration?
what about the other one?
u mean change in guild settings?
Returns True if a user can manage threads.
New in version 2.0.
oh my god
It's a permission.
People with the manage thread permission can only archive threads when that is disabled.
and that's not what im trying to do again..
im trying to check if is being changed to true/false by a administrator
audit logs
š¤¦
Nah something else but he can just use the docs or go to the people on pycord.
And we are trying to help you but you being so impatient and defensive isn't either efficient or nice.
!d discord.on_thread_update
discord.on_thread_update(before, after)```
Called whenever a thread is updated. If the thread could not be found in the internal cache this event will not be called. Threads will not be in the cache if they are archived.
If you need this information use [`on_raw_thread_update()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_raw_thread_update "discord.on_raw_thread_update") instead.
This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
New in version 2.0.
!d discord.Thread.locked
Whether the thread is locked.
why i always got NoneType?
DB is async, Awaited the def
when i tried in a seprate files inpage shown the number
Seems like page is None
no it is having value
arl tested in seprate files and it shown 2 as in the db
Well the error says that š¤·āāļø
how t f lol
used asyncio.run in seprate files shown value
but in main files no value
GGs
Might be because you don't have await bot.process_commands in on_message event but not sure if it relates to the slash commands. Anyways try changing @bot.event to @bot.listen()
Sorry didn't notice that
@slate swan I suspect that you need to actually assign your tree to tree attribute of the client
Wait just one command?
No this is good, what I think is happening is because you also sync it to global you need to wait 1 hour ish.
also, you don't need to wait for 1 hrs anymore 
not really relevant, but yerl I thought you said a while ago that you werenāt gonna switch back to dpy and stay on disnake?
Personally I've made it like "cogs".
I'm looking at it but I can't see quickly what's wrong.
What if you were to do ```py
await tree.sync(guild=guild)
What on earth is this and how is it related to discord bots
is an alt anyway
Isn't that his security cookie lol.
@app_commands.command(name="top-command") async def my_top_command( interaction: discord.Interaction) -> None: """ /top-command """ await interaction.response.send_message("Hello from top level command!", ephemeral=True)āāā
Correct code?
No error is coming in console
not true you can just opt out to make the library automatically make changes
Sarth typing... š
sync_commands=False in commands.Bot will stop the library from automatically doing stuff
you can do the same for cogs too.
True but you will need to do a lot of manual stuff then that dpy already has implemented.
Basically if you want auto sync take disnake else just stick with dpy.
anyone know why this happens?
discord.ext.commands.errors.MissingRequiredArgument: username is a required argument that is missing.
Cause you didn't parse a required argument to a command
s
s
Parse doesnāt seem like the right word there
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 855, in invoke
await self.prepare(ctx)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 789, in prepare
await self._parse_arguments(ctx)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 697, in _parse_arguments
transformed = await self.transform(ctx, param)
File "C:\Users\thoma\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\ext\commands\core.py", line 542, in transform
raise MissingRequiredArgument(param)
discord.ext.commands.errors.MissingRequiredArgument: username is a required argument that is missing.```
@vale wing
Yeah you just didn't provide required argument
man I am not a linguist not even native english speaker
how do i fix that?
Hey @slate swan!
It looks like you tried to attach file type(s) that we do not allow (.rar). We currently allow the following file types: .gif, .jpg, .jpeg, .mov, .mp4, .mpg, .png, .mp3, .wav, .ogg, .webm, .webp, .flac, .m4a, .csv, .json.
Feel free to ask in #community-meta if you think this is a mistake.
tf?
You can't upload files
bruh i need help with smth but it wont let me send it so people can see whats wrong with the code
Send only the relevant code
Why not allow txt as well, you can actually put plain text to json file 
can i send it to someones dms who knows what they're doing
No
Yes
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.
I've made two pretty good bots, now what do i do 
paste the code in pastebin and send

Same question for different amount (1)
add something to the bot which breaks the TOS and get it banned :)
Ah yes nice idea
lmao
okay so is this a dumb idea, i've made an art bot, a game bot and now if i make a social bot i could package them all together 
make one bot with way too many features
Yes
I am bored of making bots and now I am making some stupid game in unity
I am bored of bots so i went back to depression
i'm tempted to try making a 3d game but still only know python 
C# is a cool language too
has anyone tried the new unreal engine 

