#discord-bots

1 messages · Page 426 of 1

tepid juniper
#
[Attempt 1] Error fetching balance for BTC: 429 Client Error: Too Many Requests for url: https://api.blockcypher.com/v1/btc/main/addrs/1CjUh46GJUYhhL35roN8TuwK8mkH26K9wu/full
[Attempt 2] Error fetching balance for BTC: 429 Client Error: Too Many Requests for url: https://api.blockcypher.com/v1/btc/main/addrs/1CjUh46GJUYhhL35roN8TuwK8mkH26K9wu/full
[Attempt 3] Error fetching balance for BTC: 429 Client Error: Too Many Requests for url: https://api.blockcypher.com/v1/btc/main/addrs/1CjUh46GJUYhhL35roN8TuwK8mkH26K9wu/full
stark ingot
#

You are hitting the ratelimit for blockcypher, you should look into what the limits are and how they recommend you handle them

fast osprey
#

Yeah not a discord bot problem at all

verbal oar
#

Hello, I am attempting to make a discord bot but have 2 things I need help with. I am relatively new to python, with like a week's work of experience. I have watched some video tutorials as well as done a python beginner's course.

  1. Sharing variables between files. How do I pull this off? I want my cog to import some variables from the main file so I don't have to type it in over and over for each cog.

  2. How can I add new slash commands to my bot without needing to write the decorator every time? (see image)

#

Thanks in advance

fast osprey
#
  1. How do these variables get set or get changed? Are they just constants?
  2. Why do you not want to use the decorator? That's kinda just how you do it, there's nothing wrong with it
verbal oar
#

I figured both out. For the first issue, I just made a config.py file and then imported it into my cog.

The second issue, I wrote some code to make a new decorator that essentially predefined some parameters to ease the addition of new slash commands, like setting the guild ID to restrict it to a certain server only. It eliminates having to write 2 separate decorators for one command

fast osprey
#

It's a pretty common trap to think fewer lines is necessarily better

#

You're not paying rent per line. Especially if other people are ever looking at this code, it being explicit and following typical library practices is way more important than minimizing lines

#

(You also don't need to use the guilds decorator if your bot is only in one guild)

valid garnet
#

also the class method of making commands is a lot more tedious

valid garnet
fast osprey
#

Importing constants is totally fine so long as you're intentional with your dependency chain

#

It's when people put constants in a file that has a bunch of other entangled stuff that it gets messy

verbal oar
verbal oar
valid garnet
#

ehhh since you're new imports may be a bit of a hassle, so using a .env file would help

#

but it depends on your preference

#

do you already know how imports work between python files?

fast osprey
#

Relying on envs introduces another dependency and only allows for strings. Personally I really don't see any reason to use them over (well placed) python constants unless you have deployment environment considerations

#

But there's like 30 ways of doing static configuration and none of them are particularly better than any of the others lol

verbal oar
verbal oar
fast osprey
#

yaml and toml are other pretty popular formats

tawny zenith
verbal oar
#

What would be the best practice for storing embed messages? in the file they appear or in a seperate one then importing them into another?

fast osprey
#

Like a constant message you want to send? In multiple places?

fast osprey
#

Is it meaningful for the things that send that message to be in different places?

velvet badger
#

I'm working on a bot I built a few weeks ago, and suddenly I am getting error 4017 every time it tries to connect to voice. I swear that nothing has changed about the code, but I am losing my mind trying to find the source

stark ingot
#

Discord started enforcing E2E encryption. Check if the library you are using supports it, and update.

velvet badger
velvet badger
urban flame
#

Hello chat

pliant mountain
visual solar
#

def search_iterable(iterable, search_with, ignore_case=True):
result = []
for o in iterable:
if ignore_case:
if str(search_with).lower() in str(o).lower():
result.append(o)
else:
if str(search_with) in str(o):
result.append(o)
return result

woeful hill
#

Thanks for the random code snippet i guess?

verbal oar
#

Commands won't sync to the guild on startup Trying to create an app_command group in my cog using GroupCog, can't seem to figure out what's wrong. Here's my code that's giving me issues:


@app_commands.guild_only
class Tickets(commands.GroupCog, group_name="tickets", description="Ticket commands"):

    def __init__(self, bot: commands.Bot):
        self.bot = bot

    @app_commands.command(name='ticket_test', description="Test command for the ticket system")
    @app_commands.guilds(discord.Object(id=g_id))
    @app_commands.checks.has_permissions(administrator=True)
    async def reportmodal(self, interaction: discord.Interaction):
        modal = ReportModal()
        await interaction.response.send_modal(modal)
    
    
async def setup(bot: commands.Bot) -> None:
    try:
        await bot.add_cog(Tickets(bot))
    except Exception as e:
        print(f"Failed to load ticketing cog: {e}")

fast osprey
#

What library are you using?

#

Oh you asked in dpy also already

drifting arrow
#

Using discordpy, how do I get a users channel and check if it's a voice channel?

burnt quiver
#

a user object does not contain any information about a server

#

But if you have a member object, you can access it's voice attribute

#

!d discord.Member.voice

unkempt canyonBOT
velvet swan
#

Hello, Chat!

Whenever I make changes to my Bot’s code, I usually get errors related to the token. I store my token in an .env file, but sometimes it works and other times it doesn’t, even with the same code. How can I prevent this from happening again and again, I’m at the stage of going crazy.

sick birch
velvet swan
sick birch
#

Can you show us your code and the exact error?

velvet swan
#

I’m on my mobile, I will later today.

sick birch
drifting arrow
#

The solution is to put everything that handles the token into a try/except block and print out the error :D

drifting arrow
#

Can you put buttons in embeds?

woeful hill
#

You can't

#

But you can put buttons inside an action row and put it in a container

snow sun
#

@unkempt canyon what are the uses of ai in my code because most of the time i get errors and what will be use of humans if they get advanced

thin raft
#
session = requests.Session()
session.headers = {
    "Authorization": f"Bot {token}",
    "Content-Type": "application/json"
}
message = session.post(
    f"{API_URL}/channels/1479903690562207796/messages",
    json={
        "content": "asdasd",
    },
    files={
        "asdasdasdasd": open("test.jpeg", "rb")
    }
)

print(message.text)
{"message": "The request body contains invalid JSON.", "code": 50109}

#

Does anyone know what might be causing the error?

fast musk
thin raft
#

still doesnt work already tried

#

all posts I see are doing it like that

fast musk
#

Show me. It wouldn’t make sense to just open a file and pass it to a value to me. I would expect the contents

stark ingot
#

Uploading files needs to be part of a multi part request iirc

thin raft
#

damn it was that, now i have another error

#

but thanks ill try to go from here

fast osprey
#

You'll have a much simpler time if you use one of the popular discord libraries

thin raft
#

I know

#

wanted to use the rest api

gritty inlet
thin raft
#

yeah

#

but not only that, you need to remove normal payload data and send it inside the files parameter under the "json_payload" name

#
    files = {
        "file": ("test.jpeg", request.files["snapshot"].stream, "image/jpeg"),
        "payload_json": (None, json.dumps(payload), "application/json")
    }

    message = requests.post(
        f"{API_URL}/channels/1479903690562207796/messages",
        headers={
            "Authorization": f"Bot {token}"
        },
        files=files
    )```
#

weird af

gritty inlet
#

Yup

#

I didn't even know you could upload directly like this

#

There's the way of first doing POST /channels/id/attachments, then PUT to the upload url, then reference when creating message

thin raft
#

it makes sense you can upload like this

thin raft
#

but very unintuitive

gritty inlet
thin raft
#

thats why it takes some time to load images

coarse cloud
#

I’m trying to get a Scrapy project setup on my MSI windows … it says Scrapy command can’t be found… I installed it

cobalt fjord
#

Guys

proper slate
#

What kind of bots are people working on?

west breach
#

I write a moderation bot and I made a few for interacting with AI, managing tags, role colors etc

west breach
#

Its not as polished as sapphire but it helps out the server I do it for a ton

#

We get about 800 channel bans a month with it

proper slate
# west breach We get about 800 channel bans a month with it

I made a subscription bot that links PayPal to Discord and gives and takes away roles based on if they renew or cancel, etc. I use it to automate access to my animated bot

Dang thats nice. I just installed sapphire. I like it. If yours passes it up in quality lemme know. I have an 800 person server id be happy to have it in

west breach
#

Does sapphire do channel related bans and mutes?

#

or just full server

#

Its not that it doesnt work well polished, its just designed in a way that has a skill curve which could be improved

proper slate
# west breach Do you use OAuth?

For the sub bot? I made it custom. Links email and ID and has a database and looks up PayPal webhooks to give or take roles.

Im not sure about sapphire. I just installed it.

This is an example of what my animated bot makes. Renders these and outputs them live. Ill show the view attached too

#

Sapphire is nice but I like custom bots more so im interested to hear about yours

west breach
#

I used OAuth to have discord users authenticate with their discord account instead of pairing the accounts without it

#

It lets you use Discord as a login basically

proper slate
#

Like when they join a server?

#

Ooh thats cool

west breach
#

No like when you want them to log in to your site, they use discord to authenticate instead of your own custom login page for instance

#

How other platforms use apple, google etc to log in

proper slate
#

I made a report bot thats a database. Stores all kinds of media and when you review it it sends it to uou

west breach
#

Yeah its super simple, took me one 100 line python file

proper slate
#

Thats really cool.

#

Have you played fallout?

west breach
#

Yeah i like fallout newv and 3

proper slate
#

The bot i made is a ton like a pip boy

west breach
#

4 lost me, didnt like it really

proper slate
#

Wanna see?

west breach
#

Sure

proper slate
#

Can I dm you?

west breach
#

Yeah I think theyre open

#

If not just lmk and ill open em

proper slate
#

I gotyu. I run the whole bot in termux

#

I host it on my phone

west breach
#

thats dope

proper slate
#

Thats my thermal code so rendering doesnt overheat my phone

west breach
#

Dang thats sweet

proper slate
#

Its pretty cool. Ill show you around the server

#

Its a marvel rivals server but I ended up coding for it and got reallllll into it

surreal walrus
proper slate
mighty pilot
#

does anybody know how i can use the interaction data inside a modal? i want to have the guild ID to pull info from a database to use for making options for a select menu inside the modal

#

it would just make my life easier instead of maintaining a list of options as the database changes

fast osprey
#

What is the interaction? And at what point do you want to use it?

mighty pilot
#

the slash command which summons the modal and ill send what ive tried momentarily and im sure you can see what im trying to do

mighty pilot
# fast osprey What is `the interaction`? And at what point do you want to use it?
    @app_commands.checks.has_permissions(administrator=True)
    async def settings(self, interaction:discord.Interaction):
        '''Bot settings for your server'''
        await interaction.response.send_modal(server_settings(interaction))
    
class server_settings(interaction, discord.ui.Modal, title='Server Settings'):
    cur.execute(f"SELECT * FROM db2.serverinfo WHERE server_id = {interaction.guild.id}")
    myserver = cur.fetchone
    selectoptions = []
    for item in myserver:
        selectoptions.append(discord.SelectOption(label=item))
    setting = discord.ui.Label(
        text='Settings',
        description= 'Select Setting',
        component = discord.ui.Select(
            options = selectoptions,
        ),
    )```
#

the error that this gives is that interaction is not defined in line 7 above^

fast osprey
#

You should accept whatever values you need into the modal's __init__

#

not subclass interaction

#
class MyModal(ui.Modal, title='whatever'):
  def __init__(self, guild_id):
    super().__init__()
    self.guild_id = guild_id
    self.add_item(ui.Label(...)) #something with self.guild_id
#

(also would be good to not use a synchronous database driver if using an asycnio-based library)

mighty pilot
#

Thanks for the help 🙏

slate swan
#

Yo people. Im not sure i can post it here. I hope it will be help for a lot. Like to host your discord bot i found a hosting platform where u can get 1 month free hosting with unlimited resources like no limits on disc, ram, memory and with more a lot of features too!!
Dm me if u want it. Im not revealing it in here now. Like it is a hidden gem!

fast osprey
#

If it wasn't a scam you'd put it here so people can scrutinize it

#

Nobody's giving out "unlimited" resources as charity

valid garnet
#

I'm making a random ahh discord bot what commands do yall recommend I should add into utility

fast osprey
#

I'd personally recommend making a bot that fills a particular need rather than a Frankenstein of random unrelated stuff since there's like 8000 other Frankenstein running around already

valid garnet
#

later I'm probably going to make a bot that actually can go for a certain purpose (though i don't know what)

fast osprey
#

Well if it's for personal use then you can put in things you'd well...personally use. What's good for other people might not be good for you. Really depends what your server does and what the gaps are

valid garnet
#

i'm creating a new bot right now I have no idea what it's going to be used for what would you suggest

#

that's kinda new

fast osprey
#

Kinda hard to make something that solves a problem if you don't know what the problem is lol. If it's just a learning exercise you can reverse engineer an existing bot if you don't have any ideas

valid garnet
#

I might make a bot for ticket systems that's like full fledged

fast osprey
#

Yeah that's a pretty popular space, good for learning exercises but not really if you want to make something that stands out

#

Good to learn about using threads

valid garnet
#

I want to make a bot that stands out but I have NO idea what I can do

#

I do have a really WIP bot that has like a eve online type theme

#

my main problem with that bot is the fact that it needs image generation and i just CANNOT get that thing working

#

darn you diffusionpipeline

fast osprey
#

There's some good libraries out there if you want to procedurally generate images like pillow and stuff

valid garnet
#

thank you

humble horizon
#

Who knows how to make discord bot???

fast osprey
#

Lots of folks in here, if you have a question you can ask it

gleaming inlet
surreal walrus
pallid silo
#

my pc is beefing w python

valid garnet
#

is it just me or have people encountered having to use nested_asyncio as a workaround to a weird problem

fast osprey
#

What's the problem?

valid garnet
#

asyncio not allowing nested loops

#

well

#

thats more of a asyncio problem

fast osprey
#

Nested event loops? Why would you need that?

grave sandal
valid garnet
#

tasks for some reason caused a problem

gritty inlet
#

Well what is that problem
Although I don't think this is related to Discord bots

fast osprey
#

Well we'd need to know how you're starting a task and what that problem is

minor storm
#

Hello.

noble hare
#

guys

#

whats this?

#

its not really an error because it works exactly as it should

#

is there a reason i might want to fix it?

shrewd apex
# noble hare whats this?

well it expects something that supports write i.e the write method text io is much more broader scope you can just typing.cast it if that line is bothering you

noble hare
#

Oo then no need to fix it

gritty inlet
#

Interesting, that never happened to me on strict typechecker

obtuse stone
#

hi guys

#

uh...

#

bye guys

jade raptor
#

Hi

thorn raven
sour topaz
#

Hi

#

Im looking for some information

#

anywhere to download a opus.dll for discord bots?, im trying to use a bot for playing audio files, and giving me headache

gritty inlet
#

well finding that isn't really related to Discord bots

#

and how come you need that dll file for just playing audio...

sour topaz
#

And PyNa library is not compatible with discord.py 2.6.4

sour topaz
fast osprey
#

2.7.1 is the latest version Thonk

quasi quarry
#

What are you makin

gritty inlet
#

Idk what PyNa is

sour topaz
#

Exactly its PyNaCl

gritty inlet
#

Update both libraries anyway

sour topaz
fast osprey
#

You should be using 2.7.1 regardless because of the DAVE requirements

sour topaz
#

Im gonna update it to 2.7.1

#

And see how reacts

#

Thanks

gritty inlet
#

Yuh

sour topaz
#

i fixed updating to 2.7.1

#

and this is how it works

Your MP3/WAV file

FFmpeg decodes it

RAW Audio (PCM)

🔴 OPUS ENCODES ← WITHOUT THIS, DISCORD REJECTS THE AUDIO

Sent to Discord

Users hear it

#

its a cctv system for a game, that send alerts

gritty inlet
#

OPUS ENCODES ← WITHOUT THIS, DISCORD REJECTS THE AUDIO
Are you sure lol

#

I didn't need to do that manually when I made my bot play voice with dpy

gritty inlet
wind loom
#

hi guys i am looking for a job

sick birch
#

you're in the wrong place

rigid falcon
#

Guys how much python do i have to know to be able to build a discord bot

west breach
#

very little

#

imo

finite salmon
west breach
#
GitHub

An API wrapper for Discord written in Python. Contribute to Rapptz/discord.py development by creating an account on GitHub.

GitHub

An API wrapper for Discord written in Python. Contribute to Rapptz/discord.py development by creating an account on GitHub.

#

making it do what you want is the part you'd have to know the fundamentals of python for, but to create one with no function isnt too bad if you learn from these starting points

rigid falcon
#

Thanks

scenic pike
#

Is possible to remove rate limit on dc api?

fast osprey
#

...if you could just remove it at will, what purpose would it serve

fast osprey
#

No offering of paid work here

glacial sail
#

!pban 1421100595099734106 scam

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @static flume permanently.

shell ginkgo
#

@static flume 1421100595099734106 sent me a malicious link

icy wharf
#

Hi guys who do i need to speak to about advice on creating a bot for my server

fast osprey
#

You can ask any questions here and folks can help

icy wharf
fast osprey
#

Distributing music you don't have the rights to is against tos. I'd suggest just using Spotify's native listening sessions

#

(Discord aggressively compresses and reduces the quality anyways)

icy wharf
#

Ive managed to create the bot and invited it to the server. But from there I have no idea on how to actually link it up to my mixxx account 🤣

fast osprey
#

What does "linking" mean to you?

icy wharf
#

So like making them both work together ahaha

fast osprey
#

To do what

icy wharf
#

So when I go live on my mixxx software I could use the bot ive made to connect to my mixxx account and play live in one of my vc channels 🙂

fast osprey
#

Why not just stream it through your own audio? What is the bot accomplishing?

icy wharf
#

We are currently partnered with a discord called vibe radio and there bot is live in our vc 24/7 playing music. So i was ideally hoping to be able to create something simular we have a few discord servers linked in with us also. So to be able to use the bot to be placed in each server if that makes sense

fast osprey
#

So you play music locally, the bot sits on multiple servers and plays that at the same time?

icy wharf
#

Yes ideally 🙂

#

As i can get mixx to auto dj till one off us wants to go live on mixxx and do a set 🙂

fast osprey
#

That's going to be a bit on the complicated side. Would you be running both the music and the bot on your local machine?

icy wharf
#

I don't know. I dont know how I could get it to work. I cant find in the bot settings anyway of being able to set it up to work with mixxx

#

I know its possible as thats how vibe radio do it. But to set up i have no idea. And the guy that set theres up isnt around anymore aha

fast osprey
#

There isn't a bot setting because it's you making the bot lol. You have to code it

icy wharf
#

Yeah thats what I need help with i think 🤣

#

None of it makes sense to me ahaha

fast osprey
#

Do you have programming fundamentals? In python?

icy wharf
#

I dont think so

fast osprey
#

Not sure how you wound up on a python server specifically Thonk

icy wharf
#

Ive been using this so far but definitely on the wrong thing all ive managed to get this to do is make the bot live 🤣

fast osprey
#

Yeah any of those cookie cutter bot creation sites aren't going to do something this complex

#

You'll either need to invest in learning a language (like python) or pay someone to do it

icy wharf
fast osprey
#

Or maybe someone's already built this but I doubt it

icy wharf
#

Do I just download python on my pc?

fast osprey
#

This is going to be a multi week investment, at minimum, to build up the skill set from zero

icy wharf
#

I really appreciate all your support and help. 🙂 I can see this is going to be a big task 🤣

#

Even YouTube videos make no sense or are relevant to what im wanting the bot to do

fast osprey
#

If you're interested there are loads of resources out there to learn python and programming concepts in general. But you won't learn how to do this specific thing, there are several layers of concepts that build on top of each other

#

You can't walk into a nuclear engineering class not knowing what a blueprint is and expect to learn

icy wharf
#

Exactly! I really do appreciate you taking the time in talking to me. 🙂 ive got more answers from you in this messege than I have googling and watching videos the past few days 🤣

fast osprey
#

No problem. As a quick stopgap you can probably use a virtual audio cable to tunnel output of your program to a mic input on discord

icy wharf
#

I didnt release how complicated it was to set a bot up to be able to do that 🙂

fast osprey
#

There's a reason software engineers make six figures lol

icy wharf
fast osprey
#

Using existing bots can be pretty easy, but if you want something custom you generally either pay someone or build it from scratch

icy wharf
#

See this is exactly what im wanting the bot to do ahaha

#

But ideally I only need it to be able to do the live stream part ahaha

fast osprey
#

You could ask them shrug

#

But they most likely have custom code running that streams audio, and who knows where that audio is coming from or how the bot is getting it

#

Once you have a good grasp on python, you can find numerous examples of bots that stream audio from youtube. You'd just have to then write the code that takes it from your thing instead

icy wharf
#

I know there audio comes from mixxx when they go live but not sure about when it goes to auto d.j ether so ill do some digging ahaha

oak finch
#

hello

#

do you know a discord server for sell my discord bot?

#

it´s incomplete but i wanna know a server for sell it

fast osprey
#

Not the place for it here. You're also trying to squeeze blood from a rock, there's incredibly little money in discord when most of the user base refuses to pay anything

oak finch
fast osprey
#

Wut

#

This is a place for helping people with developing their bots (made in python), not selling things

oak finch
#

ok, i am only asking if somebody know a place for do that but well

grave sandal
# oak finch do you know a discord server for sell my discord bot?

Does your discord bot do something interesting? Maybe you could talk about it in a relevant community and show it off and if people are interested tell them they can buy it off of you. I don't imagine there's a marketplace server where people are arbitrarily selling discord bots to people though.

fast osprey
#

Yeah such a place would just be an unreadable cesspit of people plugging their stuff

#

Especially now that it's so easy to vibecode a bot that at least looks like it works

grave sandal
#

yea, like "hey chatgpt, give me python code for a discord bot to do x"

gritty inlet
#

I wouldn't make a bot I intend to sell without making sure there's interest beforehand

grave sandal
# fast osprey Yeah such a place would just be an unreadable cesspit of people plugging their s...

The last bot I seen sold was actually really bad and it was a telegram bot, very few lines, costed like $200, and all it did was take a list of groups, and add people to other groups. It was the first thing I got paid for (to add to/fix up) and I made significantly less, not to mention the code didn't even go much further than what was available in a guide already. But it did happen to be a piece of software sketchy people wanted. I'm not encouraging that and I'm not proud of this in general, i next got asked if i could help with drop shipping, and sniping instagram usernames 💀

gritty inlet
#

This isn't the first time I see people overpay someone to make a bot

grave sandal
oak finch
#

also, is in developing right now

stark ingot
fast osprey
#

If you just make things you're guessing people will want, you'll be sorely disappointed when 80000 other vibe coders have the same idea

stark ingot
#

Not trying to sell a premade bot

oak finch
#

ok , thanks for the help

compact yarrow
#

i just open sourced my fluxer bot! yay!

#

i think its discord bot adjacent enough for it to be in this channel

dawn plinth
#

How I make a bot

stark ingot
#

The first step is to make sure you have a solid understanding of the basics of Python
then you can pick a discord bot library. There is a list of popular ones here https://libs.advaith.io/#python. You could use the raw api if you want but that is much more difficult
After that you should follow the docs, examples, and guides of the library you choose. Avoid following random youtube or 3rd party tutorials.

dawn plinth
#

how I work it

stark ingot
#

Can you elaborate? What exactly are you stuck on?

final breach
#

hello

dawn plinth
#

Thank u

dry olive
#

Anyone wanna check it out or rate it?

fast osprey
#

Condones vibe coding, instant pass

dry olive
drifting arrow
#

OO I sense drama brewing

fast osprey
#

As the person who just posted a GitHub with a file endorsing vibecoding explicitly, yes

#

Don't know who else id be talking to given the context

dry olive
# fast osprey Condones vibe coding, instant pass

it is not vibe coded, It is coded with AI.
Vibe coding means when you don't know what you are doing or only know a little. and trust AI completly. Where you are just prompting AI and trusting that it works perfectly

fast osprey
dry olive
#

whereas I planned it out, I made all teh structure, I designed the GUI, I designed everything, Every script which is there was prompted by me tens to hundreds of times and checked.

All the markdown files are made by me, i wrote like 500-1500 words summaries for each markdown. and then AI just fixied the grammar and converted it to markdown

fast osprey
#

You're condoning it. I didn't say that's all you used

dry olive
# fast osprey

yeah I made that. that file contains all the instructions on how to vibe code, made that after completing my project.

This discord bot wa built for a competetion for a server of 2500 players. And the owner wanted a easy way to vibe code it, as without any extra work he can simply prompt the AI and add or edit anything in my app.

It was made for the owner of the server, so he can vibe code it easily with claude code.

And all the examples and the code snippets in it, are designed and written by me.

fast osprey
#

And I think it is irresponsible for you to condone it and encourage people to take that approach

dry olive
fast osprey
#

I don't need to know any context

#

It's irresponsible

dry olive
dry olive
# fast osprey It's irresponsible

I would say it is helpful, As anyone with 0 coding knowledge can download my github repo, give it to any AI directly and ask it to remove or add any feature.

As a user standpoint it is necessary. I realized it after making the app.

fast osprey
#

And the AI will shit out code that doesn't work, they will have no idea why and will have wasted that time (and environmental resources) instead of investing in themselves and learning a skill

dry olive
fast osprey
#

I don't. I expect them to pay people who invested their time to learn a skill and do the thing properly

#

Just like I don't know how to do brain surgery and will gladly pay someone to do that if I need it

dry olive
dry olive
dry olive
quick gust
drifting sinew
#

You don't have a license, BTW

dry olive
#

@fast osprey I agree with your point also.
Thats why i added a file called file strucutre, which contains everything you need to know about my project and its working in details, which a person can simply read and understand how it works.
https://github.com/smanav225-hub/AutoClaudeBot/blob/main/File Structure.md

GitHub

It is a Discord Bot, which contains free and premium features of Mee6 discord bot. - smanav225-hub/AutoClaudeBot

fast osprey
#

Anyways besides condoning vibe coding, this looks like a random Frankenstein of completely unrelated functionality, including several bits that already exist natively in the client

dry olive
stark ingot
#

there is no requirements.txt

#

also conventionally python files names are lowercase

dry olive
stark ingot
#

yeah, but in your setup instructions you say to pip install -r requirements.txt

dry olive
stark ingot
#

dont force sync slash commands in on_ready

stark ingot
dry olive
stark ingot
#

Why do you have httpx and especially requests when aiohttp is already avalible?

fast osprey
#

I don't like X

specifically makes a file called "how to X" and publishes it

woeful hill
#

also watching seven minutes video to get a bot token is very something

#

also i don't think this is a .db file, this is a .json file

dry olive
dry olive
drifting sinew
woeful hill
#

it is not a database file lol

#

json is a config file

dry olive
woeful hill
#

but you already have token.txt?

#

like why do you need to store your token at 2 places

#

also, name a json file .json please

drifting sinew
dry olive
dry olive
dry olive
stark ingot
#

the file extension does not change how a file works. On linux the file extension is often not even used in processing

woeful hill
#

i don't run random apps

drifting sinew
dry olive
woeful hill
#

changing the extension from .json to .db isn't how you make a database

drifting sinew
#

Okay. For example, remove a file extension. Will it change a data inside a file or not? @dry olive

woeful hill
#

and also to answer your question from where i get "Token.txt" you can search a string inside the project using many tools, on github you can search with the search bar on the repo, in vscode you can search with % prefix to search all the matched string in the whole project, in command line you can use grep -ri tool to search a text inside a directory

#

granted i only click in the repo and i immediately navigate to data.db and Database.py because sometimes beginners just push all their secrets on to public repo

drifting sinew
# dry olive You can protect a .db or database file, by adding password or encryption. It nee...

Okay, I'll try to explain in more details.

A type of data is determined by, if we consider textual data, its syntax. For JSON, it's a JavaScript object (because an abbrevation means JavaScript Object Notation). And there is organizations that register a file extensions to a type of data to determine in the future what is it and how it to handle.

You can, of course, use data.db instead of data.json, but 1) you don't complain to the standard; 2) tools will wrongly consider that it's a DB instead of JSON; 3) devs are used to these file extensions.

And also DB files are binary, not textual

UPD: fixed grammar errors

fast osprey
#

JSON is a data interchange format, it's not even a good config format (*IMO)

drifting sinew
#

@dry olive And, please, don't assert that you know something if you can't be sure about it. We're here to help you, but when you're trying to prove that it's made for some reasons that can't hold a critique, then it's so hard to keep to help you

dry olive
shell bone
#

do anyone know discord.js?

#

my music part of my bot keep giving me errors where it wont stream the bot and play it in the call

#

i even asked ai about it and it dont even work with ai

burnt quiver
shell bone
#

Wheres the discord.js server

burnt quiver
stoic minnow
shell bone
stoic minnow
#

Python is much more efficient

#

And easier to understand

sullen granite
#

ayo guys

#

u think it's possible to build a text based online rpg game w/ a discord bot?

#

I was just thinking cuz these rps are rlly boring and is normally based on discord but they can't play here

stark ingot
#

My understanding of text based rpg games makes me feel like discord bots would work decently well.
Especially if you are using the component system. An image and/or text plus some button options would look nice.

shrewd apex
# shell bone why you say that

cuz python server but on a serious note do use typescript instead its a much needed extension on js and makes it much more pleasant to work with

shell bone
#

not my main bot folder ( with all my commands)

stoic minnow
#

any suggestions in terms of text formatting?

gritty inlet
#

What I'd probably do is find a way to display some of the information in a "flow", not explicitly by categories

#

Like
-# Created by cookietermed. Waiting for opponent...
Instead of splitting to fields

scarlet tiger
timber dragon
fast osprey
#

soheab in the djs server smh

finite salmon
#

blasphemy

sullen granite
sullen granite
#

guys btw

#

I'm rlly stupid with discord bots running on python so... how do you make the /cmds pop up?

fast osprey
#

It depends on which library you're using

sullen granite
#

how many diff python discrod bot libraries are there?

#

I only know the one that's just named discord

fast osprey
#

discord.py is the oldest and probably most widely used one but there are several

stoic minnow
stoic minnow
#

Also have integrated Roblox auto deposits without using an external api

#

Which I don’t think any bot has capability’s of doing

stoic minnow
#

That’s just my opinion, the stuff I specialise in which is embed views for pvp games etc is much harder to do through js

grave sandal
# stoic minnow I mean realistically Python is the most reliable language for getting the job do...

No doubt on this. You can practically do anything you'd want to and the real question becomes how fast, at which point use optimized libraries for sensitive parts in native code or something, or try pypy. I can't recall the last time I found something I wanted to do that python physically couldn't regardless of how far I've gone in any direction that wasn't related to efficiency in the language it's self.

noble hare
#

guys

#

not a way to directly upload a file to the bot?

#

to the bot i mean, not from

#

like i send it as an attachment and the bot saves it?

#

or do i must use request

gleaming inlet
#

You would check the message's attachment and then you can save it

#

Something like this:

async def receive(ctx):
    # Check if the message has attachments
    if ctx.message.attachments:
        for attachment in ctx.message.attachments:
            # Save the file locally
            file_name = attachment.filename
            file_url = attachment.url

            # Download the file
            async with aiohttp.ClientSession() as session:
                async with session.get(file_url) as resp:
                    if resp.status == 200:
                        data = await resp.read()
                        with open(file_name, "wb") as f:
                            f.write(data)
                        await ctx.send(f"File `{file_name}` received and saved!")
                    else:
                        await ctx.send("Failed to download the file.")
    else:
        await ctx.send("No file attached to your message.")
noble hare
#

oo tysm ill try

noble hare
#

worked first try, tysm x2

timber dragon
#

Does the same thing as above but yes

#

Oh also, ctx, image: discord.Attachment would require the user to pass a file

fast osprey
#

Why not just take it as an input to a command rather than reading it off a message?

#

or through a modal

tough marlin
#

Hi 1 question i have a big dc bot 1 of his many functions is to send messages in DC from a site that I configurated but how can I see some messages before

#

Pls ping me in case

stark ingot
tough marlin
#

Now the flow is from the site I tipe and the bot tipe it in a channel

I would like to see some previous messages so I ca basically see the last messages of that channel

stark ingot
#

You can fetch messages in the channel. But overall this seems sketchy. Why cant you just type in the channel normally? Instead of through the website

tough marlin
#

Sometimes I don’t have access to Discord, not even from my phone (I’m still at school, so sometimes I don’t have access to my phone, and therefore not to Discord). Also, since it’s a moderation bot, there can be some issues, so this way I can still communicate through the bot directly. The server has more than 700 members. If you want, I can send you an invite to the server so you can se the bot.

fast osprey
#

If you're in school, maybe you should be focusing on school instead of using some hacky website to proxy into discord

tough marlin
#

Bruh I created the website

#

And its private

fast osprey
#

That doesn't address at all what I said

stark ingot
#

I guess that makes sense. You should make absolutely clear that your bot is relaying messages outside of discord though. Probably should limit it to a specific channel

tough marlin
stark ingot
west breach
tough marlin
gleaming inlet
unkempt canyonBOT
#
Pasting large amounts of code

So that everyone can easily read your code, you can paste it in this website:
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.

stoic minnow
#

Any formatting suggestions for this

#

I feel the price range or emoji is making it look off

gritty inlet
#

I'd use CV2 instead of embed with fields

#

That's how (imo) you can shift from looking technical to fun

maiden bluff
#

!learn

unkempt canyonBOT
maiden bluff
#

oh

#

wrong channel

noble hare
#

guys

#

im completely clueless

#

want to use buttons but have no clue how they work

#
class Components(discord.ui.LayoutView):    
    container1 = discord.ui.Container(
        discord.ui.TextDisplay(content="\nButtons"),
        discord.ui.ActionRow(
                discord.ui.Button(
                    style=discord.ButtonStyle.success,
                    label="button one",
                    custom_id="b9a193e3947f4a3fcef563f303fe658d",
                ),
                discord.ui.Button(
                    style=discord.ButtonStyle.danger,
                    label="buttone two",
                    custom_id="90cf71c7c02644fef62b6e0412b7e13d",
                ),
        ),
        accent_colour=discord.Colour(9225410),
    )


@bot.command()
async def send_components(ctx: commands.Context) -> None:
    view = Components()
    await ctx.send(view=view)```

how do i any functionality?
#

generated using discord.builders btw

fast osprey
#

You should subclass Button and implement a callback

stoic minnow
#

and go from there

#

after you add your feilds etc

#

of wtv the button is bein used for

fast osprey
#

You can't have embeds in components v2 messages

fast osprey
# fast osprey You should subclass Button and implement a callback
class ButtonOne(discord.ui.Button):
  def __init__(self):
    super().__init__(label="a")

  async def callback(self, interaction):
    await interaction.response.send_message("a")

class ButtonTwo(discord.ui.Button):
  def __init__(self):
    super().__init__(label="b")

  async def callback(self, interaction):
    await interaction.response.send_message("b")

class MyView(discord.ui.LayoutView):
  container = discord.ui.Container(discord.ui.ActionRow(ButtonOne(), ButtonTwo()))

or subclass ActionRow and use the decorators like you would a normal view

class RowOne(discord.ui.ActionRow):
  @discord.ui.button(label="a")
  async def button_one(self, interaction, button):
    await interaction.response.send_message("a")

  @discord.ui.button(label="b")
  async def button_two(self, interaction, button):
    await interaction.response.send_message("b")

class MyView(discord.ui.LayoutView):
  container = discord.ui.Container(RowOne())
noble hare
#

okay tysm both, ill see

noble hare
#

guys

#

does text formatting not work in embeds

#

im trying to set a footer with -# but it displays it as is

#

    embed = discord.Embed(
        title='-# title',
        description='-# description'
    ).set_footer(text='-# footer')

ok so as appears, it works in embed but only for description, not footer or title

#

no work around?

#

i just want a smaller text

fast osprey
#

markdown doesn't work in embeds

#

afaik

timber dragon
#

It does in some fields

noble hare
#

oo okok

timber dragon
#

But also, use cv2 / the container component

#

That's all with TextDisplays which supports full markdown

stark ingot
#

Footer text is already smaller

timber dragon
#
from discord import ui

container = ui.Container(
    ui.TextDisplay("### Title"),
    ui.TextDisplay("Description"),
    ui.TextDisplay("-# footer"),
)
stats_view = ui.LayoutView().add_item(container)

await ctx.send(view=stats_view)

Assuming discord.py

noble hare
#

-# its faded aswell so that makes it better for my purpose

potent fox
#

!clban 1484660952547983360 scam

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied ban to @untold whale permanently.

dire rose
wraith remnant
#

wsp I'm learning the basics of Python, and once I've learned the basics, can I jump right into creating my first Discord bot, or not?

fast osprey
#

Really depends what basics means

#

but regardless, you'll want to cement those concepts with actual targeted practice of those concepts, not a bot

sleek cedar
#

how do i fix this 😭

fast osprey
#

That's not enough code to really diagnose

#

depends on how these files are structured

sleek cedar
#

same error

fast osprey
#

depends on how these files plural are structured

#

assuming you're trying to define token in config

dire rose
#

Updates/sec │ 23,819 ████████████████░░░░░░░░░░░░░░░░░░░
Peak │ 47,320
Latency │ 0.1ms
Uptime │ 01:07:46

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Accounts │ 60,330,746
Orca WP │ 2,155,361
Raydium │ 11,764,662
Meteora │ 4,907,414
Vaults │ 41,503,309
Slots │ 61,840
Total │ 79,845,437
https://ghostgeyser.pro/

sleek cedar
fast osprey
#

the structure in that file is relevant

#

you'd get an import error if it couldn't find that file

sleek cedar
#

hmm

#

i dont see why it would not work

fast osprey
#

well me neither because I can't see the file lol

sleek cedar
#

what can i show so you know enough info

fast osprey
#

that file

#

removing the actual text of the token

sleek cedar
#
token = 'x'
mongoURL = 'x'
phishObserverKey = 'x'
phishReportAPI = 'x'
fishfishKey = 'x'
developers = [x, x]
watcherChannel = x
watcherLogChannel = x
reviewerRole = x
teamRole = x
certstreamFeed = "x"
iokRules=["x", "x", "x"]```
#

@fast osprey does that help

fast osprey
#

what happens if you try from config import token? Does it find it?

sleek cedar
#

tried that does not work

#

so no

#

for some reason python cannot read anything in that file

novel scaffold
sleek cedar
# novel scaffold have you saved the file?

yes, ive tried. i just got it to work. i looked in the actual file and there was nothing saved to it, it was just blank. not sure why. so then i saved as and then it actually saved

#

strange, never have had this issue

fast osprey
#

But yeah possibly just looking at the wrong thing in vsc or saving it elsewhere

velvet swan
stark ingot
#

looks like they are making an app to block phishing urls, not sure where you got token grabber from

stoic minnow
#

😭

fast osprey
stoic minnow
#

why would you even use that

#

thats just more and more work

gritty inlet
#

How? It's much easier to import from a Python file than from an .env

woeful hill
#

Something something pushing .env is harder than config.py something

#

In reality, they both have equal chance of accidentally being pushed to remote

stark ingot
#

Many template git ignores include .env by default but that is splitting hairs. Although by convention .env is often understood to be more sensitive than any .py file.

fast osprey
#

Config formats are essentially interchangeable as long as you know what you're doing

sick birch
#

Both is good

#

with pydantic_settings

hybrid atlas
#

!learn

potent light
# sleek cedar how do i fix this 😭

You're probably trying to run bot.py from a different directory.
Open the bot's folder then right click > open powershell (within that folder) then try python bot2.py.

sleek cedar
sleek cedar
sleek cedar
sleek cedar
fast osprey
#

Importing a library (dotenv) to then emit constants into the environment to then consume it rather than just directly importing it is pretty backwards

stark ingot
#

I like .env as it gives me the flexibility to use normal environment variables. For example as different run profiles in pycharm

vocal plover
#

Yeah the advantage of a .env for me is that you can pass stuff in a fairly standard way, like if I'm using docker[-compose] I can easily set env vars, whereas mounting a readonly volume for a config file is more annoying. Not really a major issue, and you can use whatever, but there is a definite benefit there

stoic minnow
#

You can use either but at the end of the day env is just pro

hollow roost
#

@fringe harbor

velvet swan
#

Hosting provider suggestions?

crystal escarp
#

Does anybody have a Discord Developer Portal team where the owner is identity verified so that I can verify my bot?

stark ingot
#

That does not seem like a smart plan. If you add your bot to a team it is like transferring the ownership of your bot to the team owner

crystal escarp
#

gotta find someone i trust

#

yk

timber dragon
#

Or verify it yourself

fast osprey
#

Someone would be pretty foolish to go through the trouble of verifying and then take responsibility to run a bot some rando made (who refuses to get verified themselves for some reason)

stark ingot
#

I can think of 2 pretty strong reasons to not get verified yourself

#

Although the first part still stands

tidal zinc
#

Hello, I am trying to make a bot that takes all the messages from a discord server of mine, prints them, and reads them out loud. They successfully print, but arent said. I am told that i dont have PyNaCl installed, despite installing it earlier.

Error: "WARNING:discord.client:PyNaCl is not installed, voice will NOT be supported"

My code (<API> is my bot api token, but replaced so its not taken) :

import discord

import pyttsx3

engine = pyttsx3.init()

API_TOKEN = '<API>'

intents = discord.Intents.default()
intents.message_content = True

client = discord.Client(intents=intents)
guild = discord.Guild

@client.event
async def on_ready():
print('ready'.format(client))
await client.change_presence(activity=discord.Game('👀'))

@client.event
async def on_message(message):
message_content = message.content
message_author = message.author
print(message_content)
text = (message_content)
engine.say(text)
engine.runAndWait()

if name == "main":
client.run(API_TOKEN)

fast osprey
#

How are you installing the library?

tidal zinc
#

I will use a venv, and once it’s downloaded, I’ll move all the files to the directory the code can actually access

tidal zinc
#

I will in a sec, Im away from my computer rn

#

put it into a terminal and got

#

Package Version


pip 23.0.1
setuptools 66.1.1
wheel 0.38.4

fast osprey
#

List out what's in your venv

tidal zinc
#

Package Version


aiohappyeyeballs 2.6.1
aiohttp 3.13.3
aiosignal 1.4.0
attrs 26.1.0
cffi 2.0.0
davey 0.1.4
discord.py 2.7.1
frozenlist 1.8.0
idna 3.11
multidict 6.7.1
pip 23.0.1
propcache 0.4.1
pycparser 3.0
PyNaCl 1.6.2
pyttsx3 2.99
setuptools 66.1.1
typing_extensions 4.15.0
yarl 1.23.0

fast osprey
#

Are you using discord.py[voice]?

tidal zinc
#

no, i dont think so

#

im trying to do tts out of my computers speakers or on a recording

#

not have the bot in a vc

fast osprey
#

If it's something else that's outputting the sound, or supposed to be, this doesn't sound like a discord issue at all

tidal zinc
#

ok, sorry

fast osprey
#

Probably an issue with pyttsx, never heard of it though

restive geyser
#

@tidal zinc How about you make sure that it's not a discord problem by just running the library.

oblique yarrow
#

Hi!

#

Did any body can give me suggestion that I had learned discord.py on intermediate and I want to go on advanced did any body can tell what I need to do?

oblique yarrow
fast osprey
#

Really depends on what advanced means to you. Also worth noting the above guide is not officially endorsed by the library

oblique yarrow
#

OK than did you can suggest me a project on which I can work brother!

#

And thanks

fast osprey
#

Hard to make recommendations not knowing what you're specifically trying to learn. The library itself isn't all that complicated once you have a firm grasp of the underlying python concepts IMO

heavy peak
#

how to make some of my hybrid commands work in a gc or a users dm as well?

timber dragon
oblique yarrow
fast osprey
#

The repo has examples of all of those things. I'd suggest copy pasting one of the examples, coming up with an idea and modifying the example to see what happens

oblique yarrow
#

Which repo brother!

fast osprey
surreal walrus
#

Hey guys is there anyway to get around the limit of 5 followup responses for slash commands on user installed app

fast osprey
#

Why would you need to send so many followups and flood the user's screen?

#

Also limits wouldn't be limits if people could just opt to not follow them

surreal walrus
#

So that's a no?

stark ingot
#

You would need another interaction. There is no way to increase the number of allowed followups in a single interaction

orchid zodiac
#

!learn

unkempt canyonBOT
oblique yarrow
brisk tapir
#

!learn

unkempt canyonBOT
brisk tapir
stark ingot
austere bronze
#

As newbie how can I start?

viral pollen
#

i used python crash course 3rd edition. try that better than yt tutorial hell

brisk tapir
brisk tapir
stark ingot
lavish pollen
#

What are some good commands that MUST be into you discord bot?

fast osprey
#

None

#

If every bot copy pasted functionality, why would you even bother inviting one of them? Let bots serve specific purposes

#

That said, there are some general purpose maintenance things for the bot developer that are generically useful (like evals or system resources), but for user facing stuff I wouldn't suggest it

celest pelican
#

Some kind of status command I guess would be useful in any bot. So you can check it is running.

fast osprey
#

In that line, I'd highly recommend jishaku if you're using discord.py, it packages a whole slew of owner-only maintenance commands for you that are implemented quite well. Had to catch myself there not thinking about the dev 😅

stark ingot
#

/ping
/info
Can't think of anything else that you would need

gleaming inlet
#

/sync command is a definite must

fast osprey
#

Not sure why you'd want that to be a publicly visible command Thonk

stark ingot
#

or have it at all but I'm pretty sure it was a joke

orchid zodiac
#

why am i having such a hard time understanding loops

fast osprey
#

What's the confusion?

slate swan
gritty inlet
#

lol made this to get guild specifc bio

#

Nothing stopping someone from documenting this on the api docs (so then libraries like dpy will follow that)
But I was also wondering whether it should be a cached property 🤔 or would I need to keep fetching it

knotty solar
#

hey

#

im working with replit but i have a problem where i can ask?

fast osprey
#

If it's in the context of making a discord bot, replit is not suitable in the first place

stark ingot
gritty inlet
#

Most definitely that field does not exist for users

umbral mountain
#

replis is an a** in every aspect as a website

fast osprey
#

Pretty sure it violates their tos to scrape with a user cookie and bypass their api

celest pelican
#

!warn 1327450740951613532 I've deleted your message as it violates our rule 5 (by violating twitter's ToS)

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied warning to @stray sleet.

plain parrot
#

hi

#

is this bot made up or they just changed the name if they did how?

fast osprey
#

What would it mean for a bot to be made up?

plain parrot
gritty inlet
#

How would it be fake

stark ingot
#

I assume that this is another bot, that changed their profile picture and name with the member edit endpoint

fast osprey
#

All bots are created...?

#

They don't just get found growing off bushes

fast osprey
#

Overjoyed

#

It's really unclear what you're trying to get at though. We can't really tell anything about the nature of a bot from a screenshot of a message it sent tbh

plain parrot
fast osprey
#

You can only modify the server profile pic of a bot if the bot specifically gives you a method to do so

plain parrot
fast osprey
#

That's up to the bot to implement if/how it wants to

tropic mantle
#

where is the general channel in here i cant find it

timber dragon
unkempt canyonBOT
young dagger
#

Can you set/change a View object's timeout to None after the button is pressed?

fast osprey
#

Dpy at least doesn't support you manually modifying the timeout, though I'm not sure why you'd want a view to last forever specifically after it's interacted with once

gritty inlet
#

Does it matter what the timeout is, if the view only contains dynamic items? (or non-interactable components)

fast osprey
#

If there aren't any components then the view timing out doesn't do anything. tbh I'm not even sure if it gets added to the view store at all

gritty inlet
#

I didn't say there aren't any

fast osprey
#

"component" is a bit of a loaded term

#

but the view store only exists for routing interactions, so if there aren't any interactions ever happening it doesn't matter if/when that view is in the store

gritty inlet
#

So the view timing out does not affect a Dynamic Item that's in it?

fast osprey
#

iirc it does deregister, because by setting a timeout you've told the library you don't want that interaction handled

gritty inlet
#

Hmm although dynamic items are added to the bot via a separate function so I wouldn't be sure it's tied to the view

#

I'll test it

#

Was also wondering whether I should set timeout of views that only contain components of CV2 that can't be interacted with, to immediate, for optimization
At my scale it doesn't really matter tbh

#

But maybe it's good practice rather than having many views wait like 3 minutes to timeout when you might as well make it immediate

fast osprey
#

you don't have to bother

gritty inlet
#

Alright, but I still dunno what should be done with dynamic items, I'll check later

fast osprey
#

Presumably if you're making it dynamic then you want to respond to the interactions forever, in which case a timeout isn't really appropriate

gritty inlet
#

Yeah but I see the view here as just the way to send the dynamic item, rather than managing and dispatching it

fast osprey
#

That's probably not how the maintainers look at it

#

It would be somewhat unintuitive if an arbitrary subset of components on a message continued to work after a timeout you set expired

#

Although looking into it, there is a flag for if everything in a view is dynamic but I didn't have the time to drill into how that flag is used

gritty inlet
#

Ok just found it

#

So it looks like it doesn't go in the viewstore:

#

Which would also mean timeout does not affect it

gritty inlet
dim pike
#

how

#

wat do u want fixed

#

u js said "plz fix"

gritty inlet
#

Also I suggest you delete it for a reason I don't want to mention before that's done

atomic matrix
gritty inlet
#

Make sure you don't send line 13 next time :p

atomic matrix
#

its a free api

#

but alr

#

ty for telling me

gritty inlet
atomic matrix
#

gimme a sec

#

ok so on the questions it doesnt solve it it sends to gemini but doesnt look for place holder when it gets it

unkempt canyonBOT
#

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

atomic matrix
gritty inlet
#

This is a long file, where do I look?

atomic matrix
#

try line 241

gritty inlet
#

What happens? Does it keep sleeping or does it hit the exception?

atomic matrix
#

1540 lines of slopmaster 3000 from claude, gemini, venice ai chatgpt

atomic matrix
#

useless html works

#

it doesnt click continue reading again

#

clicks first time

#

but not the 2nd in bottomright

#

line 1340

gritty inlet
#

If the issue is with JS I'll have a hard time helping

atomic matrix
#

its in py

gritty inlet
atomic matrix
#

its supposed to do my sprx reader hw

fast osprey
#

Are you serious

gritty inlet
#

😭

fast osprey
#

In addition to just being a bad idea, you're violating their terms of use

#

use content from or in the Sparx Product to train, prompt, or interact with large
language models or other artificial intelligence tools or products; or

fast osprey
#

Their terms of use

atomic matrix
#

i cant find on their web page

#

anyways thats wat we do

#

as kids

#

find ways to bypass hw

fast osprey
#

And that's why people who know better than you do tell you not to do that

dim pike
#

thats my fcking script

#

i told u i'll finish it

dim pike
gritty inlet
#

Tbh I never caught on to this trend of using LLMs to do school work for me

atomic matrix
dim pike
#

i make it sell it with discord integration and u get hw done

gritty inlet
#

If that's what you like doing ig

#

Anyway it got to a level where there's teachers encouraging to use it at times...

#

But only for very specific stuff, and not as school protocol

fast osprey
warped cosmos
#

can anyone reccomend any youtube videos to start learning the basics with discord bots?

woeful hill
#

There are example codes on the library's github

#

Copy it, mess with it and see what happens

fast osprey
#

youtube videos, especially those not made by accredited institutions, are incredibly awful for learning. Videos are just a wasteful medium for these concepts, and random people on youtube farming for views have no quality control or fact checking

#

IMO your best bet is to read reviewed resources for learning python, then read the documentation and examples for the library you want to use once you know the python concepts

eager crypt
#

Does anyone have a comprehensive guide for discord py's UI view? I couldn't find a single decent one, and documentation is horrible...

fast osprey
#

There are examples in the repo

#

And if you have any questions about what those examples are doing, you can ask here or in dpy's server

shrewd apex
sick compass
#

How exactly do Cogs works, and why do I need:python @app_commands.allowed_contexts(guilds=True, dms=True, private_channels=True) @app_commands.allowed_installs(guilds=True, users=True) @app_commands.command(name=name, description=desc)
Before every command in the Cogs?
I understand @app_commands.command, but why the other 2?
Isn't it taken care of when you make the bot in the Developer Portal?

fast osprey
#

They're not required. They're just there to modify from the default contexts and installs

stark ingot
#

The dev portal only controls the default installation contexts

sick compass
#

Aaaahhhh, okay
Makes alotta sense
Thanks!

north kiln
#

What should I use if I don't want a user to run a command twice? Like the second command should not run until the current interaction has finished

north kiln
#

I vaguely rmb there was a deco for it

timber dragon
proper slate
#

Anyone wanna show me their bot or see mine? Curious what people are working on

proper slate
north kiln
proper slate
north kiln
#

yes but I will need to store some additional states

#

would using something like a set be potentially unsafe?

proper slate
#

I suppose but it isnt as hard as jt sounds. You take the discord input. Defer so it doesnt timeout. And then work on it until its dome

timber dragon
#

Defer still requires you to followup within 15 mins for slash commands

proper slate
proper slate
timber dragon
#

But is this for slash commands?

#

You can just deny the command by raising an error

north kiln
#

like I want to prevent a user to invoke another slash command while he is already running one

north kiln
timber dragon
#

I had an implementation that worked similarly to dpy's max concurrency decorator for prefix commands, but I've lost it 😭

#

Basically stores a count per user on the command and then checks that on invoke

gritty inlet
#

I never reject commands, why try to fight race conditions

woeful hill
#

If i want to have a chain of interactions like that i would just put the second command as a button for the user to click in the first command response

vivid elk
#

Hi

fast osprey
#

Depending on the goal here, it's possible you can design this to be less stateful so you don't actually care if someone runs a command twice

#

Which might improve the UX and take care of edge cases

gritty inlet
#

Is there a good library out there for HTTP interactions? Would like to hear some recommendations rather than installing something random (or making my own)

fast osprey
#

Out of curiosity, why decide not to run a gateway bot?

gritty inlet
#

I'm not really planning on a bot right now but rather to experiment with HTTP

#

But if you don't use any gateway feature and want something a bit faster for just interactions, I guess idk

fast osprey
#

It's probably a pretty narrow use case where you wouldn't want cached info like the gateway provides. There are loads of web server frameworks out there, not one that wraps discord models though too that I know of

gritty inlet
#

Well the web server part isn't quite the issue 😅

#

I might as well just use uvicorn and do it raw, but that wouldn't be something I'd wanna do for a whole bot, just for experimenting Ig

timber dragon
gritty inlet
#

Ty 🙏🏻

dusk pelican
#

hello

#

someone online in the discord api gateway thread? Or not interesting anymore?

dusk pelican
stark ingot
#

TBH, this chat is inactive enough that you should just ask the questions here

whole shoal
#

memory usage on startup:
Memory Usage: 475.71 MB

memory usage after running for a while:
Memory Usage: 578.83 MB
Uptime: 1 day, 2 hours, 36 minutes, 34 seconds

after longer:
Memory Usage: 926.86 MB
Uptime: 59 days, 16 hours, 27 minutes, 53 seconds

How do i even scale the bot? RN its just one shard thats eating up so much memory

fast osprey
#

Start by using a profiler to see what is actually using that memory

whole shoal
#

i do have a lot of data thats cached on startup but that shouldnt exceed 100 MB probs

fast osprey
#

I'd try a dedicated profiling library. You need to get some actual telemetry or you're just trying shit and hoping it works

whole shoal
#

thats the issue, profiling libs have wayy too much overhead

fast osprey
#

which ones have you tried?

whole shoal
#

memray

#

and tracemalloc

#

cant even try it locally tbh

fast osprey
#

It's worth trying others. If profiling at scale was an impossible problem, nobody would be able to fix anything besides firing in the dark

whole shoal
#

i'm probably being bottlenecked by the 13 year old vCPU i got on the vps

fast osprey
#

oof

#

I mean that's definitely not doing you any favors lol

whole shoal
#

Intel Xeon E3-12xx v2 (Ivy Bridge, IBRS)

#

does the library cache some stuff on its own?

fast osprey
#

A quick google gives like a billion profiling libraries. Maybe someone else here has had recent experience doing this at scale, I haven't. That's also a more general problem you can probably get good opinions on, maybe somewhere like #tools-and-devops

#

There are lots of levers on the discord library side that you can pull to reduce memory usage, but without good profiling we have no idea if it's the library or just a memory leak you introduced yourself

whole shoal
whole shoal
fast osprey
#

Yeah give it a whirl. You may need to scale up at least temporarily while you diagnose. But if you're going into this blind without profiling, that's like your IDE saying there's an error but refusing to give you a line number, it's a non-starter

whole shoal
#

i have a decent headroom before discord forces sharding, hence want to figure this out quickly before it gets too late, probably will have to first switch the vps provider

fast osprey
#

Yeah getting good telemetry in early is incredibly important

dusk pelican
fast osprey
#

Via a library, yes. Have never needed to implement it raw

dusk pelican
whole shoal
fast osprey
#

I would suggest auditing the intents you're requesting and aggressively disable ones you don't need

#

Members is the most egregious in terms of memory, but others are really bad for cpu

whole shoal
#

i only have intents.guilds and intents.members enabled along with default intents, for role sync purposes , they are really only used to monitor one single guild so not that heavy for cpu perhaps

fast osprey
#

Defaults include almost every intent

#

Including some of the most expensive and least useful ones

whole shoal
fast osprey
#

Intents.typing for example is the one that probably fires the most and is something that maybe 0.1% of bots care about

whole shoal
#

i see

#

yeah i realised i dont even need the voice channel intents, integration, events and stuff

#

thanks for pointing it out!

#

ong just realised i need none of the default intents.

fast osprey
#

guilds is pretty much required for most things if you're running a gateway bot, otherwise your cache will be empty

whole shoal
#

yep i need only intents.guilds and intents.members

#

will probably drop the members too once i switch to webhook based logic, rn it depends on member roles

fast osprey
#

Yeah it's like a 10 minute exercise to review the intents that a vast majority of devs never bother with and just waste resources on for perpetuity

whole shoal
#

haha never had a thought about checking them, thanks a lot

#

down to 300 mb startup mem, pretty good for now

#

will probably move the mem cached dicts and large files onto redis before sharding and run a local memory profiler on a diff bot token

slate swan
#

so i started python with DPY
i dont understand async/await or anything really
i just know how to make things work, what should i learn to like get better at making bots? i can code any bot but it doesnt feel like they are scalable, efficiently written?

do i start with learning python from scratch? or do i read the dpy docs deeply?

finite salmon
#

!learn

unkempt canyonBOT
whole shoal
# fast osprey Yeah it's like a 10 minute exercise to review the intents that a vast majority o...

hey, so i setup a local instance to check mem allocation and stripped out some stuff to avoid it interefering with the main bot, and well the mem usage is fairly normal, Memory Trace Status
Current Memory
160.81 MB
Peak Memory
191.11 MB

on prod its around 300 MB,

The largest sources in the cache are mainly the 370k word list and other large obj cached on startup along with python libraries taking up most of it, will move some large lists ' to redis hopefull that will save a bit more, cant really check for mem leaks here tho

gritty inlet
#

That word list already sounds quite heavy lol

whole shoal
gritty inlet
#

I wonder how much would chunking members add if you're in lots of servers

#

I used to use a local background remover thingy that added 200mb on import

whole shoal
gritty inlet
#

Well good thing to turn it off if you don't need it

whole shoal
whole shoal
gritty inlet
whole shoal
#

makes sense

gritty inlet
whole shoal
gritty inlet
#

Hmm

whole shoal
#

i didnt bother much i just make a fetch call instead

gritty inlet
#

Anyway it's usually modules that take a bunch of memory

whole shoal
#

yeah

fast osprey
#

You can disable auto chunking and then chunk individual guilds if/when you want to

gritty inlet
#

Maybe the 3.15 lazy imports will help

whole shoal
#

baiscally heres the breakdown for top 30 alloc:

Python Import System
#1, #4, #11, #15, #18, #24
≈ 63 MB

LastLetter Dictionary
#2, #3, #7, #9
≈ 39 MB

Python Runtime Caches
#5, #6, #8, #21, #22, #23, #27, #28, #30
≈ 9 MB

Typing / Pydantic
#10, #13, #16, #29
≈ 2.5 MB

Word Royale Dictionary
#14, #20
≈ 1.2 MB

External Libraries
#17, #19, #25, #26
≈ 1.5–2 MB

Async Networking
#12
≈ 0.8 MB

Total Tracked
≈ 117 MB
gritty inlet
#

Will keeping track eventually tell you more?

#

Cuz u initially said more memory usage than this

whole shoal
#

i only listed the top 30

gritty inlet
#

oops

whole shoal
#

there are over 500 xd

tame pike
#

!eval print("hi everyone")

unkempt canyonBOT
tame pike
#

!eval def sifre_olusturucu():
uzunluk = int(input(“Şifre uzunluğunu girin: “))
karakterler = string.ascii_letters + string.digits + string.punctuation
sifre = ”.join(random.choice(karakterler) for _ in range(uzunluk))
print(f”Oluşturulan Şifre: {sifre}”)

sifre_olusturucu()

unkempt canyonBOT
tame pike
#

!eval def sifre_olusturucu():
uzunluk = int(input(“Şifre uzunluğunu girin: “))
karakterler = string.ascii_letters + string.digits + string.punctuation
sifre = ”.join(random.choice(karakterler) for _ in range(uzunluk))
print(f”Oluşturulan Şifre: {sifre}”)

unkempt canyonBOT
tame pike
#

def sifre_olusturucu():
uzunluk = int(input("Şifre uzunluğunu girin: "))
karakterler = string.ascii_letters + string.digits + string.punctuation
sifre = ”.join(random.choice(karakterler) for _ in range(uzunluk))
print(f”Oluşturulan Şifre: {sifre}”)

sifre_olusturucu()

gritty inlet
#

Try r string

#

Anyway #bot-commands would be the place

tame pike
#

oow sorry ty

honest dawn
#

what's the best python version for discord bots?

fast osprey
#

Presumably whatever the most recent one is that's supported by your library of choice for optimizations and security. Bots can do anything, that's kind of like "what's the best Python version for programs"

river valley
#

can someone teach me python

fast osprey
#

What learning have you tried so far?

gleaming inlet
unkempt canyonBOT
latent bluff
#

hihi im using visual studio code for this (even if that matters). it keeps giving me errors on certain lines and i am unsure of how to fix them. can someone help me figure out whats wrong?

unkempt canyonBOT
latent bluff
#

by the way if u don't understand what the bot is for here is an explanation to what this is supposed to do

  1. i want this bot to be a queue bot, it needs to have 3 buttons that when you click one it changes the original message.
  2. i want the buttons to say in this order: noted, processing, done. i want each to have a custom emoji and the label to be grey.
  3. i need to be able to have 3 options within the slash command, those being: customer (let me mention someone), order (fill with text), payment (fill with text).
  4. when a button is clicked it becomes unusable and the only person who should be able to use these buttons is the one using the command.
fast osprey
#

Just eyeballing it, there seems to be some indent issues

latent bluff
fast osprey
honest dawn
stark ingot
#

Just not old ones, as like any software it becomes unsupported

whole shoal
#

i disabled guild chunk on startup and now im not receiving on_member_update events ....

timber dragon
#

Makes sense, that relies on cache

#

How would you otherwise have the previous information

brazen raft
#

Gateway event?

#

Unless no intent covers member updates

#

Oh but I guess maybe the member's previous state is lost then so no before

#

Ideally in that case there would be a raw event or something that more directly forwards member update events from the gateway

thorn moth
#

Can someone explain why my

import discord
from discord.ext import commands

Doesn't work and then when I try

@bot.command()

It doesn't work

brazen raft
#

Any error messages?

thorn moth
#

Yeah

brazen raft
#

What do they say

thorn moth
#

when I did a indent for it it said smth like
"unindent line 3"

brazen raft
#

Use pastebin to send the complete program and exception traceback

#

!astebin

#

!pastebin

unkempt canyonBOT
#
Pasting large amounts of code

So that everyone can easily read your code, you can paste it in this website:
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.

brazen raft
hybrid ravine
#

is discord bot developement profitable

dusk pelican
#

has anyone here it this channel a discord bot which has some premium features and you are selling this?

hybrid ravine
#

and i was thinking discord bot dev

#

but i wanted to know if it is acc in demand

fast osprey
#

It is a very saturated market where the vast majority of the user base refuses to pay anything

#

Is it possible? Yes. Is it likely? Absolutely not, except if someone commits to paying you that money before you start

hybrid ravine
fast osprey
#

There are tons of industry jobs that use python. Also lots of jobs that don't need python directly but just want you to come in with solid software engineering skills. Picking up other languages is relatively trivial (except for deep niche specialist jobs)

#

Lots of freelancing opportunities too I'm sure

dusk pelican
hybrid ravine
#

in terms of things i am able to do as im under 18

#

im 16

fast osprey
#

I'd really suggest an internship, but probably a better convo for #career-advice

dusk pelican
#

you selling some premium features?

fast osprey
#

I just do bot dev for fun lol

dusk pelican
dusk pelican
fast osprey
#

A bot can use those endpoints in more complex and novel workflows

#

but if someone is literally just recreating "I want to ban someone right now", that's just a strictly worse version of what they already have

dusk pelican
#

ah ok I see

#

wait why worse?

fast osprey
#

The built in command applies 2FA checks and properly logs into the audit log

#

(Also as a rule of thumb, bots having fewer permissions is always a good thing)

sick dagger
#

Dm me if u can help me make a Roblox bot follower plz! I NEED THIS BS NICE

fast osprey
#

Why not just ask your question here

dusk pelican
#

are you mentally instable?

sick dagger
#

just hate life

dusk pelican
#

ok but therefore talkking is essential

#

always talk about your problems and I am sure you will find a solution to it

#

many people are in big problems or had big problems, you are not alone. stay strong and search for good people to talk and support you

sick dagger
#

Thx ig

main idol
timber dragon
#

So 5$ lol

#

Even lesser

brisk tapir
celest pelican
brisk tapir
safe comet
#

Is there any experienced discord bot developer who has experience with Components V2 in python

gleaming inlet
safe comet
gritty inlet
#

Wdym by transcript

#

You wanna know how to use them?

safe comet
gritty inlet
#

You want to extract text from them?

safe comet
gritty inlet
#

I can help you with getting the text/whatever from them, dunno what it gotta do with html

gritty inlet
sick dagger
nimble kindle
nimble kindle
#

help please

gritty inlet
#

This is assuming you really installed Python correctly

nimble kindle
gritty inlet
#

I'd show you but I'm on mobile, for now I guess you can just Google it

novel scaffold
nimble kindle
nimble kindle
#

pip install discord py ?

gritty inlet
#

no, py instead of python

nimble kindle
#

whats the link

gritty inlet
#

no, try running that in your cmd

nimble kindle
#

wait actually i did it and its installing python

#

just pip install colarama right, but i already have it installed.