#discord-bots

1 messages · Page 415 of 1

last cradle
#

yuh

stark ingot
#

With some of the new laws popping up I think it could be very possible

finite salmon
#

i was talking about discord dev policy like infernum said just to be clear

dry lodge
#

how does shards work?

merry cliff
# dry lodge how does shards work?

its like running multiple instances of the bot so that one instance of it isn't handling every single request, it's mainly good for large bots that get lots of traffic

dry lodge
#

so is the shards thing custom? like do i have to code that into my bot

merry cliff
#

and the docs say that "It is recommended to use this client only if you have surpassed at least 1000 guilds."

gritty inlet
fast osprey
#

AutoSharded is not a default, that is very much a conscious decision

gritty inlet
#

Oh I thought it was default, my bad

dusk pelican
#

So from reading the docs, if your robot is connected to +2500 guilds, it is commonly hard to handle all these events with one connected socket. So discord allows to shard, one shard is a gateway connection and kinda routes the events to guilds 1-5 and another shard is routes the events to guild 6-20 as an example. This is to scale your bot and make it more efficient. So to sum it up, sharding is like to have multiple gateway connection to handle the events from multiple guilds your robot is connected. Hopefully this is well explained, I am open to feedback and corrections

fast osprey
#

That's correct yeah

dusk pelican
#

learning about the concept of "cog". Really nice implementation to write clean code and modularize code, Astonishing!

fast osprey
#

Cogs have nothing to do with files

vale wing
dusk pelican
#

Really nice to read and learn

gritty inlet
#

Personally I just import command funcs from other files to the main. What are the benefits of using cogs? (genuinely asking)

shrewd apex
#

command grouping, cog level handlers like on load, disabling a whole group of commands by just removing that cog, error handler, checks, some group command/group cogs are also present now (basically it's the utilities that come with cogs thats invoked internally by the library is whats helpful)

gritty inlet
#

alright

#

I think I'll stick with importing funcs for now

fast osprey
#

It really depends what you're importing. You can utilize extensions without making a cog

gritty inlet
#

I import the funcs that take discord.Interaction

#

I handle checks either manually or with decorator

fast osprey
#

I mean any function can take an interaction 🤔

gritty inlet
#

Yea ur right, I'm talking about command functions in particular

fast osprey
#

You don't need to import to add commands to your command tree

#

That's one of the main points of extensions

gritty inlet
#

Ik, I have them in different files to not have a big mess

#

Unless you meant something else

fast osprey
#

You don't need to directly import to use other files, either. That's what extensions are for

gritty inlet
dusk pelican
#

I have a small but Important question. Does enabling all intents influence performance on the bot, so always enabling intents that are needed and used?

shrewd apex
#

idt they are using extensions, they are probably loading the commands/functions in manually?

#

are you using load_extension and have a setup function defined?

fast osprey
dusk pelican
shrewd apex
#

was meant for serverit :p

dusk pelican
#

sry

shrewd apex
#

np

gritty inlet
fast osprey
#

I don't think they're using extensions, I'm suggesting that they should

gritty inlet
#

Mhm

dusk pelican
shrewd apex
gritty inlet
gritty inlet
#

I'll check it out

#

Is there a helper function for Template in dynamic items or do I gotta memorize the basics of Regex xd

shrewd apex
gritty inlet
shrewd apex
gritty inlet
#

Yeeeep

#

Would be funny if I find out there's a better way to do this

#

🫠

shrewd apex
#

recursion

fast osprey
dusk pelican
gritty inlet
#

It's to get command mention

#

</cmd:id>

gritty inlet
#

mention is just a name i gave it

shrewd apex
#

why do u need it tho

gritty inlet
#

Idk so far I've used it here and there

fast osprey
#

!d discord.app_commands.AppCommand.mention

unkempt canyonBOT
dusk pelican
#

maybe cogs are the best way to handle all the code and modularize I dont know

#

take and use what is given and make something with it.

gritty inlet
#

so interaction.command.mention? 🤔

#

Wow I'm stupid

fast osprey
#

Easy to miss stuff with how big the api is

dusk pelican
#

I could not make it myself to be honest

gritty inlet
#

Was also wondering, am I supposed to define on_message once and then call whatever funcs in it? or

shrewd apex
#

!d discord.app_commands.Command

unkempt canyonBOT
#

class discord.app_commands.Command(*, name, description, callback, nsfw=False, parent=None, guild_ids=None, allowed_contexts=None, allowed_installs=None, auto_locale_strings=True, extras=...)```
A class that implements an application command.

These are usually not created manually, instead they are created using one of the following decorators...
dusk pelican
gritty inlet
#

Each one has a different purpose

dusk pelican
#

got it

gritty inlet
#

You can also make bots that don't use gateway

shrewd apex
gritty inlet
#

Also called HTTP bots

#

But it'd use a similar concept

#

Because it's still events

fast osprey
gritty inlet
#

How do I get AppCommand from interaction object

#

Can I?

fast osprey
#

You can fetch the commands from discord

gritty inlet
#

Well I'd rather cache them on startup than sending request each time

fast osprey
#

!d discord.app_commands.CommandTree.fetch_commands

unkempt canyonBOT
#

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

Fetches the application’s current commands.

If no guild is passed then global commands are fetched, otherwise the guild’s commands are fetched instead...
gritty inlet
#

I'll just simplify my method to use command.mention I guess

#

I take the ids from tree sync

dusk pelican
fast osprey
gritty inlet
#

Nah only on on_ready

fast osprey
#

That's the worst place you could be doing it

gritty inlet
#

Also is it fine to use bot.loop.create_task

#

Or am I not supposed to

fast osprey
#

bot.loop isn't documented and you don't need it when asyncio.create_task exists

gritty inlet
#

fair

gritty inlet
shrewd apex
#

just make a one time task

fast osprey
#

You should only be syncing when you need to, which is something you as a developer decide not the application

gritty inlet
#

Yea on startup

#

Well that's generic

shrewd apex
fast osprey
#

Would hard disagree except in the case of sharding and referencing things between guilds

dusk pelican
# shrewd apex some stuff is cached but it may be unreliable or a cache hit may miss so you sho...

I have currently a cog folder and there is a py file called events. If someone can evaluate this: ```py
import nextcord
from nextcord.ext import commands

class Events(commands.Cog):
def init(self, bot: commands.Bot):
self.bot = bot

@commands.Cog.listener()
async def on_member_join(self, member: nextcord.Member):
    await self.bot.get_channel(1405632225063600208).send(content=f"A new Member joined <@{member.id}>. Welcome to the server and have a nice stay!")

def setup(bot: commands.Bot):
bot.add_cog(Events(bot))

shrewd apex
fast osprey
#

I'd ask for what the case is when that object isn't cached and 99.9% of the time that's a development mistake and not an expected event

shrewd apex
#

hence like

user = bot.get_user(...) or await bot.fetch_user(...) # fallback 
gritty inlet
#

Different use cases I'd say

#

Because fetch gives you more data doesn't it

#

Anyway I never experienced cache failing

fast osprey
#

There's I think one case where it gives you more (user banners)

shrewd apex
fast osprey
#

From experience, everyone who's trying to access the cache prior to chunking is doing is accidentally and not by design

shrewd apex
#

hmm fair enough ig i still prefer having the fallback just in case

gaunt osprey
#

hi

fast osprey
shrewd apex
fast osprey
#

If people log when the fallback happens and commit to digging into it, sure, but I have yet to see someone do that

gritty inlet
#

I might finally have usage for /applications/detectable lol

#

Was thinking about making a bot mainly for finding "teammates" for games you play, and caching games' app ids is something I might do

shrewd apex
gritty inlet
#

But it depends
For game info, I might just use the external API that Discord themselves use
or I can get game description from applications/id/rpc

#

Not such a big deal

#

I have many ideas for that bot but might not do it because it'd be absolutely useless if not enough people use it 🫠 not the first time I abandon something for that reason lol

shrewd apex
#

mhm

radiant shuttle
#

Is there a way to optimise how embeds look in mobile discord ? It’s different in pc and mobile

fast osprey
#

Not sure what you mean by "optimise"

#

Your options are fairly limited though, it's really just the fields on the Embed object that the libraries give you

radiant shuttle
#

I mean make it look the same in every device

#

Tablet pc and mobile

fast osprey
#

All you can do is specify the parameters given to you. If discord renders them differently, that's discord's choice/fault

turbid karma
radiant shuttle
#

True

vagrant depot
#

Can someone explain to me difference between
for guilds in bot.guilds:
and
for guild in bot.guilds:

quick gust
#

? literally no difference except the variable name

vagrant depot
#

Yeah mb.

#

I just @vagrant depot

gritty inlet
#

All good thumbsup

gritty inlet
#

😄

#

Plus this

#

If I want to use variables from bot.py in an ext cog, would I import them normally or would I do bot.x = ... and then use the bot in the cog?

fast osprey
#

How are you using it in your extension?

gritty inlet
#

In the command, I may use some variables obviously

fast osprey
#

You can use interaction.client to get the bot object. You don't need the cog to store it

#

But either works

gritty inlet
#

Would you recommend it over importing?

#

interaction.client.x vs from bot import x

fast osprey
#

I'd recommend the former

sick birch
#

if you have a bot subclass then interaction.client requires a bit more typing

#

otherwise your type checker may not pick up extra stuff you've added onto it

gritty inlet
#

Well that var will show as Any

#

ah wait

#

I do subclass the bot
So I shouldnt do bot.x but rather self.x inside the subclass?

woeful hill
#

how do you use bot.x if youre subclassing the bot itself 🤔

gritty inlet
#

instance

#

I subclass ext.AutoShardedBot

woeful hill
#

self.x is the current class' attribute x
bot.x is (whatever the bot instance is)'s attribute x

gritty inlet
#

Also should I turn this on xD

#

General question

woeful hill
#

when youre subclassing Bot, you don't have access to the instance

#

so youre question doesnt make sense

gritty inlet
woeful hill
#

self.x is not at global level

gritty inlet
burnt quiver
gritty inlet
woeful hill
#

so why are you asking if you should use bot.x or self.x

gritty inlet
#

nvm youre right

#

ty

stark ingot
#

I am enjoying making my bot without cogs

#

Extensions only

gritty inlet
#

Just command def?

fast osprey
#

can be whatever you want. An extension is only a module that's given a reference to your bot object

gritty inlet
fast osprey
#

all load_extension does is import the file and run the setup function

gritty inlet
fast osprey
#

no

gritty inlet
#

Im sorry if I ask stupid questions but I just wanna be sure

fast osprey
#

an extension can have 0 classes or 100 classes just fine

#

the only requirement is that it has a top level setup function that takes in the bot. Anything else is entirely up to you

gritty inlet
#

Alrighty

#

I think I'll use Cogs

gritty inlet
#

await bot.tree.sync() returns app_commands.AppCommand, right?
Well then can I access children of that command?
There's AppCommand.mention but that's just mention of top level, and I need of all other levels too...

timber dragon
#

AppCommand is the API object and the api puts subcommands/groups in .options

#

So you'll need to parse it from there

sick birch
gritty inlet
timber dragon
gritty inlet
#

xD

timber dragon
#

🤢

#

Why is the dict named like a constant

#

And why is that a private method like someone is not supposed to call it

shrewd apex
#

yo 2.6.0 is out

#

with v2 components support

stark ingot
gritty inlet
gritty inlet
#

hopefully this doesnt deserve any 🤢s

shrewd apex
#

its fine lol everyone goes through a learning phase

#

don't take it so seriously

timber dragon
#

^

brazen raft
gritty inlet
#

Bout time ✌🏻

acoustic torrent
#

any1 know if its against discord tos to store message data in a database? I would look it up but i dont want to

stark ingot
#

It can be if you don't follow the rules

fast osprey
#

You should read the tos you've agreed to. It's your responsibility if you're handling people's data

acoustic torrent
#

" including the European Union’s General Data Protection Regulation (GDPR) and the ePrivacy Directive, the UK General Data Protection Regulation, Brazil’s Lei Geral de Proteção de Dados (LGPD), the California Consumer Privacy Act (CCPA), and the California Privacy Rights Act (CPRA). You will provide and adhere to a privacy policy for your Application that is compliant with applicable privacy laws and clearly, accurately, and fully describes to users of your Application what data you collect, how you use and share such data with us and third parties, and how users can request deletion of such data. For the avoidance of doubt, how you use data includes how you access, collect, store, retain, transmit, share, and otherwise process it. You may only use API Data in accordance with your privacy policy, applicable laws and regulations, and the Terms. You agree that your privacy policy may not and will not supersede, modify, or be inconsistent with the Terms, which will supersede if there is any conflict or inconsistency with your privacy policy. You will maintain publicly available, up-to-date links to your privacy policy in the Developer Portal and make it easily accessible to users from your Application."

Is the tos I dont know what these countries laws are and im really not feeling spending a year to research it

grave sandal
# acoustic torrent " including the European Union’s General Data Protection Regulation (GDPR) and t...

GDPR is a practical act with various principles. Mainly you don't collect any more information from people than is necessary and lawful, and anything you do collect, people have the right to access and see that you have, and have the right to request that it be erased from your application, also obviously informing and consenting to having personal information collected too. I don't think just collecting messages on discord and saving them without peoples consent is very lawful, and there can be a lot of personal information in messages with what people share online, where they generally don't expect someones bot to be saving them. If you want to save messages for educational purposes then do it in a server with your friends and tell them you're doing it, or do it in your own server, or have people opt into it and be very clear about it.

#

Apply the golden rule and it's easy, don't do with other peoples data what you wouldn't want done with yours.

toxic coral
#

anybody willing to help me with making a bot?

#

i tried making one and it was going alright until i reached my message limit on chatgpt 🥀

dusk pelican
toxic coral
toxic coral
#

i would use chatgpt consistently but it always finds one way to mess up like it did for me tonight and then the message limits dont help either, i have to wait until 2:51 or something tmr morning

#

to be able to send the next message in that chat that has all of the past questions and steps its given me

#

thats why i asked if someone could help me bc i know exactly what i want it to do i just dont have the brain power to put it in place

#

id love to learn tho

dusk pelican
#

yes goood

toxic coral
dusk pelican
shrewd apex
#

with regards to?

dusk pelican
#

the library has a built in websocket

shrewd apex
#

right

dusk pelican
# shrewd apex right

so far my console prints out this: {'t': None, 's': None, 'op': 10, 'd': {'heartbeat_interval': 41250, '_trace': ['["gateway-prd-arm-us-east1-b-qr22",{"micros":0.0}]']}}

toxic coral
shrewd apex
#

ide makes no difference

dusk pelican
#

use pycharm I am using it too

toxic coral
#

ok thanks a lot

dusk pelican
#

jetbrains makes good products

toxic coral
#

yea thats what ive heard

gritty inlet
#

I'd recommend VSCode with Python extensions

dusk pelican
#

vscode also good

shrewd apex
gritty inlet
dusk pelican
gritty inlet
#

Of course there is

dusk pelican
#

sending an identify payload and maybe make a background process to send heartbeats to say discord I am alive

shrewd apex
#

when you get the HELLO subsequently you are supposed to send a heartbeat every heatbeat interval, thats what tells discord ur bot is alive and online

dusk pelican
shrewd apex
#

you are supposed to yeah, otherwise it would block

#

you can use create_task

dusk pelican
shrewd apex
#

cool :)

gritty inlet
#

You want to change the lib's logic 🤔

dusk pelican
#

no

shrewd apex
#

its just learning by implementing

gritty inlet
shrewd apex
#

good approach to have

#

as long as you dont keep reinventing the wheel, and work on ur own stuff too

dusk pelican
#

the discord api so extreme, discord.py has +400 contributors

#

and the maintainer danny is a hobby programmer

#

so look what humans are capable of making

gritty inlet
#

If you want you can have a look at the internal modules discord.gateway and discord.http

#

To see more of the gateway logics

dusk pelican
#

thanks

young dagger
young dagger
#

Thanks

junior breach
#

hello there

#

i made a bot that checks messages for user IDs

#

and apparently it doesnt work for forwarded messages

stark ingot
#

Forwarded messages do not have any content, you should check in the message snapshots.

#

There are various other things that would not work if you only check the content. Such as embeds and components

junior breach
#

wait so

#

they dont work like normal messages

#

ok lemme check smth

#

thanks

#

ah yeah i see now

stark ingot
#

👍

junior breach
#

i see

#

so to fetch a part from a forwarded message (like an user ID for example), id have to utilize message.snapshots instead of the normal message.content right?

stark ingot
#

Yes

junior breach
#

to the docs we go

wanton seal
#

uh so

#

im unable to get username from id

bot.get_user(user_id_input).display_name

i get this error

AttributeError: 'NoneType' object has no attribute 'display_name'

dusk pelican
#

@shrewd apex so far I have this. I am not sure if this is a right approach. did I use create_task() correctly, is it that what you meant? ```py
async def sending_heartbeat(ws, interval):
await ws.send_json(HEARTBEAT_PAYLOAD)
await asyncio.sleep(interval/1000)

async def main():
session = aiohttp.ClientSession()
async with session.ws_connect(url="wss://gateway.discord.gg") as websocket:
hello_event = await websocket.receive_json()
interval = hello_event["d"]["heartbeat_interval"]
print(hello_event)
asyncio.create_task(sending_heartbeat(websocket, interval))
await websocket.send_json(IDENTIFY_PAYLOAD)
while True:
response = await websocket.receive_json()
print(response)

asyncio.run(main())

fast osprey
gritty inlet
#

You'll need to use await bot.fetch_user(...) which is an API call

fast osprey
#

A vast majority of the time you should be fixing why it's not in the cache rather than trying to fetch

gritty inlet
#

What would you need to do tho 🤔 I don't think this ever happened to me

fast osprey
#

The most common reasons for this are

  • You're passing in something that's not a valid id (like a string), which you should fix
  • You're not subscribed to the relevant intents, which you should fix
  • You're trying to access the cache before it's populated (ex during startup), which you should fix
gritty inlet
#

I'd assume there'd be a ValueError for 1st one

fast osprey
#

nope, it just returns None

gritty inlet
#

TypeError*

gritty inlet
dusk pelican
#

can I say that discord has for every object user, channel, server, message ... an exact id?

gritty inlet
#

Oh wait I'll need member intent for caching users

#

Yeah that makes sense

gritty inlet
#

Btw your id is more than just a number

dusk pelican
gritty inlet
dusk pelican
gritty inlet
#

Yes, the timestamp being how you know when a user created their account btw (: since it's not in the /users/id response

dusk pelican
#

nice, I need to read about it, but also for me it is a little bit complicated. The id's are called snowflakes if I have it

#

right

gritty inlet
#

Yes

fast osprey
#

How the snowflakes are generated is entirely an implementation detail as you will never be making one yourself. All that matters really is that they're globally unique

dusk pelican
gritty inlet
#

Any idea why there's string in the API?

#

Always wondered

dusk pelican
gritty inlet
#

As a matter of fact discord.Object(id=...) uses this concept

#

Well obviously everything uses that concept, but yeah

dusk pelican
#

well done discord!

gritty inlet
#

You'll need to use Object when for example passing guild to, let's say, sync() (iirc)

#

but yeah that's unrelated to the api directly, just a dpy implementation

#

Quick question, what method in guild object uses this request?

#

In dpy

wanton seal
wanton seal
glad cradle
# gritty inlet As a matter of fact `discord.Object(id=...)` uses this concept

the Object class is useful in methods that require you to pass objects that represent discord models, in some places instead of passing a whole object the library allows you to pass an Object instead, saving you from retrieving the full object from cache or from the API

that's the main reason why that class exist

fast osprey
gritty inlet
gritty inlet
gritty inlet
wanton seal
#

ah haven't yet personally experienced slow being much of an issue

glad cradle
gritty inlet
#

(in the past i was testing like a dummy and was hitting PUT /commands (sync) too often)

#

((:

#

Never got another rate limit besides that

glad cradle
#

most likely you always sinced instead of doing it only when needed?

timber dragon
gritty inlet
gritty inlet
#

And I have sync on startup

glad cradle
gritty inlet
#

yea

glad cradle
#

There is a global rate limit of 200 application command creates per day, per guild

gritty inlet
#

Is there a check decorator for @discord.ui.button(...) ?

#

Like @app_commands.check(...) but for ui items' callback

glad cradle
#

!d discord.ui.Button.interaction_check

unkempt canyonBOT
#

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

A callback that is called when an interaction happens within this item that checks whether the callback should be processed.

This is useful to override if, for example, you want to ensure that the interaction author is a given user...
glad cradle
#

ig you could write a custom decorator

gritty inlet
glad cradle
gritty inlet
#

So I'll need to re-def it?

glad cradle
#

so you either subclass the Button class and override the Interaction_check method or make a custom decorator that lets you override the Interaction_check by just passing a function

gritty inlet
#

like what, discord.ui.Button.interaction_check = custom ?

gritty inlet
#

ah for that item specifically

glad cradle
#

yeah, I'd go for the custom decorator

gritty inlet
#

How'd the custom decorator override that tho

glad cradle
# gritty inlet ah for that item specifically

I mean you could do that but that's monkey patching the lib at that point which I don't reccommend because if you forget that you are overriding the Interaction_check for every possible button in your code base you might think that there's a bug

gritty inlet
#

yuh

#

For commands I can just set a global bot.tree.check which is a big clutch

glad cradle
#

ideally

gritty inlet
#

oh a whole new button decorator..

#

is it

#

Would rather make a separate decorator just for check, if possible

fast osprey
#

You could also just put that in the body of the callback

gritty inlet
#

That's what I do rn

#

Would rather have a decorator or such tho

fast osprey
#

why?

young dagger
#

I doubt it pithink

glad cradle
#

but it's ugly

glad cradle
#

that's the most common usecase tho

gritty inlet
#

Ok I see now, I can make a decorator for the whole subclass

#

Then it can override interaction check

fast osprey
#

or you could just implement interaction_check?

#

you don't need a decorator to do that

gritty inlet
fast osprey
#

no, implemented on the view class itself

#

then it will apply that check to all interactions on that view

gritty inlet
fast osprey
#

by implementing it on the class itself

#

not stapling a method onto it

gritty inlet
fast osprey
#
class MyView(ui.View):
  ...
  async def interaction_check(self, interaction):
    return True #logic goes here
gritty inlet
#

Ahh oops alright then

#

But nah I don't want to just put it there in every view xD

#

Anyway this isn't a big deal

fast osprey
#

So all of your views apply this check?

#

You can declare a parent view class and have these other views inherit it

gritty inlet
#

It's a very generic check so I'd want that yeah

#

using subclassing?

fast osprey
#

Yup. You can implement interaction_check in the parent class, then all of the children classes will inherit it

#

I do this to do central error handling, for example

gritty inlet
#

Alright, I'll need to find a similar thing for dynamic items as well

toxic coral
gritty inlet
#

You shouldn't skip to making dbots, get the basics first

toxic coral
#

thats the one he sent and said read through that so i did

#

about to pay someone to make this bot fr

gritty inlet
#

Planning to implement specific response if i toggle "maintenance mode"

astral jetty
#

every time i made a bot in python there is this problem with the intents and i have to spend 5 minuted to find the solution , and randomly the bot doesnt take input from users anymore smh

gritty inlet
#

Just make sure your code intents match the one in the portal

#

Very simple

fast osprey
#

Intents aren't "random" 🤔

glad cradle
glad cradle
toxic coral
gritty inlet
toxic coral
#

cant use chatgpt anymore tho bc i reached my message limit

fast osprey
#

chatgpt thinks 3 isn't a prime number sometimes. It's stupid

glad cradle
#

it just can't do it right

gritty inlet
#

Tokenizing my beloved

#

2 R's in strawberry

toxic coral
#

so like anybody tryna help me

#

ill cashapp you 20 bucks ong

toxic coral
# gritty inlet .

where would i even get into that like are there guides you recommend

gritty inlet
#

But maaaybe I can "help" making it, depends

toxic coral
#

anything of that sort

gritty inlet
#

Do you have a way to host the bot?

toxic coral
#

chat what does that mean 😭

#

bro fr you gotta dumb it all the way down when talking to me about ts

gritty inlet
#

Your bot has to be hosted on a server to work

#

Just like websites

#

Even if I made the bot's code for you: what's the point if you have no way of hosting it

toxic coral
#

ohhh yea im trying to make it work out of a server that i run

gritty inlet
#

Oh you have one then

toxic coral
#

si si

gritty inlet
#

What's the bot supposed to do

#

Unless you don't wanna share

toxic coral
#

its kind of a lot well for me at least

toxic coral
#

and its no secret really i dont mind

fast osprey
gritty inlet
#

Yep no promotions etc etc ✌🏻

toxic coral
#

anyways

gritty inlet
#

Anyway count me out if it's multipurpose or music or moderation

toxic coral
#

non of that

#

i need it to store data basically

#

when someone runs a command like "/profile" i need it to come up with a list of what that person has in my case it would be awards, badges, rank, roblox name and a few others

gritty inlet
#

I don't have good database knowledge

#

JSON is an option but not recommended for large scale

toxic coral
#

but it has to store everyones lists of things and i want there to be a website or something so i can manage and see what everyone has outside of discord

toxic coral
fast osprey
#

JSON is a data transfer format

#

not a data storage one

toxic coral
#

do you know anything about what im trying to do?

fast osprey
#

The core code would be pretty simple. Incorporating it into a website and hosting that is another step

toxic coral
#

well honestly idk if its a website bit or not

#

it might just be like an html thing in the program they use to edit if needed

gritty inlet
toxic coral
#

if that makes sense

fast osprey
#

Sure, so are you gonna build it?

toxic coral
#

i have no clue how to

fast osprey
#

Are you gonna learn how?

toxic coral
#

id like to

#

i dont know what id even search for thats why im asking you guys

#

guidance is what i need

fast osprey
#

the python tutorial is quite good, the official one

toxic coral
#

does it go over what im trying to do?

glad cradle
glad cradle
toxic coral
#

ah i see

glad cradle
#

then you go again to read the guide that was linked a lot of messages ago

toxic coral
gritty inlet
#

You can also search code snippets instead of learning from scratch

#

Learning the entire logics of a library is useless, but there are some things I'd recommend going over

toxic coral
#

just pieces of code?

gritty inlet
#

Yes

toxic coral
#

i see do you know of a website?

#

ill probably just have to search around for a little to get what im looking for

gritty inlet
#

Eh, I mean GitHub or Stackoverflow can work

#

SOF is better for code snippets

toxic coral
#

just "SOF"?

gritty inlet
#

And you can use ChatGPT for very basics, but don't rely on it

#

But don't "be shy" to do it if you need to

toxic coral
gritty inlet
toxic coral
#

ooo

#

alright ill look around thanks

glad cradle
gritty inlet
toxic coral
#

chat so uh i need help agian

meager rock
wanton seal
#
local_cache = {}
keys_available = []
async def id_to_global_name(user_id: int):
    if user_id in keys_available:
        username = local_cache[user_id]
        log_message(f"Found {user_id} in cache")
        return username
    else:
        fetch = await bot.fetch_user(user_id)
        local_cache[user_id] = fetch.global_name
        keys_available.append(user_id)
        log_message(f"Couldn't find {user_id} in cache; appended in cache")
        return fetch.global_name

this good?

eternal cargo
#

i need to assume that the bot variable there is instance of discord.Client
you would want to not override assigned key values in local_cache by checking if the key already exists, but i am not sure what is intention in your case

#

i will be honest, i code a discord bot myself using python

wanton seal
eternal cargo
#

tbh i havent seen something this before! well, fetch_user() is good approach there, you receive instance of discord.User, get user's global name and assign it to local_cache with user's id as the key, append the id to keys_available (this will affirm it is now in this list so the if statement will be invoked after the next invocation of this function), you receive the global name from local_cache, print the message it was found and return the global name. all you want is to append and receive the user from cache

i think you should be fine

#

without caching this will be just (await bot.fetch_user(user_id)).global_name

eternal cargo
#

also i could tell, you can use alternatives for if statements that you wont need to use keys_available variable:

# 1
if local_cache.get(user_id, None) is not None: ...
if type(local_cache.get(user_id, None)) is int: ...
if isinstance(local_cache.get(user_id, None), int): ...
# 2
if user_id in local_cache: ... # in dicts, the 'in' keyword inspect dict keys, not their values

i personally prefer version with get() over one with in keyword
if you want to receive a list of keys, you can just do list(local_cache) or list(local_cache.keys())

young dagger
timber dragon
#

This should try cache first

#

Also fetch_user can raise errors, handle that too

lunar void
#

also i could tell, you can use alternatives for if statements that you wont need to use keys_available variable:

# 1
if local_cache.get(user_id, None) is not None: ...
if type(local_cache.get(user_id, None)) is int: ...
if isinstance(local_cache.get(user_id, None), int): ...
# 2
if user_id in local_cache: ... # in dicts, the 'in' keyword inspect dict keys, not their values

i personally prefer version with get() over one with in keyword
if you want to receive a list of keys, you can just do list(local_cache) or list(local_cache.keys())

young dagger
#

My version

local_cache = {}

async def id_to_global_name(user_id: int):
    username = local_cache.get(user_id)
    if username:
        log_message(f"Found {user_id} in cache")
        
    else:
        try:
            user = await bot.fetch_user(user_id)
            username = local_cache[user_id] = user.global_name  # Use user.name, or user.global_name or user.name if you must
            log_message(f"Couldn't find {user_id} in cache; added to cache")
            
        except Exception:
            log_message(f"Error fetching user {user_id}. Retrying in 30 seconds.")
            await asyncio.sleep(30)
            return await id_to_global_name(user_id)
            
    return username
shrewd apex
#

why do u need a local cache once u fetch the user won't it be present in the library internal cache?

young dagger
#

Also I would use user.name instead of user.global_name because it's not guaranteed to be set by the user

shrewd apex
#

also for most part the user should exist in the library cache already you can just try get_user

young dagger
#

Use user.name, or user.global_name or user.name if you must

young dagger
young dagger
quick gust
#

but they both return different objects

young dagger
#

Oh right nvm

astral jetty
#

how do i make a discord bot that will launch a tactical nuke at the user when they do/self-destruct

quick gust
#

Tf?

young dagger
#

You can use get_user across all guilds etc I forgot my bad confusion

timber dragon
shrewd apex
#

hmm rip i thought it did

young dagger
#

In that case, I would use

user = bot.get_user(user_id) or await bot.fetch_user(user_id)
#

Probably add a try/except

timber dragon
#

Realistically, you shouldn't need this as all users sharing a server with your bot should be cached as said above if the members intent is enabled

But if you do want a getch behaviour, you should try the lib cache first and then fetch. I'm not a fan of the local cache but I guess it's fine if you keep it updated (like via events). Here is my take on it: https://mystb.in/ad7ad079523fd5405f (not including events)

#

Rip indents

young dagger
#

But otherwise I like it

timber dragon
#

Fixed

glad cradle
#

hope that was clear

#

wrong message

astral jetty
glad cradle
astral jetty
#

codin is so easy bcs of ppl like you

#

may god bless you

glad cradle
#

thanks brother I think you are exaggerating a little bit

young dagger
#

@astral jetty Wrong server

wanton seal
wanton seal
wanton seal
#

anyways thanks yall

toxic coral
white citrus
#

How can i do 3 buttons in a embed in nextcord?

stark ingot
#

You can't put buttons in an embed. You are probably talking about containers.

toxic coral
#

anyone want to help me make a bot from scratch

stark ingot
#

It does not look like nextcord supports containers yet (which is part of components V2)

wanton seal
#

can bot.wait_for not detect messages at a high rate?

#

im trying to read every message sent in a thread, but bot.wait_for seems to be ignoring some messages when i type too fast

fast osprey
#

What's the code and what behavior are you trying to accomplish?

unkempt canyonBOT
#
Pasting large amounts of code

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

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

gritty inlet
#

How would I set the row to be somewhere specific rather than top level?

#

I see that this is possible, but then where do I define callback? Assign button.callback = callback?

fast osprey
#

You can subclass Button and implement the callback there

#

You really should avoid stapling methods onto generic objects when possible

gritty inlet
#

uhh alright

timber dragon
#

Or subclass ActionRow

dusk pelican
#

I need help with the intents, because I dont understand the calculation. SO far I have subscribed the basic intents with the number 513

timber dragon
#

Why are you using raw bits

#

Just set the kwargs to true

dusk pelican
timber dragon
gritty inlet
burnt quiver
#

really?

#

you sure you're not editing the message or smth

timber dragon
#

You can send anything you want, just not cv2 + embeds/content

gritty inlet
#

maybe im tripping holdup

gritty inlet
stark ingot
#

Containers are one of the new message components added a couple months back

white citrus
white citrus
gritty inlet
#

"low level" 🤔

timber dragon
#

That's a next level low

white citrus
white citrus
#

How can i install it

timber dragon
#

Should probably ask in their server

junior breach
#

yo

#

anyone can help me how i can grab text from a forwarded message?

tender bobcat
#

!d discord.MessageSnapshot

unkempt canyonBOT
#

class discord.MessageSnapshot(state, data)```
Represents a message snapshot attached to a forwarded message.

New in version 2.5.
tender bobcat
#

!d discord.MessageSnapshot.content

unkempt canyonBOT
white citrus
#

Can someone help? I used disutils.command.config in python 3.10 now i Switched to 3.12 and it is not supported anymore

molten bramble
#

Traceback (most recent call last):
File "/home/container/main.py", line 266, in <module>
bot.run(TOKEN)
File "/home/container/.local/lib/python3.12/site-packages/discord/client.py", line 929, in run
asyncio.run(runner())
File "/usr/local/lib/python3.12/asyncio/runners.py", line 195, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/container/.local/lib/python3.12/site-packages/discord/client.py", line 918, in runner
await self.start(token, reconnect=reconnect)
File "/home/container/.local/lib/python3.12/site-packages/discord/client.py", line 847, in start
await self.connect(reconnect=reconnect)
File "/home/container/.local/lib/python3.12/site-packages/discord/client.py", line 727, in connect
await self.ws.poll_event()
File "/home/container/.local/lib/python3.12/site-packages/discord/gateway.py", line 658, in poll_event
raise ConnectionClosed(self.socket, shard_id=self.shard_id, code=code) from None
discord.errors.ConnectionClosed: Shard ID None WebSocket closed with 4004
this normal?

hushed galleon
#

is this running in replit? discord bots there tend to get ratelimited

molten bramble
tender bobcat
#

Yep, it was token invalid

molten bramble
toxic coral
#

i think it was you idk it mightve been the other person

fast osprey
#

rip

toxic coral
fast osprey
#

and where are you struggling?

toxic coral
#

i just cant figure out how to do it and something always ends up getting messed up by chatgpt

toxic coral
#

i dont even really know the basics

wanton seal
#

so are you ask chatgpt to teach it or just using it?

toxic coral
#

im just trying to get a bot set up and thats all i need

toxic coral
#

what scripts i need to put and stuff like that

#

i mean it teaches me a little bit until something goes wrong and i have to reset

quick gust
#

and that'll keep happening till the time you decide to learn from the proper sources

#

chatgpt is not a learning tool

toxic coral
#

i obviously have to learn hoe ti make it but im not planning on doing coding and programming consistently

quick gust
#

Doesn't matter
If you want to make it yourself you'll have to learn how to do it properly

toxic coral
#

thats kinda why i joined this discord to see if anybody would be willing to help me make it

brazen raft
#

We help with learning how to make it so you make it yourself

young dagger
fast osprey
#

Don't use interaction.message basically ever

#

You can use interaction.response.edit_message

young dagger
fast osprey
#

Yup

gritty inlet
#

I just don't know of a better method. Is there?

fast osprey
#

"Original user"?

gritty inlet
#

The one that ran the command

fast osprey
#

How would interaction.message give you that?

gritty inlet
#

interaction.message.interaction_metadata.user.id

fast osprey
#

You could pass the user into the view to simplify that but that could work

gritty inlet
young dagger
# fast osprey Yup

My second question, is my code tied to each user’s button? I don’t want different users interfering with each other’s buttons

#

(still new to the buttons thing)

gritty inlet
#

No, you must add such logic manually

#

Otherwise any user can use the button

young dagger
gritty inlet
#

No, that's different

#

Only you will see the message, so only you will be able to use the button

young dagger
#

I'm a bit confused about this part

gritty inlet
#

Do you want it to be so only the user who ran the command can use the button?

young dagger
quick gust
#

So just send ephemeral messages

gritty inlet
#

Put instances outside of this lol, that's not really related

#

Anyway yeah you either make the message ephemeral, or add logic to check if the interaction.user is the one that's supposed to use the button

young dagger
#

Oh right, it's only when you use a hardcoded custom_id it will share among users

gritty inlet
#

No

#

Buttons work for everyone by default

fast osprey
#

I think there's a misunderstanding of how the view store works

#

When your bot receives a component interaction, it looks in your local view store. It first checks to see if there is a view object registered specifically to that message id. If there is, it looks for a component that has that custom id in that view object, then routes the interaction there

#

(this is for discord.py and other forks that follow the view model)

young dagger
fast osprey
#

no, it really doesn't matter if you do or don't

#

if you don't, the library generates a random one for you and they match up anyways

#

The first thing the library does when routing the interaction is look to see if there's a view stored mapped to that message specifically. It doesn't matter if there are other views that have components with the same custom id

gritty inlet
#

The point of the custom id is for your side to know what to do with the component

#

Just an identifier

young dagger
#

What about self.stop() will it stop all instances with that button?

#

I guess so

fast osprey
#

that applies to that view

gritty inlet
#

stop()
Stops listening to interaction events from this view.

This operation cannot be undone.

young dagger
#

Because I submitted twice

gritty inlet
#

The library internally uses that view, no matter how many times

#

So if you use stop() it will affect all buttons

fast osprey
#

The view store is basically

messageid_1 ---> [view object] : [button1, button2, button3]
messageid_2---> [view object] : [button1, button2, button3]

It is up to you what views you send and when

#

your code could easily be

view = MyView()
await channel.send(view=view)
await channel.send(view=view)

or

await channel.send(view=MyView())
await channel.send(view=MyView())
young dagger
#

It would be the same result if it was from two different users?

fast osprey
#

The view is just an object that contains component callbacks. When you send a message and attach a view to it, you are saying you want that object to handle interactions on components sent in that message

gritty inlet
fast osprey
#

this has no concept or notion of users

#

interaction on x message -> goes to y view object, and that is set at the time when you send that message

gritty inlet
#

And what happens when the component is interacted with - that's for your callback function to handle

young dagger
#

So for my case self.stop() basically cancels the view for all users that are running at that time

#

If they resubmit it works again

gritty inlet
#

No, when you interact with that button, based on its custom id, the library knows what view object should handle it. So for as long as the view is 'stopped', no interactions with that button will work

#

At least I think so

gritty inlet
young dagger
#

nvm

gritty inlet
#

All good

fast osprey
#

None of this has anything to do with users

#

views are attached to messages. Not users

#

You stop the view, interactions on that message are no longer routed

young dagger
gritty inlet
#

No because you can have the same custom id in multiple messages

gritty inlet
#

The view may be attached to multiple messages. In that case, using stop() will affect all those messages

fast osprey
#

In most cases, it is one view per message. You need to be going out of your way to specifically reuse a singleton view or if you're using a global persistent view

young dagger
gritty inlet
young dagger
gritty inlet
#

Based on the instance you used when sending the message

young dagger
gritty inlet
#

I don't see a problem

young dagger
fast osprey
#
view = VerifyButtonView()
await interaction.response.send_message(embed=embed, view=view, ephemeral=True)

You're creating a local instance here and sending it

#

Stopping this view instance will only impact this message

young dagger
#

One of them is failing

#

User 1 > Submitted
User 2 > Submitted
User 1 > Press button OK
User 2 > Press buton failed

#

Same code as I provided

gritty inlet
#

I'd have assumed that it's because the library no longer recognizes that view, but now I'm not sure after what Solstice said

#

Stopping this view instance will only impact this message

fast osprey
#

Why are you setting custom ids in the first place? Are you persisting a version of this view anywhere?

fast osprey
#

It doesn't, but it does matter if you have a global level view

fast osprey
#

no

#

Again. Nothing in this entire stack knows or cares about users

young dagger
fast osprey
#

Are you calling add_view anywhere in your code besides what you sent?

young dagger
#

That is the full code

fast osprey
#

And why are you calling add_view in the first place

#

it's not the full code. This is clearly an extension

young dagger
#

It's a cog for that particular verification. Try run the code yourself

young dagger
fast osprey
#

Me looking at this code doesn't tell me anything about what you do in the entirety of your code base

#

where any line anywhere else could be messing with this

gritty inlet
gritty inlet
fast osprey
#

When you call add_view, all that does is manually adds a view to the view store for routing. If you don't specify a message_id, it means all interactions can be routed to it regardless of what message they came from

young dagger
fast osprey
#

there is other code

young dagger
#

Dude why don't you run the code yourself and see?

fast osprey
#

Because I can't, because THIS IS NOT THE FULL CODE

#

This is an extension

gritty inlet
#

But just a quick note, you don't really need to stop the view if you make the button disabled nvm

fast osprey
#

You can't just "run" extensions. They don't do anything. They extend an existing bot

gritty inlet
#

And you should do add_view for VerifyButtonView as well

#

Unless you don't want it to work after the bot restarts

young dagger
fast osprey
gritty inlet
fast osprey
#

No, any view that doesn't have a timeout will by definition stay in the view store until you stop it

#

Actually come to think of it, not sure if editing it off the message entirely removes it from the store Thonk

gritty inlet
gritty inlet
young dagger
#

^ Here is full code same result

#

Ready for you to run

fast osprey
#

I think there's a confusion about what a persistent view is.

All add view does is just shove one view object into the view store. It doesn't make the class itself special or anything. The key here is that if you don't specify a message_id when you do that, that specific view object can be routed to for all interactions regardless of what message they came from

gritty inlet
#

No because it's not per user

gritty inlet
#

Sorry if it sounds like bs but I got a liiittle confused there

fast osprey
#

lol wut

#

Really good play insulting someone actively trying to help you

gritty inlet
#

You just had to word it right, it stops working for all messages that use that view. The word "users" isn't related

#

I think that's all

#

But you didn't use add_view for that Verification view. I guess because you specified a custom_id then the stop() acts like it'd act with a persistent view? (means it affects all messages)

white citrus
#

Are These container or components v2?

timber dragon
#

containers are part of cv2, so yes

fast osprey
toxic coral
gritty inlet
fast osprey
fast osprey
white citrus
gritty inlet
#

And I'm talking about cases where I don't use stop()

fast osprey
#

It really depends what behavior you want

#

and if your view objects have individual states

gritty inlet
fast osprey
#

DynamicItems can also be a lot more memory efficient

gritty inlet
#

I don't use any view methods really

gritty inlet
fast osprey
#

That's the idea behind them

gritty inlet
#

I thought their purpose was for when the custom id is dynamic

fast osprey
#

Well, one use case. The "dynamic" part refers to the library dynamically making a component to handle the interaction when the interaction happens, rather than a view sitting in memory

gritty inlet
#

And do those components stack up in the memory?

#

Like views do

fast osprey
#

Nope it handles the interaction and then is disposed

gritty inlet
#

Might as well switch to using only dynamic items then ✌🏻😭 Unless it's not that serious

fast osprey
#

There's really no big difference between the two if there's no message-specific data being moved around though

gritty inlet
#

Except the views stay in the memory

#

🤔

fast osprey
#

Correct, but if you're doing one global view (because no message specific data), that memory footprint is negligible

gritty inlet
#

What would be message specific data as an example?

#

Passing data to the view from for a message?

fast osprey
#

I send a view twice, one is supposed to send a response saying "A" when button is pushed, the other "B". And I want those views to persist between restarts without making two separate classes

#

Your options there are

  • have a db, make one global persistent view that looks up the message id on the db
  • have a db, call add_view N times passing in the message_id
  • embed that data into the custom_id and make a DynamicItem
gritty inlet
#

Okay thanks

#

I have one bot where I was too lazy to rewrite the views (wayy too many) so I just set timeouts for all of them lol

#

That'll do

fast osprey
#

A lot of time people think they need to make every button ever permanent but that doesn't actually match up with user behavior

gritty inlet
white citrus
#

@fast osprey yo can you please help me on my question?

gritty inlet
#

Only problem I have with buttons that just stop working, is the ugly 'interaction failed' frontend response

fast osprey
#

I don't have any experience with components v2 yet but I'm told the examples in the repo are quite extensive

fast osprey
gritty inlet
#

I have my own wrapper but yesterday i tried dpy's CV2

#

So many classes 😭 ig it's formal but it bloats up the code

#

Not exactly, safe to say I'm not an expert with views

#

😄

white citrus
gritty inlet
#

Nextcord has no support for that yet

timber dragon
#

and you cannot add a Select like that

gritty inlet
#

Decided to grab one from the top of my head

timber dragon
#

wrap it in an actionrow

gritty inlet
#

Ty for noting

timber dragon
#

but the user above is using Nextcord

gritty inlet
#

Oopsie :D

timber dragon
#

which doesn't support cv2 at all yet

gritty inlet
#

Sooo you can either wait or do what I did which is making a custom wrapper

fast osprey
#

Or switch libraries

gritty inlet
#

Yeah that too 😭

white citrus
fast osprey
#

Yeah up to you what the best use of your time and energy is

white citrus
#

Can i Download a pr ?

fast osprey
#

You can check out any commit on a public repo but you're doing so under your own risk

#

They could change anything and break any code you write now

timber dragon
#

you can install their cv2 PR by running the following command

python -m pip install "nextcord @ git+https://github.com/nextcord/nextcord.git@refs/pull/1254/head"

But you'll have to ask how to use it etc in their server as I don't think anyone here uses nextcord.

gritty inlet
#

You have their server for support xD

timber dragon
#

have you tried asking?

gritty inlet
#

Might as well click on Soheab's tag and find out

timber dragon
#

I forgot about that xD

young dagger
#

When would you use persistent view vs DynamicItem?

#

In my case, if you want to keep a button that verifies users clickable after rebooting

white citrus
gritty inlet
gritty inlet
#

eh then it could depend

#

for the time being i'd say use persistent view

#

but its ur choice after all

toxic coral
#

its fine tho

#

the system i have now is good enough

timber dragon
#

like it doesn't take up memory to store the view etc, it just dispatches the item based on regex against the custom_id

#

so you should be using that where possible

fast osprey
#

"Better" is a bit disingenuous. There are meaningful cases where having a view is useful

timber dragon
#

true. but for most people it is

gritty inlet
#

I'm not sure that I'm adding dynamic items to a view in the intended way:

...
self.add_item(TestItem().item)```

Only works when I add that .item, which is typed to Any so I wasn't sure I'm supposed to use it that way
fast osprey
#

You don't need the .item. What is TestItem?

gritty inlet
fast osprey
#

Then you should be able to add the dynamicitem directly to the view

gritty inlet
timber dragon
#

DynamicItem is an Item so that should work just fine

fast osprey
#

Yeah double checked my code and you should be fine to just slot the dynamicitem itself into a view just fine

leaden cypress
#

Is there some kind lib for discord bots?

timber dragon
#

For Python? Yeah there are a couple

karmic tendon
fast osprey
#

depends entirely on your preference

toxic coral
#

so just having it run 24/7

merry cliff
#

you would need a seperate device to host the code

toxic coral
#

bc when i close vs studio the comand doesnt run anymore

toxic coral
merry cliff
#

conventionally a cloud hosting servicewould be used

toxic coral
#

do you use one?

merry cliff
#

you could also self host with an old computer or raspberry pi

#

I self host using an old laptop

toxic coral
#

yea i cant really keep my old pc running like that

#

all of the time

merry cliff
#

I also have a free VPS from oracle free tier

#

itsgotenoughpower for multiple discord bots

toxic coral
#

im only using 1

#

for 1 single command 💀

#

i just need it to run 24/7

#

so i dont have to have my coding prog open

merry cliff
#

it is two years old but Idon't think there have been many large changes

toxic coral
merry cliff
#

you don't need to follow their bot guide

#

just the steps to create and access the cloud server

#

then you can ssh into the server in any way such as PuTTY and upload the bot files through sftp using something like FileZilla

#

and then just run the bot

toxic coral
merry cliff
#

Putty and filezilla are apps

#

sftp is just a protocol like http but instead of sending websites it sends files

#

ssh is a way to access the cloud server's command line from your own device

toxic coral
#

bro im so confused 😭

merry cliff
#

just follow the github tutorial until you reach the "Anything you wanna do" step

toxic coral
#

where do those steps start

#

intro?

merry cliff
toxic coral
#

brings me to the same place

toxic coral
merry cliff
#

the create a vm insstance step

#

is the first actual step

toxic coral
#

oh ok i see

#

thank you

merry cliff
#

np

toxic coral
merry cliff
#

you have to do that for all online payment things that use a card

toxic coral
#

oh i didnt even see the payment part

#

ok that makes sense then

toxic coral
#

and stays free

merry cliff
#

no the resources are permanently free

#

I've been using it for like 3 years now and havent been charged

toxic coral
#

so what was the point of the payment

merry cliff
toxic coral
#

hm alr

#

"Start with a US$300 cloud credit.*"

#

🥀

toxic coral
merry cliff
#

that's for people to trial their premium resources

toxic coral
#

i just saw this thats why i asked

#

i got confused

merry cliff
#

as the tutorial notes, make sure you pick stuff with the always free tag

toxic coral
#

i started from here but i see now it says create your free account in the green

merry cliff
#

it's the same thing

toxic coral
#

ah ok

#

lowkey broke rn

#

not tryna get sued 😭

toxic coral
#

is that normal

dawn delta
#

guys can anyone help me

Exception has occurred: ClientConnectorCertificateError
Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1010)')]
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1010)

The above exception was the direct cause of the following exception:

File "D:!ExZhonya\Coding\Discord-Bot\Bot\main.py", line 37, in <module>
bot.run(TOKEN)
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1010)')]

woeful hill
#

Update your windows

vital vigil
#

Are there people using render.com to run discord bots persistently? Are there alternatives?

young dagger
gritty inlet
#

You could also do local hosting if you're okay with that, cheaper and works

young dagger
#

OT I don’t believe in any free alternatives

gritty inlet
#

But everyone and their preferences/capabilities

gritty inlet
young dagger
gritty inlet
#

It depends on the scale of what you want to host on it. Yes it's not meant for huge projects or whatever.
And Idk what costs you mean, the only thing I'm paying for is a domain...

young dagger
#

That’s why I recommend a cheap VPS, it has a low entry cost and you can always scale or switch later if you want

radiant shuttle
#

i have this problem my bards are stucked, i am using pillow , how can i fix it?

gritty inlet
#

I don't think this is the correct channel to ask that in

radiant shuttle
gritty inlet
fast osprey
young dagger
gritty inlet
#

Webhook Events wrapper that I made for no good reason
-# "timestamp" and datetime.datetime doesn't really make sense but who cares
-# Just noticed it takes app id for no reason, removing that
And I figured that instead of using application.start(), it'd be much better to allow running multiple applications

timber dragon
#

Nice!

tender bobcat
#

Nice

glad cradle
#

Nice

timber dragon
#

Nice

glad cradle
# timber dragon Nice

hi soheab I noticed you opened the nameplates PR on d.py, did you notice the weird ass endpoints of the cdn to get the assets 😭🙏

zealous jay
timber dragon
#

We just did .static and .animated

glad cradle
#

not even documented

timber dragon
#

Yeah it's not documented at all for some reason

glad cradle
glad cradle
#

maybe they just want to change it freely

timber dragon
#

The webm is technically animated as it's used for the hover effect

glad cradle
#

yes

timber dragon
#

The path is weird overal

glad cradle
timber dragon
#

nameplates/nameplates/name...

timber dragon
glad cradle
#

Just discord things ig

timber dragon
#

Yup

gritty inlet
#

Idk why it was so important for them to add a slash at the end of asset

timber dragon
#

OH YEAH THAT TOO

#

So weird

burnt quiver
#

discordn't

silk pulsar
#

Can anyone give me some tips to improve my code?

sick birch
#

Set up a linter and formatter

stark ingot
#

Don't use prefix commands

potent spear
# silk pulsar Can anyone give me some tips to improve my code?

Not sure what data you are iterating through here, but there's a good chance a member can leave or for any reason not be in cache upto the time member = guild.get_member(user_id) is called
There is a probability of member being None if they are not in cache or your server

You should consider error handling this as per your requirement, ie let's say you want to skip them, use continue to skip

silk pulsar
#

Thanks for the suggestion

fast osprey
#

Why

gritty inlet
#

Hmmm Idk I just think it looks better idk

fast osprey