#discord-bots

1 messages · Page 416 of 1

fast osprey
#

Yeah shouldn't give advice based on aesthetic vibes

gritty inlet
#

Yep

#

But yeah might wanna consider moving to slash commands

radiant shuttle
#

hi

i have some custom emojis that looks small but are in max discord re s 128x128 ,can i make them bigger somehow in the embed?

radiant shuttle
#

description

gritty inlet
#

You could use headers (#) to make them bigger, but that'd also affect the other text in that line

#

There's no other way really, not that I know of

radiant shuttle
#

its too small

#

this line have no other texts

gritty inlet
radiant shuttle
#

let me see

gritty inlet
#

There's #, ## and ###
The first one being the biggest

#

Normal vs #

radiant shuttle
#

looks good let me try

#

but doesit work for custom emojis too?

gritty inlet
#

Yeah

radiant shuttle
#

cool worked ty

gritty inlet
#

🙏🏻

gritty inlet
#

Gotta love a good memory leak

#

I'm assuming it's a leak cuz I have no idea where allat would come from, was struggling to figure that out
Probably a module, I'll try to check deep

fast osprey
#

Memory profilers exist

gritty inlet
#

I tried pympler

sturdy dragon
#

Guys, what is the proper / best way to get context from a discord interaction when Im using hybrid commands?

#

the main issue I am having is that I need to defer interactions, but it seems I cant defer interactions related to hybrid commands

patent hull
#

you can

#

!d discord.ext.commands.Context.defer

unkempt canyonBOT
#

await defer(*, ephemeral=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Defers the interaction based contexts.

This is typically used when the interaction is acknowledged and a secondary action will be done later...
gritty inlet
rugged shadow
gritty inlet
drifting arrow
#

🤔 How do I get my bot to join a voice channel and start streaming?

fast osprey
#

Bots can only play audio, they can't stream video if that's what you mean

glacial grail
#

who need bot?

stark ingot
#

Me, that's why I make one

gritty inlet
radiant shuttle
#

sry guys i little out of content but can anyone tell me how can i get the developer badge in discord

#

i already have a verified discord bot

gritty inlet
#

(Also that's the requirement for maintaining the badge - yes you can lose it otherwise)

radiant shuttle
#

oh so it will be automatically

gritty inlet
#

Yes. When I got it, iirc, I eventually had a popup on the developer portal to claim it. Dunno if it changed since

radiant shuttle
#

okay thank you

junior breach
#

is it possible to create a bot that notifies us when a new discord quest is available?

gritty inlet
junior breach
gritty inlet
fast osprey
#

Which would be against discord tos

radiant shuttle
#

also how can i add this?

stark ingot
#

Discord adds it automatically when your bot is verified, has enough usage, and you have global commands with no default permissions

gritty inlet
#

That's an assumption at least (to be exact -> "enough usage" isn't defined)

radiant shuttle
#

what do you mean with default permissions

woeful hill
#

Everyone role can use it

stark ingot
#

default_member_permissions to be exact

tender bobcat
gritty inlet
#

What's a good way of chunking many servers (including a bunch of large ones) without hitting the gateway rate limit

fast osprey
#

The library you're using should prevent you from hitting the limit

gritty inlet
#

Hmm because someone I'm talking to gets these

#

It happens on startup
Also checked his code and no excessive/at all requests from gateway

#

So I assumed it's the chunking

fast osprey
#

yeah that's a warning, not an error

gritty inlet
#

Well he's getting rate limited and that's not a good thing either way

lavish thicket
#

Bot!?

fast osprey
#

I think you're misunderstand what "getting rate limited" means

#

This message specifically means the library is preventing you from exceeding the limit. It's letting you do things as fast as discord itself is saying you should. It's not a problem

gritty inlet
#

Alright thanks

dry kernel
#

hi

tender bobcat
burnt breach
#

you can make multi line strings using triple quotes, eg.

msg = """
  your multi-line string here
"""

no need for the msg +=

autumn tendon
#

Can anyone help me create a bot on Discord?

fast osprey
#

Where are you stuck?

gritty inlet
#

How do I get the inputted text of input_text in on_submit? 🤔

burnt quiver
gritty inlet
#

Whoops

#

Thanks

primal briar
ripe mantle
#
import requests
import customtkinter as ctk

def send_msg(username,content,discord_webhook,avatar_url,respond_label):
    data={
        "content":content,
        "username":username,
        "avatar_url":avatar_url
    }
    if not discord_webhook.strip(".") or not "discord" in discord_webhook:
        respond_label.configure(text="No webhook provided",text_color="red")
        return
    try:
        response=requests.post(discord_webhook,json=data)
        if response.status_code==204:
            respond_label.configure(text=f"Message sent succesfully, status:{response.status_code}",text_color="green")
        else:
            respond_label.configure(text=f"Failed to send message:{response.status_code}",text_color="orange")
    except AttributeError:
        pass
def create_gui():
    root=ctk.CTk()
    root.title("Webhook sender")
    respond_label=ctk.CTkLabel(root,text="No message sent yet",font=("",20))
    respond_label.grid(row=0,column=1,columnspan=2,pady=10)

    ctk.CTkLabel(root,
                 text="Discord webhook:",
                 font=("",15)).grid(row=1,column=0,pady=15,padx=10)
    
    ctk.CTkLabel(root,
                 text="Content:",
                 font=("",15)).grid(row=2,column=0,pady=15,padx=10)
    
    ctk.CTkLabel(root,
                 text="Username",
                 font=("",15)).grid(row=3,column=0,pady=15,padx=10)
    
    ctk.CTkLabel(root,
                 text="Avatar Url:",
                 font=("",15)).grid(row=4,column=0,pady=15,padx=10)

    Discord_webhook=ctk.CTkTextbox(root,
                                   width=120,height=90)
    Discord_webhook.grid(row=1,column=1,pady=15,padx=10)

    Content=ctk.CTkTextbox(root,
                           width=120,height=90)
    Content.grid(row=2,column=1,pady=15,padx=10)

    Username=ctk.CTkTextbox(root,
                            width=120,height=90)
    Username.grid(row=3,column=1,pady=15,padx=10)

    Avatar=ctk.CTkTextbox(root,
                          width=120,height=90)
    Avatar.grid(row=4,column=1,pady=15,padx=10)

    button=ctk.CTkButton(root,
                         text="Send",
                         width=200,
                         command=lambda:send_msg(Username.get("1.0","end-1c"),Content.get("1.0","end-1c"),Discord_webhook.get("1.0","end-1c"),Avatar.get("1.0","end-1c"),respond_label)
                         )
    button.grid(row=5,column=1,pady=15,columnspan=4,padx=10)
    root.mainloop()
create_gui()```
#

So not exactly a bot but its discord related, what could i add tho

#

or improve

#

(webhook sender btw)

fast osprey
#

You can use any of the popular libraries to simplify webhook usage dramatically

ripe mantle
fast osprey
#

Have you tried using the webhook utilities in a discord library?

tender bobcat
#

I don't think it's necessary for such project to install a large dependency

stark ingot
#

It is only a couple of lines to send a webhook, you dont need an entire library for it

#

I do recommend following formatting conventions tho
Such as snake_case for variables and a = 5 instead of a=5

gritty inlet
#

And spaces after commas xD

ripe mantle
#

Yea ik my code is hard to read 😭

fast osprey
tender bobcat
#

more readable
There are 17 line
There are literally no reason to download a whole library for it.

radiant shuttle
#

is possible to embed a mp4 ?

#

i mean to use it into the embed

woeful hill
#

no

timber dragon
#

Use cv2's MediaGallery in a Container

turbid karma
#

how do people cluster their bots

turbid karma
timber dragon
#

Yes images and gifs

fast osprey
timber dragon
#

Webhooks are entirely separate too from the main library too if we talking about discord.py & forks

hasty estuary
#

I dont know how to code a discord bot, can someone help me?

burnt quiver
#

do you know the basics of python?

hasty estuary
burnt quiver
burnt quiver
#

huh

#

uh you'd to need first make a bot lol

#

then find a vps/self-host

hasty estuary
#

My problem was it only runs for like 5 minutes

#

Then disconnects and goes offline

gritty inlet
#

Any errors you got?

hasty estuary
#

No, it automaticaly disconnects , idk how to run it 24/7, idk anything about hosting servers

#

Or getting any domain

gritty inlet
#

You'll have to learn in some way idk I self host for example

#

On a Raspberry Pi

woeful hill
#

you need to have a way to keep the process running

hasty estuary
gritty inlet
#

Gotta love mobile man skulgif

#

Well it makes sense because there's a whole bunch of spaces to each side

primal briar
gritty inlet
#

🙏🏻

glad cradle
#

I'll try to find it

tender bobcat
fast osprey
#

Define "very large"

#

I never said it was necessary either but continue putting words in my mouth

tender bobcat
#

I didn't say you say necessary
I just say it's unnecessary

#

And pointless

tender bobcat
fast osprey
#

Okay we both agree it's unnecessary. Just like making raw requests is unnecessary. So your point?

fast osprey
timber dragon
#

!

tender bobcat
tender bobcat
#

This is like saying:
I need to install numpy because I need to add 10 to each value in the array

fast osprey
#

You can do literally anything without dependencies

#

that's just a meaningless argument

#

The dependencies are useful when they meaningfully abstract away tedious or unnecessarily complicated code. Knowing the headers that discord expects and the json format they want you to send absolutely qualifies. I'm really confused why you think downloading a few mb of a library is like some herculean feat that needs to be avoided unless it's absolutely necessary

tender bobcat
# fast osprey The dependencies are useful when they meaningfully abstract away tedious or unne...

In this case, it doesn't meaningfully abstract away the tedious or unnecessary complicated code. You just move to knowing how to make a http request to knowing how a library works
This doesn't make it easier, it in fact makes it harder

This is similar to my argument, here

I need to install numpy because I need to add 10 to each value in the array

Yes, it abstracts away that you have to write a function map etc.
But clearly it is easier to just do it without numpy and having to research about it

tender bobcat
fast osprey
#

I'm not ignoring that. Using the webhook utilities from one of these libraries is a 10 minute exercise

#

It was just a suggestion and not an assertion that this this the only way to do it, you're reading way too much into this it's really not that deep

gleaming copper
#

Yo can ayone teach me please

#

Like tutor. me

tender bobcat
#

You would be unlikely to find anyone with sufficient skill and willing to dedicate a long time to teach you for free

The best way to do it is basically:

  • Self learn it yourself, many people do it this way
    • As some suggestions given by other user, such as cs50p which is free, the documentation of python is also free. There are other service doing similar thing that might require to pay, but is entirely optional and most people don't when taking this path
  • Learn it at school
  • Pay some tutor service outside of the server (note that asking to/for pay is not allowed in this server)
slate swan
#

is there anybody here that hosts in discloud ?

fast osprey
#

Anything that markets itself as a "bot host" is a scam. "Bot hosts" don't exist

fast osprey
#

IMO yes, I would only recommend using reputable hosts that very clearly describe what they're selling you which is just a rented Linux box

prisma ferry
#

Any free bot devs in here?

fast osprey
#

As in you want someone to spend their time to make something for you for free?

scarlet tiger
calm sage
#

Hello guys,I want to code a Yu-Gi-Oh bot that can give the database of the card I name and rates of it's usage and what decks it's being used,idk where to start so can you help me how I can code something like this?

fast osprey
#

What have you tried and where are you stuck?

calm sage
gritty inlet
#

I assume that's what you're referring to with "database"

calm sage
fast osprey
#

"Website database" miku_what

gritty inlet
calm sage
gritty inlet
#

Mind showing me

calm sage
#

Ofc

fast osprey
#

I mean if the question isn't specifically about discord bots, this isn't the right channel. If your road block is getting this data, it's not even a python problem

gritty inlet
#

Anyway that website doesn't seem to have an API

calm sage
#

Well I wanted to code discord bot for it so I don't have to keep changing tabs between discord and my web browser

#

So I can't use it as my website database?

fast osprey
#

"Website database" isn't a term

gritty inlet
fast osprey
#

You'll need to first find a way to access the data you want in a digestible, reliable way. That may or may not exist

calm sage
#

How can I do that?

fast osprey
#

By googling and asking people I guess

calm sage
#

Oh, alright. I'll do that then

#

I was hoping to get the answer here but I guess maybe my request is out of reach

gritty inlet
#

Ok they have an API

#

Undocumented

calm sage
#

Is that even possible?

gritty inlet
calm sage
#

Oh

gritty inlet
#

Now I'd love to help with it, but that endpoint returns a number which I have no idea how to use

fast osprey
#

If they're not publishing an API, they probably don't want you using it

fast osprey
#

begone crypto bro

young dagger
#

Do you defer responses if they might (very rare) take more than 3 seconds? Or is there a better way to handle this?

fast osprey
#

Depends on what's causing it to take that long

blissful crane
#

It feels like often there is no in-between, the thing you're doing is either instantaneous or will take too long. Is the reason it sometimes takes more than 3 seconds an edge case?

tender bobcat
#

I almost always defer the response personally

young dagger
#

I guess the issue is with the database

#

Since the order goes:

  1. API
  2. Database
  3. Response
stark ingot
#

I personally always defer API requests, DB requests and filesystem calls (if i had any)

#

I think the important thing with defer is to make sure to still respond with an error if something fails (when possible)

young dagger
#

(otherwise it would go to the error handler)

stark ingot
#

Can you explain more? Do you have a separate timeout handler for the API call?

fast osprey
#

This is an external, not discord api? Then yeah defer, you have no guarantees on how long it'll take.

The rule of thumb I've heard that I agree with 99% of the time is that your interaction response should be your first await

tender bobcat
#

agree

young dagger
#

No timeout handler for either API or DB

tender bobcat
#

and if this got longer than 3s when interaction response is the first await, then you got a bunch of thing to fix probably

young dagger
#

I was thinking about that too (putting the interaction response first) but then, if it failed along the way it would give the wrong impression to the user

stark ingot
#

You could respond, then edit with an update status

young dagger
#

I need to call the API first before responding

fast osprey
#

or defer and apply a timeout yourself?

#

!d asyncio.wait_for

unkempt canyonBOT
#

async asyncio.wait_for(aw, timeout)```
Wait for the *aw* [awaitable](https://docs.python.org/3/library/asyncio-task.html#asyncio-awaitables) to complete with a timeout.

If *aw* is a coroutine it is automatically scheduled as a Task.

*timeout* can either be `None` or a float or int number of seconds to wait for. If *timeout* is `None`, block until the future completes...
young dagger
#

Is it a good practice to combine asyncio.wait_for + gather?

    # Task 1
    summoner_task = client.get_lol_summoner_v4_by_puuid(region=selected_region, puuid=fetched_puuid)

    # Task 2
    match_task = client.get_lol_match_v5_match_ids_by_puuid(
        region=selected_region,
        puuid=fetched_puuid
    )

    summoner, match_ids = await asyncio.wait_for(
        asyncio.gather(summoner_task, match_task),
        timeout=5
    )
tender bobcat
#

!d asyncio.gather

unkempt canyonBOT
#

awaitable asyncio.gather(*aws, return_exceptions=False)```
Run [awaitable objects](https://docs.python.org/3/library/asyncio-task.html#asyncio-awaitables) in the *aws* sequence *concurrently*.

If any awaitable in *aws* is a coroutine, it is automatically scheduled as a Task.

If all awaitables are completed successfully, the result is an aggregate list of returned values. The order of result values corresponds to the order of awaitables in *aws*...
tender bobcat
#

nvm

fast osprey
#

you'll want to try/except that since the timeout throws an exception, but yeah I think that should be fine?

#

or just

#

!d asyncio.wait

unkempt canyonBOT
#

async asyncio.wait(aws, *, timeout=None, return_when=ALL_COMPLETED)```
Run [`Future`](https://docs.python.org/3/library/asyncio-future.html#asyncio.Future) and [`Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task) instances in the *aws* iterable concurrently and block until the condition specified by *return\_when*.

The *aws* iterable must not be empty.

Returns two sets of Tasks/Futures: `(done, pending)`...
calm sage
calm sage
gritty inlet
#

It's pretty much mandatory if you do an API call

#

For me at least

gritty inlet
#

If I want to access the view's message (for example to edit it in on_timeout),
Do I just do something like:

msg = await interaction.original_response()
view = MyView(msg.id)```

Or is there a way that doesn't require doing that call?
vale vortex
#

does anyone know a site where i can host and code my bot for free?
can‘t pay for ghostbot

burnt quiver
calm sage
#

i got another ygo website that has the same web database i need if it's helpful i can post it here to check for it's api

fast osprey
#

Perhaps contact the service owner to ask them if/how they'd like you to access their data?

young dagger
calm sage
gritty inlet
#

Do I have to call view.stop() manually if I override the on_timeout?

fast osprey
#

Nope

#

At least I don't think so Thonk

burnt quiver
#

nah

#

actually idk

#

tias

fast osprey
#

Can look at the source real quick and see if the base on_timeout does anything

gritty inlet
#

Nah just pass

#

Hmm but if just pass, then how is it supposed to call stop by default? Or maybe it doesn't do that at all?

#

Unless the stop is more internal

fast osprey
#

It is

#

The library removes the view from the store on timeout by default. Stop isn't required, that's just how you do it manually

gritty inlet
radiant shuttle
#

My bot is down because I hit 100 servers and its not have the privileges for . Privileged Gateway Intents

I don’t know what to do with this form can anyone help me

gritty inlet
#

Click the button

#

I believe the instructions there are clear enough

#

Unless this specifically is what you wanted help with ("form")

fast osprey
#

What do you mean down? You shouldn't be able to go past 100 unless you intentionally verified, that's the point where you'd lose intents

timber dragon
#

Or just disable the intents as you probably don't need them

gritty inlet
#

I was wondering; can I access member.activities with just Presence intent but without Member intent?

timber dragon
#

Yes you can

#

You get the members with presences

gritty inlet
#

Funny that I got just one command that needs presence intent, no idea if I'll get approved

timber dragon
#

Probably not if it's a built in feature

gritty inlet
#

Well yeah it is, I'll either move that command to a tiny private bot or idk 😭

#

So I'm assuming the member won't be None if I have presence intent?

timber dragon
# timber dragon Or just disable the intents as you probably don't need them

There are 3 and they're included in .all():

  • message_content: gives access to Message.content, .components, .attachments and .poll, required for prefix commands
  • presences: gives access to Member.activities and .status
  • members: controls members cache and required for having/fetching a full list of a server's members

Slash commands don't require any intents really.

#

It's complicated

#

But it will probably will be None

radiant shuttle
#

I can not enable the because it says

This action cannot be performed because the application has reached its maximum number of servers.

timber dragon
#

Enable what

radiant shuttle
#

I can’t

#

It says this message

gritty inlet
timber dragon
#

You can't do what?

radiant shuttle
#

And his king it takes to verify me after the apply of the form

timber dragon
gritty inlet
#

Yeah that bot won't get approved with such tiny usage of the intent

#

Perhaps I will not give up the game tracker bot so I can have that there xD

timber dragon
#

Yeah I'm pretty sure* you can get it for that

#

Don't give up smh

gritty inlet
#

I like how they did this for a few days and reverted

timber dragon
#

Fr?

gritty inlet
#

Yeah, I already changed some things to use mentions, and woke up to seeing "unknown user"

#

Great work Discord

timber dragon
stark ingot
#

Apparently it was leaking information to places it shouldn't have

gritty inlet
#

I don't really see how, to have a mention you must have that user's ID.
And if you have their ID, you can just fetch

#

No idea how mentions bring a big difference

stark ingot
#

You cant fetch a member you dont share a server with

gritty inlet
#

With their ID you can, I mean /users/id

timber dragon
#

You can literally do that and see the whole profile using the protocol link anyways

gritty inlet
#

Generally?

#

Because you can't use the link with a user you have no mutual servers with (or not a friend with)

timber dragon
#

Oh?

#

Send someone

#

Oh that's blocked here

gritty inlet
#

xD

timber dragon
#

But TIL, you're correct

#

I guess that makes sense

stark ingot
#

Lala said that it was leaking role and permissions data too tho

gritty inlet
#

How fun

vapid parcel
#
    async def vote(self, interaction: Interaction) -> None:```


how to make a command that has no parent be synced to a certain guild again?
#

i only remember groups, i forgot how to do it just for a single cmd

#

i figured it out, mb

pulsar peak
#
auto_react_users = {}

    @client.commmand()
    async def ar(ctx, user: discord.Member, emoji: str):
        auto_react_users[user.id] = emoji
        await ctx.send( f"Auto react with {emoji} enabled for {user.mention}.")

Anyone have the code for AR?

timber dragon
pulsar peak
#

Does anyone know why my Auto react code isn’t working ?

auto_react_users = {}

    @client.commmand()
    async def ar(ctx, user: discord.Member, emoji: str):
        auto_react_users[user.id] = emoji
        await ctx.send( f"Auto react with {emoji} enabled for {user.mention}.")

I don’t see the error in the code thanks

timber dragon
#

Wdym by it doesn't work

#

Where do you use that dict

pulsar peak
# timber dragon Where do you use that dict

its apart of myself bot code im trying to make a command for example

(prefix = ,)
(Ar = Autoreact)

,AR @user {emoji}

When command is active everytime @user messages it will auto react with {emoji}

timber dragon
#

Yeah so how do you do the last part

pulsar peak
#

I cant remember anything of discord python AR is a real thing used in most self bots i just dont know the line for it

timber dragon
#

Ah so that's your question

#

So for that, you need to listen for all messages that your bot can see. You can do that using the on_message event, in that you get a discord.Message which has attributes like .author to get who sent the message and more.

What you need to do is check whether the author's ID (.author.id) is in your dict, and then use the .add_reaction("emoji here") method to add the emoji to that message.

Simple example of how to listen for the mentioned event:

@client.listen("on_message")
async def auto_react_handler(message: discord.Message):
    print(f"{message.author} sent a message in {message.channel} with content: {message.content}")

Note that the event is called for all messages in all your servers, including from bots.

Now you try to implement the auto reaction.

gritty inlet
#

I've been in a server where there was a user auto reacting

#

I also saw a user with chatgpt integrated 💀

#

Every time you mentioned or replied to them or DMd them

#

Apart from that I know a single bot that uses a selfbot for one of its commands

#

As a matter of fact it has a selfbot user in this server, Idk who

warm otter
#

does it necessarily have to be a "self bot"? couldnt it be a bot in the channel firing off for an oauth application executed on behalf of the user?

#

idr but I thought there was a permission for OAuth apps to send a message as the user

gritty inlet
#

Its privacy policy does say it tracks your activity by default and you can turn it off, but it's still very sketchy, and probably against Discord's ToS, wouldn't it be?

warm otter
#

idk, it still sounds like the realm of possibility of being an OAuth app, like if it has the OAuth permission to read all messages for your account I feel like that is enough to track your last seen status

#

if the user sends messages in guilds that seem automated tho, thats very fishy

gritty inlet
#

I've seen a user that that bot tracked but that user never installed the bot

#

But the profile part is most definitely a selfbot, I don't think Oauth2 has a scope for that

fast osprey
gritty inlet
#

Yep

#

What's the character limit in a container? 🤔

blissful crane
#

The limit is 4k characters on the entire view

#

You can have 4k characters inside 1 text display or 2k in 2 text displays, etc

gritty inlet
#

Alright thx

tender bobcat
gritty inlet
#

Decided to use /applications/id/rpc for the description

#

the right side of Recent Games looks very empty but on mobile its good

blissful crane
gritty inlet
#

discord.errors.HTTPException: 401 Unauthorized (error code: 50027): Invalid Webhook Token
Is it trying to edit the message using something like edit_original_response? Is there no way to edit messages after more than 15 minutes?
(context: ui.View)

fast osprey
#

What is self.message?

gritty inlet
#

Now that'd make sense because it probably returns the interaction or something

#

🤔

fast osprey
#

Well the docs will tell you what it returns

tender bobcat
gritty inlet
#

Well I'm kinda lost then, maybe I'd have to use await interaction.original_response ? idk

fast osprey
#

And what does that return?

gritty inlet
#

The original interaction response message.

fast osprey
#

And is your timeout more than 15 minutes?

gritty inlet
#

yes

fast osprey
#

Hrm

#

!d discord.InteractionMessage

unkempt canyonBOT
#

class discord.InteractionMessage```
Represents the original interaction response message.

This allows you to edit or delete the message associated with the interaction response. To retrieve this object see [`Interaction.original_response()`](https://discordpy.readthedocs.io/en/stable/interactions/api.html#discord.Interaction.original_response).

This inherits from [`discord.Message`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Message) with changes to [`edit()`](https://discordpy.readthedocs.io/en/stable/interactions/api.html#discord.InteractionMessage.edit) and [`delete()`](https://discordpy.readthedocs.io/en/stable/interactions/api.html#discord.InteractionMessage.delete) to work...
tender bobcat
#

If it's a ephemeral message (or if your bot don't have permission to read/write message in the channel normally to) there are no way pithink

gritty inlet
#

Yea ik

tender bobcat
#

But otherwise, you could try take the channel id and message id to fetch the messagepithink

fast osprey
#

You could try making a PartialMessage and editing it through that

gritty inlet
#

Couldn't I just save the message's (edit_original_response) id and channel and edit it manually

tender bobcat
#

Also save a call

tender bobcat
gritty inlet
#

message id?

#

thought only interaction token

tender bobcat
#

However, if your bot have permission to, then you can just edit normally using bot power

gritty inlet
#

i never said ill use it

tender bobcat
#

Oh misread

#

Yes you can, this is what we are talking about

gritty inlet
velvet tinsel
fast osprey
#

Has been for years

#

v2.0 was released in 2022

gritty inlet
#

TypeError: expected PartialMessageable, TextChannel, StageChannel, VoiceChannel, DMChannel or Thread not <class 'discord.channel.GroupChannel'> aw man

#

Well fair enough since it's not messageable
Can a bot not edit messages in a group channel?

#

I'll either disable that command in group channels or I won't have (for now) logic for on_timeout that'll work in group channels

tender bobcat
tender bobcat
#

The bot isn't physically invited into group chat

gritty inlet
#

Sorry for ping

#

Wdym by normally

#

I might just add back the on_interaction that responds to expired components..
The only alternative for that specific command would be a dict that stores game sessions by message id or something

I really cant think of anything better lol

tender bobcat
gritty inlet
tender bobcat
#

And in group channel, you cannot do that

gritty inlet
#

Yep

tender bobcat
#

Which therefore this method won't work and restrict so you must send the message within 15mins

gritty inlet
#

ill prolly just disable those commands for group channels

#

idk not a big deal

tender bobcat
#

Or just not update the message?pithink

gritty inlet
#

I really dislike the "This interaction failed", so no

#

It just tells you something wrong happened and as a user you don't know what happened

fast osprey
#

Huh? You don't need to edit a message to avoid failing an interaction

#

If this is for your timeout, you really should consider lowering it under 15 minutes

gritty inlet
#

Hmm would it be right to lower a game's buttons to that

#

Not sure

#

Maybe I can lower it for group channels only, that could work

tender bobcat
gritty inlet
#

Can't just make it not timeout:
If the bot restarts, and it occasionaly does, the buttons will stop working

young dagger
#

DynamicItems?

gritty inlet
#

I have the option of converting it to dynamicitem and using a game session dict but for now I dont want to do that

solid apex
#

anyone know this issue?

woeful hill
#

you ran a python file

#

Or you want us to imagine the file content?

solid apex
#

it usually says smth like
“running moderation bot”

gritty inlet
solid apex
woeful hill
#

Are we in a guessing game of what happened

#

We dont have access to the file content like you do

solid apex
#

like im lwk lost

young dagger
solid apex
unkempt canyonBOT
#

Please react with ✅ to upload your file(s) to our paste bin, which is more accessible for some users.

young dagger
unkempt canyonBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

solid apex
#

baalright

timber dragon
#

Your token and probably also the run stuff are indented inside the command

young dagger
#

bot.run(TOKEN)

timber dragon
#

This won't ever run the bot:

@...
async def lol(...):
    ...
    TOKEN = ..
    ...

You probably meant to do:

@...
async def lol(...):
    ...

...
TOKEN = ...
bot.run(TOKEN)
timber dragon
#

No

#

Just indent the run stuff back once and add bot.run

young dagger
timber dragon
#

That won't work...

solid apex
#

still nthn

timber dragon
#

Indent everything from the first # till the end back once

    TOKEN = ...
    bot.run(TOKEN)

TOKEN = ...
bot.run(TOKEN)
young dagger
#

^^ Try this

timber dragon
#

Man

#

Can't you just let them do it themselves..

#

And actually learn something from it

#

No they shouldn't copypaste anything

#

Mine is filled with placeholders on purpose

solid apex
#

oh shit

timber dragon
#

Ah yes now they're back with another error because you have them the full solution

solid apex
#

i fixed the indent "accidental space" now this

timber dragon
#

Gotta install the package

#

python-dotenv

solid apex
#

and were back where we started chat

gritty inlet
#

Please make sure your bot.run is on global level !

#

Not inside an async function

#

It's that simple thumbsup

solid apex
#

sooooo what i do

gritty inlet
#

Do you know what global level is

#

Indent it back

solid apex
gritty inlet
#

Select your bot.run and do shift + tab

ornate wolf
#

@solid apex out of curiousity, do you know basic python?

timber dragon
#

You gotta learn python

#

Indents are really important in Python

gritty inlet
#

xd

ornate wolf
#

if you dont know basic python syntax etc, its not a great idea to instantly get into discord bots

gritty inlet
#

When you run or import a file - everything on the global level (indented as back as it can be) is being run

timber dragon
#

But why would they learn python now when someone is spoonfeeding the exact code they need and they can come back here for more.. amazing isn't it

gritty inlet
#

(Also for that reason using an if __name__ == "__main__" check is necessary sometimes)

young dagger
gritty inlet
timber dragon
#

Fml

gritty inlet
#

I like how you want to help them, but just sending the code for them will make them less independent

ornate wolf
#

oh i remember when i also used to beg for spoon feeding when learning lua 😭

gritty inlet
#

Only one I ever did that with was chatgpt

gritty inlet
#

💀💀💀

gritty inlet
#

But I'm not going to argue about this

ornate wolf
young dagger
#

Hopefully they will learn from it

timber dragon
#

That's how it works

fast osprey
#

People have 0 incentive to learn if you spoonfeed them

#

Literally why would they

wintry elbow
#

Hi guys I am new to python
So can u give me some introduction to it

ornate wolf
#

watch some sort of tutorial

#

for me personally i enjoyed watching brocode

fast osprey
#

*read

timber dragon
ornate wolf
#

his tutorials are quick and easy

ornate wolf
fast osprey
#

It's not preference. This has been studied and proven wrong

#

Only reason why one would respond to videos more is attention deficit issues

ornate wolf
#

mhm

wintry elbow
#

Ty I will watch some videos

fast osprey
#

Yes, they have debunked the concept of "visual" learners or any other kind of learning type. The correct medium depends on the nature of the content, not the person receiving it. Ironically, veritasium has a very good video summarizing the studies

#

Any preference someone has for a medium regardless of the content stems almost exclusively from tiktok brainrot attention issues

young dagger
ornate wolf
#

why have you sent it twice?

stark ingot
#

I wonder why the majority of in-school teaching is done in a modal that combines elements of live/video learning and self paced learning.

ornate wolf
#

Because it works

fast osprey
#

Mixed media approaches tend to be the most effective, pivoting as the nature of the current material changes

young dagger
young dagger
timber dragon
#

I don't agree with the AI part

fast osprey
#

AI is an utter dogshit learning resource

young dagger
#

AI is the future

fast osprey
#

Okay, so is the sun exploding

young dagger
#

There is good stuff too

#

You could get that same stuff by just googling

fast osprey
#

It is as a learning resource. I've worked in applied AI in the industry

#

In its current state, generalized models are really only suitable for augmenting existing expertise

young dagger
#

Obviously I never meant to rely solely on AI or google

fast osprey
#

It provides nothing that other methods would besides the potential for misdirection. If you need to fact check everything AI says, why are you bothering it in the first place

young dagger
#

Simply because you ask, and you get direct answers

fast osprey
#

And if those answers are wrong? You're either checking everything or just hoping it's right

#

The whole point of learning is that you don't know the thing you're learning. That's why I said it was dogshit for learning specifically

young dagger
#

That is why you use it as a tool, not a replacement for everything you do

fast osprey
#

Right but....if you're learning, how do you know how to use a tool

#

That's like giving a baby a knife, which is a tool but just because it could use it right doesnt mean it will

young dagger
#

It's better to learn with a match than a bonfire

fast osprey
#

Or you could just use a resource that is vetted, peer reviewed, and accountable

tender bobcat
#

I would say context dependent, if it's python (builtin+stdlib) then it probably is fine, but if it's stuff that is more specific, you probably should use the specific resources than AI

gritty inlet
#

I tend to use AI from time to time when, for example, I need ideas on how to implement this and that, or features to consider making

#

But not for making the whole code for me

#

Which is what I did at the beginning and ended up with an unoptimized bot with confusing code

drifting tartan
#

hello i whant to do an signal bot for trading but i am an noob at this, can i please get some help***

fast osprey
#

Where are you stuck, specifically?

sick birch
stark ingot
#

In this channel or in this server?

young dagger
#

I guess in the server

sick birch
#

we don’t have a dedicated channel for signal bots so not this channel

#

i should have clarified, sorry

left geyser
#

I'm French, can you help me remove the yellow highlights? Please tell me in PM.

fast osprey
#

The yellow lines don't matter

#

Run your code and see if you get an error

tender bobcat
gritty inlet
#

Venv isn't necessary for making it work

#

Unless they intentionally want to use it

tender bobcat
#

I would imply it's used unless they say no

finite salmon
#

It's always better to use venvs

gritty inlet
#

Have never said otherwise, it's besides his question anyway

ornate wolf
wooden basalt
#

hey

#

was wondering if someone could help me integrate my website to a discord bot

#

e.g the website sends info to the bot so it can log it

fast osprey
#

why would a bot need anything to log in

gritty inlet
#

Wouldn't recommend doing that, at most logging amounts of people

wooden basalt
#

yes

wooden basalt
wooden basalt
gritty inlet
#

Log users' passwords??

#

For what purpose

#

You only need to save such information safely in a database

wooden basalt
#

by me i mean a alt account

gritty inlet
#

Still, never ever log a user's password in Discord..

#

Or anywhere that's unnecessary

gritty inlet
wooden basalt
#

i would like to log it the thing is in the website i dont offer anything of monetary value

#

there is no reason for anyone to hack anyone

#

and no reason 4 anyone to breach it

gritty inlet
#

Not going to help you with this, sorry

wooden basalt
#

alr np

fast osprey
#

The flow you're describing is incredibly vague

tender bobcat
vocal plover
#

Just a point on

You only need to save such information safely in a database
and
Still, never ever log a user's password in Discord..
Or anywhere that's unnecessary

Don't log passwords, don't store passwords, ever, with the one exception of if you're making a password manager. If a user gives you a password it shouldn't end up anywhere - logs or a database - until it's salted and hashed, there's no reason a plaintext password should be anywhere other than in-memory briefly while converting it to a secure format (i.e. an argon2 hash)

gritty inlet
fast osprey
#

really anything that purports to handle credentials in the context of a discord application is a massive, massive red flag. Either you lean on discord for users to authenticate, or if you're using other services there should be an oauth flow. You shouldn't be handling user credentials ever in this context

young dagger
#

!pypi argon2-cffi

unkempt canyonBOT
dusk pelican
#

I think the passwords are not stored in plain rather hashed with an algo.

gritty inlet
high kite
young dagger
high kite
young dagger
#

If you really need use slow hashing algorithm

severe field
#

discord.py v2

from discord import Interaction
from discord.ext import commands
from discord.utils import maybe_coroutine
class BasicCog(commands.Cog):
    def __init__(self, bot: commands.Bot):
        self.bot = bot

    async def interaction_check(self, interaction: Interaction):
        check = await maybe_coroutine(super().interaction_check, interaction)
        # custom code to check and return if False 
        return check

my type checker goes insane. What is the proper way to override interaction_check method?
issue is Return type mismatch: base method returns type "bool", override returns type "CoroutineType[Any, Any, bool]"

should i just remove async?

gritty inlet
fast osprey
#

Interaction_check returns a bool. The base interaction_check doesnt do anything so why would you call it?

severe field
patent hull
#

what would override it

severe field
#

me? like literally right now. i think i should ignore the error

fast osprey
#

You don't need to prepare for a hypothetical situation only you could bring about

#

Otherwise you're going to continually introduce unneeded spaghetti code

#

(Like calling a base method that doesnt do anything by design)

sick birch
patent hull
torpid cedar
#

yo i have a question with discord.py i want to make my own discord bot, but how can i get the message that another message replied to?

#

like message.reply.content

#

how do i do it

burnt quiver
#

!discord.Message.reference

#

fuck

torpid cedar
#

aight man thanks

#

i already solved the problem though with another method

#

thx

young dagger
#

Can you defer when using modals?

fast osprey
#

Depends on what you mean and which step

young dagger
#

I want to defer and then send a modal with the same interaction

woeful hill
#

why do you want to defer sending a modal

young dagger
#

Because I’m doing DB and API calls before sending it

woeful hill
#

what do you do in the api call that need to be processed every time someone interact

young dagger
#

What does that matter?

woeful hill
#

you can send a head up message with a button to call a modal

timber dragon
#

But you can't defer + send modal

woeful hill
# young dagger What does that matter?

because i dont know what is the flow, the modal is depended on the api call result? is the result static? can all of them be simplified to select menu in a view you can send with defer?

young dagger
#

Yes, it's not static

#

It just checks if the user already exists in the DB and sends the model

timber dragon
#

Why does that take more than 3 secs

young dagger
#

It could

woeful hill
#

a sql would not take more than 3 seconds

timber dragon
#

It shouldn't and shouldn't that be checked before the command

young dagger
timber dragon
#

Try it

timber dragon
fast osprey
#

Or just always send the modal and do postprocessing on submit

young dagger
#

I want the check when they click the button and before submitting it

fast osprey
#

I mean you can't wait more than 3 seconds between an interaction and sending a modal. We've given you the options

#

Either send the modal quickly and do whatever after, or gate the interaction that sends the modal in the first place

gritty inlet
#

If you want to have an API call, then really just respond to the interaction (maybe a custom loading message) then check
There really is no benefit of using defer over normal interaction response (from what I know) - it's just about visuals

#

Nvm you meant before opening the modal - then just defer the command response and check, then have a button for the modal..

radiant shuttle
#

hi guys i uploaded a gif to my discord bot avatar and it only shows the first frame , its like image

gritty inlet
radiant shuttle
#

general information

gritty inlet
#

That's only for images, use Bot tab for GIF

#

Either way, have one at the general information tab, but yeah it's going to be static

radiant shuttle
#

ok ty

gritty inlet
#

Not sure if I want to use the presence intent in production

#

The bandwidth consumption is crazy apparently

tender bobcat
#

Hmm, how crazy could it be

gritty inlet
#

For 1 guy I know it got to 3TB a month just from a single large server

#

It's very unfortunate that there is no way to filter out the presence change events

fast osprey
#

There is though?

stark ingot
#

and that is...

timber dragon
#

Probably meant the incoming events, those cannot be filtered

gritty inlet
#

Yes

#

You can't set which events you receive, you will receive presence change for every member accessible

tender bobcat
#

Well, for mine, my bot have about 400-500GiB bandwidth usage per month with a lot of server

gritty inlet
#

Because if it's a music bot then I assume its usage would be high anyway

tender bobcat
gritty inlet
fast osprey
#

Well there's the underlying question of why you need to know what everyone's presence is

raven swan
#

in nextcord i created a loop task but in it after a certain line the code just stops running like i did return

gritty inlet
raven swan
#

!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.

raven swan
#
@tasks.loop(hours=24.0)
async def download_vids_clips():
    clip_urls = []
    for acc in clip_accs:
        clip_urls += scrape_profile(acc)
    clip_urls = filter_urls(clip_urls)

    vid_urls = []
    for acc in vid_accs:
        vid_urls += scrape_profile(acc)
    vid_urls = filter_urls(vid_urls)

    download_clips(clip_urls)
    add_urls_to_processedUrls(clip_urls)

    download_metadata(vid_urls)
    filter_metadata()
    download_videos()
    add_urls_to_processedUrls(vid_urls)
#

i start it with download_vids_clips.start()

gritty inlet
#

Idk what @tasks.loop is, I'd just use asyncio.create_task idk
But that doesn't really matter, probably code error

fast osprey
#

Do you have any logging or debugging to understand what's happening in here?

raven swan
fast osprey
raven swan
#

the print after download_metadata didnt run

#

and anything else didnt

fast osprey
#

Probably hitting an uncaught error

gritty inlet
#

Did you get any error

raven swan
#

no

#

no errors

#

lemme try running the functions by themselves

#

the unran ones

fast osprey
#

That won't necessarily recreate the same conditions

gritty inlet
#

Does your code execute all the way until download_metadata?

fast osprey
#

You should verify that you have proper error logging, and barring that put a try except in here directly

gritty inlet
#

Does download_metadata do API calls

raven swan
raven swan
gritty inlet
#

It should if the code runs all the way til there

raven swan
#

it does webscraping

gritty inlet
#

bs4?

raven swan
#

no

gritty inlet
#

selenium?

raven swan
#

pyktok to download tiktok vids

#

metadata*

#

i think it uses selenium but im not sure

gritty inlet
#

I'd be pretty sure that can block the bot loop

#

Since it fetches stuff

raven swan
#

no the download metadata runs

gritty inlet
#

Yea I know it does

raven swan
#

after that the problem is with the filter metadata

gritty inlet
#

Try running download_metadata alone

raven swan
gritty inlet
#

Does anything after filter_metadata run

raven swan
gritty inlet
#

Can you send its code unless its something sensitive

fast osprey
#

The fact none of this is async is worrying

raven swan
#

im not very experienced in discord bot and async

fast osprey
#

And probably violating tos if you're using a scraper to download videos

gritty inlet
gritty inlet
raven swan
#

so the problem is the funcs not being async?

raven swan
#

and in tasks if theres an error is it silent

gritty inlet
#

It's reaaally weird that you don't get any errors

#

Especially if it's blocking

fast osprey
#

If it is against tos, it's against the rules to help with here

#

So you should probably start with describing what you're doing

raven swan
gritty inlet
#

You might wanna use either official API or even an unofficial one so you'd be "legally safe"
But yea

fast osprey
#

Explain how what were helping with isn't assisting you in violating tos

raven swan
#

they label themselves as an unofficial api

gritty inlet
#

https://business-api.tiktok.com/portal/docs in case you want to check it out (looks like straight buns)

raven swan
#

and they dont give any keys whatsoever

gritty inlet
#

Well I cannot help further than this

raven swan
#

i hate tiktok i wish the videos were on another platform :(

raven swan
#

are errors in asyncio tasks silent

gritty inlet
#

Shouldn't be

fast osprey
#

Maybe start by not making something that violates the terms of the service you're using

gritty inlet
#

Not that I know

fast osprey
#

Okay then what's the service you're downloading videos from?

raven swan
#

pyktok

#

a library

fast osprey
#

That's not a service

raven swan
#

oh

gritty inlet
#

Personally I wouldn't use a package for this purpose

#

Anyway yeee done with this

raven swan
#

yea the issue is with filter_metadata

#

i wrapped it in try except and it works now

fast osprey
#

If tiktok is the service you're pulling videos from, you should read their terms of service

raven swan
#

it skips it

gritty inlet
#

Ngl this was a smart move now I don't have to create a separate client for each file

finite salmon
gritty inlet
#

I knew someone would say this

lavish pollen
#

How to create a discord bot?

lavish pollen
#

What do i need to do to get discort devoloper accses?

stark ingot
fast osprey
#

<@&831776746206265384>

#

🙏

pearl bough
#

ty

jaunty quail
#

is there a job board? im looking to hire someone to help build a discord bot

fast osprey
#

Given #rules number 9, this wouldn't be the place for it

wise vortex
#

Does anyone know how to make these lines and buttons in the middle of the embed like Rythm or other bots?

burnt quiver
#

components v2

wise vortex
blazing summit
#

@jaunty quail
I have good experience in development discord bot, so I can help you.

timber dragon
#

With or without ai

celest briar
# lavish pollen How to create a discord bot?

here is the prompt
open chatgpt login, then go to Code pilot 10x programmers
'Help me make a general full purpose bot for management and stuffs, code it on python and send it on one file simply.'
make your folder, name it whatever u want, make new text document, paste the python code, save as [Botname].py'
make sure u made ur developer portal first and get the bot_token, also remember to store ur token in .env

#

then learn there

lavish pollen
#

@celest briar thank you

celest briar
fast osprey
#

I'm not sure how someone looking to learn would find blatant, unaccountable lying "fun"

stark ingot
celest briar
stark ingot
#

Unfortunately, that is also a really bad tutorial

#

The best thing to do is pick a library and follow their official docs, guide, and examples

fast osprey
#

Oof tutorial literally advocates breaking dev policy as one of its first use cases 😂

stark ingot
#

It's so outdated it does not have intents. Yet still shows up as a top result

woeful hill
#

seo moment

radiant shuttle
#

hi, i want to find the way some bots use the /commands as mentions , is it wasy to do and does it have spam limits or smthing?

fast osprey
#

There's a .mention on the AppCommand object, or you can just format it yourself

#

It's just </command:1234567> where that's the command's id

radiant shuttle
#

ty, one more question , how can i put the buttons inside the embed? not below it

#

like the image

woeful hill
#

It's not an embed

#

Its a container

radiant shuttle
#

new function?

turbid karma
#

for the traditional text based bot with slash commands too, do they still use on_message event in dpy? or commands.Bot

stark ingot
sick birch
#

does discord.py have support for it? i recall seeing a PR a while back but not sure where it's at now

quick gust
#

Yeah it does now, was released a week or so ago

fathom bridge
#

Anyone here experienced with Discord Bot dashboards? Like connecting a Discord Bot to a dashboard.

rotund ridge
radiant shuttle
#

hello , i want to ask how can i use a modal components function with a dropdown menu? can i include a dropdown menu and a description in a modal components function?

#

something like this

stark ingot
#

You must put the select inside a label component

radiant shuttle
timber dragon
#

It's one component per label

#

And you can have up to 5 of those

radiant shuttle
#

ok ty

radiant shuttle
#

components v2 doest support gifs inside?

timber dragon
#

It should?

#

wouldn't it be better to keep the questions in one server

radiant shuttle
merry cliff
#

does ui.LayoutView mean we can have multiple sections each with their own thumbnail

burnt quiver
#

uh that does not mean anything really cuz you can't even use a thumbnail in ui.View

But yes, you can have mutliple sections with their own thumbnail

rain fable
#

YO GUys

#

Suppose i have the code to a discord Bot

#

i user replit for now how do i make it alive 24/7 is there any free alternatives or like its pure pay

woeful hill
#

If you have a credit card google and oracle offers a very small cloud computing instance that would suit a private bot

rain fable
#

ah

woeful hill
#

Aws also have a 12mo micro instance trial

rain fable
#

Like i tried using uptime bot

#

that never worked 😔

#

pretty cool what u can do the bot can

  • send a preview of anyone who pinged u
  • send instant embeds
  • create tickets on command
woeful hill
#

Running a fake web with the bot run under and keep the process online by pinging them is likely tos violation

Replit was actively blocking discord domain before

rain fable
#

ah

#

welp ;<

fast osprey
#

It costs money to run servers

gritty inlet
#

Or you can self host (indirect costs though)

topaz stratus
#

you don't technically need a credit card; you can use a debit card

rain fable
#

ty for ur help ❤️

radiant shuttle
#

hi guys . i am using top.gg for /vote . but now each user have to use the command again after the vote to claim the reward. is possible to make it automated? when user vote to instantly auto give him the reward?

fast osprey
#

Sounds related to top.gg, not discord

timber dragon
#

Pretty sure they got webhook events for that ^

velvet tartan
#

they do

haughty cobalt
#

Can anyone help idk how to fix this😭😭😭😭

fast osprey
#

pip isn't a program on your path

tender bobcat
heavy peak
#

how to make hybrid command groups?

fast osprey
#

Take how you make a normal group, add hybrid_

fast slate
#

?

sour kindle
#

Do you guys know any good ideas for my discord bot some ideas who challange me please reply or send me it to dm thank you!

woeful hill
#

a bot that generates ideas

sour kindle
#

Wait you low-key onto something

bright raft
#

a bot that generates codes for practice

gleaming inlet
finite salmon
#

A discord bot that automatically deletes itself

silver canyon
#

Hello, because my creativity is very low I ask here if you guys have any ideas with which features I can build a discord bot cause I dont have any ideas. I have build a Website Scanning Bot

fast osprey
#

Build a bot that tells people what kind of bot to build

finite salmon
#

What is a website scanning bot

gritty inlet
#

Sounds like another way to say scraping

silver canyon
finite salmon
#

Wild

radiant shuttle
#

hello i used a ticket from a server , i typed my problem and the ticket started like this ,me with the "APP" next to me
how can i do it what is the function for it?

is it a webhook?

stark ingot
#

Yeah, it's a we hook with a custom pfp and name

gritty inlet
#

This never happened before I moved it to a Group subclass.

#

Weird

timber dragon
#

Where self

#

Also are you testing in production lol

gritty inlet
#

InstructionsGroup has parent set to AIChatGroup.
I get the error:
CommandAlreadyRegistered: Command 'ai-chat' already registered.

What's the correct way to do this?

#

Okay I added add_command(InstructionsGroup() to AIChatGroup instead of using parent, removed the add_command of InstructionsGroup in the cog, and it works

fast osprey
#

You shouldn't ever need to manually add commands yourself

#

Just declaring the group in the cog is fine

timber dragon
#

Do you perhaps want a GroupCog

gritty inlet
#

Didn't know it existed

#

Neither do I know its usage but I might check

oak yoke
#

does anyone know how to get the bot to have an actual status like an user profile?

#

instead of activity

fast osprey
#

That is an activity. status is specifically online/offline/away etc

foggy dock
timber dragon
#

backticks

foggy dock
#

What is that

fast osprey
#

```

tall void
#

Could someone answer a question?

#

How do you load the Bot commands? For example, leave the emojis in a folder and load them.

fast osprey
#

What does a command have to do with emojis?

woeful hill
#

leave the emojis in a folder
🤔

somber sky
#

How would i make a command that resets another commands cooldown for everyone, and an option to reset it for one person?

for example like reset the cooldown on this command:

@client.tree.command(description="test")
@app_commands.checks.cooldown(1, 300, key=lambda ctx: ctx.user.id)
async def test(ctx):
    await ctx.response.send_message("Test", ephemeral=True)```
finite salmon
#

Ngl I just made my own cool down system cuz dpy's sucked

timber dragon
#

It's not resetting, but rather you can choose not to apply a cooldown if certain conditions are met

burnt quiver
finite salmon
#

the decorator cooldown automatically handles the cooldown reply which you can configure, and if you need to handle dynamic cooldowns you can simply check if the user is under cooldown via CoolDown.check then add the cooldown on them (CoolDown.add) or reset it (CoolDown.reset)

#

there is some room for improvement but it's much simpler to use than dpy's version imo

fast osprey
#

It's not unnecessarily complicated just because your specific use case is simpler

#

A public library needs to cater to a wide range of use cases, not just yours

timber dragon
#

It's unfortunate that CooldownMapping is undocumented

#

But it's easy to make it do whatever you want like add a check etc

finite salmon
#

damn

unkempt canyonBOT
#

:white_check_mark: Your 3.13 eval job has completed with return code 0.

001 | Theres a discord bot sec too
002 | Collio, Im a bot too
serene plank
#

i mean jingle bells

finite salmon
#

erm

slate sun
#

How make my bot run?

#

Do I need a intereaction http thing?

stark ingot
#

Only if you are using interaction and not using the gateway

slate sun
#

in discord portal

#

My bot in the server but it's offline

stark ingot
#

Your not required to use interactions, but it is the best way to get user input to your bot. I dont know what you mean by in the dev portal

slate sun
stark ingot
#

Yes, you need to have code and run it for your bot to work

#

Which requires a token to do most things

slate sun
#

3.13

slate sun
#

For test run

#

That way I don't have to use pay verison bots

stark ingot
#

Are you using a library?

slate sun
stark ingot
slate sun
#

in the dev portal

stark ingot
#

Your App -> Bot -> Public Bot -> Turn Off

slate sun
#

brb for sec

slate sun
#

this one?

stark ingot
#

If you dont want people other than you adding the bot to servers, yes

slate sun
stark ingot
#

You cant have the "Invite App" button on your bots profile if it is private. In the dev portal go to Installation and set the "Install Link" to none.

slate sun
#

thanks

slate sun
#

let me check my bot in my server if private

#

Yep it work

fast osprey
#

write out the logic -> translate that into code

stark ingot
#

The core components you will need are

  • Detect a user sending a message
  • Add to the users XP
  • Persistently store the users XP
  • Do something when the user reaches an XP threshold (levels up)
stark ingot
#

Do you have developer mode enabled?

slate sun
stark ingot
#

I should clarify, find your guild ID as a user or with code?

slate sun
slate sun
stark ingot
#

It depends on what you are currently doing. Where are you trying to get the guild ID? In a command callback? In an on_message event? Or somewhere else?

stark ingot
#

Oh, you can get it by right clicking on the guild profile picture and copying the ID at the bottom

slate sun
stark ingot
#

You just have to right click on the server picture on the left side of your screen. Then click the "copy server ID" button

young dagger
#

Maybe this can help

burnt quiver
#

why's there a library lol what

timber dragon
#

Anything that is commonly wanted needs a lib now 💀

woeful hill
#

Everything needs a lib

slate sun
#

@stark ingot i think i know why i have error in my python i need bot.py

fast osprey
#

Nothing ever requires you to have a file named a specific thing

slate sun
fast osprey
#

What is "it"?

woeful hill
#

probably the guy that makes the tutorial

gritty inlet
#

It means your code is trying to find a file with that name

#

I guess? No idea what's in your code

slate swan
#

Hey guys since ive got a load of tests coming up i thought a good way to consolidate both python and other subjects was to make a python bot which revolves around flashcards.

Do you guys think a csv text file, imported from anki, is the best way to import my notes
for example

with open flashcards.csv etc```
 
and then i can use async and @bot.command() to make commands for this bot
fast osprey
#

It depends on how big this file is and if you plan on having the bot itself modify it

radiant shuttle
#

hi, how can i find my /commands ids?
i want to use </NAME:COMMAND_ID>

fast osprey
#

fastest way is to just enter it into your chat bar, then right click the popup and copy id

velvet idol
#

Uhm guys do you know how to make discord online and offline fake members in python???

stark ingot
#

Automating user accounts is against discord TOS

silver canyon
#

Hello guys, I dont know if this question belongs here, but is there a way to find good and importantly free API´s cause I usually build discord bots with a API so that I learn how to get Infos from an API and how to put them in discord bots.

fast osprey
#

An API that does what...?

silver canyon
fast osprey
#

I mean. There are loads out there you're going to need to narrow down what you want to do

silver canyon
fast osprey
#

If you don't know what you want to build, how is looking at a list of apis going to help anything. You should start with a problem that's worth solving, rather than picking a tool and inventing a problem to use it on

gritty inlet
silver canyon
orchid pagoda
#

yo guys if anyone needed a midjourney api.. well, I've built one, then realized why not create midjourney from the ground up, it only took 3 months lol

gritty inlet
#

How do you manage to one-up the capabilities of a GPU farm?

#

Unless you mean it's a local API

orchid pagoda
#

well I'm paying a provider, I don't have my own datacenter and such

#

mjapi does all the complex prompting and model selection based on what you ask it

timber dragon
celest crypt
young dagger
#

Which server location for a VPS would be best for latency?

#

I assume in the US?

tender bobcat
young dagger
#

Discord

tender bobcat
#

You just need to be close to one of their server

#

Which you would have no particular detail info

#

Also tbf it needs to go through Cloudflare I think?

#

So maybe close to one of Cloudflare data center

fast osprey
#

Are you actually in a case where the difference in latency matters?

#

You're sending messages on a chat service, not doing ultra low latency crypto trading

young dagger
#

Just curious from a tech standpoint

fast osprey
#

In theory proximity to the data centers in ashburn but with any host that has a decent network connection the difference will be so small it's not worth any effort

vocal plover
#

What solsticeshard said, but in terms of from a technical interest standpoint I'll add that while Discord does use cloudflare as a proxy just being close to a CF point of presence isn't the key, it's being close to the GCP datacentre that the traffic eventually needs to go to that affects it most, cloudflare has POPs everywhere but as solstice rightly points out, Discord is hosted in us-east-4 which is in ashburn VA, where CF also has a POP, so being in a datacentre in ashburn means your traffic doesn't ever have to transit out of the town, let alone potentially across oceans

tender bobcat
#

I am pretty sure discord is running distributively across the world no?

#

Nvm maybe only the voice is

lime meadow
#

Is it possible to create a video embed and send it via bot?

fast osprey
#

You can't put things into embeds besides text fields and values. But you can put files into a MediaGallery that goes into a container which looks like an embed

tender bobcat
#

It's important to empathize like because they behave very differently

merry cliff
#

just realised that my roleall command is getting rate limited, is there a way to batch assign roles?

#

currently I'm just doing it individually

#
@moderation.command(name="roleall", description="give all members a role")
@app_commands.default_permissions(manage_roles=True)
async def _roleall(self, interaction: discord.Interaction, role: discord.Role) -> None:
    await interaction.response.defer(thinking=True, ephemeral=True)
    for member in interaction.guild.members:
        await member.add_roles(role)
    await interaction.followup.send(f"Gave {len(interaction.guild.members)} member(s) {role.mention}")
```(discord.py)
burnt quiver
merry cliff
timber dragon
#
async def add_role(member):
    await asyncio.sleep(2)
    await member.add_roles(role)

await asyncio.gather(*[add_role(member) for member in guild.members])

verycool

young dagger
merry cliff
# timber dragon ```py async def add_role(member): await asyncio.sleep(2) await member.ad...
async def mass_give_roles(self, members: Sequence[discord.Member], role: discord.Role) -> str:
    for member in members:
        try:
            await member.add_roles(role)
            await asyncio.sleep(0.42)  # this is probably good enough
        except discord.Forbidden:
            return f"Error: Missing permissions to update roles for {member.name}"
        except discord.HTTPException as e:
            return f"Error: Failed to update roles for {member.name}: {e}"
    return f"Success! {role.mention} added to {len(members)} member(s)."


@moderation.command(name="roleall", description="give all members a role")
@app_commands.default_permissions(manage_roles=True)
async def _roleall(self, interaction: discord.Interaction, role: discord.Role) -> None:
    await interaction.response.send_message("Assigning roles in the background...")
    task = asyncio.create_task(self.mass_give_roles(interaction.guild.members, role))
    result = await task
    await interaction.channel.send(result + f"\n{interaction.user.mention}", silent=True)
``` I went with this
timber dragon
#

Pretty sure await task literally does the same thing as just awaiting the function

merry cliff
#

XD it works so it works

timber dragon
#

What's the point of a task if you're running it immediately

#

"It works" yes but it does nothing different

#

You may want to store a task per guild so that users can't spam it

merry cliff
#

its so the command doesnt expire on large servers

timber dragon
#

what

merry cliff
#

lots of members -> loop takes longwer