#development
1 messages · Page 1857 of 1
how!?
This is the method...So I need to put that in my config.json...?
in the authorization header
uh wheree??
Does he wanna do an API call?
no idea

lol
assuming they know what they want to do if they are getting their token
I wanna setup a system, In which someone who votes my bot, receives a dm from the bot
you dont need a token for that
Well then you wanna work with webhooks you’re receiving from topgg, creating an instance of your bot, fetch the user ID you got from topgg using your bot, send a message to the user
then?
this
Can you get on some more details?
and when do we need a token?
ohh
Take at look at the examples in the docs, they’re accurate
You just need to import djs, create an instance of your bot (or use an existing one) and do what I mentioned above
Yeah so I already have an Instance...and I'll try...
Here, Uh we have a create a webhook in a channel right??
top.gg webhooks do not work with discord webhooks
Hey, for the slash commands: ```js
const Discord = require('discord.js');
const { deletionTimeout } = require('../config.json');
module.exports = {
name: 'Soon...',
description: 'aaaa',
type: "CHAT_INPUT",
options: [{
name: 'YouTube',
type: 'STRING',
description: 'no',
required: true,
}],
async run(client, interaction) {
console.log(interaction)
interaction.followUp(no...);
}
}
I don't see the slash command on my server, my handler:
index.js: ```js
client.slashCommands = new Discord.Collection();
fs.readdirSync('./Applications').forEach(file => {
const slashCommand = require(`./Applications/${file}`);
client.slashCommands.set(slashCommand.name, slashCommand);
});
client.on("ready", async () => {
await client.guilds.cache
.get("848100598908846110")
.commands.set(client.slashCommands);
// await client.application.commands.set(client.slashCommands);
});
my event interactionCreate: ```js
const Discord = require('discord.js');
const db = require('quick.db')
const { defaultPrefix, deletionTimeout, reactionError, suggestionPending, suggestionApprove, suggestionDecline } = require('../../config.json');
module.exports = async (client, interaction) => {
if (interaction.isContextMenu()) {
await interaction.deferReply({ ephemeral: true });
const command = client.slashCommands.get(interaction.commandName);
if (command) command.run(client, interaction);
}
you need to actually code a receiver(or use one of the libraries on the docs)
lol so what do I have to do?
Keep in mind webhooks will be send from topgg to your endpoint.
That means you have to setup your firewall properly if it doesn’t allow all incoming connections already
you need to actually code a receiver(or use one of the libraries on the docs)
bruh that's really confusing...
can u provide the link?
Not really as if someone wants to call you he needs your number
And if someone wants to visit you at home you need to open the door
hmm...
it may help to learn about http requests, and webhooks before trying to use them.
im already mad at my own code but sure

Well he can ping you and you Tim
And the circle of life closes

atTim
What part are you having issue with?
so just everything?
yeah to be honest...
where are you hosting? vps/home/repli/heroku?
do you have any firewalls?
what library are you using for your bot
Js
I dont think they allow webhooks as a free platform.
do they provide you with an ip?
op, yeah they allow it through subdomains on port 2000
https://docs.top.gg/libraries/javascript/#webhooks
webhook code for js ^
youll want to use port 2000 rather than 80
okay.....lemme see
how would one go about updating d.js?
i have somehting like v12 installed from whats got to be like 3 years ago now
i have 3 bots running on my server 2 are privet but one is public
they all work fine but i was trying to get a bot to play a sound through a discord chat but it never worked (this was a while ago so i cant remember the specifics)
but I wonder if it was the d.js version was out dated. anyway, how easy is it to update? do i just run the install command again and t will install again like on other things or do i have to do it manualy?
its been a while since i have messed around with javascript or d.js so sorry if i seem incompetent.
also im running centos7 on the server
To update the package just run npm i discord.js@latest, you will have to convert everything to work with the new features/changes
bruh i forgot about that
what is the latest stable version? and ho much pain do i have to do through to recode my things to work with it?
v13.1
I suppose not too much if you don't use slashcommands
If you intend on using slashcommands
which will be mandatory in the future
it will?
I suggest taking this opportunity to convert it
Yes they're planning on making message a privileged intent
thats just dumb slash commands are so clunky
I actually prefer them
fair enough but personaly i like just typing commands out
there are some things that look better as slash commands like when you have to have more than one variable on a command and it gives you hints but other than that they just feel bulky
thx
is that a stable/ longterm reliece? cuz I thought that was only the even numerd versions or is that wrong?
v13 is now stable
i have a feeling my system has been neglected a bit
ye they went from 14 to 16 rlly fast
lol
but then its not as bad as my dads voip server thats never been updated since it was first setup in 2004
to make matters worce the system is just a second hand pentium 3 unit we got for a fiver and it still has the original hdd in it that is running on hopes and dreams at this point
but eh thats irrelevent for this channel but thx for the info
Just use nvm or n to update your Node.js version to our latest releases
npm i -g n
n latest
will that break d.js v12 in the mean time?
cuz i bet im gonna have to do all this at one go and if thats the case ima take the opertunity to install another os (ubuntu server) cuz centos is eol aparently
v13 is still kinda buggi for me
Does someone know a good lesson for learn make bot dashboard
I need youtube video or something like this
you want to secure it with a jsonwebtoken based on the login info of the user through discord
Look tutorials about that up
Bc idk how can i code with compatible with api
is there a npm package for slash-commands for node v13
not sure but you can use the interactionCreate event
and then you can check if it's a slashcommand using payload.isCommand()
i am talking about package 
Well, I'm not sure you can look it up on npm
I have no clue if that's sarcastic or not
Is this the proper way to raise this exception?
#on_command_error event
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, CommandNotFound):
await ctx.send(error)
I don't code in py but I'd think that CommandNotFound needs to be a string
dont kill me if I'm wrong tho
Yes you were right thanks for your help
I update to the last mongoose version and:
error TS2349: This expression is not callable.
Each member of the union type '{ (filter: FilterQuery<GUILD>, update: UpdateQuery<GUILD>, options: QueryOptions & { rawResult: true; }, callback?: (err: NativeError, doc: any, res: any) => void): Query<...>; (filter: FilterQuery<...>, update: UpdateQuery<...>, option
s: QueryOptions & ... 1 more ... & ReturnsNewDoc, callback?: (err: NativeError, d...' has signatures, but none of those signatures are compatible with each other.
52 const data = await guild.findOneAndUpdate({id : ctx.guildId}, {lang : 'es'}, {
ok I solved it
- export default mongoose.models.GuildInfo || model<GUILD>('GuildInfo', Guild);
+ export default model<GUILD>('GuildInfo', Guild);
max options on this ?
25?
Yes
25 is the max
5 action rows per message -> 5 buttons or 1 select menu per row and 25 options in a select menu
Can someone answer it?
you need build tools installed
on ubuntu/deb you can run sudo apt install build-essential
Try sudo yum groupinstall 'Development Tools'
Nm don't
That installs all development tools
bruh
I c
welp whatever it is its installing
bruh ive been googling this error for hours howd you get an answer so fast
or are you on about the dev tools thing
if it was not found, then building tools like compilers are missing
indeed
usually compilers and makers have a lot of other dependencies and utilities, so just installing gcc usually isnt enough
so do i still install this then cuz its as its asking for confermation and its like 130 mb and thats gonna take a while
yes
cool
130mb should be fast on a vps
self hosted
rip
indeed
how fast is your internet?
like 2Mb/s
3 on a good day
MB or mbps?
megabits not megabytes
rip³
lol mpbs
Weo weo the grammar police has found an issue
sure brings me memories
well its a valid question, since the difference is 8x the speed lel
the good thing is as soon as i build a new voip server we can switch to fibre but i have to install analogue interface cards and the software for that lost suport ing like 2012 so there are errors left right and center
yeah but i understood what you ment
welcom to the club lol
I did somehow remember somebody who’s name I don’t call joked on me a few days ago 
welp 30 seconds left for the download
ay that was fast
lol crying about 30s…
You don’t know the times when ISDN started with 56kbit/s
but thats only when no one else is using the internet
we paid 1 BRL per login
everytime you got randomly disconnected, you'd have to pay again
a while back a squirrel chooed off the insulation my my telephone line and the speed went down to 0.1Mb/s
usually happened several times a day
lmao
and it was intermittent too so it was like that for like 6 months
i got my router eaten by ants once
Hehe still remember the time when accidentally opening the web browser on old mobile phones at a time internet flats didn’t exist
rip
Which did cause a bill as fat as a lexicon
but then the wire just snapped and they replaced the wire
oop downloads finnished everything is varifying
Playing snake on a Nokia, accidentally opening the browser and boom bankrupt
xD
and done
Looks like u remember these times too
and opus is installing properly now by the looks of it
i never had that issue
because my mobile was always prepaid
it could eat all my credits, but i never kept too many of them
bruh i just have pay as you go on my phone and i just dont buy data
same
is this important?
Yes
It’s a little better nowadays still fucking expensive here in my country
what is that cuz ive had warnings like that on other pakages but it rarly affects things
usually these warnings are about packages possibly interfering with each other because some dumb ass decided to mess with native prototypes
some are can be actual vulnerabilities but its rare
so this is some one elses problem and makes no odds cuz im just truing to make a privet discord bot for a meme?
these vulnerabilities are about very specific situations
ah
for example a regex package that has a vulnerability where if your program accepts regex input from users, they could abuse the regex engine on that particular package to do something
ah fair enough
welp the bot finaly works and plays my mp3 files
thx guys for the help
👍
nice
no
development
One message removed from a suspended account.
mods know
imagine coming here to talk smh
im developing
Please keep this channel development related
same
FUCK THEY FOUND OUT
what are you developing
hi so the discord css isnt working
kinda sus
anyways does anyone know an efficient way to link 2 servers together
i blame matthew
discord css
fucking hell sam
nice
how do you mean?

One message removed from a suspended account.

say I have 2 servers, with clients connected
like a text channel that connects the servers?
One message removed from a suspended account.
server 1 tries to send something to server 2’s client because of game stuff
how do I get server 2 to send to client
ur nick is sus
yes
which is good
One message removed from a suspended account.
hello
hi
ok
she wasnt talking to you matthew, go away 
so heres my code
I think I should just use a big server to do it
big master server
cant you use something like http to send whatever you need between the servers?
yea
server then registers all clients with coordination server
just make sure you have the networking secured so no one does some server trolling
neat
gotta get those security secured
Nice
ok I’m gonna go to sleep now
gn
On JDA is there a way of catching any exception that might occure anywhere?
There are default error consumers iirc
ask in their server
I asked in the JDA server but they were as unseful as Axe without the head
I don't think there's a method for it.
😦
Of course, you have the RestAction and try/catch. I'd suggest it's bad practice to just catch anything from everywhere.
const links3 = uavcodes.split('\n');
const link3 = links3[Math.floor(Math.random() * links3.length)];``` I have this code that randomly sends a link
how would i send multiple ones at the same time>
for example 3 links at the same time instead of 1
If you don't care about duplicates, just pick a random one again. If you do, you could write a loop that checks if the random selected value has already been picked before.
It removes it afterwards automatically
how would i create the loop?
for (let i = 0; i < links3.length; i++) {
text += links3[i]
}```
like this, just a normal for loop?
pretty much
No, because it has to repeat indefinitely until 3 valid values have been selected.
ty!
ah i need to replace links3.length with an argument
maybe something like:
const links = [/*some list of links*/];
let text = "";
// repeat 3 times or until no more links
for (let i = 0; i < 3 && i < links.length; i++) {
const randomIndex = Math.floor(Math.random() * links.length),
random = links[randomIndex];
text += random + "\n";
// remove used link
links.splice(randomIndex, 1);
}
So long
Yeah like that
it's not an array i am reading from
const uavcodes = fs.readFileSync('./uavcodes.txt', 'utf8');
for (let i = 0; i < args1[0][3]; i++) {
const links3 = uavcodes.split('\n');
const link3 = links3[Math.floor(Math.random() * links3.length)];
g.send(`Hey ${g}! Here is(are) your key(s): \n`+link3)
const index3 = links3.indexOf(`${link3}`);
if (index3 > -1) {
links3.splice(index3, 1);
let newLinks3 = links3.join('\n')
fs.writeFileSync('./uavcodes.txt', newLinks3);
}
``` ignore the strange names
it was a string, separated by new lines, right? That can be quickly turned into an array
anyways i am successfully sending the codes, however it is only removing 1 code from the text file
guys wuts the best License to keep my github project private
just make the repo private?
imagine if it generated code1 and code2, it would only remove code1 from the file
no License ?
ty
you don't need a license at all if it'll stay private
@quasi hearth u got a better idea to host a bot in github ?
I recommend services like heroku
thank you
some dude managed to do it
running the code in github actions
lmao
why is my program only deleting one of the codes while 2 are generated
am i not writing the file afterwards?
you are writing to the file yes
the variable is not the file
the variable is a copy of the file
uavcodes is a copy of the file and links3 is a copy of uavcodes
you change links3 and the file, but the uavcodes copy is untouched
This is in development?
how did you call it
fetchLeaderboard('547938713280446474').then(console.log)
why are you doing static?
was testing something
doesn't static make it so you can use it without initalizing the class
Yes
it does
Anyways
Any idea why that wouldn't work?
page = 0 limit = 1000 and somehow it is opposite when logged?
no
probably mixing stuff up somewhere
seems like page and limit switched somehow
oh
In ts file
dist output: http://img.extreme-is.me/t7gprOzqs99smfC7
wait
nvm
I fixed
lawl
ds.js@13 is giving me this error:
ReferenceError: AbortController is not defined
update your node.js
You need Node.js v16.6
How long does it take for the npm registry to cache a update so I can install it?
Been 2 minutes and I cannot install the new version of a package
Nvm its working
where can i see updates of the ds.js@13?
ds.js@13:
module.exports = async (client) => {
client.user.setPresence({
status: 'online',
activity: {
name: `testing || ${process.pid}`,
type: 'WATCHING'
}
})
}
not function
You may want to read this. https://discordjs.guide/additional-info/changes-in-v13.html#before-you-start
It details all changes between v12 and v13
okay
surprised they didn't split it up like everything else
client.user.presence.set()

be another useless thing
what is the tab?
what
plataform?
lol
now you can set the platform your bot is playing on
lol
? what tab?

yes what is the tab? discord.js.org/?
URL you mean
ah the url?

anyone know heroku ?
knowing as in knowing what it is, yes
i mean do u know how to use it ?
...help
Did you already take a look at the mentioned logs?
yep
I am not able to use dank memer, can anyone help me out with it?
Dbl wrongserver
@outer mist
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 Support Server, the server invite is invalid or you were banned from the bot's support server, then we can't help you. Sorry :(
Thanks bro 😊
@client.event
async def on_dbl_vote(data):
```Umm.. how do i make this log the votes in a specific channel in my main server
Add a space
Get the channel from the client instance and send the message you want (https://discordpy.readthedocs.io/en/stable/api.html?highlight=get_channel#discord.Client.get_channel).
how do i get the name of the voter?
well what is data
idk
k
and you're probably using a library for it
topggpy
So check the library to see what data is supposed to be
how do i check the library
i cant find the docs
You first search it on Google ("topggpy"). And you'll get this https://dblpy.readthedocs.io/en/latest/api.html
Then you'll browse the docs and hit https://dblpy.readthedocs.io/en/latest/api.html#topgg.on_dbl_vote by searching
Then you'll see it says that data is practically https://docs.top.gg/resources/webhooks/#bot-webhooks
and bam, now you know what it is
ok
So data["user"] will return the ID of the user who voted
So you could fetch that user with your client instance.
And send the message to the channel.
@client.event
async def on_dbl_vote(data):
votechannel = commands.get_channel(880294980076326933)
```Well, now am i right so far?
What's commands
discord.ext.commands?
Aren't you supposed to get the channel from client?
which client
oh u mean commands.bot
ok ok
Literally client
@client.event
async def on_dbl_vote(data):
votechannel = client.get_channel(880294980076326933)
voteEm = discord.Embed(title="New vote!", description="", color=discord.Colour.red())
voteEm.add_field(f"{data.user} has voted for the bot!")
await votechannel.send(embed=voteEm)
```Is this right now?
Try the test button
where is it
i cant find it
wont work
bot.topgg_webhook = topgg.WebhookManager(bot).dbl_webhook("/dblwebhook", "password")
bot.topgg_webhook.run(5000)
Someone help?
can anyone help me with the javascript topgg sdk as im currently getting an error for the topgg package being undefined, even though i have it installed via npm
Haii.
I'd like to ask.. when I type !eval bot.users.cache.size;, it keeps increasing and increasing.
Meaning it keeps caching more users.. but is it possible to show the top amount immediately.
Every guild has a memberCount property, add each guild's memberCount
how do I check if a str is a valid link
I mean I could put .startswith('https') or sum but what about the other type of urls
If you want to know if it's a valid page and returns a 200 status you'd have to fetch it
I can send you https://fhdkskfhszl.com and a regex will say it's a valid link
So only way to know is to fetch
good idea lemme do that
wait
I can also do one more thing
but well if its a valid link only then I'll process the code further or just return None
thanks for the idea tho
You could do a regex on it instead but that will only tell you if the link is formatted correctly, not if the site / page exists
@near grotto 1. you are running a copy of an open source bot. 2. There should be no space around =
ohhhh ok
still it's showing the error
actually
it cannot import the token from process.env
Yeah
Because you typed npm start instead of pressing run button
Console commands cannot use env
Try changing your .replit to run="start command" @near grotto
I want to prohibit using commands without voting how can I do it? (aoi.js)
Sup
Do I have to write to #support?
you have to write in the aoi.js server
When will be discord.py new version be released?
anyone know what kind of encryption is this?
const decrypt = (t) => {
let a = "eST4kCjadnvlAm5b1BOGyLJzrE90Q6oKgRfhV+M8NDYtcxW3IP/qp2i7XHuwZFUs";
if (t.replace(/[\t\n\f\r]/g, "").length % 4 == 0) t = t.replace(/==?$/, "");
for (var r, x = "", u = 0, e = 0, c = 0; c < t.length; c++) {
r = t[c];
r = a.indexOf(r);
u <<= 6;
u |= r;
e += 6;
if (24 === e) {
x += String.fromCharCode((16711680 & u) >> 16);
x += String.fromCharCode((65280 & u) >> 8);
x += String.fromCharCode(255 & u);
u = e = 0;
}
}
if (12 === e) {
u >>= 4;
x += String.fromCharCode(u);
} else if (18 === e) {
u >>= 2;
x += String.fromCharCode((65280 & u) >> 8);
x += String.fromCharCode(255 & u);
}
return x;
};
^^ this is the decrypt function, and i want to reverse it to encrypt
looks like a custom base64 with non-standard order
its missing remainder resolving, so it only works in blocks of 3 chars, but its easy to fix
EDIT: finished version ```js
function encrypt(text) {
let a = "eST4kCjadnvlAm5b1BOGyLJzrE90Q6oKgRfhV+M8NDYtcxW3IP/qp2i7XHuwZFUs";
let r = "";
let n = 0;
let b = 0;
for(let i = 0; i < text.length; i++) {
n += 8;
b <<= 8;
b += text.charCodeAt(i);
if(n === 24) {
r += a[b >> 18] + a[(b >> 12) & 63] + a[(b >> 6) & 63] + a[b & 63];
n = b = 0;
}
}
if(n === 16) {
r += a[b >> 10] + a[(b >> 4) & 63] + a[(b << 2) & 63];
} else if(n === 8) {
r += a[b >> 2] + a[(b << 4) & 63];
}
return r;
}
Hi.
let itemToUse = args[0];
if (!itemToUse) {
embedError.setDescription("❌ Please mention the item ID that you want to use.");
return await message.channel.send({ embeds: [embedError] });
};
const validItem = !!items.find((val) => val.id === itemToUse.toLowerCase());
if (!validItem) {
embedError.setDescription("❌ The item ID you entered is invalid.");
return await message.channel.send({ embeds: [embedError] });
};
args[0] is equal to attitudeCOIN and val.id is equal to attitudecoin, but why is it returning true in the second if statement.
you're a disgrace to humanity
the code looks correct, if it doesnt work then some variable is wrong, console.log them
thanks! it work
although there's a weird undefined at the end
nice its fixed now
thanks again tim
👍
how do i send an embed and immediatelly saving its id to a database?
with other words, how do i get the id lol
is there a way in djs v13 to get to the resource only having the player (in voice)
Does anyone know what to do about this issue? My bot is using slash commands as the default prefix. The issue is people keep kicking it since the prefix isn't /. What should I do?
Your bot page seems to make that pretty clear. What makes you think they're kicking it for that reason?
Settings for: {{guild['name']}}
I kept this in my html code H1 tag
bu the guild name doesnt appear
Hey.. sorry for the late reply. You see, validItem returns true.
OH.
I'm so sorry my bad.
how can i get the volume down only having the player in djs/voice v13?
hey, when I set commands to my server: js client.on("ready", async () => { await client.guilds.cache .get("848100598908846110") .commands.set(client.slashCommands); // await client.application.commands.set(client.slashCommands); });
my bot has an error missing access he is admin
That doesn't matter, did you invite the bot with the applications.commands scope?
let a = await message.channel.send(helpembxd)
console.log(a)```how do i find it;'s embed id.
My logs tell me that people kick the bot as soon as they invite it. Then some people who had it for like a few hours to a day kick it. I'm assuming it's the prefix due to the big change. It's been loosing a lot of servers recently.
Should I make it clear that / is not the bot's prefix on Top.GG?
Bots generally have a high churn rate. Personally I know mine probably leaves 1 for every 3 it joins. It's not uncommon.
Oh ok
Don't get caught up in the stats. Just build a good bot with unique features.
Ok, thanks
wdym embed id
embeds dont have ids
I think they mean the id of the bot's reply message
Discord Bots can't edit other peoples messages right?
Someone from another server say they can edit other users messages
they can't
I have a bot that can do it
how do i remove all reactions from an embed?
message id. Already got it tho
has anyone ever worked on a tipping crypto bot?
?
I think you can loop through a list of reactions and remove them one at a time
Pretty sure that's how I managed to do it
Hey, can someone help me with my code?
if(err) throw err;
if(data) {
message.channel.send(new MessageEmbed()
.setTitle(`${user.user.tag}'s Warns │ ` + bot.user.username)
.setDescription(
data.Punishments.map(
(w, i) =>
`\`${i + 1}\` | Moderator : ${message.guild.members.fetch(w.Moderator).user.id}\nReason : ${w.Reason}``
)
)
.setColor("RED")
.setFooter(`Angefragt von × ${message.author.tag}`, `${message.author.avatarURL()}`)
)
} else {
message.channel.send(new MessageEmbed()
.setDescription("Dieser User hat noch keine Verwarnungen!")
.setColor("GREEN")
);
}
});```
Im getting this error: ````\`${i + 1}\` | Moderator : ${message.guild.members.cache.get(w.moderator).user.id}\nReason : ${w.reason}`
^
TypeError: Cannot read property 'id' of undefined```
which language is this? I found it on discord dev portal static void UpdatePresence() { DiscordRichPresence discordPresence; memset(&discordPresence, 0, sizeof(discordPresence)); discordPresence.state = "Playing Solo"; discordPresence.details = "Competitive"; discordPresence.startTimestamp = 1507665886; discordPresence.endTimestamp = 1507665886; discordPresence.largeImageText = "Numbani"; discordPresence.smallImageText = "Rogue - Level 100"; discordPresence.partyId = "something"; discordPresence.partySize = 1; discordPresence.partyMax = 5; discordPresence.joinSecret = "something"; Discord_UpdatePresence(&discordPresence); }
Looks like Java
Anyone know how to have a bot detect when someone is live on twitch
Damn don't have presence intent
Guess I'll figure something else out since it took 6 months to get members and I'd rather not wait that long
You might be able to get something from the Twitch API? And have a setup command to associate a user's Discord ID to their Twitch account. That's the only way I can see it "detecting" them starting a stream, IF that's even possible with the Twitch API.
I think there’s a way to receive an event when a certain streamer goes live using the twitch api iirc
I'll look through the Twitch api though I'm thinking since I'm trying to have the bot change it's status when I'm streaming, I might be able to do some stuff with batch
Yeah. You might want to verify it's actually their Twitch account though.
I'm pretty sure there are bots that exist already where you can just follow streamers and get notifications.
If it’s just for you, you could just run a simple command every time you start streaming so the bot can change its status
I've got a few ideas
Yeah that's easier imo
If you don’t want to bother with a more complicated solution that is
I like doing stupidly complicated stuff so I'm down to figure something out
Probably going to see if I can use some batch to simultaneously start the stream and make the bot do something
if(err) throw err;
if(data) {
message.channel.send(new MessageEmbed()
.setTitle(`${user.user.tag}'s Warns │ ` + bot.user.username)
.setDescription(
data.Punishments.map(
(w, i) =>
`\`${i + 1}\` | Moderator : ${message.guild.members.fetch(w.Moderator).id}\nReason : ${w.Reason}`
)
)
.setColor("RED")
.setTimestamp()
.setFooter(`Angefragt von × ${message.author.tag}`, `${message.author.avatarURL()}`)
)
} else {
message.channel.send(new MessageEmbed()
.setDescription("Dieser User hat noch keine Verwarnungen!")
.setColor("GREEN")
);
}
});```
Can someone help me? - When I run the command **Moderator : ** is undefined. 
fetch() returns a promise
Hello. Does anyone know any libraries or any other ways to do unit tests on bots?
language?
js/ts
any normal test lib will work just fine
i recommend jest
you mean like testing api events and such?
never used it
idk if there is an updated discord api mockup
Use a network proxy and send yourself test requests ¯\_(ツ)_/¯
The problem is that I want to test the logic of the commands and most of them return void. I've tried using a library called Corde written for this purpose, but I haven't had a good experience.
yeah i think the only good solution is to make your own tests
attach a debugger and go stepping it
dnd
it’s not like that lol
Hi can anyone help me to add embeds, say and add reaction on bot created in discord bot clint
what's discord bot client ?
no one answered in the official D.JS discord, I'll send the question here:
how can I put a button's .setDisable to true after anything gets selected on a select menu?
I don't want to update every component, just one, and that's the OK button for confirmation/saving
you have to set it in the response
In slash commands.. is this possible with sub commands?
!use // command name
!use <item A> <amount>
!use <item b> <@user> <amount>
I have like 30 items.. like fck me.
Help me please
module.exports = ({
name:"game",
code:`
$djseval[const opponent = message.mentions.users.first();
const minigames = require('discord-minigames')
minigames.startBattle(member, message)
$onlyif[$mentioned[1]!=;{description:Mention someone to play against!}{color:FF0000}]
`})
how so?
excuse me what the fuck ?
Tf is this code.
I was thinking thae same
how do you respond to the interaction?
I'm sorry but I haven't understood anything.
I was Googling for "Thomas has never seen such a shit before" meme
I can only use .update
Do you know what the code is doing or are you blindly copying?
Yes I took some stuff in npm and did that but it didn't work too well and I came to ask for help
you have to set all components
that sucks
its the same as when editing an embed
Could you send me the NPM.. or is it the same npm in code?
you have to send a new embed to replace the old one
with embeds I can splice fields for example
you still have to clone the existing embed
yeah... ;-;
you can do the same with the buttons
It's not the same as in npm
you can clone them and edit them
@nova basin I saw your code then I saw the npm library you mentioned then I saw your code again
Then look nothing similar
Like nothing at all (nothing)
Is that even djs ?
It looks like something like bdfd tho
It's not bdfd ._.
It looks like more bdfd than djs
There is no package called bdfd.js I am wrong?
thats the aio.js bullshit or something
I use aoi.js
bdfd = bot designer for discord, which is based on dbd.js which is based on discord.js
dbd.js is outdated and abandoned, and aoi.js is the new version of dbd.js afaik
The code is discord.js so I don't see the problem ????
Hey @quartz kindle can you please put your replit (The node16 one) code to GitHub ?
The code isn't discord.js
sure

const opponent = message.mentions.users.first();
const minigames = require('discord-minigames')
minigames.startBattle(member, message)
It's discord.js ?
First of all
message comes from the onMessageCreate event. So message can only be found inside other functions. Are you really importing something (minigame) inside a function rather than doing it at the beginning of the code ?
Yes, that's djs
Also that code is too short to tell it's djs
Settings for: {{guild['name']}}
I kept this in my html code H1 tag
bu the guild name doesnt appear
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>settings for: {{guild['name']}}</h1>
<img src="https://cdn.discordapp.com/icons/{{guild['id']}}/{{guild['icon']}}.png">
</body>
</html>
HTMl
because you need to use ejs to use vbariables
How do I use that?
And that {{ }}
is reactjs
'E' is for 'effective'. EJS is a simple templating language that lets you generate HTML markup with plain JavaScript. No religiousness about how to organize things. No reinvention of iteration and control-flow. It's just plain JavaScript.
If I wanted to get started with web dev, should I start off with react?
React is rlly fun
Doesn't really matter what framework you pick, idk
I use react
it's fun but quite complicated
Learn html before react
Well ofcourse
And JavaScript
Learning react before js is like learning to fly a plane before being born
Pretty sure I've seen Waffle talk about js here before
are there any alternatives for bootstrap to style?
why does my site shows 'suspicious' on virustotal
because you're sus
sus
help 


I’ve got a good grasp of js/ts 😛
My HTML is trash though
I understand the basics I just struggle with divs
With react you basically create functions or classes that are called components who return html "objects"
Learn HTML first (The basics are enough)
If your JS is good I might have something for you
it's a trap
react is a trap
bloated
Oh no not another debate on frameworks!
Just use templating like pug
I hear “react is good”
🐶
Then I hear “react is bad”
Then again I suppose it’s based on opinions of varying experience
react is good
I’ll probably start off with react purely due to its popularity
just because it's popular doesn't mean it's good
I don't see what's wrong with React.
I feel like react is probably really good, I'm just too lazy to learn it
To me it is
Discord mobile uses it making it instantly bad
That's not my whole basis for disliking it
Discord mobile is bad?
I like that it's reactive like SwiftUI and Jetpack Compose is, making state easier to reason with
It leaves a bit to be desired
quite slow to update as well
you have to be in the betas just to get current features
That's just discord though


Fact: Discord mobile uses React-Native not actually React
I'm aware
It's like calling html bad because many sites use html poorly
PHP: Professionally-Hated Programming
php is fine
Hey, I've a big problem!
When I warn someone and want to list the warn's of the user XYZ it sends me every warn's from the server, just with an other username 
const bot = new Client();
const db = require('../../models/warns');
module.exports.config = {
name: "warns",
aliases: []
}
module.exports.run = async (bot, message, args) => {
if(!message.member.hasPermission(['ADMINISTRATOR', 'MANAGE_MESSAGES'])) return message.channel.send(':x: Du hast keine Rechte, um den Command zu benutzen!')
const user = message.mentions.members.first() || message.guild.members.cache.get(args[0])
if(!user) return message.channel.send('Der User konnte nicht gefunden werden!')
const reason = args.slice(1).join(" ")
db.findOne({ GuildID: message.guild.id, User: user.id }, async(err, data) => {
if(err) throw err;
if(data) {
message.channel.send(new MessageEmbed()
.setTitle(`${user.user.tag}'s warns`)
.setDescription(
data.Punishments.map(
(w, i) =>
`\`${i + 1}\` | **Moderator:** ${message.guild.members.cache.get(w.Moderator).user.tag}\n**Reason:** ${w.Reason}`
)
)
.setColor("RED")
.setTimestamp()
.setFooter(`Angefragt von × ${message.author.tag}`, `${message.author.avatarURL()}`)
)
} else {
message.channel.send('Der User hat keine Verwarnungen.')
}
})
}```
what name?
the username of the user, i mentioned
it shows the mentioned user instead of the moderator?
No.. I gave Wolfo an warn...
Then I requested his warn's everything is fine like you see...
But then if I request my warns Wolfi
It shows me the same warn's I gave Wolfo

@quartz kindle https://wolfis.waifus.shop/jlHaB94A
This is, what he give's me, when I want to look up my warns.
(And there are NO warns under my name!)
then you are saving them wrong
uhm- let me show you
This is my Schema:
let WarnSchema = new mongoose.Schema({
GuildID: String,
UserID: String,
Punishments: Array
})
module.exports = mongoose.model('warns', WarnSchema);```
And that's my code
(for the warn command)
why are you doing Punishments.unshift()?
(node:2547) UnhandledPromiseRejectionWarning: ReferenceError: content is not defined
what did i do wrong here?
im trying to make a bot that sends random topics
its not content that is undefined
define content
its message
depends how you are calling the function
@quartz kindle | Got it, gonna fix my DB saving tomorrow. But thanks for helping
👍
(node:2836) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'content' of undefined
i got this now
are you trying to get content of a slash command message?
yes
you can't
what do i do
slash commands don't have messages linked to them

ok so what shall i change?
they are not messages
use slash events instead of message events
Maybe not traditional messages, but they are still "messages"
what do you want to do
with it u can get the slash params
nope, no message at all
they are direct triggers basically
isnt there a message prop on the interaction
sorry im a newbie i dont really know what to change
im only 14 and learning
can u tell me what to do
nope
only author, guild, member and params
and other common stuff
var 😩
do i remove message ? im confused
Has anyone used Laravel for web dev?
I am starting to work on a discord bot after a long while, i am tryna implement a command handles is that gonna be the same thing even if i am using slash commands
It may depend on the shape of the data/library you use, but it's still the same process.
A command handler is just a way to parse a set of commands into a structure so you can conveniently use them.
discord.js
I don't know how Discord.js handles slash commands.
So you should consult the documentation.
okay thx
[
{"user":"363402633752477696","name":"coucou"},
{"user":"363402633752477696","name":"test"},
{"user":"363402633752477696","name":"blabla"},
{"user":"363402633752477696","name":"max"},
{"user":"363402633752477696","name":"maxx"}
]```
get by name ?
(on array)
Provide more context please
get {} on [] by name on {}

I couldn't be simpler
thx
well, it could if it wasn't an array but an object 
then you could just do <collection>["the name"]
var.find(v=>v.name==="NAME YOU SEARCH")
var is the list
===
I wonder if ppl still use ==
Sure why should the data type matter in this situation?
Hmm actually not the worst answer 
it's better to use isEqual() then
plus your linter is gonna shout the hell out of u for not using ===
on notepad
without ctrl z
++
at least we have ctrl c and v
without tabs and auto-indent
No no no… don’t go crazy boy
without text color
all characters are the same color as the editor background
essentially, invisible characters
can I assign a property to a function in js
I can, right?
something like ```js
function someFunction () {
return 'string'
}
someFunction.x = 'another string'
function is object so, i guess u can xD
@lucid trench i feel your pain, editing for djs update
i spent half a day doing same and not even sure if i covered them all
yep
i have to make 150 cmds
i had 300+ js files to do
lol
i used sometimes mass replacement when there was pattern
i recommend you using it to skip some portion
using regex
and replace within all files
I went through like 30 files or so
but I standardized everything to like send('content')
that's better for future
but don't expect doing this for all djs functions xD
is the userUpdate event triggered when a member leaves the server or has their account deleted? could user.username be null in that case?
client.on('userUpdate', async (oldUser, user) => {
it shouldnt trigger in those cases
show code
why are you importing something with the same name tho?
how did you import the class in the actual code?
ye
a default export only works with import not require
to use it with require you have to use export = class
ex
declare module 'mymodule' {
class MyClass {
constructor()
}
export = MyClass
}
yeah
thats what i do for my npm libs
idk if thats the proper way for internal files, its mostly for libs with their own package.json and etc
ye
yeah
same as the main but .d.ts
hmm
how are you testing it?
is it gonna be an npm lib?
put it on github, then npm install from your github
and test it as an installed lib
you dont need the full url
just npm install name/reaver.db
try closing and reopening vsc
xD
Hello
Hi, I have a discord bot and I was wondering if anyone knows how to do something like this
look in your language's standard library for getting information about the machine
ram/cpu bar is just a calculation and padding it with filled text vs. unfilled
don't know how to do that, can you explain it to me? And what library do I use?
What programming language are you using
JavaScript
You can use the padStart or padEnd functions. There's a pretty simple example here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart
For example, console.log("1".padStart(10, "?")) returns ?????????1. Node.js has some APIs for getting your machine information in the os module, but you can use a library if you want something easier.
Ok
The point of the pad function is so you can pad one end with some text to give it that bar effect.
and to look at the resources and usage and print it in an embed
yah
how i do it
Use the os module (https://nodejs.org/api/os.html). There are a few things I don't know, but you can find them on Google.
Ok
you want the system's total cpu and memory or the cpu and memory that the bot is using?
hey i am installing pm2 and trying to check whether it's installed, but it is not:
root@Kudos5128:~# pm2
Command 'pm2' not found, did you mean:
command 'gm2' from deb gm2 (4:10.0-1ubuntu2)
command 'pmi' from deb powermanagement-interface (0.3.21)
command 'wm2' from deb wm2 (4+svn20090216-4build1)
command 'pm' from deb powerman (2.3.5-1build2)
command 'pms' from deb pms (0.42-1build4)
command 'pom2' from deb libpod-pom-perl (2.01-3)
command 'pmc' from deb linuxptp (1.9.2-1)
command 'pmw' from deb pmw (1:4.30-1)
Try: apt install <deb name>
root@Kudos5128:~# apt install pm2
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package pm2
root@Kudos5128:~# npm install pm2
up to date, audited 180 packages in 1s
10 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
root@Kudos5128:~# pm2 start
Command 'pm2' not found, did you mean:
command 'pm' from deb powerman (2.3.5-1build2)
command 'pmw' from deb pmw (1:4.30-1)
command 'pmc' from deb linuxptp (1.9.2-1)
command 'pmi' from deb powermanagement-interface (0.3.21)
command 'pom2' from deb libpod-pom-perl (2.01-3)
command 'gm2' from deb gm2 (4:10.0-1ubuntu2)
command 'wm2' from deb wm2 (4+svn20090216-4build1)
command 'pms' from deb pms (0.42-1build4)
Try: apt install <deb name>
Did you do npm install pm2 -g to install it?
you have to install it with -g
_u saw nothing
_
I saw everything 
Hi , i need help for the kdbot (offline)
Is it your bot? Are you the bot developer? @earnest phoenix
No its not my bot
Dblwrongserver
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 Support Server, the server invite is invalid or you were banned from the bot's support server, then we can't help you. Sorry :(
K
for cpu there's OS module or u can use os-utils library
var os = require('os-utils');
os.cpuUsage(function(v){
console.log( 'CPU Usage (%): ' + v );
});
Okay, I'm getting started with react. Anyone recommend any editors other than VSC for React (for web development)?
I personally recommend intellij since it has direct integration with react
(only on ultimate version)
Also would it be a good idea to go ahead and use typescript instead of yucky javascript for react
or is that a no no
What's the maximum number of channels for a server?
idk, js feels more natural for react
probably 255 or so
I believe it's 250 afaik
That counts categories as channels I guess
ye
Alright ty
It really depends on you. Do you like static analysis, or prefer dynamic typing? Correctness vs. expressiveness? Coupled vs. decomplected?
It's actually 500 channels per server with 50 max per category apparently.
is anyone good at discord api
this dumb https://discord.com/api/v8/applications/<my_application_id>/commands api endpoint is eating trough my brain, it keeps spitting out 400 no matter what i do
Wasn't it 500
no its 400
Oh Mac figured that out already lawl
wasn't talking bout that my bad
just noticed kekw
are you doing a GET request
a GET request is fine too
well
ye
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
here it says it should be a post request
Showing code is likely more helpful
not sure what to show when it's identical to what's shown in discord.com
however
i got it to work trough postman now
which is... disappointing
import requests
url = "https://discord.com/api/v8/applications/<application id>/commands"
# This is an example CHAT_INPUT or Slash Command, with a type of 1
json = {
"name": "ds url",
"type": 1,
"description": "Reverse search from image URL",
"options": [
{
"name": "URL",
"description": "The image URL",
"type": 3,
"required": True
}
]
}
# For authorization, you can use either your bot token
headers = {
"Authorization": "Bot <token>"
}
r = requests.post(url, headers=headers, json=json)
print(r)
well
i just realised the command
you have to actually put your application ID where it says application id
the command name isn't have a space
^
it's \w- with up to 32 characters
how does discord distinguish slash commands
type 1
wat?
what do you mean lol
you can have underscores
lets say 2 bots has /help
it shows two of them
Slash commands are split up in the menu under their respective bots
ugh



