#development
1 messages ยท Page 1954 of 1
now**
ah lol
My brain for some reason always does not
kekw
๐
I might even turn it into an example bot using typeorm and host it
I could make an eval command so people can mess around with making their own queries and such using the typeorm methods.
Oh that'd be cool
gn
don't need help with anything, but i thought this would be cool to share 
Good job 
So for this, the first embed is in a messageCreate while the 2nd is in a interactionCreate is there a way I can just edit the first embed? interaction.message.edit? or something of that nature..?
you can defer the update and just edit the message.
await interaction.deferUpdate();
await interaction.editReply({ embeds: [embed]});
oh alr
Wouldn't that edit the most recent embed tho?
or nah?
i'm not 100% sure, i'd assume it'll be the first one, try and see
i remember having to do a hacky workaround for something like this, let me see if i still have it
though it's probably easier now that interactions are newer
it replaces all embeds with the ones you provided
Hmm, @earnest phoenix for later. I'm able to connect to my postgres DB I made on my server. However, when trying to query/manipulate it, it claims the connection default was not found. I think I found some things online claiming that this is a repository thing but I thought your example was to show how to avoid using that and just use the entities themselves?
oofies is that entity framework for dot net?
Can you do this?
const channel = bot.channels.fetch(channel_id);
console.log(await channel);
.. or should await be before the fetch method?
you can
what is this e channel_id
Although, all of this is possible?
You need to return a string
Don't call console.log(), that'll log it to console and return undefined
Last question, can you have await before the fetch method with a .then()?
Although, according to Tim, they both do the same thing but cannot be together?
they can
Ah.
you always need to use await if you want to use the return value outside .then()
That'll log the TextChannel object, right?
How can I prevent it from logging undefined?
It won't log a channel
You need to return the channel inside .then()
It returned undefined since you never returned anything inside .then()
Oh, I get it now.
Which database would be perfect to make an economy bot, I'm using firebase for now and getting error when creating relations
how can i make it so when the image isn't defined it wont put the picture on the embed at all
.setImage(image || interaction.guild.iconURL())
let embed = new MessageEmbed();
embed.setTitle("title");
if(image) embed.setImage(image);
depends on how you use it
Means?!

image ?? null
fixed em balls
Show me ur connection config
Actually try connecting to your database before anything else
Iirc this issue arises when you try using the entities before they are actually created
is there an official twitter api for java? ๐ค
I am setting up lavalink on my vps...
To keep the lavalink process running even if I close the ssh session do I need to use something like docker?
is there any other way?
you can use screens
Its what I used to do
or a process manager like pm2
pm2 for java?
yea, you can make a sh file that executes your java thing and then execute that sh file with pm2 (not sure if there is another way but this is the one i've seen done the most)
pm2 should support anything that runs in the terminal
yes
Can turning bot on and off multiple times at once get the bot remo banned
?
Its keep on happening to me a lot
Like I am using replit and testing the code after updating and I keep on getting temp banned
I am using python
TypeError: Cannot read properties of null (reading 'name')
at P:\Github Repos\discord-bot\TicketEvents\Status-Check.js:26:35
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Query.<anonymous> (P:\Github Repos\discord-bot\TicketEvents\Status-Check.js:24:29)
What does this error, mean?
Can it be because of list element @covert gale
In addition, skip indexes (if there is the continue thing on python).
Index ? ( sorry I don't know python I am the type of guy who starts coding before learning the language)
checks out
It's a good step, I did that, got shouted a lot at, but didn't care since it was a good step after all.
(although, you're struggle)
According to your code, you don't have incrementing numbers, but you skip numbers like 7 and 10, so you can use the continue code instead of break or return, during the for loop, to skip those numbers.
Although, I am not sure if this is something you find on Python.
I guess there is a continue keyword but that's not the problem why do I keep getting temp banned its annoying when you don't why
Pardon?
Discord temporarly banned the bot from accessing discord api
oof, they can do that?
For 1h
Ratelimit, most likely.
rip
What should I do
You tell ME, what is some code that is like .fetch() getting looped to cause a ratelimit.
.. or as he said; better. (._.)
@client.event
if message.author.id == 571027211407196161:
if message.embeds:
if "User Status" in message.embeds[0].fields[0].name:
user_anigam = message.embeds[0].footer.text.split("ID: ")
user_anigame= str(user_anigam[1])
if str(user_anigame) in db.keys():
del db[str(user_anigame)]
else:
db[str(user_anigame)] = [
message.embeds[0].fields[2].value,#level
message.embeds[0].fields[3].value,#exp
message.embeds[0].fields[4].value,#gold
message.embeds[0].fields[5].value,#diamond
message.embeds[0].fields[6].value,#Clan Rubies
message.embeds[0].fields[8].value,#stamina
message.embeds[0].fields[9].value,#location
message.embeds[0].fields[11].value,#team selected
message.embeds[0].fields[13].value#cardselected
]
print("Data stored:- \n User:"+ str(user_anigame) + "<>\n channel:" + str(message.channel.name)+ "\n type: Anigame")
if message.content.startswith("$self level"):
if str(message.author.id) in db.keys():
user = str(message.author.id)
info = discord.Embed(title="Profier",
url="",
description="Following is your Stats respected " + message.author.name + " ji")
info.add_field(name="Anigame",
value="level =>" + str(db[user][0]),
inline=False)
await asyncio.sleep(0.5)
await message.channel.send(embed=info)
else:
await message.channel.send("user not found")
keep_alive()
client.run(os.getenv('TOKEN'))
ooo replit database
Ooo.. I don't understand python at ALL. ;-;
famous for getting your data corrupted
The code is above tell me , help me, release me from my suffering
That's the entire code
bruh
Beside import and stuff
You havenโt defined the event function
You did @client.event
But not async def <event>
async def on_message(message)
Just some logged in as
I think that's inbuilt
Where is the problem that causing temp bannes I an gonna strick the wall with my head if this keep on

(why this emoji is here its offensive to humanity )
oooo you are on replit
do kill 1 in terminal
What's that
basically refresh your container
replit uses shared ips so thats why people get rate-limited easily
Oh thank you so much
99% of the time that is not the issue tho
for me its like 80%
As you can see the code there nothing else that can cause it
when you say you got temp banned, what is the actual error that comes up?
Once it worked fine second time same code without edit you got temp banned in big red words
cloudflare block?
That's what it said
Sorry I don't have the screenshot I will try to find the same error on net
discord.errors.HTTPException: 429 Too Many Requests (error code: 0): You are being blocked from accessing our API temporarily due to exceeding our rate limits frequently.
is that the error?
Yes
ok its fine then
- kill 1 giving syntax error in console
are you sure this is all your code? or do you have more code?
do it in shell
but if that were the case, non-message events would error on message.author.id no?
there is a async def ....
I tried it it worked but not sure about getting rid of temp banned frequently
wdym it work but not sure?
The command kill 1 worked but my bot is not temp banned on every try so I am not sure if they still temp ban me in future
they might, that is the problem with replit
if you don't want to get rate-limited easily you should use another machine
or hosting services
Suggestions because I don't know any other which let me host free
i used EpikHost and NightHost for my private bot which is free
https://sourceb.in/g0wziSdwkw
https://sourceb.in/sLFvertfhU
https://sourceb.in/cgygND7zdS
hey there good afternoon so i made this ticket system and when a staff clicks those buttons it returns this error that there is no data but everything is stored correctly what can i do to solve it?
i sent all files except the /ticket that is an embed with a button to create the ticket
Last question: Is that a good alternative for public bots
no
kinda and not kinda, first of all the owner could see your bot files and token, even though they said and promise they wouldn't use it, who knows?
await createConnection({
name: 'default',
database: 'rolebot-beta',
type: 'postgres',
url: 'postgres://panku:panku@192.168.50.36:5432/rolebot-beta',
entities: [ReactMessage, ReactRole, Category, GuildConfig],
})
.then(() => {
this.log.debug(`Successfully connected to postgres DB.`);
})
.catch((e) => {
this.log.critical(`Failed to connect to postgres.`);
this.log.critical(`${e}`);
});```
@earnest phoenix gm
panku@192.168.59.36
yes
Did he leak his IP or something? ๐ (or am i stupid)
Yeah if you can connect to my local IP ;p
Successfully connected
That doesn't really happens but that fine and my other bot is up for like 5 days on replit
you don't need the name prop
I tried it without name/database btw.
Just make sure that you are connecting before anything that uses the entities
e.g before logging into the client
It is.
that is my rule of thumb
I've never had to supply the name or database prop
Hm well you are correct it is a repository issue but BaseEntity iirc basically just creates the repository thing anyway.
Does ur current configuration work or?
I mean it says it connects, and if I change the local ip to something fake it fails to connect.
So I assume so.
Querying/mutating fails.
That's when it throws the connection default was not found
I assume startShards gets called after client login?
Before-ish?
Which means it will try and use the entities before htey actually get created
i mean if you have a lot of dependancies you might feel the pain using replit, cuz it might start refreshing your container and restarting your bot while waiting for the dependancies to reinstall which could take forever
I mean it definitely does not try before trust me.
Nothing calls any of the DB methods at the start.
I have ran into this issue before as well
and nothing called the db at the start either
Hmm
Just try starting the connection directly before client login it might help
This should be absolutely separate from the discord bot logging in. Would not make sense for them to be tied.
Nah not much
Well wherever you are querying for info relies on the bot to be logged in no?
It runs when the bot runs
Data only gets queried if specific commands are ran so like.
you dont have to listen to what im saying but I am just saying from my past experience that was the issue
I'm trying to say that it already is connecting before the bot logins.
Well I don't know the solution then. Only time I ran into this issue was at the very beginning of using typeorm and the solution was to connect before everything else
Hmmmm
essentially I just made the connection at the very top of my main file
Right, which I had originally in my index file and same issue so I thought it'd be cleaner to put at the start of the shardHandler.
If you have a repo I can take a look at it real quick
Ight 
@dry imp how you got that custom link for your bot
https://github.com/Uhuh/RoleBot/blob/bot-rewrite/src/index.ts @earnest phoenix
slash commands -> shards -> 
gj
Are you handling all your slash commands in some server thing? Lol
With the endpoint?
https://github.com/ChillFish8/roid avg command requires 0 api calls
I'd like to but like I use the client for basic stuff so like what's the point
For example I use the client for all the emojis the bot has Xd
oofies
There's only one way
the creates the bot instance and actually calls the start function
the sharding manager needs a file with the bot starting?
At least that's what the docs showed.
but you only call index.js file
which starts the shard handler by the looks of it
Well, yeah? The shard handler calls bot-start for me
Oh

Ah right you're using djs which takes a file
gotcha
I forgot about that bs
Which are you using?
Oh right we talked about this.
it spawns shards when it needs em iirc
or some shit like that
I don't get how it works myself I just use it 
the starting process is kinda fucky now that I added the shard thing but I think if I move the handler to the service folder it'd be fine
And maybe rename bot-start
also using - in a database name is annoying ๐ฉ
I just did that on a whim when I was told i needed to shard
psql doesn't like the use of colons
I did
That is psql
How did you create your db?
I did sudo -u postgres createdb rolebot-beta
๐ง
Lemmie create a non hyphenated one.
I did myself 
Obviously for my server >:((
?
One sec im confirming if this is true
crying
ggs (guilty gear strive)
Well it creates the entities now
How do I test if it works?
What were you doing to get that defaultt connection error
just react to a message
any message I send?
Ok so didn't fix it
poggers
But hey now the entities actually get created 
Hmm
I don't think I saw your example creating them so I don't see why I would've needed to?
for a dev environement you set syncronize to true so it actually creates the entities
I think I told you that last night
So the only thing i can think of is that the connection isnt "established" yet so it is trying to find a default one? (maybe I can't exactly tell)
Though I don't see why this is being like this ๐ค
Hmmmmmmmmmmmmmmmmmmmm ๐ง
I can't help any further right now as I have school here in a few
Lmao don't worry. Any and all help was appreciated. ๐
What did you add exactly to create the entity again?
synchronize: true
Man I don't see how that would create them by adding that one option. So weird.
it synchronizes the database
But always and I mean always set it to false when in a production environment
Never have it as true on the public bot
Why exactly?
Unless you want it to have a chance of wiping your tables when you do something to the tables
Lmfao
Every time the bot restarts it will resync the database
setting it to false in a production environment will just create the tables and nothing more.
You will have to use migrations from then on if you wanna edit the tables
Ah I see.
Sorry I couldn't find the solution to the issue with the default connection
I was pretty limited on time 
Lmao no worries, I'll throw random crap at it praying it works.
Might of fixed it?
Oh?
I no longer get that default connection error
OH??
I moved connecting to the db into the bot-start file and moved it above creating the RoleBot instance
and it seems to work
So it's running it more than once then?
Since that file gets called N times with the shard number
Yes lol
Well from what I can tell is
The solution is to somehow call it before instancing RoleBot
Well it's doing that in the index.ts file in the start function
It seems like it is
It connects before the shardhandler even starts.
But it s actually not
Just because it logs that way doesn't necessarily mean it is
const channel = await bot.channels.fetch("758978182807420938");
console.log(channel.name);
TypeError: Cannot read properties of null (reading 'name')
I'm genuienly lost, wtf.
It could still be trying to connect even after
Channel Id is wrong?
It's correct. ;-; (can't believe I spent 4 hours with 7 breaks in between and yet can't find an answer)
Where is bot coming from?
I don't exactly know why it is returning that error
But it does appear connecting directly before creating an instance of RB works
Let me try.
Well I gtg for a while cya bois
Did what I say work?
Why does it matter?
Once connected you can use the db across shards anyway
lmao
Well
Again N times
N being the number of shards
because the shard manager from d.js calls that file
Does it call it every new shard?
Yes.
๐ค
glhf <3<#<3
What if because of how the shard manager calls the file, is it a threading issue?
Mmmm not entirely sure
I think that might be it???
Because it works when anywhere where the bot client is made / at

Hey, just wondering how I would check if someone has manage guild perms in a command
console.log(args[2].join(' '))```
at Object.module.exports.run (F:\fiverr\proguides\assets\cmd\gess\edit-gess.js:8:25)
at module.exports (F:\fiverr\proguides\assets\events\discord\messageCreate.js:30:25)
at Client.emit (node:events:394:28)
at MessageCreateAction.handle (F:\fiverr\proguides\node_modules\discord.js\src\client\actions\MessageCreate.js:26:14)
at Object.module.exports [as MESSAGE_CREATE] ```
you clearly want args.join(' ')
You can grab the member object and check the permissions object on them.
928276601643356183 928289824157347891 hello world remove args[0] and [1] ?
Do you want to get rid of the first two?
yes
Look up array splicing.
try to log the event debug
ok
not workin
i think the issue is with distube only
no
all waorking
working*
but it is taking a lot of time
to start
idk why
api hmm
is there any way to fix it?
should i chnage the api?
to what?
everything
yeah
just wait
ok
done a lot of time
wait
wait
i got idea
lemme make it 24/7
lol
yeah
uptime robot
deloy it to cloud
ok
thank u for u help ๐
no problem :))
buy a vps
not everyone have money tho, for some ppl discord bot project is for fun
not something serious to spend money :))
is there anyway of find out what connections someone has on their account with djs?
So what server perrmits need to be enabled for twitter bot, it works on mmy own channel but not for a friend?
you listen for user activity, and then save it
wrong server tho
i wanna find out what their github username is tho,
wait
@azure lark i think not
f
you need the scope for that
meaning, oauth2
connections allows /users/@me/connections to return linked third-party accounts
oh ok, so i couldnt make it just as a bot?
but that is direct interaction with api right?
its an oauth2 scope
you'd need to make a page where the user has to "login with discord"
to give you permission to access their connections
๐ฅฒ ok
how do i send a ephemeral message as message.channel.send({ content: 'Pong!', ephemeral: true }) is not working
Did you ever fix the db issue?
I'm somewhat certain it's because of how shardManager runs it. Pretty sure it making it a separate process breaks the connection and explains why it works when put into the code that is handled by d.js shardManager
Tested with multiple shards and it works fine.
I found out how to do the foreignkey stuff too
Oh good
I told you I knew the issue :^)
:^)
orms are scary
hey i trying to made a iframe for my bot page and y having this error
hey why is this actually returning me a \r after each gameid? ```js
const readFileLines = gameids =>
fs.readFileSync("./gameids.txt")
.toString('UTF8')
.split('\n');
let arr = readFileLines('gameids.txt');
console.log(arr)```
The game id used to be 250252252 and afterwards i have an array that contains: 250252252 \r
because the gameids.txt file was created in windows
windows uses \r\n as a line separator, where linux uses only \n
dos2unix is your friend
Or for sanity
/\r?\n/
Heya its me again
I have an issue with my evaluate command.
"invalid syntax"
I'm using Discord.py, not cogs.
why do you just cut it off halfway through
can't tell what the rest of that textwrap indent is or what local_variables is supposed to be used in
mk
mention?
can I make math.random() pick the numbers I want?
like I want from 27 to 30
but If I use ```js
let trophiesWin = Math.floor(Math.random() * 27) + 3;
The 27 influences the range of the generated number, while the 3 determines the minimum value.
then I just swap it?
You probably want to flip those two.
ok
I'd probably just create a function like this
function randomRange(min: number, max: number) {
return Math.random() * (max - min) + min
}
``` if that stackoverflow thing is right
It looks correct
only difference is it doesn't chop off decimals
You would floor.
yeah floor
function rand(min: number, max: number) {
return Math.ceil(Math.random() * (max - min)) + min
}```
There
If we use ceil we don't have to do +1 to get the range.
do you even need to do the +1? seems to work just fine for me when I was testing
+1 if you do floor
Math.floor(Math.random() * (5 - 3)) + 3
= (max random is 1) + 3 = 4 (But we set 5 as our max???)```
I seem to be misunderstanding
Math.random() times 5 for example.
without floor or ceil
Can go to 5., but good luck
Math.floor(Math.random() * (5 - 3)) + 3
= (max random is 1) * (5 - 3) = 2, then 2 + 3 = 5
idk I'm bad at random stuff
the floor/ceil/plus 1 really only matters if you care about (in/ex)clusion
Yeah
I've found it best to just do:
function random(min, max) {
return Math.random() * (max - min) + min;
}
random(5, 10): It won't reach 10 but will still reach 5
a simple function too
with overloading it'd be even cooler
But it has decimals
that's a good thing
if you want decimals use them
if you don't just chop them off
and if you really distaste them:
function randomInt(min, max) {
return Math.floor(random(min, max));
}
I don't think decimals make good for most random cases since I don't know why you'd want those decimal places anywhere. Hence the floor and ceiling and wanting to be correct with your min and max
people have their use cases
if it turns out you need the decimals, will you be able to use the random with the floor/ceiling?
nope
how can I get the iconUrl for a specific card?
GETTING JSON
let info = await
node_fetch(`https://api.clashroyale.com/v1/cards`, {
method: 'GET',
headers: {
'Authorization': `Bearer ${process.env.API_KEY}`, /* La api key la pueden conseguir aqui -> https://developer.clashofclans.com/#/ Crean su cuenta y listo */
'Accept': 'application/json'
}
});
JSON ```json
{
"items": [
{
"name": "Knight",
"id": 26000000,
"maxLevel": 14,
"iconUrls": {
"medium": "https://api-assets.clashroyale.com/cards/300/jAj1Q5rclXxU9kVImGqSJxa4wEMfEhvwNQ_4jiGUuqg.png"
}
},
{
"name": "Archers",
"id": 26000001,
"maxLevel": 14,
"iconUrls": {
"medium": "https://api-assets.clashroyale.com/cards/300/W4Hmp8MTSdXANN8KdblbtHwtsbt0o749BbxNqmJYfA8.png"
}
},
{
"name": "Goblins",
"id": 26000002,
"maxLevel": 14,
"iconUrls": {
"medium": "https://api-assets.clashroyale.com/cards/300/X_DQUye_OaS3QN6VC9CPw05Fit7wvSm3XegXIXKP--0.png"
}
},
{
"name": "Giant",
"id": 26000003,
"maxLevel": 12,
"iconUrls": {
"medium": "https://api-assets.clashroyale.com/cards/300/Axr4ox5_b7edmLsoHxBX3vmgijAIibuF6RImTbqLlXE.png"
}
}
any example?
If your specific card name was Goblins, you could use the .find method on arrays to check if the card.name === "Goblins"
If something was found, you'd have a map, which you can easily access the icon as .iconUrls.medium
A more robust example would look like:
info.items.find(...).iconUrls.medium;
(node:1523) UnhandledPromiseRejectionWarning: TypeError: Giant is not a function
Giant exists
it's a json
if Giant doesnt work, try a Dwarf, or an Elf

@round cove Helping out a lot more here eh?
Seems since ur no longer mod u started talking here more
kekw
Yeah.
Well this week has been slower at work and I have 2 days off this week so been trying to get this bot working how I want.
Ah yea, thats sweet
I tried calling Social Security to setup an appointment to get my new social security card but them bitches be busy from open to close so I never got through ๐ฉ
Oh jeez did you lose your SSN? (card)
One message removed from a suspended account.
Hi
One message removed from a suspended account.
One message removed from a suspended account.
My dad holds onto that stuff and his wallet got stolen so ye
I purged most people I don't talk to often.
Not yet 18, got a bit to go
Oh god.
๐ฉ
That's not fun at all.
Yea, it sucks
Prevented me from getting a job I basically had in the bag
I just needed to give em my social security card (a copy of it) and I would of had it :c
Yea
No?
Wtf?
Not sure if its just because im under the age of 18, but you have to give them a social security card to go on some type of form they have to make as part of you being an employee of their company
Nah you have to do that over 18 too.
Yea
i never had anything similar to a social security @_@
Figured
Poor tim
what does social security even do?
SSN is your unique identifier.
the only things i have is passport, id, tax id, and driver license
oh?
Yeah they're basically the same.
but i dont think this tax id is used for anything related to security/health
Nah but it uniquely identifies you.
Now places that USE the SSN as a way to identify you are bad because they're using it as a unique identifier.
TypeError: Cannot read property 'name' of undefined
at /home/runner/Clash-Chest/commands/user/card.js:19:27
at processTicksAndRejections (internal/process/task_queues.js:97:5)
``` ```js
url = cards.items.name.find(card.name).iconUrls.medium;
``` without name it says find undefined
It does but the word security card is weird in that context
cards.items is undefined.
thats not how you use .find()
you were given a link explaining how to use it
you didnt check the link
r/therewasanattempt
@_@
Get off your phone ๐ง
not nice to drive in
Could be
cold be
:^)
noice

It is nice to drive
Driving a RWD
So itโs fucking much fun
as long as you dont start sliding i guess

do you have chained wheels?
I do that intentionally lol
Okay, but who asked. ๐ง
I got some with me for complicated cases
cool cool
Idk Iโm bored
hi bored im dad


jk im the one in the kitchen
you're the mom?
When did this channel become family-development
Ah, they're still driving?
did you spend christmas and new years eve driving? i actually did lmao
I feel damn guilty Sir
Thereโs so much work to do currently as lots of people are at home caused by positive COVID test bullshit
Driving like 18h at some days atm
Just to help out others
dayum
i drove quite a lot those two days but nothing compared to you
just about 6 hours a day
Currently no time to go on trying out autocomplete and other shit
Itโs just frustrating
Not that this shit even has a priority but yeah
Damn I wanted to ask you something but completely forgot what it was 
Yeah cards.items is undefined
but cards exists
and returns ```json
{
"items": [
{
"name": "Knight",
"id": 26000000,
"maxLevel": 14,
"iconUrls": {
"medium": "https://api-assets.clashroyale.com/cards/300/jAj1Q5rclXxU9kVImGqSJxa4wEMfEhvwNQ_4jiGUuqg.png"
}
},
...
..
show code
api.getCards()
.then((cards) => {
console.log(cards.items)
url = cards.items.find(name => name === card.name).iconUrls.medium;
})
.catch((err) => {
console.log(err)
})
i've defined url above
and what is the full error?
TypeError: Cannot read property 'find' of undefined
at /home/runner/Clash-Chest/commands/user/card.js:19:27
at processTicksAndRejections (internal/process/task_queues.js:97:5)
does "undefined" appear anywhere in your logs, right before the error?
yep
above defined
cards.items is undefined
if you have "undefined" in your logs right before the error, then cards.items is indeed undefined, try logging cards instead
but does it error too?
try it
and if it errors, show what is logged right before the error
logging? console.llog, right?
yes
Is it just unparsed text ?
just change console.log(cards.items) to console.log(cards)
probably yes
oh wait ty
there is no items in the logs but in the docs there is
i'll remove .items and check
Check the docs if items is optional
umm what ```js
TypeError: Cannot read property 'iconUrls' of undefined
at /home/runner/Clash-Chest/commands/user/card.js:19:53
at processTicksAndRejections (internal/process/task_queues.js:97:5)
in the logs this time there is IconUrls
Show what you log shows
this is how iconUrls looks like for every card ```js
iconUrls: {
medium: 'https://api-assets.clashroyale.com/cards/300/QJB-QK1QJHdw4hjpAwVSyZBozc2ZWAR9pQ-SMUyKaT0.png'
}
just show what console.log(cards) shows
that's what the logs shows
thats all of it?
Wut
no
all the cards or only 1 card?
what console.log(cards) shows
5$ bet on itโs just unparsed text
10$ bet its just unrefined salt
so thats what console.log(cards) shows?
yes
if so, the correct code should be cards.find(...).iconUrls
and the medium?
yes
but it's just the same thing from before
what thing
same error
show code and error
TypeError: Cannot read property 'iconUrls' of undefined
at /home/runner/Clash-Chest/commands/user/card.js:19:53
at processTicksAndRejections (internal/process/task_queues.js:97:5)
that means what ever you searched for in your .find() was not found
indeed now I deleted iconurls and logged it
if you're still using this code, that .find() is incorrect
cards.find(name => name === card.name)
``` this is how it should be (?)
no
you have an array of objects
meanind .find(item =>) the item here is an object
an object will never be equal to card.name
object.values?
what you want is "find an item where the name inside the object equals to the name i want"
.find(item => item.name === some name i want)
ok
all is ok I think but why the thumbnail ain't showing?
I did .setThumbnail(url)
logged url and it returns the card's url
Discord sometimes has trouble with fetching external image sources
but it never shows
Well the source webserver may blocks Discords user agent which tries to fetch the images or Discord doesnโt show it for reasons we donโt know
oh
Try to post an image URL in discord manually and see if an image pops up or just the URL
but many bots are using it
yeah image pops up
Yeah probably still a Discord related issue as I have that issue sometimes, too with new uncached images Discord doesnโt show as icon or thumbnail
ok
oh
seems link is empty (?)
(node:2657) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message
give it something to send
I used message.channel.send(url)
what is url?
the card's url
Mmm
and when I logged it, it was fine
yea
let { chh } = require("../../object.js");
let cards = chh;
const card = cards[args.join(" ").toLowerCase()];
let url;
api.getCards()
.then((cards) => {
url = cards.find(item => item.name === card.name).iconUrls.medium;
})
.catch((err) => {
console.log(err)
})
and u are sure url is what you think it is
yeah but wait i'll re-log it
log it before sending
it gives this
https://api-assets.clashroyale.com/cards/300/Axr4ox5_b7edmLsoHxBX3vmgijAIibuF6RImTbqLlXE.png
If it canโt find a card based on what youโre searching for the URL will be undefined
Iโm this case, maybe not in the one you had issues with before
Just edit your find() inside the then clause
let find = โฆfind(โฆ === card.name);
if(!find) return โcard wasnโt foundโ;
if(!find.iconURLs || !find.iconURLs.medium) return โno icon URL foundโ;
After both statements
url = find.iconURLs.medium;
You should always check if something exists and is not null/undefined before using it if you fetch something from external sources
Itโs still required to check if url is not undefined after both your api call
ok
If you send that message only including that picture
Make sure url you defined exists
if(url) send message
Or if(!url) error message
finally
tysm
And one more thing, is there a way to whitelist all the ips? Because I want the api to whitelist all the ips (0.0.0.0 doesn't work)
You should keep in mind that Iโve got no clue what youโre talking about.
You gotta explain things if you ask something.
Where do wanna whitelist what?
I want to whitelist all the ips that request http
because i'll be the only one doing it and I don't want to make separate apps for separate ips
All IPs that do requests on your API or..?
Still havenโt got it yet
You do requests at an external API that requires your IP address to be whitelisted?
Or the case mentioned above?
it requires my ip adress to be whitelisted
I don't know replit's ip adress so I can't use the api unless I whitelist it
I want replit for test purposes
what api is that?
aight i'm going to sleep
it seems like they dont want you to use the same api key on different IPs
so for each app/ip you need a different api key
ok
lol canโt even open the link
he mispelled it
Blocked by my pihole
its developer not developers

anyway you can still use a proxy, that way you can use a single ip to all your apps
Guess the domain includes some sort of ads etc.
there are even public proxies for clash api you can use
The token is bound to rate limitations and specified IP addresses, so you will need a web server to fetch data from the API and host your application.
I mean you can define multiple IPs for a single API token
As long as you donโt run into rate limits
This or simply doing a proxy pass for all of your apps to one endpoint redirecting the requests
โฆ to the API
Mehโฆ third party services
thx
Say my bot allows emojis from others servers but I start sharding, and one guild is on a separate shard. There's no way I can react to a message with that emoji ID because it's unknown to the sharded instance, correct?
Edit: Apparently the solution is to do <:name:id> when reacting instead of just having the ID.
Stuff
anything
ayo guys can a option on slashcommands have 2 seperate options
throw e;
^
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in C:\Users\pc\Desktop\Discord Bot\node_modules\discord-api-types\package.json
at new NodeError (node:internal/errors:371:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:440:9)
at packageExportsResolve (node:internal/modules/esm/resolve:692:3)
at resolveExports (node:internal/modules/cjs/loader:482:36)
at Function.Module._findPath (node:internal/modules/cjs/loader:522:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:27)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\pc\Desktop\Discord Bot\src\commands\economy.js:2:33) {
code: 'ERR_PACKAGE_PATH_NOT_EXPORTED' ```
I tried converting all commonjs require to es6 import but the bot is still not working. What should I do??
how do i add a option with choices on a slashcommand
Integrate your service with Discord โ whether it's a bot or a game or whatever your wildest imagination can come up with.
yeah fixed the issue forgot to say
is there a way i could change the color of the buttons on discord.js?
the last time I checked it wasn't possible (except green, red, grey)
like custom description?
you can use iframe
ty
Can you redirect after sendFile on express? and if yes, how?
setTimeout(() => res.redirect("URL"), time)
you ever think maybe you might wanna rewrite that to be more readable so you have a easier time debugging?
:v
and?
well im sure you know whats wrong then 
I'm going to be frank, that code is completelyfcked
yeah
just in so many ways
Thatโs not my issue
why u login the bot... in a express app

wdym
redirect with headers
:)??
you litterally cannot, do what you want to do with that code
your code, violates, even JS' forgiving rules
??
html redirect maybe
write yeah
everyone have their first time, in time to time they will learn how to write a clean code
yeh
so chill
Yeah that can work
This is not the way
<meta http-equiv="refresh" content="timeinseconds; URL=https://www.google.com/" />
This is copied from github
yeh thanks
The oauthpart
And the bot
is ran on a separate server
there are easier ways to do oauth
You login on EVERY request
try passport-discord
nty
and you try to return a webpage response IN AN EVENT in a diffrent wrapper
I know how to change but dk
i smell a api violation
well this code is fucked
poor api
you know what u can do to improve that?
please
Fr tho #development message that code section is why its not working
i will happily provide you with some base code for oauth for you to expand form and work with
you're a) blocking the request calling login and b) returning a web response which d.js will just never pass back because its a asynchronous event, it doesnt care about your web server.
you could remove all of that block and just return the redirect directly, it would do the same thing to the bot, just instead it would actually redirect
because your code itself doesn't do anything on the bot's side, you update a cache that gets immediately destroyed (or well not destroyed, until the bot shuts down because you spawn one on each request until each session is logged out)
be more specific
What is this error supposed to be? Im confused
like instead of 2022-01-06T09:56:51.000+00:00
6th Jan 2022 09:56 UTC
or just 6th Jan 2022
in what language
nodejs
ty
????
.setDescription('Adds a item to the shop (Sellers Only)')
.addStringOption((option) => option.setName('url')
.setDescription('Insert the url of the nitro you are listing!')
.setRequired(true),
)
.addStringOption((option) => option.setName('price')
.setDescription('Insert the price of the item you are selling can go from 20 - 50 Cips!')
.setRequired(true),
),
ok so i've updated this a few hours ago and it is still not updating on the bot, any explation
@solemn latch so i found out you can use custom domains for backblaze
you must use cloudflare
and you point a cname at the friendly url, then set a transform rule and bam it works
What do I need to do to open the bot?
What bot?
Raindow
@zinc fable -wrongserver moment
-wrongserver @jade anvil
@jade anvil
Hey! We think you have our server mistaken. We do not provide support, help, or advice for any bot. You need to click on the "Discord" button on the bot's page of the bot you need support for, not the "Join Discord" button at the top of our website. If there isn't a button that says "Discord" or nothing else mentioned about a support server, the server invite is invalid or you were banned from the bot's support server, then we can't help you. Sorry :(
what?
you are in the wrong server
I made v13 slash help command with select menu but I don't know how to reply or update the select menu I don't know what to write in maine can anyone help
Slash commands has IDs right?
Flaze. Yk how I can fetch those in discord.js?
Canโt find anything easily on mobile in the docs
Aren't they cached
Iโll check later when I have a easier way to read docs
My file containing the require statement is being treated as an ECMAScript module and not Commonjs. And I'm having trouble registering the slash commands. So I changed my package.json and added "type": "module" but still it's not working.
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');```
What will be the es6 import statements for that???
The following code isn't working idk why? Can somebody help? Please
I have been asking the same question from days but no-one has replied yet. ๐
HIGHLY CONFUSED
Ik that but how to solve the error
And if files are named .jsm or .mjs, itโs also esm
Ik that too
Remove the type: module and check if the file extension is .jsm or .mjs, thatโs all I can help you with
I tried doing that
But same error
Then why you told me that you added "type": "module"



