#discord-bots

1 messages · Page 417 of 1

merry cliff
#

and even if you defer the interaction I think its like 5 min max

timber dragon
#

You're already responding to the interaction

timber dragon
#

But you've already responded so discord doesn't care anymore

merry cliff
#

oh ur right

#

🤦‍♂️

timber dragon
#

What you should be doing here is moving the sending message to the task too and only allowing one per guild

And don't call it yourself

merry cliff
# timber dragon What you should be doing here is moving the sending message to the task too and ...
async def mass_give_roles(self, members: Sequence[discord.Member], role: discord.Role, inter: discord.Interaction) -> None:
    if inter.guild.id in self.currently_roll_assigning:
        await inter.channel.send("This guild already has a /roleall task running! Please wait for the previous task to complete before calling this command again."
        return 
    self.currently_roll_assigning.append(inter.guild.id)
    for member in members:
        try:
            await member.add_roles(role)
            await asyncio.sleep(0.42)  # this is probably good enough
        except discord.Forbidden:
            result = f"Error: Missing permissions to update roles for {member.name}"
            await inter.channel.send(result + f"\n{interaction.user.mention}", silent=True)
        except discord.HTTPException as e:
            result = f"Error: Failed to update roles for {member.name}: {e}"
            await inter.channel.send(result + f"\n{interaction.user.mention}", silent=True)
    result = f"Success! {role.mention} added to {len(members)} member(s)."
    await inter.channel.send(result + f"\n{interaction.user.mention}", silent=True)
    self.currently_roll_assigning.remove(inter.guild.id)```
?
timber dragon
#

Wth is that

merry cliff
#

💀

timber dragon
#

Well it's fine outside of sending the result multiple times in the loop

merry cliff
#

thats for specific users

timber dragon
#

But I was thinking something like

# task
async def mass_roles(interaction):
    ... # add roles and send message etc

# command
...
if interaction.guild.id in self.tasks:
    return ... # tell user to F off

task = asyncio.create_task(mass_roles(interaction))
self.tasks[interaction.guild.id] = task
task.add_done_callback(lambda: self.tasks.pop(interaction.guild.id, None))
...

Could send the message etc in a done callback too but eh you can decide that

merry cliff
#

will this fix the race condition if two admins from triggering the task at the same time

    lock = asyncio.Lock()
    async with lock:
        if inter.guild.id in self.currently_roll_assigning:
            await inter.channel.send(
                "This guild already has a /roleall task running! Please wait before calling this command again.",
            )
            return
        self.currently_roll_assigning.append(inter.guild.id)  # yay fixed the race condition hopefully
    for member in members:
        ...
young dagger
#

10 members > sleep 1 sec on repeat

#

1000 × 0.42 = 420 seconds
1000 ÷ 10 = 100 seconds

verbal island
#

What hosting service do yall use to keep bot Alive? (Also is it free or paid)

fast osprey
#

It would not be economically feasible for someone to provide you compute resources for free eternally

stark ingot
#

Oracle also has a free tier

verbal island
#

I see. Thanks

gilded python
#

Anyone want to build bots with me?

#

We can try to make projects together

young dagger
#

Is it possible to change the server banner?

#

I can't find anything in the docs

fast osprey
#

!d discord.Guild.edit

unkempt canyonBOT
#
await edit(*, reason=..., name=..., description=..., icon=..., banner=..., splash=..., discovery_splash=..., community=..., afk_channel=..., owner=..., afk_timeout=..., ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Edits the guild.

You must have [`manage_guild`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.manage_guild) to edit the guild...
young dagger
#

Thanks

wise sky
#

How can i delete past sent messages?

#

With my bot

fast osprey
#

How are you identifying which messages you want to delete?

wise sky
#

by an int

#

But i think i got it

#

I just did

async def clear(ctx, amount: int):
    deleted = await ctx.channel.purge(limit=amount + 1)
sour lagoon
rain bear
#

hi :3
i've made a pretty big discord bot. I'd like if someone could review it and give some insights. I have it on github :)

fast osprey
#

link?

rain bear
finite salmon
# rain bear https://github.com/japaneseTemmie/MusicBot.py-2.0
  1. You didn't have to create a separate repo for v2, you could've just used your original repo. One of the biggest reason to use github is for version control itself and it becomes ironic if you don't use it for that. You can make use of tags and releases to mark (a snapshot) of different versions of your code base.

  2. Personally I prefer keeping only the main file at the root of the project and the rest of the files inside a folder to make it clear where the entry point is supposed to be.

  3. Usually you'd name your entry file name of your program as main.py or the name of your project, not run.py

  4. Automatically installing and checking for dependancies in runtime is diabolical, don't do that. There's so many points of error and adds too much complexity for very little purpose.

  5. Avoid using from module_name import * whenever possible, it usually pollutes your namespace and type checkers cant infer what you're importing and also makes debugging slightly harder.

  6. Instead of manually attaching an error handler for every command individually to do the same thing, you can override discord.app_commands.CommandTree.on_error once and it will apply to all app commands

  7. Use formatters, linters (like ruff which does both) and type checkers (like basedpyright)

  8. Your filenames should follow snake_case, yours is like a c style with no underscores lmao

  9. You can use docstrings within the command method to give it descriptions and stuff instead of having an unreadable help.json

  10. In some places you have mutable data as default value in a function's parameter, specifically your this function in iohelper.py: def ensure_paths(path: str, file: str | None=None, file_content_on_creation: str | dict={}) -> bool:

This is a very bad idea since if you don't overwrite it, the data in default dict will persist in every function call instead of clearing. Just google "why should you not have mutable data as default params in python functions" to learn more

#
  1. I just saw your settings.py file realized that your import that shit into EVERY module... that's single handedly one of the most questionable things I've seen. ONLY and ONLY import the modules / packages you actively need in your working file DIRECTLY instead of having a separate file that loads shit ton of unnessescary files and then load that bloated file into your working one
#

I'm not even gonna question why you have time.sleep in that file..

#

there's probably a some more i can point out but these are some of the obvious ones

#

Even though you're making use of json as a database and you handled synchronizations and somewhat non blocking, json is still not suitable for databases because it can get really slow very fast (especially because of synchronizations)

#

its not even that hard to use an actual db lmao

gritty inlet
#

For very small things it doesn't matter

finite salmon
#

Nah, in this case, the amount of efforts they put into syncs and non-blocking, they could've easily just used aiosqlite (which does that for you) for half the effort and better readability

gritty inlet
finite salmon
#

👍🏿

gritty inlet
#

Ngl I'm still doing fine without a typechecker

#

We'll see though

finite salmon
#

now i cant go back

gritty inlet
#

I won't go beyond these

finite salmon
#

i js use vsc standard to point out the obvious mistakes i do and run basedpyright for the more detailed ones

gritty inlet
#

Your choice

#

I like the standard actually

#

🙏🏻

gritty inlet
#

the ... hits hard frog

finite salmon
#

type shift

gritty inlet
#

Should I just append all functions instead of allowing only one per event? 🤔

#

Not that serious

rain bear
rain bear
fast osprey
#

My review is that this violates TOS and this server's rules by extension

finite salmon
finite salmon
#

Also if you want to automatically sort your imports you can use isort or ruff (with I rule extension as fixable) to do that for you

gritty inlet
rain bear
timber dragon
#

Discord event name -> object

gritty inlet
#

with that

#

i like this quite less

#

Thing is, all 3 can be only two things, that's why they all just subclass the same thing and that's it

timber dragon
#

Always better to keep them separate for future proofing Shrug

gritty inlet
#

Yea

#

But I was too lazy to parse the regular message object xD

#

Maybe later

rain bear
rain bear
fast osprey
#

It is against YouTube tos to redistribute their content, and by extension against discord's.

It's also illegal to redistribute copyrighted content without permission from the copyright holder

gritty inlet
#

Music bots in a nutshell

rain bear
#

But yeah i guess so

gritty inlet
#

I'd recommend just dropping the YouTube feature

#

Unless you want the chance of ending up like Rhythm

fast osprey
#

Don't redistribute copyrighted content or interact with services in unsupported ways

rain bear
gritty inlet
#

I won't get into this too much but as long as you're using a service that does that, you become a part of the problem too

rain bear
#

Got it.. I just liked the idea of a personal bot and figured i'd put it on github if it could interest others too

#

Ima go now

molten bramble
#

I’m using pterodactyl panel but my bots code is python but I don’t know what happened

woeful hill
#

The error is self explanatory

warm bramble
#
async def security(self) -> discord.Embed:
        g = self.guild
        verif_map = {
            discord.VerificationLevel.none: "None",
            discord.VerificationLevel.low: "Low",
            discord.VerificationLevel.medium: "Medium",
            discord.VerificationLevel.high: "High",
            discord.VerificationLevel.extreme: "Extreme"
        }
        nsfw_map = {None: "Not Set", True: "Yes", False: "No"}
        afk = safe_attr(safe_attr(g, "afk_channel"), "mention", "None")
        notifications = str(safe_attr(g, "default_notifications", "Unknown")).title()
        explicit = str(safe_attr(g, "explicit_content_filter", "Unknown")).title()
        partnered = "Yes" if "PARTNERED" in safe_attr(g, "features", []) else "No"
        verified = "Yes" if "VERIFIED" in safe_attr(g, "features", []) else "No"
        community = "Yes" if "COMMUNITY" in safe_attr(g, "features", []) else "No"
        nsfw = nsfw_map.get(safe_attr(g, "nsfw", None))
        
        embed = discord.Embed(
            title="Title",
            description=(
                f"**Verification Level:** {verif_map.get(g.verification_level,'Unknown')}\n"
                f"**Default Notifications:** {notifications}\n"
                f"**Explicit Content Filter:** {explicit}\n"
                f"**AFK Channel:** {afk}\n"
                f"**AFK Timeout:** {getattr(g, 'afk_timeout', 0) // 60} min\n"
                f"**NSFW Level:** {nsfw}\n"
                f"**Partnered:** {partnered}\n"
                f"**Verified:** {verified}\n"
                f"**Community:** {community}\n"
            ),
            color=discord.Color.gold()
        )
        return embed

is this code correct?

finite salmon
#

run it yourself and see if it works, if there's any error show it and explain what you're trying to do

warm bramble
#

gu run mai tid

#

i kwai

finite salmon
#

what

#

don't drink and code

warm bramble
#

i wont ask if it tells me an error

#

you matafaka you better shut up if u gonna say run it myself

finite salmon
#

run it yourself

warm bramble
#

frick off you matafaka

woeful hill
#

Not that hard to just spin on the bot and use the command that send the embed

Better yet use jishaku extension

#

No need to be rude

#

You are asking for free help

finite salmon
#

No one can even run that command for him since there are variable and function names that only he knows how they are defined.

timber dragon
#

Really hope safe_attr is just getattr(obj, "attr", fallback)

#

But also, why is that even used there? Those attributes should always exist.

#

"Matafaka" KEKW

finite salmon
#

i love abstraction over abstraction

warm bramble
#

i fixed it period

celest pelican
#

!mute 604560333063061505 1h If you want to remain in the server, you need to be more respectful towards its members.

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied timeout to @warm bramble until <t:1758968621:f> (1 hour).

warm bramble
#

no respectful for strangers , its for my parents

celest pelican
fast osprey
tender bobcat
slow sphinx
#

I know this isnt a discord bot question but seemed like the best place to ask. when making a twich chat bot should i make a seperate twitch account for the bot or would using mine be okay?

gritty inlet
fast osprey
#

Doesn't even seem python related at all tbh

scarlet galleon
#

i need help

#

import discord
from discord.ext import commands

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

bot = commands.Bot(command_prefix='!', intents=intents)

@bot.event
async def on_ready():
print(f'Il bot è online come {bot.user}')

@bot.event
async def on_member_join(member):
channel = discord.utils.get(member.guild.text_channels, name='welcome') # nome canale
if channel:
await channel.send(f'Benvenuto/a {member.mention} nel server!')

bot.run('token') #token

#

what is wrong?

#

PING ME PLIS

scarlet galleon
#

and someone know a free hoster for discord bot?

fast osprey
#

It costs money to run servers. People aren't going to run your stuff for free

#

Also we can't tell you what's wrong if you don't describe the problem

gritty inlet
#

Either pay for a good VPS or considering self hosting. Depends on your preferences/scale/budget of course.

scarlet galleon
rugged shadow
#

just... a vps

gritty inlet
#

Actually I'm not sure

scarlet galleon
gritty inlet
fast osprey
#

You should get a traceback, not just an error

scarlet galleon
#

can someone send me a code for welcome bot?

#

because i dont understand the problem of my code

fast osprey
#

No

#

Provide the traceback of your error

stark ingot
fast osprey
#

They don't have any commands though Thonk

glacial grail
#

If you have good Idea I am here for the implementation

fast osprey
#

Make a bot that tells people what kind of bot to make

simple hawk
#

Did I cook chat:
if message.content.startswith(“popsicle”):
c = message.channel.name
ch = c.split(“-“)
if “ticket” in ch:
await message.channel.delete()

gritty inlet
#

Why not just make a slash command bruh

fast osprey
#

also you shouldn't be using channels for "tickets" when threads exist

gritty inlet
#

Correct

trail sentinel
#

Can we have 2 bots pls

fast osprey
#

yes...?

simple hawk
#

Ppl can create a ticket and it’ll add only the person and staff in the channel

fast osprey
#

yes. That's what threads are for

simple hawk
#

ohhhh

#

mhmm

stark cairn
#

Hi i need a bot for a chess server where i can (after the new member cites his lichess username) create a new role with that name and assign it to him with a bot comand. Is there a bot that does this?? Thank you

woeful hill
#

why would you wanna create a whole role just for one person

fast osprey
#

Also if you're looking for existing bots, rather than building one yourself, there are better places than a python server. Existing bots don't need to be in python

stark cairn
stark cairn
fast osprey
#

Why can't people just change their own nickname?

gritty inlet
#

Best option might be making your own bot and saving those Lichess names in a DB

merry cliff
#

there's an authentication workflow so you can get users to login to your bot through lichess

topaz field
#

hi, I need help with making my own jarvis from scratch, I have the txt to speech done, I need help making the brain

stark ingot
#

Is it a discord bot?

waxen hound
#

Hello

merry cliff
gritty inlet
warm bramble
#

i never get muted in this server before

finite salmon
#

Matafaka

gritty inlet
#

🤨 🤨 🤨

#

And that was a thing since..?

gilded python
#

hello
i need help regarding the hosting
my query is:
that when i use a command in my bot of ?help it does not send any responce
when when i host my bot with same files locally, they work
other all commands are also working on hosting too but only help command is not working
If anyone know please ping me

stark ingot
warm bramble
#

timeout does not equal mute

fast osprey
#

@celest pelican

celest pelican
#

!mute 604560333063061505 4h don't insult

unkempt canyonBOT
#

:incoming_envelope: :ok_hand: applied timeout to @warm bramble until <t:1759177259:f> (4 hours).

celest pelican
fast osprey
#

Ack ack will do, figured you had the context but will use the role going forward sorry!

gritty inlet
timber dragon
#

it's a new component that hasn't been announced publicly yet

gritty inlet
#

For modals? 🤔

timber dragon
#

yup

gritty inlet
sterile shore
#

Hi anyone know how to add erlc api

#

to a discord bot

#

(ping when read)

gritty inlet
sterile shore
gritty inlet
sterile shore
gritty inlet
sterile shore
#

but i dont understand it and how to make it into a cmd

gritty inlet
#

Do you have Python and/or Dbot developmenet experience?

sterile shore
#

a bit, but barely

#

mostly like bot knowledge e.g embeds and whatnot

gritty inlet
#

So no experience with http stuff I assume

#

I mean maybe there's a wrapper for it somewhere, you can try to search

sterile shore
gritty inlet
#

If you need further assistance, I'm here

sterile shore
gritty inlet
#

However, I definitely recommend using asynchronous methods when using an API

For example if you use httpx (the HTTP library I use), you'd do something like:

import httpx

client = httpx.AsyncClient(headers={"server-key":"YOUR_API_KEY"})

async def example():
    response = await client.get("https://api.policeroleplay.community/v1/server/command", json={"command": ":h Hey everyone!"})
    data = response.json()
gritty inlet
sterile shore
#

sorry if i wasted ur time

gritty inlet
sterile shore
vivid mango
#

Hi everybody ! I'm sorry if this question has been asked many times before, I haven't been active in the server. I'm making a gacha discord bot, where it generates a random picture based on a discord command, and the user gets to keep that picture. So far, it works great. However, I don't know how to save the data. Everytime my bot goes offline (I can't host it 24/7 yet), data is lost (collected pictures in the binder disappear). I've read that I could use JSON files, but it doesn't seem to work (unless I am doing it wrongly), or I could use SQL. Do you have recommendations?

finite salmon
# vivid mango Hi everybody ! I'm sorry if this question has been asked many times before, I ha...

It's best if you use a Relational DB like postgresql, SQLite or whatever you're comfortable with. Or non relational like mongo.

You can use the db locally if you're self hosting on your machine but if you're hosting on a server or smt you'll have to install whichever db's driver on that too. But that's a lot of work so the recommended way is to use cloud databases, you can check out supabase which has a free tier with 500mb db and uses postgresql

vivid mango
#

I see. I had started checking out postgresql, but I might as well try the cloud databases, I didn't think of it. Thank you ^^

fast osprey
#

SQLite is a very good option to get started

#

My advice is to default to sqlite until you find you need features it doesn't have

vivid mango
#

tbf I went with postgresql because it seemed like the most popular and liked choice in general. I had tried sqlite3 at school, but I guess I need to see which one might be better, if I were to go with more traditional sql handling, rather than cloud db

finite salmon
#

Or you can make it database independent by using an orm

fast osprey
#

if you don't know sql at all, that's step 0

finite salmon
vivid mango
#

I do know the queries and the management of tables, but I don't know all of the differences between the relational and non-relational databases

fast osprey
#

That's a good topic to get a handle on. It's extremely likely your data is relational but it's a good thing to know

vivid mango
#

I'll keep those info in mind, thanks

gritty inlet
#

I'll learn to use a DB some day

#

I'm still using JSON 😛

finite salmon
gritty inlet
#

What'd be a good DB that fits for very frequent changes (but also for normal paced changes)? Disk based

#

Maybe I can use aiosqlite, but I'd like to hear some recommendations since I have zero DB knowledge

fast osprey
#

sqlite is the format, aiosqlite is one option for libraries that interact with it

#

I personally recommend asqlite instead

gritty inlet
#

Does it offer any specific benefits that you like having? Or is it rather you being used to it or maybe just syntax?
Thank you anyway!

fast osprey
#

and provides a connection pool implementation

wooden mortar
pure schooner
#

Does anyone have a discord bot templates with many features

gritty inlet
# sick birch how frequent

Let's say for presence update changes, for example
Tbh one of my "archived" bots that I'm sometimes working on needs that and the others don't

gritty inlet
#

Anyway I probably don't need it as I kinda gave that bot up

oak sedge
#

Hii

sick birch
#

making a database query for each presence change can get unwieldy quickly for larger servers. you would need to do some sort of optimization like caching or batching

gritty inlet
#

Yeah..

gritty inlet
fast osprey
#

You generally do not need to store stuff in a db that's tracked by discord, you're just duplicating data and discord has a lot more money than you do

gritty inlet
#

🥲

#

Anyway is there a downside of using a disk based DB? Necessarily not for very frequent changes (but edge cases always exist..)

fast osprey
#

...what is the alternative?

gritty inlet
#

Good question that I can't answer (:

#

Alright then

fast osprey
#

stone tablets? KEK

gritty inlet
#

Comparing to stuff like Redis, unless Redis is called "disk based" too

fast osprey
#

Where would redis physically put data Thonk

gritty inlet
#

Well yeah you cannot completely avoid using disk

fast osprey
#

I don't think this distinction of disk-based is what you're trying to get at

#

Redis (and the like) are caching layers, not databases anyways. It's meant to be used in tandem with a db, not as a db replacement

finite salmon
# gritty inlet Comparing to stuff like Redis, unless Redis is called "disk based" too

As far as I know, most databases (SQL type), load "pages" (sections) of the disk data to memory and whenever you make any query, it does most of it in memory than disk I/O, which is why they're super fast.

But databases like redis loads the entire data to memory without needing to calculate which page it needs to load.

But in the end all the data is being saved in the disk

fast osprey
gritty inlet
dry kelp
#

A quick suggestion i can give you, is learning how to use docker, you can easily setup a database running on docker, no need for extra installation on your pc, Amazingly to be able to work in development.

#

Consider in production you will need to connect to a proper database cluster or locally, i do recommend postgreSQL, I main it, and it's the best in my opinion for long term data storage, and works amazingly for discord bots.

#

It's a lot easier creating a configuration to connect using Dynaconf package, And to also facilitate your work, you could use ORMs, You define your models, they will migrate / upgrade / downgrade based on how you want.

#

Using them in your code it's also a lot easier than having RAW sql (or any)

gritty inlet
#

Docker no, I'll consider the other things, thank you

dry kelp
#

Why not?

#

It's the most friendly tool for developers, and probably the best.

gritty inlet
#

I'm doing perfectly fine with my RPI and its venv

dry kelp
gritty inlet
#

No

dry kelp
#

Are you aware that within just 1 command installation it will automatically create a venv, not using a basic "requirements.txt" to install each package.

timber dragon
dry kelp
#

I think most developer here that have a certain level of experience would prefer docker.

timber dragon
#

UV isn't a host?

dry kelp
gritty inlet
gritty inlet
dry kelp
dry kelp
gritty inlet
#

cd bin
source activate
pip install

ez for me

dry kelp
gritty inlet
#

But thanks for recommendations

timber dragon
dry kelp
#

Yeah, but it depends a lot over what you're building.

#

for me, being able to use all these tools as docker, poetry, it's absolutely all i need.

timber dragon
#

That's great for you

dry kelp
#

Yeah, i just need something to run properly, not focusing on "speed"

#

But you're right, UV is ineed better, as far as i know it's rust based.

gritty inlet
#

Gotta love user installs

#

It's very easy to implement and support, definitely recommend it

earnest cloud
#

i need a free hosting website that auto update from my repo

fast osprey
#

You don't need it to be free

woeful hill
#

Is it that hard to just hop in or load jishaku to do git pull

woeful hill
#

Jishaku is an extension that provide you some neat owner only commands

#

Run shell command, run python snippet, test command as other user,...

fast osprey
#

You also don't need a host or any extension to do this for you. GitHub Actions exist, or you can make a like 5 line command that pulls and reloads things.

gritty inlet
#

Maybe except for the last one

sweet minnow
#

will discord slash command ids change or not?

finite salmon
sweet minnow
#

does it change?

sweet minnow
#

will the id stay permanent?

fast osprey
#

unless you change the name of the command, yes

finite salmon
fast osprey
#

it's not going to rotate them randomly, no

sweet minnow
#

ok

finite salmon
#

I'm not sure if you change the parameters and sync again and the I'd will remain the same or not. But it most probably will change I think

fast osprey
#

It's the name that identifies the command

finite salmon
#

Oh alr

timber dragon
#

There is a version field that changes for other stuff afaik

gritty inlet
#

"In conclusion", I recommend not using a static string for command mentions

#

But rather find a way to dynamically get it

rustic pagoda
#

Does select work yet in modals? I see on discord.py's website that they added it in 2.6. If I put a select in my modal in the code the bot will run, but when I run the command to open the modal the bot errors

fast osprey
#

Are you putting it in a label?

rustic pagoda
# fast osprey Are you putting it in a label?

I'm not sure what you mean tbh. I was just trying it out with this. If I remove the select it works fine with the text input, but errors out with the select

class modalTest(discord.ui.Modal, title = "poopy stinky"):
    testfield = discord.ui.TextInput(label = "input poopy", style = discord.TextStyle.short, placeholder = "not poopy enough", required = True, max_length=2)
    select = discord.ui.Select(
        placeholder = "Select something",
        min_values = 1,
        max_values = 1,
        disabled = True,
        options = [discord.SelectOption(label = "option 1", value=0)]
    )
fast osprey
#

Selects have to be put in a label. You can't just directly add them to a modal

fast osprey
rustic pagoda
#

It worked, thanks for your help! I was having a lot of trouble finding recent examples that showed select working in a modal, so this helps a lot. Thank you!

earnest cloud
mild bloom
#

nope but you didn't specify this before

earnest cloud
mild bloom
#

just go with a vps

fast osprey
gritty inlet
#

Here is a link to an image*

#

Sounds botted

pure schooner
#

Does anyone have a really good template for discord bot. I wanna learn from scratch

fast osprey
#

How are you going to learn from looking at a template?

pure schooner
#

Youtube tutorial is way too basic, not practical

fast osprey
#

youtube tutorials are also wrong and made up

#

Just looking at a template a) won't tell you the design choices they made to get that code b) help you understand the tradeoffs made or c) even necessarily be "correct"

pure schooner
fast osprey
#

I'd recommend starting with getting very, very strong fundamental python skills if you don't have them already

#

you should know things like OOP and async first

sly burrow
pure schooner
sly burrow
#

can i ask u some in dms

pure schooner
rough pivot
#

i know oop is object oriented prorgamming

pure schooner
#

asynchronous

rough pivot
#

what is it?

finite salmon
#

Usually used in networking where there's a lot of I/O and waiting

rough pivot
#

wow you guys know a lot of words and stuff

#

my school didnt teach me anything

#

i wasted like 5 years of my life learning bare minimum

#

self taught is way better

finite salmon
#

Schools usually teach you the bare minimum or scratch the surface of many topics, you gotta learn mostly on your own

rough pivot
#

anyways what is i/o?

finite salmon
finite salmon
rough pivot
#

do you mean multiple programs?

#

its probably a simple concept youre telling me about its just i dont know any of the vocabulary us3d

finite salmon
rough pivot
finite salmon
#

It's alright, I don't mind answering

rough pivot
finite salmon
#

Host is a server somewhere on the internet that accepts requests to it and possibly sending request back too

rough pivot
finite salmon
#

Discord API

rough pivot
#

well

finite salmon
#

You send a request to the discord api's server

rough pivot
#

i mean like

finite salmon
#

And get some data back

rough pivot
#

whats api

finite salmon
#

Application interface

#

It's a kind of abstraction to simplify the internals of a programs for external use

rough pivot
#

so what would discord’s api be? could you give some examples?

finite salmon
#

This is the base URI of the discord API

finite salmon
rough pivot
#

ah i see now i looked what api was on google

#

sorry im bad at wording

#

i wanted like the definition of api and like what it does and stuff and like an example

finite salmon
#

Yea there's many different kinds of apis you're better off googling them

rough pivot
#

i just wanted the general concept of one

#

this was very straightforward

rough pivot
finite salmon
#

Sorry if I didn't explain it well

rough pivot
#

we’re all human

#

me and you

finite salmon
#

Alr

rough pivot
#

man i still dont get it

finite salmon
#

Lmao

#

What do you not understand

rough pivot
#

i dont fully grasp the concept of why to actually use one

rough pivot
finite salmon
#

Api?

rough pivot
woeful hill
#

Api = application programming interface, you interact with the application programmatically

finite salmon
#

Through your code

finite salmon
#

Every api is different and serves a different purpose

woeful hill
rough pivot
woeful hill
#

You are interacting with discord thru a user interface

#

Specifically graphical user interface

#

But since bot dont have senses like you

finite salmon
woeful hill
#

They interact with discord differently

finite salmon
rough pivot
#

i dont know man maybe im just stupid and cant learn normally

#

if it seems simple to you guys and explained simply then why dont i understand it

rough pivot
#

i dont know what to ask to help myself understand it more

finite salmon
woeful hill
#

They dont understand how api work, not how to work with api

finite salmon
# rough pivot yeah

I still think you will understand a bit better if you actually work with the api

rough pivot
#

when im given a definition of how something works it doesnt let me understand why i should use it

its like not knowing anythinf at all about a lawnmower and its reduced to a word.

A, using scissors to cut grass: hey B, why should I use a lawnmower?

B: because it cuts grass

A: how does it cut the grass?

B: by using blades, here work with it.

A: i have no idea what im looking at, i dont even know how to work with it and how to know if its cutting grass or not, and i have no reasoning to use the lawnmower instead of the scissors.

finite salmon
#

If you want to understand how to make your own APIs and stuff you can check out FastAPI

rough pivot
finite salmon
rough pivot
#

you dont know why you should use it either

#

i cant visualize things in my head API right now is just a word to me

finite salmon
rough pivot
#

im overwhelmed now

#

these things arent put in a way i can understand

finite salmon
#

You won't understand at first why a lawnmower is better than scissors but unless you use both of them you won't know that lawnmower is easier to use. So just start using an API and see how it works right before your eyes

gleaming inlet
#

Im trying to deploy a new readthedocs site of my repo and saw that it has pelican as one of the configs. I dont know how to see what the pelican docs look like. Anyone know of any existing repo that points to their pelican type docs?

#

oh nvm. The actual docs site of Pelican is made with Pelican

woeful osprey
#

gulp

brazen raft
# rough pivot i dont see why you should use one

It's like a user interface but for developers.
Let's say there's an API for cat images.
It exposes parts of its underlying system, that is a database of cat images, and enables using them in programs in a cohesive, abstract and (hopefully) safe way for the system.
It could provide a function to retrieve a cat image from its database or even many at once. These two functions may support specifying filters to get images of specific cats or other features like pose, accessories or environment.
This API would set a limit to the rate at which users can access it so it won't get overwhelmed with requests and go down for all users.
Now you get to use cat images in a simple way. You don't know the details and you can't abuse this system, but this is the tradeoff you make.
Alternatively, you would have to set up your own library of cat images and write your own functions that simplify extracting images from it in possibly complex ways.

APIs of online services let you work with systems you don't own (e.g. social media APIs, game APIs, Google Translate API) or can't possibly replicate on your own with limited resources (e.g. satellite APIs, database APIs).

If an API is locally available, it's basically the same as programming libraries or even operating system APIs and drivers.
You may not know how the random module in Python's standard library produces randomness for your intents and purposes, but you can use it nonetheless.

tranquil plaza
#

hello

#

I am looking for python dev from india only

timber dragon
#

Not the server or channel for that, #rules 9

rough pivot
#

i cant understand it logically. i know its a way to get requests from the server/ send them and i know thats what the api is for but i want to know deeper than that and im not getting my answer wherever i go. youtube, AI, even here i cant fully grasp the concept of an API. it just feels like every explanation is vague and explains WHAT it is, but not HOW it works and WHY you should use it.

#

and if i see one more restaurant analogy i am going to lose it

quick gust
#

what do you mean by "how" it works?

fast osprey
#

Fam it's clear you are more interested in getting frustrated and complaining than actually engaging with the information people are giving you

#

it is not our responsibility to keep trying random words until we find the combination that works for you. It is your responsibility to engage, think through it, and ask targeted questions on the specific things you don't get

rough pivot
#

this is very insensitive

#

im just stressed out man

#

ive been trying to learn for hours i am engaging it just isnt clicking

fast osprey
#

it's insensitive for you to take that out on people helping for free

rough pivot
#

im not blaming anyone?

#

im not saying its anyones fault that i dont get it

#

im grateful theyre helping. its just im bad at learning

#

i appreciate the time people take to help others and that doesnt mean i cant express the frustration im feeling

fast osprey
#

I'm not going to argue with you. But you're not going to get anywhere if all you do is express frustration

#

not once have you asked a clarifying question that demonstrates you're even trying to engage

rough pivot
#

that isnt an argument, im not arguing dude

rough pivot
#

if youve actually read what im saying, im not solely just complaining

#

“all im doing” is not just expressing frustration im literally trying my hardest to grasp the concept of an API.

fast osprey
#

im not arguing dude

argues

rough pivot
#

okay so we’re just brainless here

#

im blocking you, have a nice day

fast osprey
#

my feelings are hurt and my day is ruined

finite salmon
rough pivot
finite salmon
#

did you try experimenting with an API yet..

rough pivot
#

could you maybe show me what its doing so i can understand it better?

finite salmon
rough pivot
#

let me go back to it rq and ill tell you

finite salmon
rough pivot
#

whats a curl?

finite salmon
finite salmon
#

you can use any library for making a request

rough pivot
#

wait wait

#

im slowly getting it

#

wait 1s

#

i see

rough pivot
finite salmon
# rough pivot

the second image, response body is the main data returned by the server (which is nothing here, idk what you did to do that), response header contains metadata returned by the server. What's metadata? metadata contains useful information about the host's properties like the type of encoding etc

rough pivot
finite salmon
#

I see

rough pivot
#

dude this actually made me understand databases way better

#

they were so ambiguous

#

and vague

finite salmon
#

or mongo

rough pivot
#

so an API is a method right

#

you talk to the API and basically you give it arguments right

#

and then it uses those arguments on the database to give you what you want specifically

finite salmon
rough pivot
#

so it would be like

give 3 cat facts

api: ok catfact(3)

api: hey database im going to select 3 random cat facts from you

database: ok

api: ok done

api: hey i got your 3 cat facts here you go

finite salmon
#

pretty much

rough pivot
#

basically my whole issue was i thouht it would be more convinent to just pull them out the database, but that can completely expose things that you werent meant to interract with

rough pivot
finite salmon
#

that's why it's called Application Interface (API), the API gives you an interface to work with it's database or of some sort

rough pivot
#

disambiguating what a database was solved 90% of my problem

finite salmon
rough pivot
#

i like understand it 75% now. i think if i want to know more then id have to experience an api more

finite salmon
#

you'll have to pip install the requests library

rough pivot
#

cool

livid brook
#

bruh

#

im sturggling tryna debug fucking python

#

so my main.py links in with my commands folder and all my commands

#

for some reason it's not working and i literally cant think of why

#

ive even tried asking another person and they dont know

#

maybe were both blind

#

or tired since it is late

fast osprey
#

We need more details than "it's not working"

rustic pagoda
#

In discord.py is there a way to make / commands only visible in one channel? I know I can make them just only work in one channel, but I want them to only appear on the tree at all in one channel on a guild

fast osprey
#

You can do that from the integrations menu in guild settings

#

(So not in code but in the UI itself)

rustic pagoda
#

Darn, that sucks. Thanks

fast osprey
#

?

#

it's super fast and easy to do, and way more maintainable than code

stark ingot
#

Technically you can do it via OAuth but that is out of scope for discord.py

rustic pagoda
fast osprey
#

But not every server has the same channels

#

Nor would every server necessarily want that behavior

split scaffold
#

hello guys can i automate a click in chrome using python ?

#

anyone

#

?

merry cliff
#

you can do that with libraries such as selenium or playwright

split scaffold
#

sry in wrong channel

narrow hazel
#

Does anyone know anything about JSON files? I'm making a basic counting game where users input a count and increase the count by 1 each new message. If they say anything or it doesnt equal the number it gets removed.

#
  self.count_file = 'JSON_storage/counting.json'
    os.makedirs('JSON_storage', exist_ok=True)
    
  @commands.Cog.listener()
  async def on_message(self, message: discord.Message):
        if message.author.bot:
            return
        if message.channel.id == 1414445233814634679:
            print("MEssage sent to channel")
            try:
                with open('JSON_storage/counting.json', 'r', encoding='utf8') as f:
                    count = json.load(f)
            except FileNotFoundError:
                count = {"Count": 1}

            print(f"User sent: {message.content}, expecting: {count['Count']}")

            if message.content.isdigit():
                print(f"User sent: {message.content}, expecting: {count['Count']}")
                if int(message.content) == count["Count"]:
                    print("It did check if matched the count")
                    count["Count"] += 1
                    await message.add_reaction("✅")
                else:
                    print("Number mismatch!")
                    await message.add_reaction("❌")
                    d = await message.channel.send(
                        f"Hey {message.author.mention}, that's not the correct value. "
                        f"The value is ***{count['Count']}***"
                    )
                    await asyncio.sleep(5)
                    await d.delete()
            else:
                print(f"User sent NON-digit: {message.content}")
                await message.delete()

            with open('JSON_storage/counting.json', 'w', encoding='utf8') as f:
                json.dump(count, f, sort_keys=True, indent=4, ensure_ascii=False)```
#

I've been doing some basic debugging but I can't figure out what I did wrong that it doesnt create the count in the file and doesnt add it

#

im still new to JSONs and im trying to learn

merry cliff
#

what print messages are triggered when you attempt to start the count?

narrow hazel
#

after that nothing happens

#

it does detect words that are not numbers and delete them as well

#

but it doesnt print anything

merry cliff
#

so nothing with the ```py
print(f"User sent: {message.content}, expecting: {count['Count']}")

narrow hazel
#

yeah it doesnt print that

#

maybe because the count doesnt exist

merry cliff
#

but then it should chuck an error

narrow hazel
#

wait could it be becuase im not checking if a count exists

#

like my other JSON

if user_id not in users:
                users[user_id] = {"name": user_name,"level": 0, "exp": 0}```
#

or no?

merry cliff
#

my best guess is that opening the file is blocking the async function

#

you could try to put the loading of the json file in a seperate function and calling it with asyncio.to_thread()

#

can you try putting a print statement under the with open place

narrow hazel
#

yeah

#

doing some more checks

finite salmon
narrow hazel
#

I want to keep the count after the bot restarts so I got no choice

finite salmon
#

They are not a good databas for an async environment, just use a dedicated db like sqlite

finite salmon
narrow hazel
#

I dont need to use a DB if Im not looking to scale

finite salmon
#

What

narrow hazel
#

its a personal bot on my personal server

#

JSONs work fine

finite salmon
#

It doesn't have to do anything with scaling, using jsons is just bad, use an async implementation of a database if you want to store data

high kite
finite salmon
#

There's very high chance of your json getting corrupted too

narrow hazel
#

using a DB means Im reliant on paying for storage or I have to learn SQL which I dont wanna do

narrow hazel
#

JSONs are simple and quick and I can see what goes on

finite salmon
#

You can store it locally

high kite
#

can you send full script

narrow hazel
#

im using cogs

high kite
#

send the cog part

#

i mean

finite salmon
narrow hazel
#

what does that even mean

#

if you're gonna insult me for wanting to use what I know then I dont need you're help

high kite
#

stop the beef guys

finite salmon
narrow hazel
#

So for now im using JSONs

finite salmon
#

Try SQLite and aiosqlite if you want to use it in your bot

narrow hazel
#

welp I cant figure it out right now so i'll move on, not a big deal since counting can work without the JSON

#

I'll just manually update the value if the bot restarts until then

young dagger
#

Can you add a persistent button to an ephemeral message?

#

I heard it's only possible with non-ephemeral messages

#

My idea was to wrap the button response in a try except (since it expires after 15 minutes). Is there a better way to handle it?

narrow hazel
#

I figured it out

#

Im so beyond dumb

#

So the
try:
except; was causing the data to be loaded without caring if it exists

#

I removed try and excepy and now it saved it

young dagger
#

Can you add timeout to ephemerals?

obsidian mist
narrow hazel
young dagger
# narrow hazel Wdym

I'm sending an interaction.followup.send with ephemeral=True and attaching a view (button). The issue is that the button in the view stop responding after 15 minutes

narrow hazel
#

Did you set a timeout to have it stop working after 15 minutes

young dagger
#

You cannot keep it running for longer than that

narrow hazel
#

Just set the timeout = None

young dagger
#

Yes that is what I did

burnt quiver
young dagger
fast osprey
#

The whole purpose of ephemerals is to be temporary. If you don't want something temporary, don't send it ephemerally

young dagger
#

I want it to be private from others

fast osprey
#

Well that's just how ephemerals were designed, they go away quickly

earnest cloud
fast osprey
#

Could you rephrase what you're looking for?

#

The docs are fully searchable online

gritty inlet
#

Improved syntax for my webhook events wrapper stonks

#

Hopefully I'm using this type hint correctly lol (No I don't care that there's no "T" in the name, maybe I'll change it but meh)

timber dragon
#

Banana

gritty inlet
#

Very secure Banana

narrow hazel
#

recreate my punishment system I said, it'll be easy I said

fast osprey
#

json as a db blobpain

narrow hazel
#

my sever aint gonna be large so idc

fast osprey
#

It has nothing to do about size

narrow hazel
#

thats literally the only complaint that comes with using JSONs

fast osprey
#

It's not

narrow hazel
#

great argument

fast osprey
#

You're the one that made the lofty claim that size is the only problem with using json as a database

#

I didn't make an argument, I just corrected you

#

The lack of transactions and atomic reads/writes is a huge issue regardless of scale

woeful hill
#

Easily got into a race condition and then all your data gone

#

When writing a json file everything inside is cleared, and the whole new data is written into

#

If another activity that needs to use the json file happens when the last one is still writing, you are gonna have tough time

gritty inlet
#

Better save every x amount of time instead of saving dynamically

But better just switch to a real db

narrow hazel
#

again I dont have time or money to learn a whole new database

#

my server aint gonna be big and theres not enough activity worth doing all that

#

so no

fast osprey
#

I mean it's your choice, but if you're gonna talk about it in a public forum then be prepared for people to tell you how bad of an idea it is

#

If the afternoon to learn sqlite is more important to you than your data not randomly getting wiped out, that speaks volumes about how little you care about this project

narrow hazel
#

I dont have time or money to learn SQL I barely know discord.py

fast osprey
#

How do you know how long it's going to take? You conveniently have enough time to do everything else here except the thing that keeps your data from randomly getting wiped out?

merry cliff
#

18 exercises covers more than you will need to know for a discord bot (most likely you dont need joins)

gritty inlet
#

This is for the best but you can also just learn the very basics from code examples

#

I don't completely agree with the idea of learning a course for every thing you use

narrow hazel
#

I've looked everywhere online and it says to host your sql db you're gonna pay

#

from articles I found, microsoft, reddit

#

if im gonna do all that i'd rather just go back to mongodb cuz at least they're easier to learn

gritty inlet
#

Sure they don't mean the simple fact that you need to have your db stored somewhere?

fast osprey
#

SQLite is just a file

#

Presumably you have files

narrow hazel
#

Huh? but the api worked?

#

no wonder their role wasn't getting added

#

been working on this for 2 hours

gritty inlet
narrow hazel
#

im not even sure why it was produced my content and embed combined only add up to 1400

#

probably just gonna go back to embeds cuz this api has caused more issues than it's worth

gritty inlet
#

What API

#

Are you talking about Components V2

narrow hazel
#

yeah

gritty inlet
#

The content length is a problem on your side mate

narrow hazel
#

im using a discord POST message API and a JSON to create it

#

This is the only content i have

gritty inlet
narrow hazel
gritty inlet
#

What is that

#

Guild name?

narrow hazel
#

status code of the api

compact halo
#

Guys what’s wrong with it?

gritty inlet
compact halo
#

I did do everything right

gritty inlet
compact halo
#

Lmao ty

narrow hazel
gritty inlet
narrow hazel
#

ah

#
      body = {
      "flags": 32768,
      "components":[
   
    {
        "type": 17,
        "accent_color": None,
        "spoiler": False,
        "components": [
            {
                "type": 9,
                "accessory": {
                    "type": 11,
                    "media": {
                        "url": member.avatar.url
                    },
                    "description": None,
                    "spoiler": False
                },
                "components": [
                    {
                        "type": 10,
                        "content": f"Hey {member.mention} welcome to {member.guild.name}"
                    }
                ]
            },
            {
                "type": 14,
                "divider": True,
                "spacing": 1
            },
            {
                "type": 10,
                "content": f"We are at **{member.guild.member_count}** members"
            },
            {
                "type": 1,
                "components": [
                    {
                        "type": 2,
                        "style": 2,
                        "label": f"{member.guild.member_count}th Server Member",
                        "emoji": None,
                        "disabled": True,

                    }
                ]
            }
        ]
    }
]
}```
gritty inlet
#

Instead of printing just the status code, you can print the response text. The API tells you what the problem is

narrow hazel
#

oh can I?

gritty inlet
#

Yes

narrow hazel
#

didnt know that was a thing

gritty inlet
#

What http library are you using

jovial ingot
#

Zizzlewizard is a poop 💩

gritty inlet
#

Bruh

compact halo
#

tf is wrong now

jovial ingot
#

Also metal is pooopp

gritty inlet
narrow hazel
gritty inlet
jovial ingot
#

All of u ar poop

compact halo
gritty inlet
jovial ingot
#

And back to ur toilet

compact halo
jovial ingot
#

Lol no

compact halo
jovial ingot
#

K

compact halo
#

@gritty inlet god help me

narrow hazel
#

im going back to embeds, im just gonna store V2 until python supports it

narrow hazel
compact halo
#

Tf is the best app for coding in iphone

narrow hazel
compact halo
#

Buy me one

deft portal
#

w

gritty inlet
compact halo
narrow hazel
#

iphone? probably

deft portal
#

www

narrow hazel
#

everything else works fine

narrow hazel
#

Cuz I tried the discord.ui.LayoutView a couple months ago and it said it wasn't supported

narrow hazel
#

I have one, im using it to watch anime while I code

compact halo
gritty inlet
fast osprey
narrow hazel
#

it wasn't supported

quick gust
#

yeah that's right, it was added a month ago iirc

narrow hazel
#

ah okay i'll try again

earnest cloud
gritty inlet
#

discord.js is a library
python is not a library

#

You need to know what you're using

narrow hazel
#

I also tried pycord

#

oh well back to embeds

quick gust
narrow hazel
#

I think 3.11

woeful hill
narrow hazel
#

2.5.2

compact halo
narrow hazel
#

never used instagram

compact halo
woeful hill
#

components cv2 support is on 2.6

compact halo
#

instagram + telegram u can make ez money from them

narrow hazel
compact halo
#

They sell Usernames checker for a 100$ monthly

compact halo
#

If u make a 400$ in 4h I don’t need anything

narrow hazel
#

then buy a PC

compact halo
narrow hazel
#

sounds like you need a ||job||

compact halo
#

Nah im good but idk how to handle my money

#

Im spending on everything

narrow hazel
#

Yknow what close enough, thanks everyone

#

finally rid that API

compact halo
#

Great

narrow hazel
#

There we go much better

#

I'll fill the empty space with a job application

compact halo
#

Put my name

narrow hazel
#

put your name where

compact halo
narrow hazel
#

yall think I should actually learn python?

#

I learned .py without actually learning the language

finite salmon
finite salmon
gritty inlet
#

Man oh man is there a wrapper of sqlite that does not use string for actions 🥲 I feel like it makes it harder to learn and use

gritty inlet
#

Thought of asking that here since at this moment I'm migrating to it in my bot

gritty inlet
gritty inlet
finite salmon
#

Object relation mapper, it maps SQL syntax to programmitical (pythonic) objects and functions

gritty inlet
finite salmon
gritty inlet
gritty inlet
finite salmon
gritty inlet
#

Alright, guess I'll search on Pypi then, unless you know of a good one, I just wanted to use sqlite because of recommendations

finite salmon
#

Sqlalchemy

gritty inlet
#

I'll check it out, thanks

narrow hazel
#

got a new system in mind now that I learned this

gritty inlet
#

Oh I can definitely get used to this flowercat

#

Got it all to work

narrow hazel
#

User frogs

gritty inlet
#

Indeed

narrow hazel
#

Looks pretty much like how I do it aside from the mapping whatever that means

young dagger
#

So the problem is that the interaction token is only valid for 15 minutes. The timeout starts counting from the moment you click the button. After 15 minutes, when the timeout is triggered, it’s no longer possible to edit the button and it gives me this error Error during timeout: 401 Unauthorized (error code: 50027): Invalid Webhook Token

timber dragon
#

Indeed

#

But you can fetch the full message and edit that

#

Unless it's an ephemeral message

young dagger
#

So there is no good way to use timeout for ephemeral messages?

timber dragon
#

Nope

#

Ephemeral messages can only be edited/deleted from an interaction

young dagger
timber dragon
#

Set a timeout that's less than 15 mins?

#

14.3 KEKW

young dagger
timber dragon
#

Oh

#

So you want an absolute timeout

young dagger
#

If possible

timber dragon
#

But also, that'll be a new interaction

young dagger
timber dragon
gritty inlet
#

Will using interaction.response.edit_message not work?

young dagger
gritty inlet
timber dragon
#

You could also track the time yourself and check that and edit when exceeded

timber dragon
gritty inlet
timber dragon
#

But if it’s ephemeral, then you can't do anything with it without an interaction.

Otherwise, you could've fetched it and done whatever.

gritty inlet
timber dragon
#

Never understood "sir" lol

gritty inlet
#

Sir me too sir

timber dragon
#

sir

#

iOS autocorrects "sir" to "die" 💀

gritty inlet
#

Damn

#

Anyway I meant to say if he plans to edit using the button, he can definitely use response.edit_message

#

But now I understand that he wants to edit the message in another way

young dagger
gritty inlet
#

Might wanna just change this UX

young dagger
gritty inlet
#

It's different than edit_original_response

#

And as I said, this would only work with the button interaction,
so that's why I concluded this isn't what you need

timber dragon
gritty inlet
#

Yep

young dagger
timber dragon
#

A task instead of waiting hm

#

Looks good to me tho

burnt quiver
#

we love tasks

young dagger
timber dragon
#

Not sure

#

Wait makes it wait x seconds and then executing the callback to stuff

Your impl executes the callback and then waits to do stuff

young dagger
timber dragon
#

Yeah

young dagger
#

I guess I will stick to that

young dagger
# timber dragon Yeah

self.stop() doesn’t stop the scheduled timeout. After verifying, it still times out the button

#

Should I use something like self._absolute_timeout.cancel() to cancel the timeout?

timber dragon
#

your custom timeout? yeah

#

the view doesn't know about that one so ofc it doesn't do anything to it

young dagger
#

Hmh

wheat current
#

I need help with my discord bot pls dm me

fast osprey
#

Just ask your question here

gritty inlet
#

Ah yes the feeling of sitting down to think and write some corny ahh phrases (:

#

At least they're corny on purpose

timber dragon
#

I would just ask ai to come with 20 or so lol

gritty inlet
#

xD meh, it wasn't so painful to think of them myself

timber dragon
#

Lmaoo

finite salmon
#

sigma

young dagger
#

@timber dragon Thanks. Here is the result

gritty inlet
#

I think the second embed has some unnecessary text. Personally I'd use a container and add accessory link button to each step

#

Also "in about" is just odd, why not tell the exact time?

stark ingot
gritty inlet
#

Does Riot not have Ouath?

#

Wouldn't that be enough of a verification

#

🤔

young dagger
gritty inlet
#

I get you

young dagger
#

Just a different type of application

gritty inlet
#

Ah so it's not that much of an issue (:

young dagger
gritty inlet
#

And I would put the "the session..." as footer

fast osprey
#

I'd wager that getting a production key once and doing an oauth is less work than making your users do this convoluted old school profile juggling

gritty inlet
#

It's more reliable as well

fast osprey
#

"Hey change your icon to match mine for this game"

tawny anchor
finite salmon
#
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.

tawny anchor
#

components v2 persistent view is possible?

fast osprey
#

Yes

#

Your bot still gets interactions the same way

low harbor
fast osprey
#

It works the exact same way as a regular view. LayoutView inherits from View

young dagger
narrow hazel
#

Now we need a tutorial for the new modals

stark ingot
#

There is not really much different about them. There are a few new components but they are quite simple. Is there anything in specific that you dont understand?

narrow hazel
#

Finally learning the basics

#

hope yall are happy

merry cliff
#

...

narrow hazel
#

to keep it related to discord bots im working on this new command

woeful hill
#

Beside inconsistent formatting for more readability, why is the bot dming people

narrow hazel
#

wdym inconsistent theres no other way to write this

woeful hill
#

There are indeed many ways to write an app

#

But im not talking about that

narrow hazel
#

wdym then

woeful hill
#

The formatting

narrow hazel
#

I think it's fine 👉 👈

woeful hill
#

2 spaces mixed with 4
No new line separating things - everything is jammed
Class name should not be in all lowercase

#

The code you sent is hard to read

narrow hazel
#

I dont like camal case

#

and discord.py is super picky about spaces and uppcase for commands so I just write in all lower case

#

I used to do camal case for discord.JS

#

tho honestly its fine I can read whats going on

merry cliff
#

kid named linter

narrow hazel
#

I use functions and class names to determine where stuff is

woeful hill
#

Its readable for you because you wrote it

#

But what if you come back after like a week

#

Will you remember whats going on

narrow hazel
#

yeah

#

and I wrote this a couple days ago

finite salmon
#

That's the python standard

#

You can read PEP8 to know the complete style guide of python

#

And use a formatter tool like ruff to autoformat everything for you

narrow hazel
#

Will look into it

narrow hazel
#

python should be more like JS and just stop being picky about indents

woeful hill
#

its not, the code you shared is just inconsistent

#

make it easier to make a mistake because you don't know if you are using 2 spaces or 4 spaces this time

narrow hazel
#

it is, it wont work if you dont indent it correctly

#

JS you can have inconsistent indents and it wouldnt matter

coral flicker
narrow hazel
#

let me see if I have any of my old JS discord bots

#

It wasn't as bad as I thought actualy

woeful hill
#

?

#

this is consistent

#

everything is indented nicely with 2 spaces

#

actually your js code is pretty nicely formatted

#

why don't you apply it to py

narrow hazel
#

I worked with other people to make it + thet sent me sections

finite salmon
#

Even then python is still lenient with how much spaces per tab it allows, as long as you use the same amount of spaces/tab under each code block. It considers it valid. This allows you to have different number of spaces in different code blocks (which is what you're doing)

woeful hill
#

its just how interpreted language works, same indent level = same block of code

coral flicker
runic valve
#

hello im new to python

woeful hill
#

well, thats how indentation works ig

#

better to say

finite salmon
runic valve
#

why chatgpt doesnt want to learn me how to steal discord tokens with python?

#

im kinda sad

#

i got hacked like this once and im curious

woeful hill
#

because its against tos

runic valve
#

i just wanna know how it works not to use it

woeful hill
#

i want to know how to do a crime to not do a crime

runic valve
#

btw can i use python for in hacking

finite salmon
#

You can use any language for anything including hacking

woeful hill
runic valve
#

what if i wanna make some to hack ingames

woeful hill
#

thats cheating

runic valve
#

alr then cheat

#

is python even useful for it

finite salmon
#

Read the server rules, we don't help with illegal stuff

woeful hill
#

you wont get much help then, due to in most case cheating is illegal

runic valve
#

i just wanna know how it works so in future i can help with anticheats or something

finite salmon
#

Google is your best friend because we still can't help you

runic valve
#

oh okay

woeful hill
runic valve
woeful hill
#

¯_(ツ)_/¯

#

so you identify yourself as a cheater then

runic valve
#

nah rn im noone, but i wanna learn it

#

im nobody rn

#

i only learn basics like how to read files modify them, use some loops, little tkinter but i wanna see what pyqt is

#

i mean how to read files with python

#

and pyqt for guis