#development
1 messages · Page 1913 of 1
oh ok wait now i get it
the 'i' starts from zero, and only hits the full length on the last for, so one less than length is the last item in the array
did you delete your node_modules folder AND your package-lock.json file?
AND delete the dependencies: {} block from your package.json?
for(let i=0;i<arrays.message.trigger.length;i++){
if(arrays.message.trigger[i].includes(";")){
console.log(arrays.message.trigger[i])
for(let ii=0;ii<arrays.message.trigger[i].split(";").length;ii++){
if(message.content.toLowerCase()===arrays.message.trigger[i].split(";")[ii]){
if(arrays.message.action[i].includes(";")){
message.channel.send(arrays.message.action[i].split(';')[Math.floor(random(arrays.message.action[i].split(';').length))]);
}else{
message.channel.send(arrays.message.action[i])
}
}
}
seems to work now, thanks for the help!
and save package.json?
How can I check if the bot have the permission to create a text channel?
guild.member.permissions.has("...")
const { Client, CommandInteraction, MessageEmbed } = require('discord.js')
module.exports = {
name: "userinfo",
description: "Displays the target's information.",
options:[
{
name: "target",
description: "Select a target.",
type: "USER",
required: true,
},
],
/**
* @param {Client} client
* @param {CommandInteraction} interaction
*/
run: async(client, interaction) => {
const Target = interaction.options.getMember('target');
const Response = new MessageEmbed()
.setAuthor(`${Target.user.username}`, `${Target.user.displayAvatarURL({dynamic: true})}?size=256`)
.setThumbnail(`${Target.user.displayAvatarURL({dynamic: true})}?size=256)`)
.setColor("#2f3136")
.addField("UserID", `${Target.user.id}`, false)
.addField("Bages", `${Target.user.flags.toArray()}`)
.addField("Server Member Since", `<t:${parseInt(Target.joinedTimestamp / 1000)}:R>`)
.addField("Banner",
`${Target.bannerURL({ dynamic: true })}`)
.addField("Discord User Since", `<t:${parseInt(Target.user.createdTimestamp / 1000)}:R>`)
if (Target.roles.cache.size > 1) {
Response.addField("Roles", `${Target.roles.cache.map(r => r).join(' ').replace("@everyone", " ")}`)
} else {
Response.addField("Roles", `No Roles to display.`)
}
interaction.followUp({embeds: [Response], ephemeral: false});
}
} ```
Regarding the docs, there's no bannerURL() method available in the member class
But in the user class, there is
You need to get the user object for your interaction option target to get the URL of the banner
Can you give me a example code this?
What's the part of the code you got an issue with?
Changing the embed in your original message?
The embed itself
You mean updating the embed when pressing a button?
yeah
Well that's actually the easiest part, I'm gonna give you an example
Yes
Your original interaction has a button you assigned a custom ID to, let's call this custom ID change_embed for now.
Also in your interactionCreate you check if a user has clicked your button with the ID change_embed.
If so you simply gonna edit the interaction response (which currently includes your button and embed).
If you wanna keep the button, then the code needs to look like:
let component = interaction.message.components;
let embed = { color: 0xffffff, description: "This is your new embed." };
await interaction.message.edit({ embeds: [embed], components: component }).catch(...);
If you wanna update the message (embed) and remove the button, the code needs to look like:
let embed = { color: 0xffffff, description: "This is your new embed." };
await interaction.message.edit({ embeds: [embed], components: null }).catch(...);
While the interaction object is still the interaction response your button is attached to (the message with your unchanged embed)
ok i'll try something like this.
give exaple code pleas
Well to get the user object use interaction.options.getUser("target")
But you will still also need the member object
You can also interact with the user object directly using Target.user.bannerURL()
Which is easier of course
did not work
leme retry
I don’t see you tried that in your code
target.banner != target.user.banner
The user object should "always" be included in the member object
At least in djs
@boreal iron ok so what do i do?
code: https://srcb.in/qNzGyZ3loj
I'm trying to do a ticket system with threads, but idk why I get an api error;
error: ```RequestHandler.js:298
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Unknown Webhook
at RequestHandler.execute (C:\Users\Utente\Documents\progetti\NOVABOT v13\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (C:\Users\Utente\Documents\progetti\NOVABOT v13\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
at async InteractionWebhook.send (C:\Users\Utente\Documents\progetti\NOVABOT v13\node_modules\discord.js\src\structures\Webhook.js:192:15) {
method: 'post',
path: '/webhooks/899585166438191176/aW50ZXJhY3Rpb246OTA0ODM4NDA0MTc1NDYyNDMwOkw4N1lrTlpFWEpqTzVDRFRCN0U0QVJUUmtId1dYbU5TY3RWbmFvNmRYelcxWno0UzVnVDNYZHZLZkNORzdFTTk3cnN4TU1ENWg3QXlJUEdCUFJDWUxBZzBKaG01WHFsWDZDYWk5VnRUdUgxT09JYjIyQVJKRHNldW9RMEVYaE9F?wait=true',
code: 10015,
httpStatus: 404,
requestData: {
json: {
content: 'Ticket creato!',
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 64,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined
},
files: []
}
} ```
nvm i had to update discord.js lol
But still the member class doesn’t include the banner URL
The user class does
You just need to edit target.bannerURL() to target.user.bannerURL() as I mentioned
Simply defer the interaction when pressing the button
Since you await things to happen like creating a thread, which may take a few seconds
But the webhook is only available for 3s
After deferring you can respond to the interaction within 15 min
@woeful pike can I get a link for your jetbrains theme
What plugin is it
doesn't look like it works
it's not a plugin
it's a color schema
the plugin is material theme
it's just a fork of an existing theme
unless you're talking about something else
How do i react with a custom emoji?
how do you cope with size 16 font 😭
thanks @woeful pike it works great, best team member
message.react(":wave:")
}
instead of: message.channel.send("":wave:")
type: message.react(":wave:")
That's not what they asked and your code example is incorrect
For built in emojis, you have to use the unicode version of the emoji; \👋
For custom emojis, you have to supply a name and an ID in name:id format. The name seems like it can be anything, so you could pass _:id if you want to be generic
You need the emoji identifier which looks something like
<:name:id:> for normal and
<a:name:id:> for animated
react doesn't accept that format
Like I mentioned, it's name:id
Djs does, Eris doesn't iirc
Can't make assumptions about their env
True true
@quartz kindle or others who know sharding: I have an error in my event handler for guildCreate, where the sharding is saying it finds Discord undefined: ```// The embed which sends to channel
const joinEmbed = new Discord.MessageEmbed()
.setTitle('Server Joined')
I import Discord at top level, and this is within a broadcastEval scope.
I tried sending in through the context object as well, but then it said it's not a constructor....help? I guess I don't understand what is invisible to the broadcastEval scope from file-level definitions....thx.
the file where the broadcasted function is executed does not have Discord in its context
you need to define it yourself with a require
broadcastEval((stuff) => {
const Discord = require("discord.js")
})
For specific values
We have been given, some values like
56+2 = 70
We need to be specific bout them
And the rest of the calculator must work fine
based on the formula or on the result?
like anything that would result in 58 gets changed to 70? or only that specific 56 + 2 input?
Specific
lel funni
Yeah....
So my import/require needs to be done within the broadcast scope because it doesn’t see anything outside it’s direct scope?
yes
How did they even do it, do they just .toString() the function and eval it like normal?
yes
the function is stringified and sent to the shards as text, then evaled inside one of the discord.js files, so it inherits that scope
Ahh ok. Got it. Makes much more sense now. Thx!
@client.event
async def on_message(message):
if message.channel.id == 899242171838910527:
data = message.content.split(" ")
user = re.sub("\D","",data[4])
print(user)
await client.process_commands(message)
i need to add voting rewards
i want to find the user which voted
i add webhook
Thankyou for your upvote@deft citrus
i add this in the webhook channel if someone voted
but i cant find the user
who voted
is this code wrong
Wdym, it doesn't print the ID?
it should collect the id from the message
and print it
it should print this id
@deft citrus
My question was like does it not print the ID
no it does not print it
Are you sure the channel ID was right?
yes
Well, I have no clue man, it's hard to tell what the problem is without further information. Besides, this is rather a hacky way, I'd personally just set up a webserver for top.gg to send the requests directly
what is re.sub?
i got it from youtube video
well we have no idea what that function does
so unless you show/explain, we cant help
nope
Replace a string which matches the pattern, in that case, it removes non digit characters
its a built in method?
re is part of the standard library yeah
then the problem is likely data[4]
ie the content of the message you are receiving
If there was no space before the mention, it should be 3 yeah
- you have to invite me to your bots team
- i am the permanent owner of that team
- u send me the application for the bot so i can fill it out
- you stay in the team while i am just the owner
is this rules good
a person dm me
with this rules
to verify
my bot
what
@quartz kindle
???
do you know this person?
but with these rules
no
then its a scammer
ohk ty
how could i fix this
oh
@client.event
async def on_message(message):
if message.channel.id == 899242171838910527:
data = message.content.split(" ")
user = re.sub("\D","",data[4])
await message.channel.send(user)
await client.process_commands(message)
see
Thankyou for your upvote @deft citrus
i add space
now 4 space
We're still lacking info. The problem can be anything, really. You might've overridden your on_message event with another
Keep in mind, no one should be verifying your bot except you, yourself, and you ONLY. If you're not willing to verify your bot by inputting your passport or ID, then you can't expect people to input theirs to verify it for you since No One will do so for you.
ok i will wait 2yrs
If you yet don't want to, unfortunately, your bot will not be verified and will never will.
.. and why so? 👀
Are you 13 or almost thirteen?
13
Your birthday has passed and you became 13, correct?
Moreover, you can ask a legal guardian to verify the bot for you, too.
yes
who
can you
Example, your parents, older brother, some relative close to you.
oh they will never agree
I know most developers are 16 and can use their own passports, according to the TOS and FAQ.
my parents dont like social media
You can't expect to verify the bot, if so.
Unfortunately, I can't either interact or help.
As a developer, you're expected to go through stages like this, and I thought the same, years ago, when I also joined, but it's to prevent Fraud.
You're new to coding, correct?
i know java script i make games to python i am new
can anyone help me with this
Sweet, you can continue learning before verifying anything, don't rush.
The more you rush, the more you are preventing yourself from learning.
Make sure those aren't spam servers like creating servers with you and a bot like 100 times.
nope
it got verified in top.gg
that doesnt really matter
so i got lot of servers
Oh, you took advantage of the front page, GG. 🎉
people invite hundreds of bots to their servers to "grow" them
should check the amount of bots in each server and leave ones with like 10 or more
Hm, why so?
helps prevent much spam imo
Bot farms are servers with like 30 bots or more.
change the number how you want ¯_(ツ)_/¯
10 bots can be good, mostly the guild owner doesn't want a bot that has everything. (Due to some features are premium, etc.)
what would happen if you removed bot from topgg then added back 
would it be as if you added for first time with no downside ||other than losing votes and stuff||?
Absolutely nonsense to declare a fix value.
A check if a certain percentage of members is a bot makes more sense, e.g. 50% or more.
yes
You'd get your cheeks clapped by veld
those 10 bots destroy your dms when you send !help
yeas
i made the mistake of sending !help in one of those servers
It had over 300 bots
My phone literally rebooted
What a nice day to NOT use exclamation mark for prefix
jeez
im surprised not many bots used / or // as a prefix before slash commands were added
// seemed like a good option so i used that until it started causing me issues with the app (not the bot)
They did
i meant to say not many
i will now disappear
Evaporate
if (message.guild.id === "754604182995992609" && message.content.includes("1")){
message.reply(`Why are you pinging Broken Tooth! stop it <${a}:angryasf:904984616904036352>`)
return
}
for some reason it does not work
message.content.includes is not a function
how do i make the bages emojies?
like instead of HOUSE_BALANCE it show 
put an emoji there instead of HOUSE_BALANCE?
Baguettes
@nimble kiln but it is if a user have it then it show so i cant do anything with that
Sorry, but I dont understand you
they put the exact user badges string inside the field description
and they don't know how to change the badges to emojis
var it, if its true it will show an emoji that you have in your server
look at bages field
wdym var?
btw its badges not bages
Show the code for this part
var that if they have house balance it will be true and it will show the emoji
I don't understand you
one sec
and var sucks
let and const are better
i dont understand my self its okay
var ftw
ahhhh
ES5 ftw
u mean like i typ if the user have this badge it show an emojie?
yes
one sec
@earnest phoenix
you don't know what you're doing yourself and you're trying to help them
.addField(''Bages'', ${Target.user.flags.toArray()})
yes i do i did it already
but i am not good at explaining
idk with badges
map the array to change the HOUSE_BALANCE and stuff to emojis
how
edit it pleas
I have a serious question:
Do you actually know how to code or did you just follow an outdated discord bot tutorial
ik how to code but idk with badges
if(Target.user.flags.toArray() == 'HOUSE_BALANCE') {
userFlags = '<:balance:887102876407693383:>';
}
...
...
Somewhere below:
.addField('Badges', userFlags)```
ah ok
But a user can have multiple badges, so you probably want to for loop it
(If you want to display multiple badges)
ouf
toArray doesn't return a string
¯_(ツ)_/¯
hmmm
why don't you just map and join the array
and I'm not going to send a code example because I know you're gonna copy paste it
.addField("Bages", ${Target.user.flags.toArray.map.join()})```? like that
are you sure?
it is
yo what
it's a valid function
ofc it is
...
will that work?
toArray()
.map(badge => change badge to emoji)
.join(", ");
how do i change it to emojie if idk if the user have it or no
map allows you to change the stuff inside the array to something else
ok so how do i change
[1, 2, 3].map(number => number + 2) becomes [3, 4, 5]
scruw it
my mind
To everyone in this channel who said creating a discord bot as your first project is fun:
fuck you
hey it is fun
scratching your head, calling yourself an idiot and giving up programming is fun
yeah
well if you give up you can go outside and socialize with people so
My first project has been my Discord bot and it's been going on for well over 4 years
send help
That's the difference
You have a brain, most people in #development don't
shit developers be like
There should be an autoresponder just for that very phrase
hi, guys, need help for using webhooks
What with
I followed the guide here: https://docs.top.gg/libraries/javascript/#webhooks
when click "test" button in dashbord
I can receive event, but I can not receive anything when vote at bot page
@spark flintthank you
No problem
Also scrolling through that chat may be helpful as there may already be a response from someone with the same issue
got it
code: https://srcb.in/qNzGyZ3loj
I'm trying to do a ticket system with threads, but idk why I get an api error;
The thread is created but after the correct creation and the direct message I get this error.
error: ```
RequestHandler.js:298
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Unknown Webhook
at RequestHandler.execute (C:\Users\Utente\Documents\progetti\NOVABOT v13\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (C:\Users\Utente\Documents\progetti\NOVABOT v13\node_modules\discord.js\src\rest\RequestHandler.js:50:14)
at async InteractionWebhook.send (C:\Users\Utente\Documents\progetti\NOVABOT v13\node_modules\discord.js\src\structures\Webhook.js:192:15) {
method: 'post',
path: '/webhooks/899585166438191176/aW50ZXJhY3Rpb246OTA0ODM4NDA0MTc1NDYyNDMwOkw4N1lrTlpFWEpqTzVDRFRCN0U0QVJUUmtId1dYbU5TY3RWbmFvNmRYelcxWno0UzVnVDNYZHZLZkNORzdFTTk3cnN4TU1ENWg3QXlJUEdCUFJDWUxBZzBKaG01WHFsWDZDYWk5VnRUdUgxT09JYjIyQVJKRHNldW9RMEVYaE9F?wait=true',
code: 10015,
httpStatus: 404,
requestData: {
json: {
content: 'Ticket creato!',
tts: false,
nonce: undefined,
embeds: undefined,
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 64,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined
},
files: []
}
} ```
Does somebody have a solution for it?
My discord bots disconnects after 4 days automatically.
I've never heard anything like this, wich host r u using?
youll need to respond to a interaction in 3 seconds
that isn't the host.Since the process is still online and db is connected
I seem to be having the same issue. It randomly just disconnects itself. Happens with both of my bots even tho they are online and still posting to top.gg etc
and how can I fix this issue?
And then my bots statuses go as well
respond to the interaction in 3 seconds
yea and i don't get any type of error
or defer reply
then respond
Mine seems to give an error but the error doesn’t actually provide anything helpful
It just says something about 403 unauthorised but doesn’t say what for or what is causing it
(I can now know tell it’s for Discord API)
Managed to connect using my Phone and can see the error I get now(different from yesterday)
Errrr big bun I have a question
Hi
So on the site on top gg I can’t vote like at all cuz there’s always a problem occurring in the web page is there anything to fix it
I can like screenshare or sum and show you if you wanna
Could you screenshot it
Sure one sec
I’m at school so can’t really call or anything
Ah sorry then
It’ll always come up with this
Or reload the page
And then I have to watch the ad 8 million times
Like I’ll tap twice and it’ll reload the page after the ad
And say a problem occurred
Aight sorry
how can I send the buttons inline?
Have them under the same ActionRow
They probably meant fun to watch 
Apple forces you to use their browser then doesn't even properly implement web standards? Cringe
Which standards are missing to prevent you from browsing the 'net?
Using it for more than 10y... dunno which complaints you have.
Telling somebody to use a different browser because the site is still a nightmare, isn't the browsers fault.
idk css tricks says safari is the next internet explorer

Careful!!!1!
the next internet explorer
That's something you can't take back, Sir.
It is possible for a bot to edit a message from a slash command?
The response for a slash command is just a normal message, so yeah it's possibe
with the method named(?)
djs?
Other than slash commands, button interactions for example come with the message property you can access
It might be needed to defer the initial slash command response if you wanna edit it later on, as the webhook is only available for 3s
I heard Safari is a pain in the ass to maintain frontend for
I just downloaded my code from github again and this is the error npm install
https://sourceb.in/XvedhjpYKK
@quartz kindle
how to get all the servers that my bot is watching including the shard servers?
what language?
js
but here edits reply, how can I edit interaction.followUP?
Can anyone help?
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
you still have a shit ton of trash in your package.json
and yes, you need windows build tools, which include visual studio
How to install them?
npm i -g windows-build-tools from an administrator cmd or powershell
(right click -> run as administrator)
Okay I will try
@boreal iron https://www.safari-is-the-new-ie.com/
Safari is becoming the new Internet Explorer, and it's high time we fixed that.
i have a problem
bot.shard.fetchClientValues('guilds.cache.size')
.then(results => {
setInterval(() => {
bot.user.setActivity(`with money | e!help | in ${results.reduce((acc, guildCount) => acc + guildCount, 0)} servers.`, ({ type: "PLAYING" }))
}, 600);
}).catch(console.error);
sounds like a really bad problem
you're not updating the guild count
you set the interval inside the fetchClientValues block which means every 600 milliseconds you're updating your client presence to the old data
o so i need to put it outside of it?
can i do that instead then?
setInterval(() => {
bot.shard.fetchClientValues('guilds.cache.size')
bot.user.setActivity(`with money | e!help | in ${results.reduce((acc, guildCount) => acc + guildCount, 0)} servers.`, ({ type: "PLAYING" }))
}, 600);
wait is that how you get data from shards in discord.js? that's so funny
At least every 4s but 5s just to be on the safe side
why the hell 600ms
Lol
the usual is 5s
why would you try to update your status every 5 seconds
Users don't care about stats
plus its not exactly important to have a live server stats updated instatly
make it update every 30s
do it like once a day or something, nobody cares and inconsistency doesn't matter
doesn't this eat up into your other rate limits too
30s is a reasonable update interval
you're taking from your global rate limit doing something super unnecessary
its not like anyone is going to go "wtf this isn't a live update on the bot status removes bot"
I'd honestly just remove it completely idk why anybody would care
have shards send stats to a database or datadog
i did that,
setInterval(() => {
bot.shard.fetchClientValues('guilds.cache.size')
.then(results => {
bot.user.setActivity(`with money | e!help | in ${results.reduce((acc, guildCount) => acc + guildCount, 0)} servers.`, ({ type: "PLAYING" }))
})
}, 600);
and it still does not show the correct amount
600ms 
does this really matter
you're 4 servers off
there's obviously some caching involved somewhere along the way
${results.reduce((acc, guildCount) => acc + guildCount, 0) + 4.45445233533534545} there
Simple
well i dont want to deal with it in the future
I wouldn't be surprised if your bot was removed from a couple servers and the discord invite page just relies on eventual consistency or something
but at some point it will change from 4 servers, the shard will look on more, any idea how can i just make it to do like it should
Ahh
this is like the ultimate bikeshed
with money | e!help | in ${Math.floor(Math.random() * 493)} servers.
activities are useless
No one cares about statistics, and if you want to put website/announcements, just add it to your bot's about me
No presence needed
go set up metrics for your bot
Even better, everyone can still see it even when your bot is down
doesn't top.gg have like some dashboard that shows you some of their own metrics for the site? Go make something like that
Watching over X servers
now says
Watching for suspicious users | website.xyz
Make the status relevant to the bot
not just a server count
no one realistically needs a live server count
if i wanted server count, i would go to either top.gg or see the server count when adding the bot
just send metrics to datadog so you know how your bot is being used

true
I have a live count on my RPC that updates every 30s
That’s what I do instead of updating the bot status
(Only works when I’m on my pc though since it works through IPC)
what did I do wrong?
Hey! I'm making a dashboard for my bot, and i get this error: GET https://dashboard-backend.wingek.repl.co/api/auth/ 401
it says the error is coming from this line: getUserDetails()
but i dont understand whats wrong/why it doesnt work
This is the function:
show code
return axios.get('https://dashboard-backend.wingek.repl.co/api/auth/', { withCredentials: true });
}```
this is whats on the https://dashboard-backend.wingek.repl.co/api/auth/ site
Skill issue
huh
You should look up what the 401 http code means.
im assuming you are using oauth2?
so when you visit that page in a browser, it asks you to login with discord?
if thats the case, then you are logged in, but this code is not
how tho?
when i log in via the oauth2
i get a cookie on the https://dashboard-backend.wingek.repl.co/api/auth/ site
and it displays all my info
if i clear the cookie it says unauthorized on that page
@quartz kindle
I deleted package-lock and did the cmd and got this
https://sourceb.in/v9c4pi27vV
and some unwanted packages
well thers your answer
the cookie is stored in the browser
your code doesnt have it
you didnt do anything i said...
- open cmd or powershell in administrator mode, run
npm i -g windows-build-tools - open your package.json file and delete everything from
dependenciesthat you dont use in your code. open all your files, look at all yourrequiresand whatever you dont find, delete it from package.json - save the modified package.json
- delete package-lock.json
- delete node_modules
- run
npm i
also, READ all of these
if you dont use them, delete them. if you use them, read what it says, it likely tells you what to do, how to update
Has anyone here by chance used the XCP-ng hypervisor software
I'm having an odd issue I can't find any info about
Figured perhaps someone here may have a little insight lol
hey Tim, for sharding, during a guildDelete event, is there a timing issue for broadcastEval calls, where the guild leaves the client's cache, while I'm in the event handler for the guildDelete event? bascially I'm getting a failure for finding the guild, so I'm wondering if this can be a timing thing?
its supposed to save the cookie to the database, but there might be something wrong with the saving part
I will try this
basically here's what I think I am doing wrong (and going to try the reverse): I have guildDelete event, and I have a support server on another shard I want to notify of the departure. I was finding the shard with the support, and then querying the client for the departing guild's info...which fails. I"m thinking the client sees this as "gone" already. So I'll swap and handle this in the shard/context of the departing guild and query the support server shard for the comms. I think that will fix it....
yes, you have to get the guild information inside the event, then send it over
thx.
You Sir are using python and telling me something else is pain? 
Wanted to diss you earlier but just woke up now 

is there a js version of """ ?
```
ah
fuck
just one of them
discord is shit
\`
like
let test = `hello
world`;
though doesnt result in pretty code
Worth learning and switching to Typescript? 
yes
Does a Anti-Spam System flag block the request type? For example senddm?
Definitely
Write something in JS like this and it should be correct but doesn't work with TS.
module.exports = async (client) => {```
You get quickfix option and it modifies the code into this and then it works. (Varies between the use your code has.)
```ts
module.exports = async (client: { guilds: { cache: { size: any; }; }; user: { setPresence: (arg0: { activities: { name: string; type: string; url: string; }[]; }) => void; }; }) => {```
I've noticed typescript being super useful
Theres not much differences between JS and TS but one of the first differences you see is its not
const something = require('blahblahblah')
but instead
import something from 'something'
This is how my slash command is build, how can i add options to it?
import { CommandInteraction, Collection, MessageSelectMenu, MessageActionRow, Client, MessageEmbed } from 'discord.js'
import { commands } from '../..'
export const name: string = 'test';
export const description: string = 'This is a Test Slash command';
export const category: string = ''
export const run = async (client: Client, interaction: CommandInteraction): Promise<any> => {
await interaction.deferReply();
await interaction.editReply('Hello World!')
}
I have added this but not sure if this is correct
export const options: string = ''
He do be type hinting everything
Me when ts compiler gobbles up the type hints for my string literals
I did the same thing cause why not
I am running my bot on visual studio code on the rdp is this the right way to host it on it ?
How to make a slash command handler
It's pretty much the same as a common command handler
Just with the small difference to register/update/delete slash commands
every code i try it fails
How to delete? ._.
client.application.commands.delete(...)
You can pass the whole command object or just it's ID
Fails to register/update/delete the commands or fails to run the commands?
I mean the structure is absolutely the same but you won't pass message as argument into your run/execute function, you will pass interaction to it
Which you will receive in your event interactionCreate
I don't know the id
H0w can i know the id
You will have to fetch the commands then to get your command by filtering the result by it's command name.
client.application.commands.fetch()
Keep in mind that's a promise
oh
why not just global slash command instead of per guild slash command
That is very far from the truth and would be fixed if it was a Discord error. It sounds like an error on this person's end
@covert gale
I'm coding in JavaScript and have been having trouble updating my embeds to work with Discord v13.
Is it still possible to have an image url put into an embed as an attachment?
I can either get the embed to post or the attachment, not both.
you can set the file of specific fields with links still
use setImage to set a large version of the image providing the link to setImage
I can just drop the link in the embed like
exampleEmbed.setImage("imageURL");
```and it works but I want to know if you can turn that URL into an attachment and have it display in the embed just like the URL image would.
That's what I was doing with my image embeds before v13.
What?
If you want to set an attachment, you have to download the file and then create an attachment and specify that in the attachments field of the create message and reference attachments://filename.ext when you set the image field in the embed
Is that new to v13?
I was able to make non-downloaded image links into attachments before.
MessageAttachments are Buffers of image data to send to Discord. Discord.js downloaded the images first if it detected an http(s) protocol
So it should still be possible and I don't know why it's not working.
No because they removed that functionality. You need to manually do it yourself
Oh, so it doesn't work anymore and you can only make attachments off of downloaded images.
yep

Well, at least now I know and I can stop frustrating myself trying to get it to work.
Thanks for your help~
That would be nonsense.
A registered command is registered and does not need to be registered again, unless it got deleted.
A proper command handler fetches the registered commands and compares them to your loaded commands.
It does then register unregistered ones, updates them if you changed the description or options for example or deletes the registered ones if this doesn’t exist locally anymore.
Also registering guild commands only makes sense to test things in the first place or to dynamically create commands in guilds for whatever reason since they will be available immediately.
Commands take up to an hour to be pushed to all guilds if you register them.
A joining guild should always have access to the commands within seconds or maybe minutes.
So that would only be the case if you register them over and over again for no reason as I explained above.
Nope
It’s simple, create your own function loading your command files which you already have i guess, create a function that fetches the registered ones from Discord, compare them all together and then register/update/delete your commands
2 functions, only a few lines of code
Both been called in the ready event
Also consider to create a reload command calling these two functions
That lets you create or edit commands and get it in place without restarting the app
how do i convert a bigint perms to a readable text?
permissions.toArray()
if you only have the bigint value and not an actual permissions object, just do new Discord.Permissions(bigint here)
why does rewriting systems suck
I didn't want to use slash commands, but we all have to now 🙄
perhaps, but Discord bots have been built on the existing system for years
They're mostly pushing this for privacy which doesn't even work because user bots exist. User bots literally break all of their security measures
Well some tech companies think they can change their whole image or the way users interact with their platform by forcing new rules
Which will mostly lead to issues and unhappy users instead of an improvement but companies think they need to reinvent themselves from time to time
meta
That’s true but to be fair I guess user bots are less in percentage than bots existing which do all have the possibility to read message
Only issue is user bots are more dangerous since they don’t need an auth to get into guilds
So yeah I got your point
Yeah which is most likely the best example of one of the biggest players out there transforming into a gigantic shithole other than what it was or supposed to be in the beginning
it always was a giant shithole
Also just exist because most people are addicted lurking for attention in any way
I never used it once in my life as well as insta shit or Twitter or any related other shit and still happy and around the net every day
Doesn’t mean it can’t be useful, it can but only for a very small circle of customers
Lol
What the fuck is this shit
I am literally pulling my hair out because it's also saying the same thing for { [key: string]: unknown }
I guess declaring that it accepts a Model<any, any> works, but eslint does not like any
What's model?
It's a definition for a Table in Postgres
I'm rewriting my orm from JS to TS
I can provide the TS version once I'm done
How'd you define Model?
class Model<T extends string | number | symbol, D extends Record<string, unknown>> {
public table: T
public primaryKey: Array<keyof D>
public options: { useBuffer: boolean; bufferSize: number; bufferTimeout: number }
public constructor(table: T, primaryKey: Array<keyof D> = [], options: { useBuffer?: boolean; bufferSize?: number; bufferTimeout?: number } = {}) {
this.table = table
this.primaryKey = primaryKey || []
this.options = Object.assign({ useBuffer: false, bufferSize: 50, bufferTimeout: 5000 }, options)
}
}
It didn't throw any error for me
change line 36 to
class Database<M extends Record<string, Model<string, Record<string, unknown>>>> {
@lament rock Heh https://safe.kashima.moe/lhhdrv1rcbpf.png
oooh typescript
bruh lol
Dude I accidentally fixed it
Then the methods won't work!
:c
declaring {} as the def isn't an option sadly :(
I am SUPER proud of the orm. Especially buffering multiple calls together and de-duplicating prepared statement values
typescript is the better version of javascript since it helps you understand how coding really is like. There are some arbitrary requirements tied to it, but getting over that isn't too bad. The biggest upside is teaching you to think in terms of types where specific types have their own intrinsic properties and methods
I highly recommend a deep dive
just wanna be clear that you meant ts and not js?
i don't even know if what i said makes sense
yeah, i was trying to make a joke earlier but i failed
Okay. I take things pretty literally if I haven't interacted with people before. Now I know
i dropped js for ts a while ago
Good choice
Wanted to get around to rewrite my bot, but the code base is over 20k lines last I checked
discordjs is just too bleh for me
too simple now
so i'm trying dpp
but my brain is getting fucked
not to mention the cpp operators
idek what & does
if you wanna go pro mode, take a look at cloudstorm and snowtransfer on npm. I've updated them with original author perms and I like them :)
bitwise logic is fun
wut
i only started 2 years ago
pls explain
oh
an ampersand
& is bitwise and. | or bitwise or.
bits can be explained as a collection to some degree.
You can add bits together to form a collection and check for if the collection contains a bit which is the logic behind Discord permissions.
I can provide a Discord example. One sec
nah
i get it
i think
const member: Discord.Member = message.mentions.members.first() || message.guild.members.cache.get(args[0]);
something like that?
i forgot how djs worked
Bits aren't that hard if you think about it
sir, please
i'm 13
don't murder me
It's just a different representation of your integers
bits are base 2
lemme think
Discord permissions example:
3145728 is a collection of (1 << 20) and (1 << 21) ORed together ((1 << 20) | (1 << 21)) 20 is the connect permission and 21 is the speak permission.
You can check if the collection contains a bit by doing:
collection & bit
if the collection contains the number on the right hand side of the operation, it returns the bit. Otherwise, it returns 0.
3145728 & (1 << 20) // 1048576
hex is base 16
Depending on how you write them down, you will be able to convert it from, say, hex to decimal (base 10)
"American standard for code information interchange" I believe
special encoding for characters
so just utf-8 but american?
It's basically a table that consists of Latin characters used in English and their decimal/binary representations, also what papi said
looks like darcula
Well, UTF-8 is more of an "improvement" in a way as ASCII was the first to come afaik
Old computers worked with ASCII mainly, other encodings became a thing later
utf-16 :)
dude
(:
the american standard was first and then they added support for other countries because the usa loves to help the world
i introduced something very easy to my teacher
and we did it for 3 days
and he said it was too hard

Lol what did you tell him
can y'all guess what the lang was?
Well. Not everyone thinks logically
python and pycharm
i gave him a 10 minute video of the basics
Make them all suffer.
what is asm
assembly
Assembly
oh
the closest fucking thing to machine code
No abstractions, everything done manually
Never worked with C and C++ 
and mingw is giving me a hella hard time with it
actually
it might be the library
it's giving me a undefined reference __imp__* error
i'm just gonna take it as imp is an important
but it were an import
that'd be on me?
I'm at the point of blaming the language :)
Welp. Good luck with that then
i'll be crying myself to sleep in a few
can anyone help me in webhooks forwarding?
i am using top.gg/autoposter to sore vote events but also want the same webhook to be used by another bot
how can i do so?
You have to forward the events to the other bot if you mean multiple sources receiving the same event
i mean can i get a sample snippet?
Not really because it depends on your setup. You could either make an HTTP request to your other bot or some other form of IPC
idk exactly how to acheive it
Then google examples
wait imma explain my case
so i use autoposter to log when any user votes
but the problem is its very inaccurate
doesnt logs every vote count
so i have to use an external bot "vote tracker"
now it also requires a webhook
but top.gg can handle only 1 at a time
so i need to forward my webhook to "vote tracker's" event
thats all i wnt............
Then do that
thats the problem i dont know how
If it's another process you have running, look up how to do IPC in whatever language you're using
what do you suggest using another process
I have no clue
i have to host that too
What about this? https://safe.kashima.moe/a40vlvnk0hxe.png
suppose i reply to someone's message. Then is it possible to get the id of the replied message through interactions
When it gonna takes for approval on the Bot?
around 2 weeks
btw next time ask in #support
oh sorry, My apologize
np
i cant figure out how to forward webhooks
where should i put message
async def mycmd(ctx, member: discord.Member,*,reason=None):
i want to add message here without getting error i am getting error when i add after ctx
With python can't you put it anywhere?
Could you possibly send the code like this
`
print("hello world")
`
Or does it matter where it goes
everything matters lol
like ```py
code here
mmm true
ye
python kinda an annoying language at times
where do u want to send it
Right here.
yes u can
wait now im confused.
copy the error or something, explain the problem
How to show Total votes of each user in embed ?
use the api
Which
Any one can help?
WOK Commands is so useful module
Only if you are under 13 and have no knowledge of computers
Bruh so how it works?
i run my bot on heroku because i dont have money for hosting 
Learn linux, run it on linux
I run my bots on kubernetes because I have the money and time to mess around with hosting
It's windows 10 system XD
Yeah that's no way to run a bot
Sad
I'd say this is okay for my bot im not very experienced with coding bots
It's decent
and its not a all in one bot
its just a bot that is used to check stats from esportal
esportal is a csgo matchmaking provider like faceit
so i dont expect the count to be very high anyways
at first the user count was from cache and it showed 600 then my friend helped me make it count it from the servers and it now shows accurate number
and i finally added categories to the help command so it shows my commands 
I have WOK Commands node module its very useful and makes me not need to do a lot of stuff
I have been working on a ai chatbot
noice
thats actually cool
thx
its gonna take time to teach it to be more humanlike
im happy that my bot was approved even tho it doesnt have much features
Yea
we are workrng on that
but it does what its supposed to do and it does it pretty well
congrats
Thats important
i still need to do some changes at some point
at some point i need to make the stats channel into something anybody can add
at the moment its only in the support server that has no members lol
Maybe a website can be really help ful
idk im lazy so i havent done anything on my website
my website only has a goose that you can click and it honks and then my webmail
so i can access my business email
I did pay to see that
my discord status shows my business email just take the domain from that and u get to the website
Okay thx
perfect update pushed to github and its gonna deploy on da bot now
how can I get the guildId in an event.js file
You will receive the guild object in the associated event
For example the GUILD_CREATE or GUILD_DELETE event
I'm trying to do a log system, and I've created a event for only logs
how can I get the guild Id here
By passing the guild object or just the ID to where ever you need it
require it from discord.js?
You may wanna be a little bit more specific
const { MessageEmbed } = require("discord.js");
const log = require("../models/logs");
//const response = log.findOne({ guildId: channel.guild.id });
// Channel Topic Updating
client.on("guildChannelTopicUpdate", (channel, oldTopic, newTopic) => {
const LogChannel = client.channels.cache.get("905412841266352148"); // Replace with your channel id
const TopicUpdate = new MessageEmbed()
.setTitle("Topic Updated!")
.setColor("PURPLE")
.setDescription(
`${channel} Topic changed from **${oldTopic}** to **${newTopic}**`
);
return LogChannel.send({
embeds: [TopicUpdate],
});
});```
for example this
Instead of that ID, I want to put obviously the id of the log channel of the guild
could work if inside every event I put the findOne?
srry for ping
Where did you create your event (guildChannelTopicUpdate)?
Why don't you simply pass the whole guild object ot it when you emit it?
What I see doesn't make much sense if you need to specify the channel yourself.
(if the event should be triggered in any guild, not just that one)
It Is done by an NPM package
I want to make It multiguild
Ok then log channel to see if that's actually a guildchannel obj or just a channel obj
If it's a guildchannel object it does include the guild property as well as the guildId
If not you fetch the channel by it's ID using your client and will get a guildchannel obj as result
This will contain the whole guild object of the channel, also it's ID of course
<ref *2> TextChannel {
type: 'GUILD_TEXT',
deleted: false,
guild: <ref *1> Guild {
id: '846752749555286027',
name: 'Server di cristiangrossano',
icon: null,
features: [],
commands: GuildApplicationCommandManager {
permissions: [ApplicationCommandPermissionsManager],
guild: [Circular *1]
},
members: GuildMemberManager { guild: [Circular *1] },
channels: GuildChannelManager { guild: [Circular *1] },
bans: GuildBanManager { guild: [Circular *1] },
roles: RoleManager { guild: [Circular *1] },
presences: PresenceManager {},
voiceStates: VoiceStateManager { guild: [Circular *1] },
stageInstances: StageInstanceManager { guild: [Circular *1] },
invites: GuildInviteManager { guild: [Circular *1] },
deleted: false,
available: true,
shardId: 0,
splash: null,
stickers: GuildStickerManager { guild: [Circular *1] }
},
guildId: '846752749555286027',
parentId: '846752750033305630',
permissionOverwrites: PermissionOverwriteManager { channel: [Circular *2] },
messages: MessageManager { channel: [Circular *2] },
threads: ThreadManager { channel: [Circular *2] },
nsfw: false,
id: '905413370210050048',
name: 'testfuigajkf',
rawPosition: 0,
topic: null,
lastMessageId: '905413437469892688',
rateLimitPerUser: 0
}
this is the log of channel
There you go, there's you guild object
tysm
Top.gg's API docs is a bit confusing maybe adding some example of what you can do with it would be helpful 😃
Simply said receiving webhooks from topgg at your endpoint and generally the possibility to send requests to the API to get infos like bot stats, the last votes, etc.
i will try and see what i can do and do tests with a simple ping command ||it is allowed for,if a user wants to use a commands hey have to vote to use it every 12 hrs right?||
not the majority of the commands
You can create vote only commands if you like to, it's your application
It just doesn't make sense to send a request to topgg everytime someone calls the command
To check if someone has voted
That would require to use webhooks then (recommended) and store the voters in a database
oh i didnt notice i can post my bot repo url on topgg because its open source
just 3
ahh makes sense now i will use Airtable or Google Sheets
Well... whatever Airtable is and how ever Google Sheets makes sense... lol but why not

It's a table but in the air (cloud)
lol know i just have to figure out how to check if the user voted in the last 12hrs
Well by sending a simple request to topgg's API or listen to their webhooks on your end.
Whatever you prefer
Both will only work if you got an approved bot
Well the cache is gone if you restart the app
my bot is not able to kick a member even after it has role higher than the target and it has administration
and about bot restarts you can check if the user id exists in a vote Map (that auto deletes stuff after 12 hours) and if it doesn't then fetch from top.gg and cache again
Also if you store the user data for longer than a database is the way to go
*then
Vote only command doesn't mean voted in the last 12 hours, can also mean at least voted once
shhh ik it's a time term, im not on mobile, no auto correct while typing shit here
As well as the developer portal
help ?
I see your reply but where's the code that actually kicks the member?
1st: don't test with admin perm
Ah nvm, saw it now
2nd: mess, that whole code is an entangled mess, please use if (condition) { code } blocks
What does the console error look like?
Looks like you like nesting, aren't you? 
if(condition)
{
if(condition)
{
if(condition)
{
if(condition)
{
if(condition)
{
//shit
}
else return;
}
else return;
}
else return;
}
else return;
}
else return;
Are you checking the BOT's highest role position or the interaction MEMBER's? Oh I see
he just fucked up the code tags
oh it had "expand", didnt see it
Nesting is much easier to read imo
Than having 30 if cases right next to each other
It sometimes happens messages, guilds, channels etc. aren't available
well its not displaying message author is it
nevermind it is
oh wait
bruh
u didnt add second field in embed
.addField(`Author`, message.author.tag)
lol
That should throw an error since field values can't be empty
That's the price of using that shit embed builder instead of writing the object yourself
just build your own library smh
{
color: 0xffffff,
description: "whatever",
fields:
[
{ name: "Test", value: "hello" },
...
]
}```
I'm gonna tell you something MAGIC
log your var in the console
console.log(ghostPing)
And see the magic
M A G I C
Yes, oh. It's an object 
The API accepts that object as serialized string
That's what all libs are doing for oyu
Or you can do yourself
Yes especially if you interact with the API without using a library.
How to interact with the API and the complexity is well documented in the Discord docs
just to say
doesnt it have garbage collection (nodejs)
You can clear your caches every so often if you’re really worried about it, but I’m pretty sure you can set an option that makes items in the cache expire after a certain time period in djs
Maybe that’s just a detritus thing though, not entirely sure
its a djs thing since v13
all caches have a .sweep() method
you can safely clear messages, members, users, most channels, presences, etc...
and in djs v13 you can configure max sizes and expiration times
no
guild.members.cache.sweep()
because thats the only thing thats designed to be swept
everything else is techincally not supported but it exists
no idea
why do you need to push it there?
lel
The event's called GUILD_CREATE
Providing the whole guild object
The object contains the whole guild object, guild.id
djs?
Keep in mind djs is using that weird camel format
guildCreate
Well async is only required if you got some async code running
Does include a list of events
djs can receive
The parameter is the guild object
client.on("guildCreate", (guild) => { console.log("Guild joined", guild); }
Wheter you search the cache for the guild first, then check for the channel or use the guild object directly
Lemme provide an example+
Yes that will work for a specific guild, assuming guild is your already choosed guild object
let guild = client.guilds.cache.get("guild_id");
for example
Searching all cached channels globally will may return similar channel (names) for different guilds
So make sure to always specify the guild before searching the channel cache
Yes.
Indeed.
You can simply one-line that shit tho if needed
client.guilds.cache.get("guild_id").channels.cache.find((channel) => channel.name.toLowerCase() === "general")
Well no, you already got the guild object, provided by the event
^
also, you need to account for the fact that some people won't have a channel named general
client.on("guildCreate", (guild) =>
{
console.log("Guild joined", guild);
let channel = guild.channels.cache.find((channel) => channel.name.toLowerCase() === "general");
if(channel) channel.send("fuck you for adding my bot");
})
Because code examples are fun

you can make that even shorter




