#discord-bots
1 messages ยท Page 881 of 1
:praise_the_sun: this work, ty
HOLY SHOT I WAS RIGHT LMFAO
lol
I KNEW IT
and is used if the 2 conditions are correct or is used for 2 different conditions lol
weird maybe an internal error because you have declared the embed instance and youre sending it
If item is "brewing stand" it'll make the statement false but it goes to the next one being an or since "brewing stand" isn't "sword" it'll return true!
yep
maybe check the dpy server
And only runs if all statements are true, with or only one needs to be for it to run, so even if the first one is false the next one will be true and it'll run anyways :) that was my train of thought just difficult to explain it when your not sure if its right lmfao
no no it depends on the conditions but basically or is used to check 2+ conditions, and is used to check many conditions
i had a stroke reading my own sentence

And/or are logic operators and requires everything to be true while or only requires one
yup
better worded
The symmetry istg
mobile
Indeed
its mobile or your client hasnt cached the member yet lmao
Eh, I'm on a mobile
Common bug
ik im just bored bro
Lmao
Hunter pro at this stuff ๐
Eh
big pro
Stop. It.

!ot Hunter's a God
I'm offended
Off-topic channel: #ot2-never-nesterโs-nightmare
Please read our off-topic etiquette before participating in conversations.

guys
Okimii get a good zt pfp ๐
the discord developers event?
Yea
why does go have a gopher and we dont have a cool cartoon snake
yeah it was most of what i already knew was coming so meh
wait, time?
you can watch it on YouTube
Well I just wanted to see the sneak peak of the app discovery
nah
Happened like 10 hours ago
ooh thanks god
useless for me; I don't have a verified
im only in the server to get updates on new interaction features
asdf, seriosly 2.48 AM
Lmao

Time to bother YouTube
Gotta love it im at least 10k lines of code off of even having my bot in 3 servers lmao
that's unfortunate
you need cogs and not guilds
but, well, I already have the code, just need to replicate it to another bot account and wait
one cog for one command 
@sick birch rn: 
okay bye, good night 
Good nightttttt
lol
I'm a monster and just don't like coding in OOP I can I have I just prefer functional or whatever its called
its already 6 am ๐
where
go to sleep you need it
jesus christ u dont sleep at night?
Recording of our event hosted in the official Discord Developers server (https://discord.gg/XjtHAR9GsE) - for those who couldn't attend or want to revisit the content
oooh ok ty
that wasn't my fault
yeah yeah
@maiden fable what do you think of this? And also, how long did it take you waiting on the bot listed sites to reach 100?
About 4-5 months? idk
which bot has that?
Word of mouth was also there
excuses 
@dim ruin?
it only ahs one command?
For now but they're going to implement all the event commands from @lament depot
Robin... never expected this from you
it wasn't me ๐ญ
hey is there something where when someone deletes a message
Yes
!d discord.on_message_delete
discord.on_message_delete(message)```
Called when a message is deleted. If the message is not found in the internal message cache, then this event will not be called. Messages might not be in cache if the message is too old or the client is participating in high traffic guilds.
If this occurs increase the [`max_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") parameter or use the [`on_raw_message_delete()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_message_delete "discord.on_raw_message_delete") event instead.
This requires [`Intents.messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.messages "discord.Intents.messages") to be enabled.
On_message_delete
docs for drop downs?
!d disnake.SelectMenu
class disnake.SelectMenu```
Represents a select menu from the Discord Bot UI Kit.
A select menu is functionally the same as a dropdown, however on mobile it renders a bit differently.
Note
The user constructible and usable type to create a select menu is [`disnake.ui.Select`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.Select "disnake.ui.Select") not this one.
New in version 2.0.
ty
@botinstance.listen()
async def on_message_delete(message) -> None:
print("omg a message was deleted")
https://github.com/Rapptz/discord.py/blob/master/examples/views/dropdown.py I wrote this myself :D
nice
That should still carry over to the forks as well
so thats why that example is so bad
Complements the documentation
im joking
yessir

@commands.Cog.listener()
async def on_message_delete(self, message):
print(message.content)```
not working ๐ฆ
wdym
what is not working?
im deleting messages and its not printing anytthing
Oh God not cogs
the message isnt in cache or you dont have message intents
!intenst
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 the Members and Presences intents, which are needed for events such as on_member 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.
i have intents
what about them
yes i have them
then the message isnt in cache
Did you load the cog?
If the message is not found in the internal message cache, then this event will not be called.
Well if you're not doing anything else wrong, then it's a caching problem
yeah
Try deleting a new message
Though I'm almost sure there's something else wrong
And your bot has access to the channel?
ye
Then it's most likely a caching issue which I still find unlikely
try it many times it probably is a caching problem
Yeah
on message isnt workign either
Are you loading your cogs?
Yeah for things like message delete it's usually going to be something else
I prefer writing redundant code
yep its working now thanks guys
ty for the example, that helped me a lot
Glad it was helpful ๐
is it possible to get the author
Message.author
who sent the message who deleted it
currently, i use this code to load in all my cogs(present in the cogs directory). But, is it possible to modify this to load cogs from multiple directories? i want to better organize my files
for cog in listdir(path.join(path.dirname(path.abspath(__file__)), "cogs")):
if cog.endswith(".py"):
client.load_extension(f"cogs.{cog[:-3]}")
else:
print(f'unable to load {cog[:-3]}')```
The person who sent the message that was deleted or the moderator who deleted the message?
The person who sent the message can be found out by using message.author, unfortunately you can't figure out who deleted the message
thats okay
audit logs
just why
Not saying it is efficient, but there is a way you can find it
I don't think audit logs show one-off deleted message, it's always been very unreliable in my experience
Honestly its because I don't like writing OOP code
Sometimes it'll show that I deleted a single message but 90% of the time it doesn't
?
Are you up to recursion?
i run a sniping bot in a server. the only time the 'snipe' fails is grabbing before the image is uploaded
ive foudn it to be very realiable
Audit logs?
i need to send a long message using my bot
anyway to format it rather then embed?
How long is the message?
cogs will speed up your bot
codeblocks/files maybe
if you write all cmds in one file your bot will be slow
You would think it'd be faster since it doesn't have to load other files into memory
json.read()
this is one example
That's not that bad, just send it as a regular message or embed
it will get long as time pass
Oh I see
i'll try
which way to embed ?
any specific format u recommened
Then you'll probably want to send it as a text file or something of sorts because you can't send message > 2000 in length
Create a function that takes in a folder, it loads all the extensions within the folder. If it encounters a folder inside the folder, then call itself
Yeah you could also store it as multiple strings and just send one at a time
now it is doing that but when it sends its block the entire chats
How do I implement code that does this
A button has the name of a user. When a person presses that button, a dm goes to that user
How do I do that
timeout for bot.wait_for?
when a person clicks 'lonely' a dm goes to me, etc
oh ok, i'll try that
Well yeah because your sending thousands of characters you can't really get around that, wouldn't the same thing happen with an embed
Best bet is sending a file as others have recommended IMO
yeah got it
for dm:
user_object = bot.get_user(int(userID)) or await bot.fetch_user(int(userID))
await user_object.send("message")```
is that exist or no
i mean, how to do that when a person clicks a button
what do i do in the callback function
get the ID of the user in button ig ๐ฟ
how idk
why?
why what
Anyways im out hope I was of some use lmao
!d disnake.Guild.getch_member
await getch_member(member_id, *, strict=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Tries to get a member from the cache with the given ID. If fails, it fetches the member from the API and caches it.
If you want to make a bulk get-or-fetch call, use [`get_or_fetch_members()`](https://docs.disnake.dev/en/latest/api.html#disnake.Guild.get_or_fetch_members "disnake.Guild.get_or_fetch_members").
this exists
oh that thing
i just remembered-
my doubt is, how do i get the id into the callback function
btw, ik i write poor code. please dont make fun of me
how do i get the id into the callback function ||@sick birch help||
;-;
what ids?
please dont make fun of me
me, user of big elifs:
this
why are you fetching the member?
to send a dm to them
he want send DM
property members```
Returns all the members with this role.
you have a list of member objects, iterate through and send them
role = #role object
members = role.members
for member in members:
await member.send()
what im doing is, iterating though them and creating buttons for each of them. the user selects a button and a dm goes to the selected person
im not doing that
see?
@bot.command(name = 'report', aliases = ['rep'])
async def reportgame(ctx):
role = discord.utils.get(ctx.guild.roles, name="Bot Testers")
members = role.members
ids = [member.id for member in role.members]
view = View()
async def button_callback(interaction):
user = bot.fetch_user(id)
await interaction.response.send_message('Hi '+ user.name+ ' :wave:')
for i in ids:
user = await bot.fetch_user(int(i))
b = Button(label = user.name, style=discord.ButtonStyle.green)
b.callback = await button_callback(id = int(i))
view.add_item(b)
await ctx.send('Please select a moderator', view=view)
I havent written the rest cuz im stuck
you see the user = bot.fetch_user(id) in the callback?
so what's id?
it should be the id of the person in the button
how do i get that.
okay wait so basically you want a button view and whichever buttion is pressed it DM's that memeber?
yup, correct
the button label would be the name and discriminator or just the name of the member?
just the name, no discriminator
@duel.error
async def duel_error(ctx,error):
if isinstance(error, commands.TimeoutError):
cd = disnake.Embed(title="Timeout!",description="yes, timeout", color=ctx.author.color)
await ctx.send(embed=cd)``` can i do thing like this :V
everybody died ig
lol
;-;
ok ๐ฟ
lol
jesus christ
@spring flax u here?
dont disturb mode
im claiming a help channel
๐ฟ wow
ok, if i wanna use asyncio.TimeoutError, can i use something but not try and except, like @command.error()
idrk
what is this?
ayy helo
guys pls dont go ot?
yooo
@slate swan
.
lol
for?
we did the same thing
You know, you could really do with a little patience.

for a comand that goes timeout, but i want use like that except use try: except:
a command doesnt have a timeout you mean a button?
i mean wait_for lol
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
timeout kwarg lol
meh, ik that, the one i want is when the timer goes out, that send message, but i dont want use try: excepg
excgep
excedep
ecprct
e x c p e t
e p e c t
e c x e p t
except
there we go
im not really sure how you would pass a coroutine to timeout what are you using wait_for btw?
repy message
R E P L Y
ah
go to r/ihadastroke when
ive been trying to solve this for 1.5 hours. please anybody help
m e m e b e r
ah it raises an exception due to it using the asyncio wait for
ik, but instead use try: except: i want it just use kinda like command.OnCooldown error
you cant
ah fk, indent suc
it raises a exception by asyncio and not your lib
ok then ๐ฟ GGty
just do
try:
msg = bot...
except asyncio.TimeoutError:
...
now please
on the button callback send a dm to the inter author
oop, i didnt mean you
!d disnake.Interaction.author
The user or member that sent the interaction.
open a help channel and be patient
on the callback dm
i was tryna refer that message
im not tryna send a dm to the person who clicked the button. im trying to send the dm to the person on the button
pardon?
if they click the first button, a dm goes to me and if they click the second button, a dm goes to Ava
get the user and send a dm lol
@bot.command(name = 'report', aliases = ['rep'])
async def reportgame(ctx):
role = discord.utils.get(ctx.guild.roles, name="Bot Testers")
members = role.members
ids = [member.id for member in role.members]
view = View()
async def button_callback(interaction):
user = bot.fetch_user(id) #how do i get the user id
await interaction.response.send_message('Hi '+ user.name+ ' :wave:')
for i in ids:
user = await bot.fetch_user(int(i))
b = Button(label = user.name, style=discord.ButtonStyle.green)
b.callback = await button_callback(id = int(i))
view.add_item(b)
await ctx.send('Please select a moderator', view=view)
you would just set the int on the params of the method on each button because you cant really pass anything to the callback of the button
why isn't this working
@client.command()
async def emojify (ctx,*,text):
emojis = []
for s in text.lower():
if s.isdecimal():
num2emo = {'0':'zero','1':'one','2':'two',
'3':'three','4':'four','5':'five',
'6':'six','7':'seven','8':'eight','9':'nine'}
emojis.append(f':{num2emo.get(s)}')
elif s.isalpha():
emojis.append(f'regional_indicator_{s}:')
else:
emojis.append(s)
await ctx.send(''.join(emojis))
#bot-commands
we have no idea
at least give us an error

and define "not working"
Stop


why is the function indented
because it can be a reason as to why the command "isn't working"
so you think i shouldn't indent it?
i do
i don't even know why it's indented if you put it like that
@spice basalt Do other commands work
yes
???
like
why wouldn't i indent it even
i just said why
๐คทโโ๏ธ then emojis must be empty.. try printing it
and yes i want help but even i don't know how to answer your question
Because Python code is indented? What
just say why it's indented, simple
i don't know why it's indented ffs
bro what
Uhhh bro
python depends on indentation levels
Python works on indents
yes also that
workson
i don't know why the guy keeps asking "why" is the function indented
#esoteric-python : I am about to end your career
๐
is that a challenge 

That's an exception
๐ซ

it isn't giving an output
๐ฉ I miss nitro

Noo ๐ฅบ
there goes my question



when i use
member.mention
it says member not defined
altho i defined as
on_member_join(member):
why is it so ?
Also I used intents
yea, why is it indented?```py
def main():
@client.command()
async def a(...):
...
show me your code above the emoji command
In 0.options.0.description: This field is required
In 0.options.1.description: This field is required
warnings.warn(``` what's causing this??
```py
COVEROPTIONS = commands.option_enum(["album", "track", "artist"])
@bot.slash_command(name="cover", description="get a album's/ track's/ artist's picture on Spotify", guild_ids=[906881394859470879, 939488113045159956])
async def main(inter, options: COVEROPTIONS, name: str):
#dostuff
using disnake
I'm developing a bot and I want to catch and handle exceptions thrown while it's running. But I cannot use try except because then I will have them everywhere and the code will not be readable. Is there a way for me to catch exceptions and handle them without try except.
this area of indentation behind @client.command()?
i think you can build a error handler
yea
Update your disnake version
all of that line?
There are events for kinds of Discord errors, or you can attach specific functions to specific commands to handle the commands' errors
yea
is that really it lmao i've been stuck on this for a hour i hate my life
yea
update
update
kk
for command need use Bot, not client
doesnt it work for both??
you need to make a commands.Bot instance ```py
from discord.ext import commands
client = commands.Bot(command_prefix=".")
ah
no
i already added that
remove the second variable
yes
yes, but on next line you write client = discord.Client()
yes?
as rn u are deleting the first instance by reassigning it
just delete it
so i don't need it?
nope
commands.Bot has all the features of discord.Client so no
use client instead of bot
ah so i have to add commands.Bot?
you already have it
depending on which library
still no output
Any errors?
no
you have an on_message event?
Also, you forgot to add a : in the start of append in the isalpha() condition
oops
yes
why
I don't see how on_message and on_ready are similar
I pinged you somewhere, check it
one cog for one command 
Used to do it until started using subclassed help
In which case should I use await fetch instead of get ? or should I use fetch instead of get in every place ?
why dont people just use a regular import instead of cogs more easier and simple
the whole thing are useless but if you insist using it then use import
i mean in general
like import discord.py?
no
thats the problem
most people that are coding discord.py doesnt know anything about python in general
cuz if you did you will use import immediately
How do I fetch a category by it's name?
!d discord.utils.get
discord.utils.get(iterable, **attrs)```
A helper that returns the first element in the iterable that meets all the traits passed in `attrs`. This is an alternative for [`find()`](https://discordpy.readthedocs.io/en/master/api.html#discord.utils.find "discord.utils.find").
When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.
To have a nested attribute search (i.e. search by `x.y`) then pass in `x__y` as the keyword argument.
If nothing is found that matches the attributes passed, then `None` is returned.
Examples
Basic usage...
!d discord.Guild.categories
property categories: List[discord.channel.CategoryChannel]```
A list of categories that belongs to this guild.
This is sorted by the position and are in UI order from top to bottom.
#bot-commands
Just use getch
how can I check if someone reacted to my bot's message?
like the delete reaction thing that some bots use
!d discord.Message.reactions
Reactions to a message. Reactions can be either custom emoji or standard unicode emoji.
!d discord.on_reaction_add
discord.on_reaction_add(reaction, user)```
Called when a message has a reaction added to it. Similar to [`on_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_message_edit "discord.on_message_edit"), if the message is not found in the internal message cache, then this event will not be called. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") instead.
Note
To get the [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") being reacted, access it via [`Reaction.message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Reaction.message "discord.Reaction.message").
This requires [`Intents.reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.reactions "discord.Intents.reactions") to be enabled.
Note
This doesnโt require [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") within a guild context, but due to Discord not providing updated user information in a direct message itโs required for direct messages to receive this event. Consider using [`on_raw_reaction_add()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_reaction_add "discord.on_raw_reaction_add") if you need this and do not otherwise want to enable the members intent.
This?
I'll see what I can do, thx
Can not import name commands from discord.ext (unknown location)
Reinstall discord.py
I did
Try doing pip install -U discord.py
Try restarting yr ide
I restarted pc
Hi guys I forcefully activate the sub-channel, but the user can download without joining the channel, what can I do?
CODE:
https://pastebin.com/7PVpNuGC
https://pastebin.com/WhYsZYjG
Used library pyrogram
*All required library imported
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
But still
Weird
I had to uninstall it to install next cord
Then I reinstalled after deleting nextcord
Ah nextcord
What should I do now
U need to do class Fun(commands.Cog) instead of class Fun
class Bot(commands.Cog):
def __init__(self, bot):
self.bot = bot
class Fun(commands.Cog):
def __init__(self, bot):
self.bot = bot
class Ticket(commands.Cog):
def __init__(self, bot):
self.bot = bot
class GlobalChat(commands.Cog):
def __init__(self, bot):
self.bot = bot
class Mod(commands.Cog):
def __init__(self, bot):
self.bot = bot
class Utility(commands.Cog):
def __init__(self, bot):
self.bot = bot```
i have this
Wait now it works
Ayo why u using one file for all the cogs?
wdym
Xd
U have all those classes in the same file?
oh i get it
in my fun.py in cogs i have class Fun:
i change it to (commands.Cog)
?
tell pls @maiden fable
i want to make an even for my bot ( priv bot) to delete any message send in a channel but except the emoji...like if a member sends a text message bot deletes it but if a member sends a emoji the bot doesnt delete it
is this possible ?
brb
Yea
!d discord.Message.mentions exist bruv
A list of Member that were mentioned. If the message is in a private message then the list will be of User instead. For messages that are not of type MessageType.default, this array can be used to aid in system messages. For more information, see system_content.
Warning
The order of the mentions list is not in any particular order so you should not rely on it. This is a Discord limitation, not one with the library.
Just saving u lines of code (I don't mind pings)

you would have to use some kind of regex which checks if there are emojis in the message
You almost ghost pinged me there lol
hm alr
huntr
like this? 
Yea ashley?
while sending the message you can just use allowed_mentions kwarg so even if the bot sends the message, noone gets pinged
Yea

Is fine
the bot will simply send @everyone without pinging anyone
Stop with this emoji
Hm?
why 
what? i just said the name of a variable in my code
Nvm I will just go away. Already on the verge of a mental breakdown
same
Hey guys I have a kind of interesting question. When I run the discord bot the program's at client.Run(), but I want to make something so that the bot sends a message at a given time. Any ideas how to do that? I tried schedule package, but I don't know where to place it, I tried it in on_ready event but it wasn't working. Do I need to make some kind of multi-threading, and if so how can I do that? (I'm kind of new to python, only programmed in c# and Java before)
Thanks, found something based on task loop, will implement it now ๐
discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True, loop=...)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
It takes a list of datetime objects
Exactly what I need, thanks ๐
!warn 925079016174682213 Please respect peoples boundaries, if they ask you not to call them specific names/use specific emojis in reference to them. Please reframe from doing so, be civil and respect individuals. Continuing this further will lead to further action.
:incoming_envelope: :ok_hand: applied warning to @slate swan.
If you wish to discuss moderation action, please open a ticket with @novel apex
uh sure
Are there even any "unique" features left to add?
!greet @hunter
-Hi @hunter

2 continuous pings 
Use a while loop instead and spam the mention
but you forgot one thing (:
Ratelimits?

replit 
You do know there's nothing to laugh about, right? sigh
Ah yea, the great ol' replit. How can I forget that
probably because you didn't use it much? 
small number ๐
I spent around 200+ hours on one repl
cries in getting rate-limited everyday
Haha well, I'm only talking about hosting a discord bot on replit. I have used replit for other projects and am still using it
lol
they got warned, thats technically a thing worth laughing about 
its not funny?
yes ๐
Warn happened in the past, new subject.
alright
Suggest more topics here!
someone needs to make a PR to add more topics
what feature isnt there in any bot....
these are getting ridiculously repetitive
ahem ahem there's a hyperlink ahem ahem
yes, it's quite obvious
Yea so, Daniel. Mind posting yr code?
Hey, I asked about sending a a message at a specific time, and I now know that it can be solved using tasks loop, I tried to make a dummy test method, but for some reason it's not working. Does any1 have any idea?
Yes its implemented
What error
It just doesnt do anything
how do i fix this
Didn't define bot
how do i define it
Can I see your commands.Bot line?
U used client right there, which means u would need @client.command()
U have to do:
@tasks.loop(time=[datetime_object])
async def reminderMsg():
. . .
ah
Replace client with bot, and it will work too
thank you
It's gonna mess up the run method then lol
Better is to just do @client.command() imho
He will have to change that too then
But it's up to you if u want to use bot or client
bot = client```
๐
๐คก ctrl+f "client" and replace it with bot
No!!! Don't
no output
Best thing ever 
Error?

Can u send ur full cr command @spice basalt
Let's just tell everyone to do that from now on!
๐
client, bot = [commands.Bot(), commands.Bot()]```
better
No
Ain't gonna work
lol
Lmao imagine
i know
you dont need the []
help me 
I added them on purpose lmao 
That's why I stopped commenting further. I forgot u r just joking
Send ur cr command as I asked before
i forgor
U still use client right?
client = commands.Bot?
the user isnt cool ๐ even the bot doesnt respect
gay


And no errors?
show your bot constructor?

that emoji....
how
ss it
the place where you define your client var
by any chance, do you have an on_message event?
do you have client.process_commands in there?
no
That causes ur issue
await client.process_commands(message)
use this at the end of the event
didn't sarthak help you about this a couple hours ago
no
poor him ๐
For some reason it's still not working, I also tried using datetime.time=testdate
!d discord.ext.tasks.loop
discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True, loop=...)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/master/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
takes seconds minutes hours etc etc
I also have that
oh nvm
Time probably means 11:00
it takes a time kwarg too
yeah I'm blind
Use a minute, minute = 1

@spice basalt is ur issue fixed?
I had it like this, but it was not working lol
by that you mean at the end of this?
i have severe brain damage
inside the on_message event
async def on_message(message):
if whatever.author == uhh:
return
await client.process_commands(message)```
At the end, add await client.process_commands(message)
like ```py
@client.event
async def on_message(message):
if message.author == client.user:
return
await client.process_commands(message)
fix the indent, and yes
yes
it'll work now maybe
Yes
pip install -U git+https://github.com/Rapptz/discord.py
still no output 
Run this in yr command prompt
Have u enabled logging?
is the command getting invoked or not
is cool (:
Tbh, the only thing I hate about dpy is cz u gotta enable logging to see if u r ratelimited or not
been doing nothing but bug fixes since i switched my bot to databases and started using classes and cleaned it up a lil
done 22 bug fixes so far today
Imagine getting yr console spammed with logs
doesnt it show a message by itself?
I once tried setting the logging level to the lowest and the VPS crashed 
U gotta enable logging to see those messages
dont you have code to prevent that?
The only way is to enable logging
yeah but you shouldn't be getting rate limited in the first place
Or that's what I think
you could've just said import logging but ok
what......why did replit show that message to me everytime my bot got ratelimited...
U also gotta add logging.basicConfig(...) but okay, I'm sorry for that
Weird, I got ratelimited once on replit cz it was a spam bot but I never got any notifications/messages from replit
logging.basicConfig(level=logging.INFO)
Yea
I'll try making a new app to try and get it ratelimited to confirm 
this how i handle ratelimiting, called every time they press a button or use a command
Don't, u just making it difficult for other bots on yr machine 
you do know I've stopped bot dev ๐
I would instead just agree that u r right and I have just forgot about stuffs
Never knew that, but okay
And other bots as in, other people's bots who are using the same replit machine as yours
done
why are you using replit to host your discord bot?
Now run it
Try running the cmd
still no output
Show the console
nothing changed?
Like there's nothing printed on the console?
His code probably does same thing
ah ye

Did u add the await client.process_commands in the on_message?
kek
There ya go
there it is its wrong indentation
tf?
its inside the if statement
what's the "right" indentation
moveitto left
ah
so
@client.event
async def on_message(message):
if message.author == client.user:
return
await client.process_commands(message)
si
like that?
well
@client.event
async def on_message(message):
if message.author == client.user:
return
await client.process_commands(message)
it should be same indentation as if
ah so
yes
Yea
so i should move them to the left by one block?
that looks fine
No keep everything like that
tf?
the error message showed that
!indentations
does it show sameerrornow?
arentit already?
oh it does accept emojis
i gave it administrator
ah
nvm, my account's gone.....forever ๐
rip nitro ๐
hah against ToS?
rip 
Huh?
i bet
no......it just logged me off from everywhere and now they want a 2fa code from me even though I never enabled 2fa ;-;
What the
lol?
Tried contacting discord support?
:l
das scary 
doing it, anyways, I wont continue here before mods come
nvr change settingsdrunk
tf?
aren't you the ashleyy from a few minutes before?
different account, same person
yes

anyways imma go study and then contact discord support later, enjoy
!ot please
Off-topic channel: #ot2-never-nesterโs-nightmare
Please read our off-topic etiquette before participating in conversations.
lol
Cya
@slate swani dont think discord can/will help with f2a lost acc's
yeah i know
Traceback (most recent call last):
File "C:\Users\hackt\OneDrive\Escritorio\Protech\main.py", line 42, in <module>
@client.slash(description="Pong!")
AttributeError: 'Bot' object has no attribute 'slash'
PS C:\Users\hackt\OneDrive\Escritorio\Protech> python main.py
Traceback (most recent call last):
File "C:\Users\hackt\OneDrive\Escritorio\Protech\main.py", line 43, in <module>
@slash.slash(description="Pong!")
AttributeError: module 'slash' has no attribute 'slash'
I need help
Try doing @slash.slash_command(...)
and make sure you have slash = SlashCommand(client, sync_commands=True)
What lib u using tho
if you're using discord_slash
Traceback (most recent call last):
File "C:\Users\hackt\OneDrive\Escritorio\Protech\main.py", line 43, in <module>
@slash.slash_command(description="Pong!")
AttributeError: module 'slash' has no attribute 'slash_command'
PS C:\Users\hackt\OneDrive\Escritorio\Protech> python main.py
Traceback (most recent call last):
File "C:\Users\hackt\OneDrive\Escritorio\Protech\main.py", line 9, in <module>
slash = SlashCommand(client, sync_commands=True)
NameError: name 'client' is not defined
bot, not client
are you using client or bot
client
PS C:\Users\hackt\OneDrive\Escritorio\Protech> python main.py
Traceback (most recent call last):
File "C:\Users\hackt\OneDrive\Escritorio\Protech\main.py", line 9, in <module>
slash = SlashCommand(client, sync_commands=True)
NameError: name 'client' is not defined
PS C:\Users\hackt\OneDrive\Escritorio\Protech> python main.py
Traceback (most recent call last):
File "C:\Users\hackt\OneDrive\Escritorio\Protech\main.py", line 12, in <module>
slash = SlashCommand(bot, sync_commands=True)
NameError: name 'bot' is not defined
PS C:\Users\hackt\OneDrive\Escritorio\Protech>
it should be client if that's what it's defined as
and you're defining slash after you define client?
this should work, works for me
ty!
you're welcome
async def ping(ctx):
embed = discord.Embed(title="Pong!", description=f":ping_pong: Client latency: ``{round(client.latency * 1000)}ms``")
await ctx.send(embed=embed)```
is good?
what's the indentation error?
missed :
needs a name i think
ohh nice
You need :
oops, i removed it accidentally while doing ctrl z
is it global?
it still says there's an indentation error
if so wait 1-2 hours to register
use aiohttp, requests is blocking
select from response to the last (quote) and press tab
!blocking
Why do we need asynchronous programming?
Imagine that you're coding a Discord bot and every time somebody uses a command, you need to get some information from a database. But there's a catch: the database servers are acting up today and take a whole 10 seconds to respond. If you do not use asynchronous methods, your whole bot will stop running until it gets a response from the database. How do you fix this? Asynchronous programming.
What is asynchronous programming?
An asynchronous program utilises the async and await keywords. An asynchronous program pauses what it's doing and does something else whilst it waits for some third-party service to complete whatever it's supposed to do. Any code within an async context manager or function marked with the await keyword indicates to Python, that whilst this operation is being completed, it can do something else. For example:
import discord
# Bunch of bot code
async def ping(ctx):
await ctx.send("Pong!")
What does the term "blocking" mean?
A blocking operation is wherever you do something without awaiting it. This tells Python that this step must be completed before it can do anything else. Common examples of blocking operations, as simple as they may seem, include: outputting text, adding two numbers and appending an item onto a list. Most common Python libraries have an asynchronous version available to use in asynchronous contexts.
async libraries
The standard async library - asyncio
Asynchronous web requests - aiohttp
Talking to PostgreSQL asynchronously - asyncpg
MongoDB interactions asynchronously - motor
Check out this list for even more!
it still says there's an error
Hey, I made a Temporary Voice Discord Bot. Its working well, but if you change the name of the channel a few times it wont delete the voice channel.
use the ID to identify those channels instead of channel names
how can I make required permissions for a command such that the author can bypass it if they have admin permissions the first one is @has_any_role()
whereโs the code above
That still doesn't fix the indent error lmao
^ itโs probably from code above
wait nevermind
check_any exists
!d discord.ext.commands.check_any
It is with the ids but I made a command to change the names of the channel
@discord.ext.commands.check_any(*checks)```
A [`check()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if any of the checks passed will pass, i.e. using logical OR.
If all checks fail then [`CheckAnyFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckAnyFailure "discord.ext.commands.CheckAnyFailure") is raised to signal the failure. It inherits from [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure").
Note
The `predicate` attribute for this function **is** a coroutine.
New in version 1.3.
it works now, i left an unfinished client.command
oh thanks
maybe make a custom check that executes the command if the user has the permission
how does the bot delete the channel? some code for the context
can I somehow cause slash commands to be registered after starting the bot?
it's just that my bot first registers the slash of the command, then loads all the cogs, and only then re-registers the slash of the command
And it turns out that he first removes all slashes and then adds them
hi, I know how to code few things for discord bot...but im not sure how I can connect my bot to the project/code/file where I have coded the stuff. Can someone help me with it? (Im new to coding python)
consider learning python extensively before making a discord bot, you should be able to solve simple indentation errors
Can I send it private
there's something like sync_commands for most of the libraries , you can utilise that
sure ig
i will learn it along the way

re add your bot with dis link https://discord.com/api/oauth2/authorize?client_id=&permissions=8&scope=bot applications.commands
put ur client id in client_id=UrclientId
you do need some basic python knowledge to go forward
yes
will this work?py @commands.check_any(commands.has_role(787149777103486986) or commands.is_owner())
i said put ur bot id in the client_id
(sorry if im bothering anyone) Help would be highly appreciated!
@commands.check_any(commands.has_role(787149777103486986),commands.is_owner())```
oh
you need to get a bot token for the developer portal
and run your code with the token in it
yep that part's done
great, what code do you have at the moment?
ok so how do I add the token in the code? like where do I put it-
does it work now?
you're using discord.py right?
ye-
nope
client.run("ur token")
same thing
you might have something like bot.run()/client.run() put it inside it
ik how to fix it
bot/client.run("your token")
ouuu
so on the last line of the code right?
Please
maybe the application id is invalid?
yes
untick the oauth2 code grant
no...
I c
tysm!
gotta put it in the last line right?
yeah!
ouu oki tysm! ^^ have a lovely day ahead~!
you too
discord rn :rocket>
lol
is it for protector?
wait you have 0AUTH turned on
yus
nope
same happening
hm
.
untick it?
i already did
ok
how do i define it
show code
i fix i think
embed = discord.Embed
why -
shit
damn i like ur abt me it looks awesome
typo
dles it work?
i thought u had roles
and then i found out
lol
is no working is running bot and invite working but slashs nope
What
hm
did u invite ur bot with the %20applications.commandsinvite link? (%20applications.commands allows the bot to create slash commands)
can i make the embed color be the user's name color?
get the user role's hex color
@slate swan in slashs is not working and no showing
no i mean the embed color depends on the user using the command
async def ping(ctx):
embed = discord.Embed(title="Pong!", description=f":ping_pong: Client latency: {round(client.latency * 1000)}ms")
await ctx.send(embed=embed)```
he answered u
oh-
give me ur client id real quick
Yo guys how do u get individual variables for individual people using databases?
ok i found nothing on that in the docs
how do i do that
Library: PyCord
How'd I check that the Member who selected an option from a Select component is the same Member who initiated the Interaction?
Basically, I want so that only the person who started the interaction can select stuff and not someone else.
!d discord.Member.colour
property colour: discord.colour.Colour```
A property that returns a colour denoting the rendered colour for the member. If the default colour is the one rendered then an instance of [`Colour.default()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Colour.default "discord.Colour.default") is returned.
There is an alias for this named [`color`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member.color "discord.Member.color").
forget what i said
it's a callback function for the Select class
you're using Views right
you can store the user inside your view class and then compare it during interaction_check()
snippet?
i was referring to the color attribute of a Member object, i.e. the member you want the color of
yes
then i get this
only functions (or classes) can be called , color is a property
color and not color()
ah so i don't need the () for that
nope
use an instance of the Member object, not the object itself
class MyView(discord.ui.View):
def __init__(self, user_id: int):
super().__init__()
self.user_id = user_id
async def interaction_check(self, interaction):
# if this method returns False then no callback is executed;
# you could also respond to the interaction here as well
return interaction.user.id == self.user_id```
in your case, ctx.author.color will server the purpose
sweet. thank
generally you'd store the user's identity alongside their data and then lookup using their id, but how you'd actually structure it depends on the type of database you choose - for discord a relational database is a good choice
still didn't work
also how do i choose the embed's color just normally?
just the hex?
disnake.Embed(colour=0x000000)
Or if u want it to look better, color=(0x000000)
it just keeps turning the hex into comments
ah
should it be just color=(0xffffff)?






