#development
1 messages · Page 130 of 1
yeah but i don't copy and paster
btw
is putting ; after my code bad?
also
the opposite
it's good?
not putting ; is bad
even tho js doesn't enforce
hard to say without looking at code
whats the best way to test my code in a production-like environment
bc i am making big changes and don't wanna do bad
making a production-like environment
lmao
can you believe we still use the Integer type for application programming
insane
this is the regex i wrote to parse the fancy new input that tim suggested
const placementInputNoWhitespace = placementInput.replace(/\s/g, '');
const teamOrPlayerStrings = placementInputNoWhitespace.match(/(\([^()]*\)|[^\b>]*)/g).filter(a => a);```
'(@ebon shadow @median yoke)(@ebon shadow @median yoke)';
'@ebon shadow @median yoke(@ebon shadow @median yoke)';
'(@ebon shadow @median yoke)@ebon shadow @median yoke';
'(@ebon shadow @median yoke)@ebon shadow <@&456>';```
regex is just annoying
regex is pain, but it works
also guys
whats the best way to make number that goes up
right now i do this but it's kinda akward
you probably want to use a nosql database instead of a legacy sql database
see, it doesn't work the same when you know i'm trolling
exists?
yes?
where
in the database
Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.

A string null being an empty string or a string that is "null"?
"null"
I’m not even going to ask why you’re doing it like that
well
for some reason with my old code
null is being stored in my database as a string
because you told it to?
yeah ik that's why i'm trying to fix

again, without code it's impossible to know
^
Also you don’t have to save anything in a db if you want it null, fields left empty are by default null
Unless you give it a default value
well i did this to automatically increment my ids
my updated bot code is looking good
that's horribly inefficient
2 db ops + wrapping resultset + preparing statement + incrementing variable
Bro does not use auto increment
how else am i suppose to do it
???
also whats wrong with prepared statments
you see, you need to prepare them
his issue isn’t swapping to a new database
sql has funcions to increment numbers without having to get them first
you dont need to know sql for nosql
you need to know !sql tho
i don't see
I have to give you a warning for that joke
https://google.it, literally
autoinc is the very first thing u learn basically
UPDATE misc SET tracker_ids = tracker_ids + 1
that is, it tracker_ids is really a number
oh wait i see
fucking discord using 1.2gb ram for no reason
that wont work for ur case btw
rookie numbers
Discord using more ram than an operating system 
auto
I had it use 4-5gb once 👀
literally closed discord plus chromium and ram went from 90% to 50%
when i set mine to auto incredient it created this and won't let me delete
that moment when you find out the gate you were trying to jump is open
forgot new database()?
anyone have an idea about how to make this on bot profile ?
Essaie mes commandes : Try my commands
Well, you can't
Discord add it after some time
Like, in my bot it has been added like 2 weeks maybe 1 week after verification
IIRC there are some requirements for it to show
I didn't count the time exactly
The command cannot be nsfw, that's for sure
To show up like this
Only verified bots will have it show up
pretty sure you need it to be listed in the discovery thingy for it to appear
Hmmm
How do I enable it? You don't have to do anything! As long as your app is verified and has at least one global slash command, a max of 5 will be displayed in your bot profile automatically.
ah cool
i moved my rust code and now intellij is yelling at me
i needed to update this manually.
check module settings
oh yyeah lol
verified bots
after a few days it will show up
at least it took that long for mine
how can I convert true / false into numbers?
but also keep null as null
const value = whatever === null ? null : whatever === 1 ? true : false```
idk
i have no clue what you mean by convert into numbers
false = 0
true = 1
sqlite cannot store booleans
it will automatically convert them for you
i am proud to say i have never used sqlite 
ok
sqlite is so good
why don't u like?
because tim is sane
JS™️
what
columnar > relational
yo my acc got disabled nice
Error: value of type "columnar" cannot be cast to "relational"
and also anyone knows why this ain't working?
EmbedX.description += `**${data.replace('.txt','')}:** \`${lines.length}\`\n`
--force
It should work according to older versions
what is embedx
Argument of type 'HTMLImageElement' is not assignable to parameter of type 'Canvas | Image'.
Property 'dataMode' is missing in type 'HTMLImageElement' but required in type 'Image'.ts(2345)
index.d.ts(328, 2): 'dataMode' is declared here.
Code:
const img = new Image();
img.onload = async () => {
ctx.drawImage(img, 0, 0);
...
}
anyone knows how I can resolve this typing issue?
??
that "cannot access id" is from the image I sent
ur literally assigning a variable to its own iterator during initialization of itself
image
An element to draw into the context. The specification permits any canvas image source, specifically, an HTMLImageElement, an SVGImageElement, an HTMLVideoElement, an HTMLCanvasElement, an ImageBitmap, an OffscreenCanvas, or a VideoFrame.
This is definitely a typing issue on canvas's end, any idea how to solve?
could I just type cast it
imma try that
best lang
so far
no
TRACK_COMPAT_MODS is a string or contains strings?
that contains strings buddy
anyway, what's the issue?
consider that idk how forge works internally, nor how to check for mods
aight, what u want is TheClass.valueOf(mod.toUpperCase())
do note tho
it must be a perfect match
else it'll error
so biomesoplenty != BIOMES_O_PLENTY
any fix?
also here's EmbedX definition
u didn't show the error
there you go
(node:4868) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
App is running, server is listening on port 5000
06/14 19:51:37 info I am logged in as GenBot#3237 to Discord!
/home/runner/Generator/node_modules/@sapphire/shapeshift/dist/index.js:47
throw this.error;
^
CombinedError: Received one or more errors
at UnionValidator.handle (/home/runner/Generator/node_modules/@sapphire/shapeshift/dist/index.js:1104:23)
at UnionValidator.parse (/home/runner/Generator/node_modules/@sapphire/shapeshift/dist/index.js:212:88)
at EmbedBuilder.setDescription (/home/runner/Generator/node_modules/@discordjs/builders/dist/index.js:316:26)
at /home/runner/Generator/commands/pstock.js:33:12 {
errors: [
ExpectedValidationError: Expected values to be equals
at LiteralValidator.handle (/home/runner/Generator/node_modules/@sapphire/shapeshift/dist/index.js:745:76)
at LiteralValidator.run (/home/runner/Generator/node_modules/@sapphire/shapeshift/dist/index.js:198:23)
at UnionValidator.handle (/home/runner/Generator/node_modules/@sapphire/shapeshift/dist/index.js:1099:32)
at UnionValidator.parse (/home/runner/Generator/node_modules/@sapphire/shapeshift/dist/index.js:212:88)
at EmbedBuilder.setDescription (/home/runner/Generator/node_modules/@discordjs/builders/dist/index.js:316:26)
at /home/runner/Generator/commands/pstock.js:33:12 {
validator: 's.literal(V)',
given: '',
expected: null
},
ExpectedConstraintError: Invalid string length
at Object.run (/home/runner/Generator/node_modules/@sapphire/shapeshift/dist/index.js:1546:79)
you likely can't .description +=
not anymore?
idk why people use sapphire, it produces such garbage errors that make no sense
lemme just share this cool glowy thing im proud of
True, I'm gonna refine JavaScript in a major fashion to make it a trillion times better
But, statically typed JavaScript...
pogu glow yes
noooo, not static
dynamic is da wae
stuff like jsfuck is what makes js great
and being able to hack prototypes at runtime

how do i set an option to autocomplete
i see what you are doing. pls nooo
early v13
it was off till now
i started to work on it again now and its erroring
managed to change most of the stuff to v14
yo tim long time no see
yo
Yo
?>??
U can't use default as a name
why
Ur editor was supposed to tell you
Reserved keyword
w0t
switch (blabla) {
case 1:
something();
break;
default:
otherthing();
}
whats this suppoet to mean
Would creating a node.js bot to force approval process of image uploads be feasable?
I have no idea what's doable through dev API
it's a legacy switch statement that js keeps around
Like the match case in py
wym
oh ok
I mean whenever someone, with image perms, posts an image > Ping admin and wait for approval (Approve/Deny) before it's either posted publicly or deleted
@hushed robin
Did someone do it previously?
oh wait
For a specific usage, my boss wants it
because even though some users have image perms
i mean it's possible but you can't really like
go on?
reviewn a message
like the bot would have to send the image
idk if that makes sense idk how to explain it
and then replace with a placeholde
Like send the image in the admin channel first ? Once its approved send the image back in the channel where it was supposed to
That's what I suggested
like u can't stop a user from sending a message, so you would have to delete their message, send it for approval, then send it through the bot
but you know bosses
Thats a cool module I will add it in my bot ngl
Yeah, if image posted then
- send in specific channel
- delete original upload
yes it's possible
- replace with local-only message about "your image is being reviewed)
not really difficult either
Yo if you do, ping me
I really could use it. Boss'd be happy.
I was thinking man, not a bad idea, so I'm thinking about making it myself
it would be better to use a webhook for this.
but I've no idea how2
Its just an messageCreate event , check if the command is on . If yes then check for images (maybe also filter role or perm check, so it doesn't delete admins/staff images) . Then it continues with the process
yeah u could set the username and picture to the users
With a webhook you can set the name and avatar just for that message to the users username.
who orginally sent it
looks a lot noicer
ye
Avoid rate limit
nicer*
💀
👼
goodluck
chatgpt only knows older versions of djs right?
can't I point him to external ressources?
actually it may
e.g. latest docs
if you have premium
but it doesn't know v14 for sure
It will write you a v12 combined with v13 code. If you dont know how to code that will confuse u
It can do psudocode that could be helpful too
then its just a matter of reading the docs and understanding the psudocode
chat gpt is ok for small code snippets
I just cant wrap my head around the fact this doesnt exist
not really an entire bot
and isn't in MEE6 or wtv
no I know
but like
MEE6
Upload Approval
module
or something
The only reason I use gpt is when I need to make multiple functions , so I just explain the method I want them to be written & just get like 10 function templates, saves me a few minutes cuz Im lazy
Jokes aside, if you guys think it would be easy to do, DM me and we can work a paid deal out.
me
me
me
Most of it is only a few lines tbh
dm
the most complex part is the database
why would u need a database for
Nah my friend made a whole website (react) with the free plan. ☠️ Took him 5 days of chatting
Which is pretty basic
You will need to store the image for a period of time to do this properly.
i can deploy aws
Unless you plan to store the image within discord; but thats against the dev policy
save the admin channel ? & A boolean for the command to be set if enabled or not
why
cuz it cant disappear
hm
since the files are temporary you may be able to get away with storing it on the filesystem; but meh
Well you can send the image directly no need to push it into the db. Just make a function that will send it directly to the admin channel
just upload to dedicated server/instance
no?
oh, I see.
Since it needs to be reviewed just reupload it?
yeah
Yeah; thats probably smarter
or yeah, this is also valid but not "clean"
might be a bit rudimentary
but would work
i think
Oh yeah, there's the re-upload too lmao. Welp local db in a sqlite.json would be faster then .
but wait who would REPOST
the bot?
not the user
That depends on how you write code
A webhook would be the ideal way
The bot yeh?
You tell me
webhook with the username and profile picture set as the original users

Add a date too so people see when he uploaded it
Are you actively working on this/it?
If so I'd like to buy the code
I haven't even started it , we just came out with this idea
For that, you can dm me.
hi
How can I make a voting system? when they vote for my bot they can use exclusive commands
is it possible to get the date a certain user got a specific role?
maybe through audit logs
Somebody know where I can found a guy for test my bot ? Like finding bugs
theres an audit log event now
is this a cleaner way to do all this
it works but
er
@pale vessel
why
:hmm:
Either find a volunteer or hire a QA tester
guyssss 🙏
#1 stop using semicolons after non-statements (blocks)
#2 you can simplify your switch statement to be ```js
if (tracker.type === 'favorites') {
path = 'favoritedCount';
} else {
path = tracker.type;
}
#3 don’t use `new Array()`, just initialize it with empty brackets
is that it?
er
i need to do this 3 times
will kinda look cluttered
there's probably more but that's what I got from first glance
also why #1
KuuHaKu said using them is good
he meant that for statements like console.log("Hello world!"); not {};
hm ok
do u have suggestions on how i can condense the bot more
^
condense != better codebase btw
Using brackets is good, when they have a meaning
make it efficient and readable
so would you say my code is fine?
I don’t like how you’re getting guilds and channels from the cache instead of fetching them
They’re not guaranteed to be cached
That doesn’t guarantee caching of channels
yes it does
It does not
it does
i've been running my bot for a long time with getting the channel from the cache and there's never been a single time a channel hasn't been in the cache
Pretty sure that guilds aren’t guaranteed to be cached either even with the intent
Just because something works now doesn’t mean it will work in the future
Talking from JDA experience, it's the only type of entity that has no retrieve method
Not really, what's 100k entries in a collection
As long as u keep the member count low it shouldn't impact much
because you guys don't believe me for some reason
and i'm telling u but no listen
well
waffle wasn't
Battle I don’t take anything you say at face value lmao
he thinks i'm wrong
Your credibility is below earth core already
😐
i am a serious person
Iirc, guilds are kept at shard-level
So shard 1 will not have the same guilds available as shard 2
I believe that which is why it concerns me so much when you ask certain questions that most would believe to be common sense; I do not trust your judgement
Hence why I called upon a secondary source here to help me
ok i guess
kinda sad but
I'm not a good source tbh, only had top-level experience with jda
Tim would be able to say for sure
Reminds me of that old kids tale about credibility
Exactly that one
Our version is slightly different with a tiger instead
But that's what happens when a tiger is more common than wolfs where u live 
Code size is not synonym to code quality
No
💀
how can I improve it
bruh
this ain’t about typescript
it would be the same length or long with typescript
i will just become good at JavaScript like Tim
so there’s no need for typescript
my code above
I'd go with an OOP approach, moving as much processing as possible to inside the class
And sieve as much as possible inside the query
are you talking to me
Queries are extremely powerful, lots of filtering and transforming can be done before it returns the resultset
Yes I was
i don't really know what any of that means
Oop means object-oriented programming
Basically using classes to handle processing as you would in real life
Queries, well, you skipped the entire fundamentals about sql, u didn't even scratch how to build queries
Is the code I use for calculating the meta for my game
The data is returned ready for use, I don't need to do anything else on java's side
PyThOn fAstEr
whats a class
ok i'm looking at mdn
how would classes be used in my code? 🤔
Hardly, if you didn't start with oop in mind it's unfeasible to convert to
I deleted the old version of my bot about a year ago and am working on a new but similar version. My top.gg page shows "Deleted User" as the name. Do I need to delete the bot listing and apply again?
Yes
As if it's a new application app then it will be classed as a separate id and a whole different bot
got it, thanks
K
Is it allowed to use a currency for your bot that you pay for to get specific things from your bot that are premium and if you don't want the currency you can exchange it for something like a £5 gift card voucher or discord nitro or something
Like you pay irl money for bot currency
Like if someone was to go buy 500 coins for £5 they could buy a £5 voucher if they decide nah I won't use this anymore its been a while so I will transfer it for this
Guys how can I fix my websocket error....
Discord will frown upon that yes
Thanks !
When I want to host something on my local server and access it on my ip but my Cloudflare/Nginx/Router configs are set to exactly say fuck that and have to make a subdomain 🔥 9
hey can someone help me with buttons?
so basically i run the command,the bot responds with the message that has buttons.
now i want like that so that when i click one of the buttons,it sends the same message again and keeps going like this until a no. rolls to 5
For eg-
command- c!bat
message- Full Toss Delivery Is Coming.
Buttons - loft,drive,cut
i click loft,i want it to send same message again(full toss..) with buttons and keeps going like this until a random no.(say 5) rolls
i hope i was able to explain well
can someone help
You need to write the backing logic entirely, buttons are nothing more than clickable commands
Do it as if you were making commands
You can't use loops
You need a handler like you would for commands
Then have a persistent "context" to store states
cant there be a simpler way
u sure u got what i an trynna do?
Yes
say to confirm u got it
First of all, you're using js, so using blocking loops will hang your app
then what do i do
Second, you can't have an interactive game without states
This is not something easily done at first try, you'll need to experiment a bit
see i got this template of python
it is a handcricket game(not buttons)
Especially if ur used to functional programming
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
char name[20];
int choice, player, comp, score2 = 0, toss, ts, d, score1 = 0, comp1, player1,
num;
void bat() {
do {
comp = rand() % 10 + 1;
printf("%s Enter number from 1 to 10 to score\n", name);
scanf("%d", &num);
printf("the no. given by computer is: %d \n", comp);
if (num > 10 || num <= 0) {
printf("wrong entry!!! \n");
continue;
}
else if (num != comp) {
score1 = score1 + num;
if (d == 2) {
if (score1 > score2)
break;
}
}
else if (num == comp) {
printf("You are out !!\n");
printf("The score of player 1 is : %d\n\n\n", score1);
break;
}
} while (comp != num)```
like he did while
cant i do
i tried tho,but not working
That's a console app, not a discord bot
Apples are not oranges
Console apps don't care if they get halted by a blocking loop
Bots must handle thousands of users at once
hm then what do i do nw
Hard to explain if u never did something similar
I could show u my game, but it'd make even worse to understand
explain in short,will try my best to undertsand
Already did
please dm
You create a context class to hold states, and act on button press based on it
No need, it's open source anyway, but it's java
show
ik this bot will take me ages..
but i'll make
Not really, all u need is to grasp the logic
It's a huge logic, don't expect u to understand
Just scroll down to getButtons()
That's where I make the buttons act based on the current game state
blown my mind 💀
Yeah, it's a very complex logic
is ur game complete
Did u ever work with classes?
nah,before this i have only made moderation type of bots and leaderboard bot
Kinda, it's a ever-updating game, so it'll never become "complete"
where can i play
Not available in english yet, and it's only available on my dev bot for now
The production bot isn't in English either
Then that's where u start
Try learning how to work with classes
It's VERY different to functional (the way people write bots in d.js) programming
No
U can make in any lang, u just need to practice
hm so i first go learn classes u say?
Yeah
To sum it up, you need a game instance to track player actions, whenever they press a button u update the state and edit the message from inside it
To start the game, all u need to do is create a new game instance and let it act by itself
yo just searched up a bit
i need create like a storage jar with all the functions inside it
And to start game, i need make object @lyric mountain
is that it?
Nono, jar?
Jar is for java
U need to research how to use classes in js
Ah, u mean "storage jar" as in the container
Yeah, kinda that
u made me doubt my ears
For example, imagine I have a car
start is class
leave a class
u are object
kuu.start
so whatever function associated with start will perform
Yes, start would be the initial setup
Such as adding button listeners, adding players, initializing variables, etc
After that, it should act on its own
these all will come under function of start right?
or i define it before
Yes, and you shouldn't need to control it directly
Buttons must be intercepted and acted upon by the instance
Programmed into the instance
The easiest project u can attempt to learn how to work this way is by making a pagination feature
Like this
what is pagination
Huh, the gif is stopped
dude what the hell is hat
that*
Is it playing for u?
no
Weird
Meant the gif itself, for some reason linking the url makes the gif not play
didnt realy understand
really*
its just like dank marketing page left right
Hey, anybody know how I can also make this command work with a userID also:
const { EmbedBuilder } = require('discord.js');
module.exports = {
name: 'avatar',
aliases: ['av'],
async execute(message, bot, args) {
let user = message.mentions.users.first();
if (!user) {
if (args.length > 0) {
return await message.reply({
content: " Please mention a valid user!",
allowedMentions: {
replied_user: false
}
});
}
user = message.author;
}
let member = await message.guild.members.cache.get(user.id);
if (!member) return await message.reply({
content: " The user mentioned is no longer within the server!",
allowedMentions: {
replied_user: false
}
});
let avatar = user.displayAvatarURL({ size: 2048, dynamic: true });
let embed = new EmbedBuilder()
.setTitle(`${user.username}'s avatar`)
.setURL(avatar)
.setImage(avatar)
.setColor('#00008b');
await message.reply({
embeds: [embed],
allowedMentions: {
replied_user: false
}
})
},
};```
If yes, then please tell
yes, exactly
that's pagination - using buttons for navigating a very big list
that uses the same concept as your desired game
simply get the first argument and see if it's a number
sir
add a if function to prevent argument not a no.
and then just find the user and do what u want
oh nice
Can you give a snippet (if you don't mind)?
thats not exactly what i wanna do but concept same ig
did u write that code yourself?
wait
Yea
hi
that's unironically the thing u want, just used for a different purpose
if (isNaN(warnno))
return message.reply("Argument Isn't A Number.")```
why can't i loop through games
in this case warno is ur args
Ok
it's an array
hm
hey but thats like clicking buttons in the same msg
what if the message is diff
u click the button,new message apppears,click button and so on
u just need to update the message id which ur tracking
works when i want this?
hmm but currrently i am just tsting
2 people using that command in a single channel would clog it
so u know startup to udertsand
hmm thats a point
you need to learn how to ask proper questions
i think u need fetch
what am i fetching
i try looping through games
and it returns nothing
no, not like that
can that be done through classes?
show the actual code and what error ur facing, and write at least the minimal context for undestanding ur question
everything can
:Skull:
simply saying "why this not working" is not something anyone can answer
tracking is the thing on the right
ok, now the context
what is tracking?
as well as i understoood till now is
classes are like a fucntion of game and object is to run the game
^
wym
ok
yo isn't that familiar to like making a meme command which take memes from reddit
its just a regular batch api response
right?
what
nvm sir
..
there's ur issue
but
tracking is an object, not an array
classes are self-contained logic
yo kuu whats ur age
24
how self when u actually code
24 and u learnt like 3 langs
class Cow {
void moo() {
println "moo"
}
void move(int x, int y) {
... // move the cow to x,y
}
}
def cow = new Cow();
cow.moo();
cow.move(1, 0);
this is self-contained logic
the cow has all the logic for doing cow things
you don't need to handle anything outside of cow
updated code?
code, not the object
because the issue is there, not in the obj
^
u dont need to change the object, u need to change the code to properly access that object
games is inside that object, you need to access before iterating over it
i think i solved
thats py??
what does this do
lol
it's groovy actually
groovy?
yes, groovy
it's to java what typescript is to js
except groovy makes java more minimal, contrary to ts
you can do the same thing on js i think
println and printf diff??
println prints a line
nvm i only need know channel.send,.reply and .log
printf prints formatted
void means it returns nothing
I don't need a return of moo()
💀 tf
it's only supposed to say moo to the console
what is cow at this point??
def cow = new Cow() creates a new cow, imagine u have a grass field and a cow simply pops there
then it proceeds to cow.moo()
and walk to cow.move(1, 0)
ok i've made progress
so u just create new stuff which arent anything in js
and that move?
ig moves along x and y axis on website
?
slight progress, it's only logging games tho
u can do that in js
hm thank you so much for explaining so well bro
@lyric mountain
in any lang actually
imma go get dinner
Object.values
have a nice day ahead
u dont care about the keys
imma make some progress and return
actually, just do tracking.games
bye cya and thanks once again
do some courses, there are very good OOP courses out there
sure
gn bros
then use const (key, value) instead
as ur looping over entries, not values
ok i fixed
but now
my function is making it not continue loop
likely getting stuck in updateTypes
yah
trying to find out whats doing it now
ok it's getting stuck on this
hm
kinda confused tbh
why's it not logging?
maybe that select is erroring
there's no errors
not showing anything when it should is technically an error
put a try-catch around it
if it's async use .catch() too
it's not async but
i put it in a try catch and it sent the error
SqliteError: no such column: playing
er i know why
why should it be
all database ops should be async
because a query might run for a long time
being sync means it'll stop the execution until it finishes
human behavior is strange
maybe it's because sqlite itself doesn't support multiple writes, so they chose sync
but it's weird anyway
hm
Better sqlite3 is fast enough that it really isn't an issue
'did u forget something?'
the author of better-sqlite3 explains this quite in detail on his readme
EmbedX.description += `**${data.replace('.txt','')}:** \`${lines.length}\`\n`
});
any help with this i'm struggling on from yesterday?
didn't we talk abt this already?
i went to sleep didnt read ur reply
stop using description += altogether
then what i should use
setDescription
i'm planning to make a DynamoDB table like this to store guilds and users. it'll be shared by two bots and eventually more. In the DbGuild table i use application_id and guild_id for the key schema. Now i'm wondering if there is a better way to create the key schema for the DbUser. I currently concatenate application_id and guild_id in my code and use that for the HASH key. is there a better way to do this? like tell DynamoDB to do this for me through configs?
DbGuild:
Type: AWS::DynamoDB::Table
Properties:
KeySchema:
- AttributeName: "application_id"
KeyType: "HASH"
- AttributeName: "guild_id"
KeyType: "RANGE"
AttributeDefinitions:
- AttributeName: "application_id"
AttributeType: "S"
- AttributeName: "guild_id"
AttributeType: "S"
BillingMode: "PAY_PER_REQUEST"
DbUser:
Type: AWS::DynamoDB::Table
DependsOn: DbGuild
Properties:
KeySchema:
- AttributeName: "application_id+guild_id"
KeyType: "HASH"
- AttributeName: "user_id"
KeyType: "RANGE"
AttributeDefinitions:
- AttributeName: "application_id+guild_id"
AttributeType: "S"
- AttributeName: "user_id"
AttributeType: "S"
BillingMode: "PAY_PER_REQUEST"
or see if there's an appendDescription or smth
how did u try?
i removed the .setDescription at first
and then changed the .desc with .setDescription
i'll look for it
TIL you can't use ternary operators inside a string, only in a template literal
u didn't try setDescription += did u?
cuz it wont work obv
i tried that
it's a function ffs
template literal aka template strings are string though
setDescription(the text)?
ye
then your EmbedX is broken
and it only put 1 item not each items
Yes but you can't use a ternary operator in a string. Only a template literal.
So this doesn't work:
let text = "My favorite color is " + blue ? blue : red + "!";
But this does:
let text = `My favorite color is ${blue ? blue : red}!`
if u want to concatenate u need to setDescription(getDescription() + text)
or build the string outside of it
"My favorite color is " + (true ? 1 : 2) + "!";
u need to put parens yeah
else it'll try to concat the falsy branch
the ternary operator has the wrong level of precedence in all programming languages so it's confusing
only with values that implement the + operator
it should be at the same level as the logical or operator
but yeah, try to use it only with strings and numbers
hi
why when i fetch a user in a guild for the second time their data isn't updated
context
What
i fetch user in my guild to check their roles
if they have Supporter role
when I do first time
role = correct
if I change role without restarting bot role = incorrect
it has old roles
do u have guild members intent?
no
i don't want unnecessary intents
also my bot is verified, i don't think Discord would give me the intent for this
You can fetch the user again to get their roles
i am
are you no caching the fetch?
i use fetch
idk
Yea but fetch gonna check cache first
You need to add something like force: true but it's gonna hit ratelimit so fast
the values should stay updated though, assuming you're receiving the corresponding events?
If you are gonna use loop or something
whats the ratelimit?
5/s?
there's ur reason
i need to check the roles in my guild
without the intent it wont receve role updates
so it'll never update the cache
fetching a member will add them to the cache, the second time u use it it'll grab from the cache as it's still there
i don't wanna do that
i need updated values
adding force: true doesn't do anything
hello
why do u need to check the role anyway?
^
store the supporter status in the database
er
together with their user account
how
If you already have a table with a list of users just adding a column
if not, you can make a dedicated table
i mean like
how would i do that
fetch all members of my guild and filter them out?
if ur giving them the role, u can add to the database
wym
unless ur manually giving the role
i'm not
a bot will give them it
ok i figured out how to force fetch
i think it'll be fine
i need to
i need updated values bro
if i don't force it'll be outdated
donating services will usually offer a webhook for listening to events
and apis for checking
it does but
they don't provide you with person who donateds discord ID
this is what they give ya
tho they have a feature to give people who subscribe to u a role
which is what i'm planning on using
just use the email within that and oauth, compare the emails, boom
might only cover the ones with the same emails
skill issue then
can i send gifs using canvas
File "main.py", line 169
@venady.slash_command()
^
IndentationError: unindent does not match any outer indentation level
this worked few hours ago
it doesn't now
wow
more code please
venady is the client (like client = discord.Client)
i'm lil new to python and found disnake
and also i'm not using local because i'm running out of space
yeah this isnt valid
the annotation needs to be on the same line as the function

