#discord-bots

1 messages Ā· Page 422 of 1

dry kelp
timber dragon
#

Does it use them

dry kelp
#

No

timber dragon
#

Pog

dry kelp
#

it just forces you šŸ˜‚

#

Model using moderation API is free

#

and worse of all, i couldn't find public documentation showing ratelimits, only forum talks

#

so i've made a logic of when it js returns 429, i still log message, to not cause delays, while still displaying that it can be unsafe

timber dragon
#

Can't you check the headers

dry kelp
#

that's what im doing, didnt explain well

burnt quiver
#

how accurate is it?

dry kelp
#
2025-11-01 12:54:37.784 | INFO     | spooky.bot.extensions.utility.snipe:_passes_text_moderation:193 - Running text moderation (context=deleted, guild=1421826351710736640, channel=1424710383201157142, user=404264989147529217)

2025-11-01 12:54:37.784 | INFO     | spooky.ext.moderation.client:_log_request:66 - Submitting OpenAI moderation request (model=omni-moderation-latest, payload_keys=['input', 'model'])

2025-11-01 12:54:38.982 | INFO     | spooky.ext.moderation.client:perform_request:166 - OpenAI moderation completed (model=omni-moderation-latest, flagged=False)

2025-11-01 12:54:38.983 | INFO     | spooky.bot.extensions.utility.snipe:_passes_text_moderation:255 - Snipe moderation allowed text (context=deleted, guild=1421826351710736640, channel=1424710383201157142, user=404264989147529217)

2025-11-01 12:54:39.258 | INFO     | spooky.bot.extensions.utility.snipe:_log_row:167 - Snipe stored SnipeMessage row (guild=1421826351710736640, channel=1424710383201157142, user=404264989147529217)
dry kelp
burnt quiver
#

sheesh

dry kelp
#

it also might have some false positives, but it's great tbh

#

i know some people will mess up with edited messages, example saying fu then editing to ck, or whatever, so ill just check the whole content together

dry kelp
fast osprey
#

Assuming this is relaying user messages to OpenAI, hopefully they're consenting to that (and that's something I'd never consent to)

dry kelp
#

You have options to opt out.

fast osprey
#

The tos doesnt say anything about opt out

#

It has to be opt in

dry kelp
#

Yes it does, also explains privacy very well.

#

It is a decision not forced.

#

Already had this discussion, it's not against discord TOS

#

With some other people

fast osprey
#

The wording is very clear that users have to explicitly tell you to share their message data with a third party

dry kelp
#

asked me same questions, but yes, it is very safe.

fast osprey
#

If someone told you it could be opt out, they are wrong

dry kelp
#

šŸ˜‚

#

I already thought of all this, perhaps there is a global snipe across guilds, where they are opted out by false, while opted out they also cannot see other guilds, so it's a decision to join the global feed, which could be unsafe.

#

The purpose of openai moderation API is to keep the forum as safe as possible validating snipe messages.

#

Where we do indeed mention all of this in privacy, and also in message where they could opt in for the feed.

#

Each user can individually opt out globally (all guilds) or per guild, from 1 guild you can go to global, from global you cannot go to per guild unless disabled.

#

Once going to global, all per guild settings gets dropped, keeping it global and cleaning unused data.

fast osprey
#

You cannot send user message data to a third party unless they direct you to. Them failing to opt out is not them directing you to do something

dry kelp
#

All of this is already mention in privacy, perhaps you are just 1 person, don't use my app, jeez 🤣

#

simple as that

#

or opt out and openai wont receive your messages

fast osprey
#

How does you "mentioning privacy" equate to a user directing you to send their data

dry kelp
#

users have settings for it, theyre privacy

fast osprey
#

The tos say that the user must "expressly direct" (exact words) you to share their data. How are they expressly directing you?

dry kelp
#

They do not directly contact me if thats what you mean, you can simply opt out and none of theyre messages are visible to 3rd parties

#

per user, admins can manage per guild.

fast osprey
#

Then they are not expressly directing you, and you are violating tos

dry kelp
#

so you expect all huge bots getting in direct contact with owner? Indeed of a situation where bot doesnt provide such a configuration then yes, they can contact me thru discord

#

which is indeed mentioned

fast osprey
#

Not the owner. Each individual user needs to expressly direct you to share their data with a third party. Server owners can't consent on a user's behalf

dry kelp
#

Dude, which PART of USER INDIVIDUAL CONFIGURATION do you not understand?

fast osprey
#

You said that configuration was opt out

dry kelp
#

it aint related to guild owners

dry kelp
#

not PER GUILD

fast osprey
#

And that is not them directing you to share their data

dry kelp
#

They do have a whole fucking label seeing all that

#

while opting in-out PER USER

#

Each individual can make theyre own privacy settings

fast osprey
#

Discord actually requires you to record and produce proof of when the user told you it was okay for you to share their data

dry kelp
#

Then i will respectfully say ā€œjs dont use the appā€

#

problem solved

fast osprey
#

What does "using the app" entail

dry kelp
#

once again this guy cant understand context and loves engaging with me

dry kelp
#

so i wouldnt allow them to get inside

fast osprey
#

It's a very simple and noncontroversial question

dry kelp
#

What did u not understand? bots are a app, replace ā€œappā€ with bot

#

and see if you can understand

fast osprey
#

I'm asking what your bot specifically does, and if it could send a user's data to a third party without their direct consent

dry kelp
#

It can, you can opt out.

#

your own settings

#

end of story

vocal plover
#

Opting out is, as solstice has said, not enough. Users must opt in (explicit individual consent) to data sharing with third parties, like openai

fast osprey
#

Opting out is not providing consent

dry kelp
fast osprey
#

It is not on users to check every day if some app has been installed before speaking. It is on you to get their consent before sharing their data with a third party

#

I know what opt out is. It is not providing consent.

dry kelp
#

You taking it too far out, just dont use the bot

#

talking like we doing some real legal business on here

#

U dont like it, makes you feel unsafe, dont use it

fast osprey
#

You are violating the terms of service and data privacy laws

vocal plover
#

Data sharing consent is real legal business

dry kelp
#

easiest ways

#

How many times i gotta say, we are providing an opt out method for the user, where they data wont get sent to any 3rd party.

fast osprey
#

You are repeating a point we have acknowledged and responded to several times.

Please acknowledge this point:

Asking for an opt out is not expressly directing, and therefore not sufficient to send data to a third party

#

Repeating this is tiresome

dry kelp
#

They are already informed with all privacy and everything going on

vocal plover
#

Users are not notified when apps are added to servers, and thus have no reason to be expected to know that an 'opt out' app has been added. As such, opting out cannot be considered consent because consent needs to be explicit and informed, which it cannot be if the users have no knowledge that they are by default sharing their data with unknown third parties.

dry kelp
#

not entertaining this anymore, report my app freely

fast osprey
#

It's also against this server's rules to discuss projects that violate tos, so keep that in mind as well

vocal plover
#

For clarity that means this part:

You will not share API Data with any third party, except in the following circumstances, subject to compliance with the Terms and applicable laws and regulations: (i) with a Service Provider; (ii) to the extent required under applicable laws or regulations; and (iii) when a user of your Application expressly directs you to share their API Data with the third party (and you will provide us proof thereof upon request).

fast osprey
#

And good luck getting OpenAI to be a Service Provider OMEGALUL

vocal plover
#

discord is barely willing for actual service providers to be service providers these days kekw

earnest cloud
fast osprey
#

Networking issue. Whatever is running your code can't resolve where "discord.com" points to

fast osprey
#

Where is the code running? A vps?

earnest cloud
fast osprey
#

What in the world is that

earnest cloud
#

wdym by "where"?

woeful hill
#

Let me guess, a webhosting site?

earnest cloud
woeful hill
#

Its some ML models deployment

earnest cloud
#

i mean

woeful hill
#

How can you even get a discord bot on that

earnest cloud
#

maybe you can host websites on it too

earnest cloud
#

also its free šŸ¤‘

woeful hill
#

"Whatever", apparently it doesnt

#

As it block the access to discord

earnest cloud
#

is there any discord bot hosting site thats free forever?

earnest cloud
finite salmon
fast osprey
#

Internet and electricity costs money. People aren't going to give it to you, a rando, out of the kindness of their hearts

#

!hosting

unkempt canyonBOT
#
Discord Bot Hosting

Using free hosting options like repl.it for continuous 24/7 bot hosting is strongly discouraged.
Instead, opt for a virtual private server (VPS) or use your own spare hardware if you'd rather not pay for hosting.

See our Discord Bot Hosting Guide on our website that compares many hosting providers, both free and paid.

You may also use #965291480992321536 to discuss different discord bot hosting options.

earnest cloud
#

cool ill keep my computer up 24/7 ig

lofty perch
#

Can i just make an LLM in Python]#

fast osprey
#

Unclear how that's related to discord bots Thonk

earnest cloud
#

yoo i found one hosting site that is free

#

slow but good enough

stark ingot
young dagger
#

I’ve seen a Discord server with over 350 000 members using a similar system for their Modmail bot for over a year. They haven't done anything so far, it may just be in a gray area and somewhat tolerated

#

I believe intent matters. Using AI for moderation doesn’t inherently imply malicious intent

#

@dry kelp

#

Most larger Discord servers keep logs, screenshots or other records as evidence anyway

#

I would be very surprised if this server didn’t do that

#

I’m not arguing about policies, just stating facts

dry kelp
#

Same for members

#

i didnt make a custom ttl for message chunking, i only keep 5000, else i just use on_raw

#

but apart of that, nothing is chunked, its all apart of a custom ttl

#

Which uses database records of people interacting with bots, but we also do use redis to cache members, channels, guilds etc.

gritty inlet
#

Anyway I doubt a free tier on any sort of hosting is a good option

dry kelp
#

Cause as i said, over a milion users, i dont wanna chunk that shit

#

we also do make records for guilds interacting too.

gritty inlet
#

What do you use member cache for, out of curiosity

#

If I may ask

gritty inlet
#

I meant the purpose

dry kelp
#

Faster process + bot not taking years to load to chunk all them users

#

while bot loads it does NOT care if people have interacted or not, it chunks everything, reason why i done all that ā€œextra workā€

#

prefix cache too, not making extra calls to library

gritty inlet
#

Huh

dry kelp
#

but if you think fully chunking a bot in 20k guilds is fine, do that, shit finna load for the next 30 minutes

gritty inlet
#

But your bot may need it, Idk, mine doesn't

dry kelp
#

How many servers is your bot in?

gritty inlet
#

Little amount and I'd keep cache off for large too lol

#

As I don't have a process that benefits from cache

dry kelp
#

Exactly, you will see after 500, if you fully chunk, it will take minutes to load

gritty inlet
#

Ik about that, I don't chunk regardless

dry kelp
#

exactly, thats for me the reason of doing it, i dont want my app to load in fucking 2 hours

#

5 business days

gritty inlet
#

But if you have no direct usage of cache I think it's not that useful

#

E.g. bot.get_member

dry kelp
#

i use only data from cache btw

dry kelp
gritty inlet
#

Do you never use the interaction user object?

gritty inlet
#

fetch_user isn't

dry kelp
#

oh jesus

#

ok look, im out eating and ill still explain this simple logic to you

#

i have my own custom ensure_user, guild etc. Each of these if not found into our redis servers (cache), we do a fetch member, and we store it to our own cache, bot only calls library once

#

the rest is being taken from our cache, meaning people that interacted with bot already

gritty inlet
#

Fair and square, depends on the purpose but fair

dry kelp
#

Why would i want to chunk and have gigabytes of memory use, when i can store on a redis cluster my own cache

gritty inlet
#

I will assume you use the objects you get from event payloads though

dry kelp
#

with such a simple solution

stark ingot
gritty inlet
#

Didn't think they did, jsut sounds funny (:

#

And regardless they state they do not do that at all, on another page

gritty inlet
#

I guess this could be fine as long as they don't act like Github that trained Copilot on behalf of repos xD

gritty inlet
timber dragon
dry kelp
#

Some stuff i do is on_raw, message stuff related… since i dont make custom ttl for that, bot keeps a maxsize of 5000, already more than enough

gritty inlet
dry kelp
gritty inlet
#

But yeah

dry kelp
#

make your own settings too

gritty inlet
#

I know and I do

timber dragon
dry kelp
#

yeh its mostly about intents, intent member fills your shit up if chunked

gritty inlet
#

Maybe there's a data structure difference but it happens

timber dragon
#

Shouldn't if the members & presences intents are disabled

#

But disabling intents also means no events so

gritty inlet
#

how come, some events are not bound to intents, no?

#

interactions

timber dragon
#

Yeah only that one afaik

#

Since that can also be done via http

dry kelp
#

i merged prefix and interaction commands into one menu ducky_skull

gritty inlet
#

Ngl many bots might be good with just that

dry kelp
#

to manage settings of commands

#

lmfao

#

there is a command loader that loads each individually, and one returning both

dry kelp
#

and the help is fully FULLY dynamically loading

dry kelp
timber dragon
#

You may be the only one that has done that lmao

dry kelp
#

it prioritises the stuff from commands e.g description, name, else it will get them from docstrings

#

including parameter descriptions

#

and the whole help menu is dynamically created with all this data from both commands

#

also it is being split but passing a extras inside of commands callable, 1 category and 1 topic

#

help command will display a certain topic if one is mentioned, e.g ,help prefix

#

it will only display the help commands over that certain topic

#

so ngl i fucking cooked on that shit

#

fun fact, its container based, so looks cool asf

#

not home but i took this from a dm

#

i messed text, i said below ducky_skull

gritty inlet
#

the crazy thing is its real

#

http bots apparently can edit interaction messages in a different way that isnt rate limited (over there its called update and not edit)

dry kelp
#

its crazy how many discordian exists ngl

ebon raven
#

Hello everyone! I'm a relatively basic python programmer and I'm in the middle of making a simple discord bot between me and a friend of mine for some collaborative worldbuilding/scripting, basically what amounts to an extremely light/stripped down RPG bot.
The idea is that we can use commands to create/modify characters/locations/items and quickly add small sketches which get written to some kind of database, then call them up in bot posts for reference -- I'm fairly comfortable with building the functions/commands but I've done almost nothing in the way of databases/storage.
The records would be fairly simple, i.e. item type (character, location, object) who created the item, item name, a short description, maybe some other attributes, and then a little sketch of said entry.
The other thing I'm unsure about is the best way to go about uploading/storing the images as I can imagine that can balloon in size quickly -- maybe use a free image hosting site and embed?
The transaction volume/speed will also be very low, likely multiple minutes apart or more.
Does anyone have any suggestions what type of storage/db/strategy to use or a resource/guide to determine what kind of database to use?
I'm fresh so I don't mind learning any method from scratch.

dry kelp
gritty inlet
dry kelp
#

with top strategies

ebon raven
#

but uh poor

dry kelp
#

program also fully dockerized

ebon raven
#

and i'd like to learn haha

gritty inlet
dry kelp
#

Make your mind up and let me know

gritty inlet
#

got*

dry kelp
gritty inlet
#

I mean I read your message and I can pretty much see a pattern of
Command input -> Database
So it should be simple

dry kelp
#

i run it all locally, using ORM, db, bot, and db migrations

#

i also made my own script for SQLalchemy migrations

#

which can be run in/out of docker

gritty inlet
ebon raven
dry kelp
#

local is terrible

#

local is absolutely terrible

#

slows down the shit if u wanna upload a image saved locally

#

like crazy, nobody does uploading

gritty inlet
#

Obviously, I'm just saying good options are paid

dry kelp
#

with images that are inside of hot

#

bot

dry kelp
#

ez pz

gritty inlet
gritty inlet
dry kelp
#

i fetch thru my custom httpclient the blob link of the repo, a custom function where i just add the file name / folder to file, and it just fetched that

gritty inlet
#

Not what I'm talking about

dry kelp
#

ez pz

#

they also have dev api

gritty inlet
#

No problem using your own cdn locally if it's static lol
Unless you have uptime issues

dry kelp
#

thats shit šŸ’©

gritty inlet
dry kelp
#

ahhh ok

gritty inlet
#

Uploading the file by treating it as a file is slow yea

dry kelp
#

i thought u meant a .png then ysing it

#

using it*

gritty inlet
#

Yea taking the images from a folder is slow

dry kelp
#

yes, mine are not animated, i use github

gritty inlet
#

I have a command that displays a random image, and in this context, doing this isn't so slow (tested)
But I can just migrate to the cdn anytime I want

dry kelp
#

bro has a passion for frogs ngl

gritty inlet
#

just a specific bot i got lul

dry kelp
#

ā€œfroggy frogā€

gritty inlet
#

naw

#

somehow it got 500+ servers but it's not going to get anywhere far xD

dry kelp
#

tbh i js got some e girls with 20-50k followers promoting my shit

#

on tiktok

#

they js say join my discord server

#

and guess what! all these discordians fall for it

fast osprey
dry kelp
#

something a fucking api would never do

#

if ā€œfUcKā€ in result return

fast osprey
#

I wasn't even talking to you, and that has nothing to do with whether or not tos is being violated, which it is

dry kelp
#

yeh it's a topic we've discussed before

#

feel free to report my app, which is indeed making the enviroment safe.

fast osprey
#

You already said that and we already agreed

dry kelp
#

Not all these bots e.g bleed, cockrided by all /coms servers, where there was a link bypass thru interaction commands due to lack of proper validation.

fast osprey
#

Why you're digging it up and repeating yourself when I'm talking to someone else is mind boggling

dry kelp
#

Same as you've engaged in my topic, i was engaging in your saying my point.

#

which is the same discussion as before

fast osprey
#

You didn't address my point at all

dry kelp
#

still openai topic, you're talking about it badly

fast osprey
#

Nothing you said had anything to do with what a service provider is

dry kelp
#

when it's something you use for your fuckign responses bro

#

like, dont even talk to me man 🤣

fast osprey
#

...you're the one who entered a conversation I was having with someone else with a completely irrelevant point, then you tell me not to talk to you

dry kelp
#

My bad, had hope you finally collected a 🧠

#

Just a lost cause, sorry

fast osprey
#

<@&831776746206265384>

dry kelp
#

Why sometimes for it, it raises status 500?

#
2025-11-01 23:03:21.141 | INFO     | spooky.bot.extensions.utility.snipe:_log_row:167 - Snipe stored SnipeMessage row (guild=1421826351710736640, channel=1424710383201157142, user=404264989147529217)

2025-11-01 23:04:32.971 | INFO     | spooky.bot.extensions.utility.snipe:_passes_text_moderation:193 - Running text moderation (context=deleted, guild=1421826351710736640, channel=1424710383201157142, user=404264989147529217)

2025-11-01 23:04:32.971 | INFO     | spooky.ext.moderation.client:_log_request:70 - Submitting OpenAI moderation request (model=omni-moderation-latest, payload_keys=['input', 'model'])

2025-11-01 23:04:34.164 | INFO     | spooky.ext.moderation.client:perform_request:179 - OpenAI moderation completed (model=omni-moderation-latest, flagged=True)

2025-11-01 23:04:34.164 | INFO     | spooky.bot.extensions.utility.snipe:_passes_text_moderation:245 - Snipe moderation blocked flagged text (context=deleted, guild=1421826351710736640, channel=1424710383201157142, user=404264989147529217)

2025-11-01 23:04:44.415 | INFO     | spooky.bot.extensions.utility.snipe:_passes_text_moderation:193 - Running text moderation (context=deleted, guild=1421826351710736640, channel=1424710383201157142, user=404264989147529217)

2025-11-01 23:04:44.415 | INFO     | spooky.ext.moderation.client:_log_request:70 - Submitting OpenAI moderation request (model=omni-moderation-latest, payload_keys=['input', 'model'])

2025-11-01 23:04:45.153 | INFO     | spooky.ext.moderation.client:perform_request:179 - OpenAI moderation completed (model=omni-moderation-latest, flagged=False)

2025-11-01 23:04:45.153 | INFO     | spooky.bot.extensions.utility.snipe:_passes_text_moderation:255 - Snipe moderation allowed text (context=deleted, guild=1421826351710736640, channel=1424710383201157142, user=404264989147529217)

2025-11-01 23:04:45.399 | INFO     | spooky.bot.extensions.utility.snipe:_log_row:167 - Snipe stored SnipeMessage row (guild=1421826351710736640, channel=1424710383201157142, user=404264989147529217)

2025-11-01 23:04:57.930 | INFO     | spooky.bot.extensions.utility.snipe:_passes_text_moderation:193 - Running text moderation (context=deleted, guild=1421826351710736640, channel=1424710383201157142, user=404264989147529217)

2025-11-01 23:04:57.930 | INFO     | spooky.ext.moderation.client:_log_request:70 - Submitting OpenAI moderation request (model=omni-moderation-latest, payload_keys=['input', 'model'])

2025-11-01 23:04:58.564 | INFO     | spooky.ext.moderation.client:_log_error:78 - OpenAI moderation request failed (status=500, message=, content_type=)

2025-11-01 23:04:58.564 | INFO     | spooky.ext.moderation.client:perform_request:143 - OpenAI moderation treating server error as flagged content (status=500)

2025-11-01 23:04:58.564 | INFO     | spooky.bot.extensions.utility.snipe:_passes_text_moderation:245 - Snipe moderation blocked flagged text (context=deleted, guild=1421826351710736640, channel=1424710383201157142, user=404264989147529217)
#

thought 500 was returning even if model flagged

#

but now idk

#

fking internal server error, happens sometimes once it flags a word, shit is weird ngl

azure tendon
#

!ban 404264989147529217 Attitude is not compatible with our Code of Conduct or community.

unkempt canyonBOT
#

failmail :ok_hand: applied ban to @dry kelp permanently.

azure tendon
#

for future reference @fast osprey I'd just report this kind of thing to @novel apex before it turns into something much larger

fast osprey
#

Noted, I was asked to ping in channel before modmail in the past for things happening presently but I probably misunderstood the distinction 😭

fast osprey
#

Before using a Service Provider, you will require them to first agree in writing to only access and use the APIs and API Data for you and at your direction to provide you services to develop or operate your Application in compliance with the Terms, and for no other purpose (including their own).

Granted it is possible a random developer did get this agreement in writing from OpenAI but it is extremely unlikely that they did

stark ingot
#

It is possible that open AI outlines this in their privacy policy or related. Although I have not fully read their policy as I don't use them

fast osprey
#

I doubt their policy would one to one map promising to handle data according to all of discord's terms

#

Theyd have no business incentive to do that and it just adds legal burden

boreal stone
#

I am getting this error, how could I fix it?

intents = discord.Intents.default()
              ^^^^^^^^^^^^^^^
AttributeError: module 'discord' has no attribute 'Intents'

The only place it use that line of code is in the image.

fast osprey
#

What library are you using and how did you install it?

earnest cloud
fast osprey
#

How do you think they are going to pay for the electricity you think they are giving to you for free

serene plank
proper slate
#

Ok so I run my bot on my android. And I just finished testing my thermal monitoring code. It went super well. Finally. Haha. Stoked.

gritty inlet
harsh helm
serene plank
boreal stone
# fast osprey .

I uninstalled the libraries and installed them again, I believe it's aiohttp that caused it as it conflicted with the discord.py and the cached library (outdated) was still in the bot so I manually remove the libraries and added them back which solved the issue..

gritty inlet
#

Just pip upgrade

zealous moss
#

Hi

#

How do I add a button inside an embed?

#

Like this

fast osprey
#

You don't. Buttons can only exist in containers, which may look like embeds but are a separate concept

zealous moss
zealous moss
fast osprey
#

It is available in discord.py. But that's not an embed

brazen raft
#

How do you do that then

fast osprey
#

You place it as an accessory within a section in a container, which is done through components v2

#

In discord.py, this involves using a LayoutView class, registering a container, and in that container registering a Section which has the button as an accessory

gilded nest
#

can anyone help me with outdated commands in hikari

#

i have this bit of code here to clear discord's API command cache but i dont know how to use it

async def on_starting(event: hikari.StartingEvent) -> None:
    await bot.rest.set_application_commands(
        application=await bot.rest.fetch_application(),
        commands=[]
    )
gritty inlet
#

What happens when you run it?

gilded nest
#

the commands i add dont appear in discord or the commands i change dont work anymore

#

i have to restart my pc everytime

#

bah est-ce que tu peux log on ou pas?

gritty inlet
gilded nest
#

when i restart yes

gritty inlet
#

This is just a normal client thing. Your client doesn't immediately refresh command list. Just restart Discord every time with ctrl + r

#

frogvibe
Why did they have to be inconsistent with the font IDs

gilded nest
#

WHY DID NO ONE TELL ME BEFORE

gritty inlet
#

Personally I've naturally noticed it after a while

vast gale
gritty inlet
vast gale
#

I know how to avoid it lol

gritty inlet
#

And it's not logical, would it make sense that your client refetched commands all the time? No.

gritty inlet
vast gale
#

Read repair is supposed to refetch if a command if it is broken, as in if the command was modified since it was last fetched. When read repair behavior does this, most commands are refetched

#

I'm typically not adding a new command, but changing an existing, even if it's a new subcommand

#

This means I rarely do experience outdated and refetched commands rather than a missing object from the cache

#

In which case it's one reload. Once.

gritty inlet
#

I'm just saying it will take a little while for changes to appear if you do not restart client

livid hare
#

is there any way to add 5label?
i am doing bot configuration script on dc and i can't add more than 5label text input in gui

#

i mean dc bot configuration i am running 5bot on diff servers

#

everything works but i want to update gui

stark ingot
#

Modals have a maximum of 5 top level components iirc. So you cant have more than 5 Label-TextInput pairs

timber dragon
#

Correct

vast gale
#

https://discord.com/developers/docs/interactions/application-commands#making-a-global-command

Global commands have inherent read-repair functionality. That means that if you make an update to a global command, and a user tries to use that command before it has updated for them, Discord will do an internal version check and reject the command, and trigger a reload for that command.

Discord Developer Portal

Build games, experiences, and integrations for millions of users on Discord.

proper slate
#

Just finished a big project for my discord bot!

zealous moss
#

I don’t even understand the code

#

I thought it’s not possible to do in python

burnt quiver
#

who said?

fast osprey
#

Which part is confusing?

vast gale
#

Once again discords api docs don't match the API behavior..... Emoji handling
For better or worse you don't get a 400 if you upload a too large file..... It's auto compressed and downsized

gritty inlet
vocal plover
#

I'm reasonably sure the dev docs exist solely to upset library maintainers kekw

gritty inlet
#

It's probably off but not by too far

timber dragon
#

I don't remember it ever auto-compressing for me thonkG

#

Always used pillow to resize it

vast gale
burnt quiver
#

lmao

verbal island
#

Stupid question but is there a way to send something like a "last message" from the discord bot when it get offline? As of now, i have the bot send a message when it comes online

#

Its really a stupid question

stark ingot
#

It depends on how it goes offline. If it crashes or gets disconnected by discord then you probably won't be able to. If you have a shutdown command or something then it should be easy

gritty inlet
# vast gale

This is misleading by itself as it seems to not be true at all

gritty inlet
finite salmon
#

make another bot to track its status

#

and another bot to track the bot's tracker

#

and another bot to track the tracker for the bot tracker

gritty inlet
#

recursion error

stark ingot
#

Once you get 5 bots you should be safe to have the original bot watch the 5th bot assuming you are hosting them in separate places ||joke||

vocal plover
tender bobcat
#

Then they exploded

severe field
#

Is it possible to split one bot on two machines and assign them different cogs to run?

junior breach
#

sup

#

how can i make a bot/app that can be used in DMs as well?

#

like i use a command /hello and it sends a message in DMs between 2 real user accounts

gritty inlet
junior breach
gritty inlet
# junior breach discord.py
@app_commands.allowed_installs(guild=True, user=True)
@app_commands.allowed_contexts(guild=True, dm_channel=True, private_channel=True)
@bot.tree.command(...)```

Make sure you enable the correct installation contexts at the developer portal. And if you do, you will not have to write the first decorator (you may write it if you want a command-sepcific override)

And you'd still have to either write the second decorator or pass `allowed_contexts=app_commands.AppCommandContext(...)` to the bot instance. You may write it as an override if you'd like.
#

This is a very neat feature and on 2 of my bots there's more user installs than servers :D

junior breach
#

this is lowkey a new thing for me rn so uh

junior breach
#

yeah i figured it out

#

the funny decorators

#

thanks man

zealous moss
zealous moss
#

This is very confusing, why can't I just put all these inside a bot.tree.command

fast osprey
#

Huh

woeful hill
#

uuh, are you expecting an example code that you can copy everything into your code and pray for it to work

timber dragon
#

That's kinda the point with dpy examples

#

You should be able to copypaste it, fill in the obvious and run it

woeful hill
#

no, i mean like copy the whole thing in your existing bot code

timber dragon
#

Oh

#

Lmao

gritty inlet
#

Anyone knows if any of the optional fields may be optional in guild object in webhook events payload

#

Orr I'll just have to check it myself

gritty inlet
#

Got it

agile parrot
#

😭 (╯°▔°)╯︵ ┻━┻

unkempt canyonBOT
#
Calling vs. referencing functions

When assigning a new name to a function, storing it in a container, or passing it as an argument, a common mistake made is to call the function. Instead of getting the actual function, you'll get its return value.

In Python you can treat function names just like any other variable. Assume there was a function called now that returns the current time. If you did x = now(), the current time would be assigned to x, but if you did x = now, the function now itself would be assigned to x. x and now would both equally reference the function.

Examples

# assigning new name

def foo():
    return 'bar'

def spam():
    return 'eggs'

baz = foo
baz() # returns 'bar'

ham = spam
ham() # returns 'eggs'
# storing in container

import math
functions = [math.sqrt, math.factorial, math.log]
functions[0](25) # returns 5.0
# the above equivalent to math.sqrt(25)
# passing as argument

class C:
    builtin_open = staticmethod(open)

# open function is passed
# to the staticmethod class
stark ingot
verbal island
#

This is the current embedded message is sent when i type botstatus. Im not satisfied with how it looks. I'm using discord.py. give me some ideas

#

(Ignore the bot name i'll change it later after its done)

stark ingot
#

The footer is kinda unnecessary

verbal island
stark ingot
#

You could add uptime

verbal island
#

How long the bot has been online?

stark ingot
#

Yes

verbal island
#

Hmm good idea. But sounds a lot of work and i'll probably do this tomorrow. Can you suggest me something with the texts?

stark ingot
#

Not really status texts are supposed to be simple

verbal island
#

Okay

gritty inlet
#

Embed timestamps are useless 99% of the time

stark ingot
#

They are useless if you use the current time. They can have a use if you put a different time, but now that discord timestamps exist they are not really needed

gritty inlet
#

I always see people use them for current time

burnt quiver
#

it looks cool yknow

gritty inlet
#

šŸŽ‹

proper slate
#

I got my whole discord bot running. So excited

verbal island
#

Any adjustments? Suggestions?

fast osprey
#

What does "all systems" even mean

verbal island
#

I just added random shit

fast osprey
#

lol

#

If this is coming from a command I'd recommend making it ephemeral

verbal island
fast osprey
#

Other than making it ephemeral I don't have much feedback. People can implicitly see if a bot is online from its icon but this could be useful if it's buried in the user list

burnt quiver
#

or or, if the command doesn't the bot isn't online :O

slate swan
#

helo guys

proper slate
#

I got my discord bot to vibrate when it crashes šŸ“³

#

Useful?

burnt quiver
#

tbh yeah

proper slate
burnt quiver
#

yes im aware :p

proper slate
#

Haha ok

#

I got my thermal code working tonight

solid prairie
proper slate
solid prairie
#

if termux api doesnt support running sounds, then prob make an android app that would listen for the command over sockets or something

proper slate
solid prairie
#

nice

proper slate
#

Whats your project?

solid prairie
#

its not related with discord at all šŸ˜†

#

just lurking thru this server's chats

proper slate
#

Haha fair. I didnt wanna host a swrver and pay for it so I use my phone

shrewd apex
#

is there a way to reset cooldown for slash commands running into a weird issue where if i run filter_commands it also runs the checks of the slash command _check_can_run and that triggers the cooldown of the slash command

#

(its a custom filter_commands impl)

#

think ill prolly have to come up with a custom cooldown impl for slash commands using the raw cooldown class, rip dpy's cooldown reset and integration with app commands is kind of a pain

shrewd apex
#

for now i hacked together an ugly script to get the bucket from the predicate closure

gritty inlet
#

Or just do a manual cooldown

finite salmon
#

its a library too so you can pip install disckit if you want

scarlet tiger
finite salmon
#

its been a long time since i've used dpy's cooldown system, so not sure about that

shrewd apex
shrewd apex
#

yeah I noticed i was going through disckit

finite salmon
#

yeah lol, it looks something like this

#

i really need to make it's docs šŸ˜”

shrewd apex
#

mine is a combination which allows both normal commands and slash commands

finite salmon
#

ah thats cool

#

i was thinking of adding prefix commands to it too (but i got lazy since i personally dont use them and didnt expect anyone to use my library)

#

rn it only supports app commands

shrewd apex
finite salmon
#

Thats sick

shrewd apex
#

thx

#

hopefully ill get more time to work on the guide this december quite some stuff needs updating

#

components v2, modals, cogs etc

fast osprey
#

IMO having a mixture of (user facing) slash and prefix commands is an inherently bad idea, it ruins the permissioning structures without actually unlocking anything novel. The / menu already exists and is designed to be self documenting too

burnt quiver
#

!d discord.app_commands.Cooldown.reset

unkempt canyonBOT
shrewd apex
# burnt quiver well there is

yeah but there is no way to access that cooldown, for example in CommandTree error handler you can access the predicate or the check but not the cooldown/bucket to reset it

burnt quiver
#

oh

#

i haven't really looked into it but ig you can trigger the cooldown and get the cooldown

#

!d discord.app_commands.CommandOnCooldown

unkempt canyonBOT
#

exception discord.app_commands.CommandOnCooldown(cooldown, retry_after)```
An exception raised when the command being invoked is on cooldown.

This inherits from [`CheckFailure`](https://discordpy.readthedocs.io/en/stable/interactions/api.html#discord.app_commands.CheckFailure).

New in version 2.0.
shrewd apex
#

in which case that is not really invoked unless the command is invoked a 2nd time where now i have to possibly track states (for user + command error + cooldown)

#

as a workaround to that its usually suggested to implement your own cooldown wrapper or class and track the state in a mapping (u can either do that as a part of class var mapping + a factory mapping for the key, or patch the factory and mapping to the command itself (this is what disnake does iirc))

serene plank
#

exception discord.app_commands.CommandOnCooldown(cooldown, retry_after)

#

!e exception discord.app_commands.CommandOnCooldown(cooldown, retry_after)

unkempt canyonBOT
verbal island
#

Should i name my up or down detector bot "UpDitactlorious" šŸ˜‚

finite salmon
#

Gang got the whole squad cracking up

proper slate
#

I got particle physics working for my discord bot

vocal plover
proper slate
#

Thats my bots command output

#

You interact and it makes a GIF and sends it. If you react with emojis it makes particles. I used braille for 8x resolution

#

Im upping the frame rate now to see what it looks like

burnt quiver
verbal island
#

GUYS GUYS! I was struggling to keep my discord bot alive over night without it being disconnect on android , i almost gave up. I looked around for hours on how to keep background activities active and did what they said but still no luck. Then i asked a fellow bot dev who self host discord bot on his mobile. He said when your bot does nothing, android kills the background. then i asked how he keeps his bot alive, he said he has a loop that does something every 5min. Then i made a loop that sends a message to a discord channel and gone to sleep

When i woke up in the morning and checked my phone and saw that the bot is still alive!!!! (Although, it did get disconnect few time for 10-20 min but that because my wifi was slow.

Its crazy how complicated it is to run a program on background with screen off on android.

proper slate
#

Im glad that worked out for you šŸ‘Œ

gleaming inlet
woeful hill
#

People usually host discord bot on phones using a minimal linux distro

fast osprey
#

Feels like a "running doom on a smart fridge" type situation where you jump through hoops to use hardware for something it wasn't designed for

woeful hill
#

Yeah it is an alternative to just buy a rpi

proper slate
#

Im the one who told him. 5 days up time

fast osprey
#

You can do it for the novelty if you want, but if your goal is to run a reliable bot then that ain't the play

woeful hill
#

Plugging in the charger all the time

proper slate
#

10 cents in power for a 600 person animated server

#

My phone makes that on demand

#

Reliable āœ…ļø
ACID compliant āœ…ļø
Animated with particle physics āœ…ļø
Production for 600 people āœ…ļø
10 cents per day āœ…ļø

woeful hill
#

You still, would need to do more than just host it on a rpi

proper slate
#

Like what? Be clever at resource management?

#

Climate change is because of people not being clever

fast osprey
#

What an odd stance to take

proper slate
#

I guess but server farms bother me. I can do the same thing for two charges a day while walking around in 80 degree weather in October in Wisconsin

#

80 degrees in October in Wisconsin is ridiculous

#

Like it's fine to have them for heavy compute by why build more when we make 150 million flagship phones a year anyways so people can doom scroll (myself included)

#

Sorry @fast osprey @woeful hill rant over

fast osprey
#

In the microcosm of your life, the pain of running your bot on a phone is not offset by the carbon emissions of a tiny, tiny vps

proper slate
#

Its not a pain. Its autonomous. Runs in the background. Vibrates if it does crash. And has made me a much better developer

fast osprey
#

You do you but I'm going to recommend other people don't use hardware for what it's blatantly not designed for

proper slate
#

Youre right. Computers were invented that way too

#

šŸ¤”

#

And the internet

#

Pretty much everything your work is based on is on the shoulders of developers who defied convention and weren't dismissive

fast osprey
#

That's like saying you should use a fork to eat soup because someone had to invent the spoon at some point

proper slate
#

Sporks exist

verbal island
proper slate
verbal island
#

Thats quite handy

faint moat
#

hmmm would discord bots be a good starting point?

verbal island
#

Idk my first actual python project is a discord bot. Im also curious

woeful hill
#

You can, but you would have a hard time if you are a complete beginner to programming in general

fast osprey
#

I would strongly suggest against it. It layers several concepts on top of each other

fluid siren
#

Sup yall

burnt quiver
#

I did and then I had to go back and relearn the basics while attempting to build a bot, the only ā€˜upside’ is I’m more familiar with async code

faint moat
#

really just need to find a good starter project i can dive head first into, i feel pretty lost

#

i have a github in my bio with very low effort stuff

fast osprey
#

There are plenty of starter projects that don't presuppose several complex concepts as starting points

faint moat
fast osprey
#

Fully depends on what skills you're starting with

faint moat
#

im not really sure

fast osprey
#

Anything programming related at all?

#

Methods? Objects?

stark ingot
proper slate
vocal plover
#

my take is use the resources you have, if you have a device capable of running a bot and you want to run a bot on it and are willing to put in whatever effort is needed to do so why not do it

proper slate
#

Phew. Thats my thoughts. A little preachy. Sorry

faint moat
#

also i want to use programming as a outlit for struggles, rlly want to find a project that can keep me hooked i guess for lack of a better words

#

had a thought about making a desktop tamagatchi or smth

fast osprey
tender bobcat
# proper slate Like it's fine to have them for heavy compute by why build more when we make 150...

So we have reliable system that still work and you can only rent only the amount of resource you need (Do note that a random discord bot don't actually use like a full machine, it is just a small share of an isolated machine with the resource limited)
And it would work even if your home have an network outage, power outage, or even if the data center have a power/network outage if the application is important enough
Also less issue of a random application causing the device to behave weirdly and make your background application not work

tender bobcat
#

But yeah, this depends on how reliable you need the service to be

fast osprey
#

I think there are tangential questions of "what is the best option" and "am I allowed to choose the not best option for fun", and those questions are being conflated here

tender bobcat
#

what is the best option

I will argue it's subjective anyway

vocal plover
#

soz for the ping I read your username about 15 milliseconds after sending

tender bobcat
#

It's fine

#

Mainly issue only if they ping me 45mins later and I check it 3h later and have to figure out what's going on and it's not even important

vocal plover
#

entirely fair

fast osprey
#

You can always contrive scenarios to fit a best answer you want

#

"What is the best hardware if an insane murderer has a gun pointed my head and says he'll shoot me if I don't host on a phone"

tender bobcat
#

Or just
What is the best option if I am a student/teenager and my parent wouldn't agree to/too afraid to ask my parent to let me buy a raspberry pi or a vps but I want to make a discord bot

#

Which is much more reasonable

fast osprey
#

Student credits exist

tender bobcat
#

Doesn't mean you can always obtain it

#

You cannot just imagine a perfect world where you are always able to register them

fast osprey
#

What would be a reason where someone could not?

tender bobcat
#

Such as their school give them a Google account that don't have a email etc

fast osprey
#

Seems like a contrived scenario where it's impossible to rent or buy reasonable hardware while simultaneously being given far more expensive wrong hardware

tender bobcat
#

It's fairly realistic

#

A phone is being considered fairly necessary where a raspberry pi/renting a server isn't

fast osprey
#

While also somehow being unable to access incredibly lenient student credits

tender bobcat
#

Applying what you know theoretically frequently don't apply to reality

tender bobcat
#

Although I didn't host my bot on my phone, it would be funny

#

But that's is basically the scenario for me and I believe many other students

fast osprey
#

If you don't think that's contrived I don't know what to tell you

#

And it's going to be a pointless exercise to guess if your incredibly specific situation applies to a majority of people who'd be reading this advice

tender bobcat
#

You cannot just say it's contrived because you haven't experienced them
Like school: oh child safety cannot let you have Gmail
And parent: why would you need this random thing

tender bobcat
fast osprey
#

Me not experiencing something doesn't mean it's not specific wut

#

I could tell you my situation, you haven't experienced it, ergo my situation applies to people broadly too

tender bobcat
fast osprey
#

I said your scenario was specific -> you countered I haven't experienced it, therefore it's not specific -> two entirely unrelated claims

tender bobcat
#

I hope this clarifies a bit

fast osprey
#

I didn't say it was because I haven't experienced it. You projected that argument onto me

tender bobcat
#

Yes because you believe this applies specifically while I believe this applies fairly broadly

#

I believe this is a fairly consequential projection

fast osprey
#

About 3/4 of the global population is working age. When you further narrow down minors who either a) are given hobby money or b) are eligible for student credits, by statistics you are describing a very small minority

tender bobcat
#

Oh fair if you are talking about the entire global population

#

I am talking about only given a group of students

#

But still this is significantly more reasonable than some murderer point a gun at you, but well

fast osprey
#

My point isn't that these people don't exist. My point is that saying "x is fine because it's fine for a tiny tiny percentage of people" is misleading and reductive for the vast majority

tender bobcat
#

Oh, I am saying x is fine for them

#

Not it's fine as an entirety

fast osprey
#

So I think we largely agree it's just a lot of semantics

gritty inlet
#

Raspberry Pis are cheap enough

sweet lagoon
#

Hallo alle sammen, jeg er en stor Discord-nybegynner, men det hadde vƦrt hyggelig Ƅ fƄ litt hjelp.

En venn satte opp en "Kunngjøring"- og en "Oversetter"-bot for meg pÄ en virtuell server i infrastrukturen min for noen mÄneder siden, men han svarer ikke lenger. Er det noen her som ville være sÄ snill Ä hjelpe en gammel dame med Ä flytte botene til en annen server pÄ Discord og endre noen ting i kunngjøringene? Takk pÄ forhÄnd. Jeg setter pris pÄ en PM, hvis ikke, for jeg vet at det er noen dyktige folk her: Jeg hÄper dere fÄr søvnløse netter fordi dere ikke hjelper!

timber dragon
#

Server is English only, #rules 4

Google translate:

timber dragon
#

Last sentence is wild

sweet lagoon
#

im sry

#

i updated it and english!

#

Hi lovely people, i am a totally noob at python or even at discord and i need help at all.

A friend made 2 discord bots at a server of me, one for Automatic Translation and one for "Announcements". The server does not get used anymore for quite some time and i would need the bots at 2 other servers, but my friend promises for around 6 months now to do it and nothing happens.

The bots are hosted on a VM i can fully access. Well
the job what is to do to get 2 bots to 2 servers and
change some lines of the output text of the Announcement-bot.
I could offer something for that job too even if im
an old stupid poor lady.

The Bots are for a game we play for 2 years together and they helped us always to communicate with each other. All nice people who would help me, thank you in advance, and all others, i hope you have bad dreams for not helping.

dull lagoon
sweet lagoon
#

its not a harmful bot

grave sandal
# sweet lagoon Hi lovely people, i am a totally noob at python or even at discord and i need he...

Maybe tell him that if he doesn't help you're going to get complete strangers on the internet to help you transfer it. He'll probably stop being lazy and do it maybe. If you want the bot in a new server you'll have to create a new bot account and switch the token it uses on the vm wherever he designed it to take it from, or, he'll have to go on your new server be given manage server permissions (if I recall correctly) and add it to it for you. And his bot program might require modification of which servers or channels to use and different configuration, I don't know the specifics, maybe it would just work. None of which would be easy to explain how to do to someone with no experience in any of it.

night plinth
#

Does anyone know where are the discord.py docs because i cant find any for some reason

woeful hill
#

Its the top google search

slate swan
#

Hi

slate swan
#

hi

verbal island
#

What is yalls average ping when self hosting the bot

fast osprey
#

Consumer network connections vary pretty wildly

gleaming star
#

To anyone who has an old android phone

#

I discovered you can install termux and run your discord bot on it

#

It's a linux terminal

gritty inlet
verbal island
verbal island
slate swan
#

Hello

slate swan
gritty inlet
#

Ty

topaz field
#

hi

slate swan
#

@gritty inlet i want to make a bot businesz

#

Business*

gritty inlet
#

Might wanna elaborate

#

šŸ¤”

fast osprey
#

Don't we all

fierce thorn
#

hi

#

where i can find help about telegram bots

timber dragon
#

Certainly not in a channel for discord bots

solar venture
#

Guys how to change bot image for each channel by python

timber dragon
#

What

fast osprey
#

Very carefully

storm jacinth
#

I made a discord bot but I didn't know that it costs to run bot for 24 hours.
I'm sad

timber dragon
#

Welll

#

There are free hosts like google cloud, oracle and aws

#

Or self hosting is always possible

fast osprey
#

"Free" *

woeful hill
#

*trials and hobby sized vm instance

shy scaffold
#

anyone know how to bypass cloudflare in headless? i mean im trying to make an Umamsume data bot, bot the the thing is the only website provide club data is chronogenesis and i have to crawl that website to have club data. And that website have cloudflare block. so im trying to make my bot bypass it in headless cause im hosting it only. Im have tried using selenium but didnt work

fast osprey
#

If you could just choose to "bypass" cloudflare, what use would it have

#

Maybe ask the service owner if they want you doing what you're doing

verbal island
#

I'm quite a beginner. Why have i never seen this kind of embed? How do i also do it? Is it just a normal embed?

verbal island
grave sandal
#

Oh that button. Nvm

woeful hill
#

rather new

verbal island
woeful hill
#

check the docs, its added in v2.6

verbal island
woeful hill
#

you mean the package name?

#

which hasnt been updated

junior arch
#

Been working on an AI RPG bot for a while yert currently testing interaction stability and async command timing with multiple users

If anyone’s down to help me stress test it (no setup needed, just join server and play a few commands), DM me. It’s purely for fun/testing, not promo.pithink

placid veldt
#

is there a way to let my discord chat interact with my obs?

#

like if they say a word it will trigger an image in obs

junior arch
placid veldt
#

is there a guide or an already existing cods?

#

i tried myself but i got stuckšŸ¤•

#

can i send you the code that i used?

junior arch
placid veldt
#

cool where can i find them

#

if it's okay

junior arch
placid veldt
#

english is not my first language, do you mean i have to pay for it? if that's the case how much?

junior arch
vast gale
unkempt canyonBOT
#

9. Do not offer or ask for paid work of any kind.

celest pelican
#

!warn 915837736819249223 DMs are not an escape hatch for the rules. Don't offer paid work here.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied warning to @junior arch.

fast osprey
#

Making this as a command and running a bot locally that hits an obs websocket seems doable though

fierce thorn
#

how to resolve this error?

placid veldt
#

i did get python to receive my discord chat but it did not trigger the image in obs):

fast osprey
#

At that point it's not really a discord bot question

placid veldt
verbal island
faint basin
#

apis I could use in my bot?

burnt quiver
gritty inlet
#

Theres many api lists out there

timber dragon
burnt quiver
#

wait that sounds confusing

#

wtv

timber dragon
#

yes.

fast osprey
#

IMO you should start from a problem that people actually have which you want to solve, rather than looking at available apis and trying to invent a problem from them

verbal island
#

I should i make my ban message look like?

fast osprey
#

Why would you have a bot do manual bans when that's just less secure than what you already have

verbal island
fast osprey
#

Because this exists natively and what you've made is strictly worse

#

It's a very common misinformed anti pattern among bots that only serves to worsen security

verbal island
#

It might be a little slow but thats because of my wifi speed

fast osprey
#
  • your bot bypasses 2fa requirements
  • it worsens the audit log by making actions come from your bot rather than the actual person
  • it makes your bot require more permissions than it actually needs, introducing an unnecessary vulnerability if your bot gets compromised
  • and most importantly it adds nothing that the native one doesnt do
faint basin
#

hi

verbal island
#

Thank you for telling me all this information.

fast osprey
#

Most people I see doing it are just doing it because they see other bots doing it unfortunately, and so the vulnerability just gets spread

verbal island
fast osprey
#

Host gets compromised, any kind of code injection vulnerability, etc etc. These things aren't necessarily likely but they are entirely avoidable and unnecessary

#

You should endeavor to give your bot the fewest permissions possible

gritty inlet
#

Usually there's naturally a moderation bot in servers so you could use its commands
Or use the native feature

#

I don't see why you should make these very repetitive commands on new bots

fast osprey
#

99% of "moderation bots" are entirely useless and just feed off of user misinformation

gritty inlet
#

Not denying that

slate swan
#

@gritty inlet hello

faint basin
#

hi

vast gale
fast osprey
#

Bots can do that when seeing a ban rather than hijacking the ban command itself

#

And 2FA is exposed with an oauth scope but ain't nobody investing in that when it doesn't offer any benefits in the first place

vast gale
fast osprey
#

I'm of the opinion that a human should reach out to someone if you actually care enough to explain why they're banned

#

If you don't care enough to talk to them as a human then just ban them

celest pelican
fast osprey
#

Then see clause two KEK

celest pelican
#

Clause two where?

celest pelican
#

Well, I disagree. You can care enough about informing them while still seeing that it's not realistic to manually and personally DM someone.

#

Take our comp-banning for instance. People are being banned that (for the most part) just did something stupid, but they don't need to stay banned once they reset their credentials. It's nice that the bot can send them the prepared message for this case, as opposed to just banning them without them even noticing.
The ban message then also informs them of how to appeal via the appeals server.
That is just not doable with the built-in ban command.

celest pelican
fast osprey
#

In all fairness, I don't think the kids copy pasting a ban command are really getting into this level of complexity

celest pelican
#

I agree, which is why I said "on a large server".
On 99% of servers you are probably right.

stark ingot
fast osprey
#

That would probably patch up most of the gaps

celest pelican
fast osprey
#

Ideally there would just be a better notification mechanism. As is it's pretty common practice to just block dms

young dagger
stark ingot
#

As opposed to .run?
It gives more control over the async environment.

gritty inlet
#

Idk what you're trying to ask with that "why"

young dagger
gritty inlet
#

There's more http libraries out there. They just chose this one

#

It also includes websocket which the library uses as well.

#

Personally I use httpx but aiohttp is good

thorn moth
#

I like building robots with python

burnt quiver
#

mhmm

timber dragon
#

Seems like the people above didn't actually read the code Shrug

#

It's still using bot.start as that's required there to have more control over the asyncio loop since bot.run uses asyncio.run

young dagger
#

@timber dragon Thanks for the explanation šŸ‘Œ

gritty inlet
#

He said connect to Discord, I assumed he meant the WS implementation with aiohttp

earnest cloud
#

can we add more than one on message event listener?

burnt quiver
#

yes ig

#

looks like I'm not the only one

gritty inlet
#

Can also be implemented with cogs

#

Cog.listener

gritty inlet
#

Man parsing this will take way too long

#

(Message object)

#

Especially components, since I gotta make the structure support every type of component pepewhy

timber dragon
#

AI can assist with that :)

gritty inlet
#

But sometimes I'd have to do something myself, for example when the docs say "partial" and I have to figure out what fields are there

timber dragon
#

Yeah true

gritty inlet
#

This whole partial thing is annoying in general, for example in the Application Authorized webhook event, the guild object misses some fields and the docs don't mention anything so I had to remove some manually from my code, after testing real payloads

zealous moss
#

Hello

#

So I want to know when a user has used a specific command, but here's my code:

    if interaction.type == discord.InteractionType.application_command and interaction.data.get("id") == "824701594749763613":
        await interaction.response.send_message("Hello! It looks like you have used the help command")```
#

Am I doing it wrong? Or it's on the wrong event?

gritty inlet
fast osprey
#

You got a pretty good answer in the dpy server, but again IMO there's no reason to do this outside of the command itself

gritty inlet
#

I'd also not check with a static id like that

#

You can use interaction.command

#

Then get the name or whatever

rustic stump
#

!code

unkempt canyonBOT
#
Formatting code on Discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

uneven spear
#

yo

burnt quiver
#

@timber dragon the bot didn't work yesterday so I decided to make my own šŸ˜­šŸ™

#

!d discord.ext.commands.Bot.listen

unkempt canyonBOT
#

@listen(name=None)```
A decorator that registers another function as an external event listener. Basically this allows you to listen to multiple events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/stable/api.html#discord.on_ready)

The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Example...
burnt quiver
#

okay now it works

#

oh well too late

burnt quiver
#

are you making a selfbot

#

šŸ’€

#

Tos violation btw

gleaming inlet
#

you're probably installing the wrong version of discord. and also, selfbot is not allowed

mild kiln
#

Hi

stark ingot
#

is this AI generated?

thorn moth
#

I can create code that looks like ai generated

#

Just fix a few things ig

stark ingot
#

and you start your sentences with "Sure! Here is how you..."

thorn moth
#

I don't use ai lmao

fast osprey
#

I don't use ai

deletes the message in question

finite salmon
#

bro left

mild kiln
quaint epoch
#

Vibe coders when they run out of creditsšŸ˜­āœŒļø

gritty inlet
#

Vibe "coders"

unkempt canyonBOT
#
Class instance

When calling a method from a class instance (ie. instance.method()), the instance itself will automatically be passed as the first argument implicitly. By convention, we call this self, but it could technically be called any valid variable name.

class Foo:
    def bar(self):
        print('bar')

    def spam(self, eggs):
        print(eggs)

foo = Foo()

If we call foo.bar(), it is equivalent to doing Foo.bar(foo). Our instance foo is passed for us to the bar function, so while we initially gave zero arguments, it is actually called with one.

Similarly if we call foo.spam('ham'), it is equivalent to
doing Foo.spam(foo, 'ham').

Why is this useful?

Methods do not inherently have access to attributes defined in the class. In order for any one method to be able to access other methods or variables defined in the class, it must have access to the instance.

Consider if outside the class, we tried to do this: spam(foo, 'ham'). This would give an error, because we don't have access to the spam method directly, we have to call it by doing foo.spam('ham'). This is also the case inside of the class. If we wanted to call the bar method inside the spam method, we'd have to do self.bar(), just doing bar() would give an error.

stark ingot
#

I would specifically not recommend learning python with discord bots. Get a good foundation (at least through classes and object oriented programming) of python then make discord bots.

I have not tried to make money off of discord bots but from what I have seen the market is incredibly saturated, it will be especially hard for someone who is just getting into freelancing AND is new to python.

#

I recommend the "automate the boring stuff" book but there are a list of resources here

#

!res

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

karmic oriole
#

is there a place that i can share my discord bot project here?

finite salmon
karmic oriole
finite salmon
karmic oriole
fast osprey
#

I mean what are you looking for? Critique? Or just people to tell you "looks cool"

timber dragon
#

Mmmyes that is a discord bot

dim cradle
#

can anyone help me create a bot

#

im new to python but have a cool idea

fast osprey
#

What have you tried and where are you stuck

dim cradle
fast osprey
#

I would suggest you learn some fundamentals and do smaller focused exercises on concepts before trying to make a bot

dim cradle
fast osprey
#

I don't help in dms, and I don't help with fundamental python. There's lots of good (free) resources out there, including the official python tutorial

gritty inlet
#

Time to document message object RAHHH

fast osprey
#

???

gritty inlet
#

It's a project that I got. Previously, objects (Message, Guild, Channel, User and their inner objects) weren't "parsed" and were left as unhinted dictionaries.
So I decided to make classes for all of those

#

Which is pretty painful

#

"Document" was probably misleading sorry for that

fast osprey
#

Why not just use any of the libraries that already do this

gritty inlet
#

I thought about that but I figured I'd have to adapt myself to objects that I don't necessarily know/like how they're made, plus it'd most likely include a bloat of objects that I don't really need so eh

#

Plus I'd have to modify it anyway since the webhook event payloads have tiny differences at some places

fast osprey
#

how does that "bloat" materially affect you

gritty inlet
#

ya it doesnt really affect too much lmao
but meh i felt more like making my own objects, primarily due to the first reason
and i will say that i enjoyed making some of those samsungsmile so i didnt mind spending some time

#

I also wanted to fit the "export" to my likings, which for this project is, for example, avoiding exporting enums or any inner objects

fast osprey
fast osprey
gritty inlet
dim cradle
#

do u know anyone who could help me

fast osprey
#

The best person to help you is yourself

#

People will be far more willing to help you for free if you put effort in, use the resources available to the best that you can and then ask targetted questions

dim cradle
fast osprey
#

Then don't? Thonk

barren plover
#

want to make a bot somone

gritty inlet
#

Lua is soomewhat similar to Python, especially in the aspect of being a high level dynamic language. If you ask me, choose one and stay with it.. Your choice

dim cradle
dim cradle
gritty inlet
#

It's possible in either

dim cradle
#

but i need help

#

i pay well\

gritty inlet
#

I don't think learning the basics of Python is something worth paying for

fast osprey
#

Also asking for or offering paid work is against the rules of this server

#

if you want to hire a tutor, do it elsewhere

barren plover
#

need a cord

stark ingot
#

py-

broken fjord
#

Need some advice, the bot sometimes sends logs as LTC when it's not ltc, and someotimes usdt when its not its weird, anyone know why ?

stark ingot
#

That is very likely a issue with your code, we wont be able to help without seeing the code that handles that

dim cradle
#

not like real money robux tho

finite salmon
fast osprey
#

<@&831776746206265384>

celest pelican
#

!compban 1412796450986786927

unkempt canyonBOT
#

:x: According to my records, this user already has a ban infraction. See infraction #107019.

coral flicker
#

!compban 1412796450986786927

unkempt canyonBOT
#

:x: According to my records, this user already has a ban infraction. See infraction #107019.

gritty inlet
#

Lol that one is flagged as spammer

fast osprey
#

Do you have a question?

timber dragon
#

Do you?

burnt quiver
#

Do I?

fast osprey
#

Someone was spamming tags earlier which I guess self delete here

timber dragon
#

Ah lol

gritty inlet
finite salmon
#

inside your init before anything else

gritty inlet
#

thumbsup alright

burnt quiver
#

🤨

#

!docs super

unkempt canyonBOT
#

class super``````py

class super(type, object_or_type=None, /)```
Return a proxy object that delegates method calls to a parent or sibling class of *type*. This is useful for accessing inherited methods that have been overridden in a class.

The *object\_or\_type* determines the [method resolution order](https://docs.python.org/3/glossary.html#term-method-resolution-order) to be searched. The search starts from the class right after the *type*.

For example, if [`__mro__`](https://docs.python.org/3/reference/datamodel.html#type.__mro__) of *object\_or\_type* is `D -> B -> C -> A -> object` and the value of *type* is `B`, then [`super()`](https://docs.python.org/3/library/functions.html#super) searches `C -> A -> object`...
burnt quiver
#

there

zealous moss
#

i still dont understand the new components v2

#

What is a section and how can I place textdisplay inside

woeful hill
#

You instantiate one with str or TextDisplay inside, and add a required accessory (thumbnail/button)

zealous moss
#

Bc what I want basically is the seperator between my texts

woeful hill
#

Then you put the TextDisplay inside the Layout View

#

Or inside container if you are using it

fast osprey
#

Most of these things are Items, and Items are interchangeable. A LayoutView is just a list of Items. One of those Items can be a Container, which itself contains a list of Items. One of those could be a Section, or a TextDisplay, or a MediaGallery, etc etc

#

One item is a Separator, which is a visual break between the items above and below it

unkempt canyonBOT
#
Available tags

Ā» args-kwargs
Ā» async-await
Ā» blocking
Ā» botvar
Ā» class
Ā» classmethod
Ā» codeblock
Ā» comparison
Ā» contribute
Ā» customchecks
Ā» customcooldown
Ā» customhelp
Ā» dashmpip
Ā» decorators

unkempt canyonBOT
#
The `dict.get` method

Often while using dictionaries in Python, you may run into KeyErrors. This error is raised when you try to access a key that isn't present in your dictionary. Python gives you some neat ways to handle them.

The dict.get method will return the value for the key if it exists, and None (or a default value that you specify) if the key doesn't exist. Hence it will never raise a KeyError.

>>> my_dict = {"foo": 1, "bar": 2}
>>> print(my_dict.get("foobar"))
None

Below, 3 is the default value to be returned, because the key doesn't exist-

>>> print(my_dict.get("foobar", 3))
3

Some other methods for handling KeyErrors gracefully are the dict.setdefault method and collections.defaultdict (check out the !defaultdict tag).

frail trellis
#

Anyone able to help me build a custom discord bot?

scarlet tiger
jaunty cape
#

Is discord.py’s components v2 stable as of lately

fast osprey
#

It is on a stable released version yes

zealous moss
#

Hi

#

How do I know when a user has executed the help command

#

And it will run a code for me

finite salmon
zealous moss
finite salmon
#

You'll have to use on_mesage event and see if the specific bots message is a help command or not

#

And different bots have different types of help message so you'll have the parse the message or the embed and check for some keywords that it could be a help command

static shale
finite salmon
#

For what?

#

Learning python?

static shale
#

Yes.

finite salmon
#

Sure ig

#

Idk

static shale
#

Where did you learn from?

finite salmon
#

I'd recommend Corey Schafer for python tutorials, anthonywritescode for type annotations and some important concepts and arjan codes for python tools and stuff

#

!res you can also check this out

unkempt canyonBOT
#
Resources

The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.

zealous moss
#

if message.interaction.command == ā€œhelpā€?

finite salmon
#

Oh yea you can check from the command name too

#

It'd be message.interaction.name

#

But you'll have to check if interaction is not None before accessing the name attribute

woeful hill
#

why do you need to listen to other bot's interaction tho

west hare
#

I have an auth question (auth on bot website using Discord account).

After I make login, from an API I can request User object from the obtained token.

Now that I have authorization and visit any other authorized pages I can verify user authorization, a typical way for a regular API with local DB would be getting User object from DB and do all checks on each API request endpoint, but I think using same approach for Discord would be unwise as there may be some rate limits. How do you handle that? Do you save user object to local DB and reuse it indefinitely? Or cache it temporarily (e.g. for 1 hour)? Or something else?

fast osprey
#

What is your actual goal here?

west hare
#

It's quite simple, well for the first visit on page I may need to show user name (when logined, on frontend). As to something advanced let's say user send to API POST request to change some setting, then I first need to verify that this auth is valid, that user is on the server and that user have moderator/admin permissions.

gritty inlet
#

Are you asking how to handle an authorized user's data considering that it may change?

fast osprey
#

You're being intentionally vague here. What is "some setting"? What are users actually interacting with? A web page? What sort of volume of users are you dealing with?

gritty inlet
#

As of the guild permissions part, if the bot is in that guild and has the right intents, you could update your saved data on member edit or such

fast osprey
#

Generally it's pointless to try to mirror discord's state in your own db/persistence. you can ask discord for the most accurate state at any time, and if you're in a spot where rate limits or network io become an issue you should have a connected gateway bot that'll cache that for you

west hare
fast osprey
#

"Some checks" like what

#

This is a much more straightforward conversation if you actually describe what you're trying to do

gritty inlet
#

You want to ensure user has right permissions, otherwise they won't have access to a certain part of a dashboard?

west hare
#

yes

fast osprey
#

It depends if you can get the information you need solely from oauth grants from the user

fast osprey
#

You can run a gateway bot to manage a cache of information for you, but I really suggest you don't overengineer to avoid rate limits you haven't actually hit

west hare
#

It just think about it, if user open dashboard and start clicking on settings, visiting other part of the settings, all GET/POST request have to be checked. It's one thing if it only me locally testing perms and requesting user on each API request, but I think for general users when there will be too much it may be a problem.

#

Even just something like GET current settings for server of specific ID I would need a check for a user ID and if it is in that server first, then do the same on any POST/PUT/DELETE requests as well

fast osprey
#

And how do you know that's a problem? Or are you assuming it will be?

west hare
#

That's why I asking it here if there people who done it and have an experience with this

#

right now I only in the development phase

#

and only testing things locally from my perspective

fast osprey
#

As a rule of thumb I highly suggest not solving problems you don't have

west hare
#

but before it goes public I have to make sure I give all proper precautions

#

if I would hit a rate limit that would just mean that user wont be able to load page or changed settings wouldn't save

#

right now I don't know how high or low limit for this would be

fast osprey
#

You can make that request yourself and discord will tell you what the limit is

#

This is documented on the rate limits page in their dev docs

#

The simplest answer is to make that check during the oauth flow and attach it to the session you store, any web framework worth its salt would give you some kind of session mechanism

#

This depends on if you care whether or not those things change during a session or if you really need accurate state on every single request

west hare
#

make that check
This can't be the same as login and checking different permissions based on endpoint

#

the first thing that login will do is only allow me to get user name to show on frontend and getting bot & user guilds that I can list which can be opened to change bot settings

fast osprey
#

You can cache whatever you want to. Again, what do you mean by "different permissions"

west hare
#

but let's say that user have guilds 111 and 222 which he can edit settings, but he open page with ID 333 which bot in, but user doesn't have permissions to change settings there. obviously this is where I need to do this check, upon request of that endpoint

fast osprey
#

What determines this permission?

west hare
#

I was thinking the cache as well, this is what I suggest myself

#

user roles

#

if user have admin/mod perms

#

and admin have more settings that mod have

fast osprey
#

This honestly sounds like complete overkill to do this through oauth when it could just be done in platform