#development
1 messages Β· Page 988 of 1
I'm not salty just saying what I'm thinking π€·ββοΈ
which makes u salty af.
So if I'm honest I'm salty?
ur not honest in there.
Alright then π€·ββοΈ
LMAO
@tulip ledge i agree with you on this one
Please just go learn basic js first
thats kinda important
i have problem i have Const guild = new Discord.Guild(client, data); but it says ReferenceError: data is not defined
@earnest phoenix Learn javascript ty.
i will send it now
oh god
Read
oh jeezus
The
learn javascript.
Error
DATA IS NOT DEFINED
oh lord all mighty
you must define data
they probably copy pasted the docs
at Object.execute (C:\Users\PC\Desktop\DsBot\commands\wlcc.js:7:45)
at Client.<anonymous> (C:\Users\PC\Desktop\DsBot\index.js:50:33)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
at WebSocketShard.onPacket (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
at WebSocketShard.onMessage (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
at WebSocket.onMessage (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\websocket.js:800:20)
at Receiver.emit (events.js:315:20)
at Receiver.dataMessage (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\receiver.js:436:14)
at Receiver.getData (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\receiver.js:366:17)
at Receiver.startLoop (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\receiver.js:142:22)
at Receiver._write (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\receiver.js:77:10)```
const data = "your data"
ok
@solemn latch big brain
it's not hard
Ah he edited it
im on mobile
please, learn basic JS before coming here.
im trying to make a swear filter for my server so how do i make it search the message for spefific words or strings
im using discord.js
its slow
Ah yeah no worries

@clever garnet use .includes or regex
ok
I wonder I've never really used python before but does regex work in python? π€
yes
Oh cool
regex works in many languages
please, learn basic JS before coming here.
...
Nah
How do you return a message and add a reaction in if(!)
@earnest phoenix just do
const guild = require('discord.js')
run: async( client, data) {
}
this chat rn
Ive tried message.channel.send('') + message.react('')
im trying to make a swear filter for my server so how do i make it search the message for spefific words or strings
im using discord.js
@clever garnetjs const badWords =[ "word", "anotherword" ] if(message.includes(badWords)){ message.delete }
you get it
but i get a error
ok
atleast i think thats it
actually no Jeremy lol
idk
Ive tried message.channel.send('') + message.react('')
@still merlin .then(() => message.react)
i'm just thinking
you can use .some
words.some(word => content.includes(word))
cases aren't taken in account
Oh and doesnt message.delete have to be a function? π€
You'd do message.delete()
wait so,
if(!my thing) return message.channel.send(my second thing) .then(() => message.react('my reaction')
or msg.delete()
@still merlin yeah
ok tysm
or msg.delete()
Ah, a man of culture
or msg.delete()
@earnest phoenix Only if the message you're deleting is defined as msg
@still merlin add a closing parentheses
bOt.oFf('mOoSaGe', aSyNc mSg => {})
I'm looking for bot verifier developer, for businesses. Write to private.
if bot.on takes no parameters, why would bot.off take parameters lol
@placid hamlet please explain
if bot.on takes no parameters, why would bot.off take parameters lol
@digital ibex is joke
he is looking for bot verifier developer for business. if you are a bot verifier developer, write to private
I'm bored, someone need help
can you do the dishes for me plox @pure lion
No

wihs
Please help i get this error ``` const data = data
^
ReferenceError: Cannot access 'data' before initialization
at Object.execute (C:\Users\PC\Desktop\DsBot\commands\wlcc.js:7:18)
at Client.<anonymous> (C:\Users\PC\Desktop\DsBot\index.js:50:33)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:386:31)
at WebSocketShard.onPacket (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:436:22)
at WebSocketShard.onMessage (C:\Users\PC\Desktop\DsBot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:293:10)
at WebSocket.onMessage (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\websocket.js:800:20)
at Receiver.emit (events.js:315:20)
at Receiver.dataMessage (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\receiver.js:436:14)
at Receiver.getData (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\receiver.js:366:17)
at Receiver.startLoop (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\receiver.js:142:22)
at Receiver._write (C:\Users\PC\Desktop\DsBot\node_modules\ws\lib\receiver.js:77:10)```
Send the line
they said to put this const data = data
Change the name of the const
ok
Right now, you're getting the value of data, the const you've just written
bc i need it here const guild = new Discord.Guild(client, data);
ok
poor guy
@earnest phoenix
const discordData or something idk
k
you're not supposed to do that
lol
:/
wjay
@pure lion it's useless
W j a y
oh boy
xd now i get data is not defined
OMG LEARN JAVASCRIPT
Use a yt tutorial
he just doesn't know js, no need to be retarded about it
There is no need to get heated over it, everyone was a beginner once
:/
Okay true
@earnest phoenix don't listen to them, just keep trying and you will succeed
Google is your friend
You can lookup your issues
^^^^
And find forums with the same issues as you like stack overflow
Yes, definitely stack
he just doesn't know js, no need to be retarded about it
@digital ibex if so
why doesn't he learn first?
he doesn't know anything and asks for help
makes alot of sense.
it makes sense to ask for help doesnt it?
literally the error tells him what's wrong and he still ask what is wrong.
This isn't a conversation
it makes sense to ask for help doesnt it?
@tepid canyon with 0 javascript knowledge?
Go to DM please this is for development of code, not character
Listen if you are gonna be a dick about it then go somewhere else or we'll get mods involved
how is he going to know to he needs to know js first? you're probably the first person to tell him
my mans everyone starts somewhere
@golden condor Ty u are nice guy
at one point you too didn't know the first steps of it
i literally told him 20 minutes ago
how he can fix it
and he still continued it
i tryed
it didnt work ok
Just change the name of the const
didnt work still
Wait I have a better idea
it seems like he doesn't have a variable called data either
Watch this JavaScript tutorial for beginners to learn JavaScript basics in one hour.
π₯Get my Complete JavaScript Course with a BIG discount (LIMITED TIME): http://bit.ly/2KZea52
πSubscribe for more tutorials like this: https://goo.gl/6PYaGF
βοΈWant to learn more from me? Che...
now i get data is not defined
i learned basics
you guys need to chill seriously
im chill xd
@earnest phoenix can u send whole code and then let's see?
how do i change the css of the bot website to make all span text be white
doesn't work on the bot name
show code
span{
color: white;
}```
ahh
anyone has an example for a boost message?
I tried something like:
const channel = member.guild.channels.cache.find(channel => channel.name === "Ξ΅β€Π·γ»staff-commands");
if (message.member.roles.find(role => role.name === 'test role')) {
channel.send(thanks for boosting! this is a test message!);
}
But not working lol
how about
client.on("ServerBoost", (ServerBoost)?
im not sure if it works but it might
maybe check the docs
no boost event :(
ah
can you not listen out for the boost message in a certain channel?
I'm making a suggestion command in discord.js and I'm not sure how to make it react to the suggestion embed, anyone know how?
I'll look smth up
i mean, you know the system message that is sent?
where is says something like 'user boosted this server'
you can listen out for that, and when that is sent, you check if the number of boosts in the server has increased
nope, it shouldnt
as long as the bot can read messages there...
and you can get the current number of boosts with guild.premiumSubscriptionCount
I don't think you understood me, all I'm trying to do is make my bot send a thank you message, for whoever gets that test role (booster basically) π
so you want your bot to send a 'thank you' message to the person who boosted?
yeah!!
yeah so you're gonna have to check for the system message being sent
then you can see which user is mentioned in it
Can some help i dont know what it wants me to put ..
and that user should be the one who has boosted
i think your missing a ","
^
i tried that and more errors
oof
ah damn
@earnest phoenix
https://github.com/discordjs/discord.js/issues/3359
theres a message type for boost messages
Oooo
it is possible im pretty sure
as long as you have the system messages being sent to a channel the bot can see
im 99% sure @gilded plank does it automatically too
yeah heres all the message types
^
I tried guildMemberUpdate it didn't seem to work for some reason
check the link that Woo sent
okkie
you basically gotta listen out for the system message
message.type gives ya the type
and the user who boosted is mentioned in the message
Aaaaaaaaaaaaaaaaa
um
USER_PREMIUM_GUILD_SUBSCRIPTION

:o
hmm okok I can try
yeah, pretty sure those are boosts
my cat has demanded a cuddle, ill be back 
erm can someone help-
Delete the break
send the code
And then send the code
lets see what ur trying to do
no need for a break
client.on("message", (message) => {
let args = message.content.substring(prefix.length).split(" ");
switch (args[0]) {
case "spidersuggest":
if (message.author.bot) return;
let suggestion = args.slice(1).join(" ");
if (!suggestion)
return message.channel
.send("**error** You need a reason for the suggestion!")
.then(() => message.react("β"));
const webhookEmbed = new Discord.MessageEmbed()
.setTitle(`Spider Suggestion -`)
.setColor("#c75dc9")
.addField("Suggestion:", suggestion)
.setFooter(`Suggested By ${message.author} (${message.author.id})`);
webhookClient.send("New SpiderSuggestion", {
username: `spidersuggest`,
avatarURL:
"https://cdn.discordapp.com/icons/702134225528291368/66d4c03d4c8d064fc884ba70d32134f6.webp",
embeds: [webhookEmbed],
});
message.channel.send(
`Successfully submitted, thank you for submitting a suggestion! ${message.author} (Join the support server to see the results of the suggestion)`.then(
(webhookEmbed) => {
webhookEmbed.react("π");
message.react("β
");
break;
}
)
);
}
});```
I think break should come after });
That's a lot of brackets
put the break before the 2nd last }
it is currently within the .then for the message sent
ok thanks
@earnest phoenix oh just read that you can actually do it with the guildMemberUpdate
lol sorry
oh lol
const BaseEvent = require('../../../utils/structures/BaseEvent');
module.exports = class GUILD_MEMBER_UPDATE extends BaseEvent {
constructor () {
super('GUILD_MEMBER_UPDATE');
}
async run(bot, oldMember, newMember);
const channel = bot.channels.cache.get('589748677929861160');
if (oldMember.roles.cache.size !== newMember.roles.cache.size) {
if (!oldMember.roles.cache.has('725022503004799017') && newMember.roles.cache.has('725022503004799017')) {
channel.send(thanks for boosting! ${newMember} this is a test message!);
}
}
[Got this off a YT vid, so confusing]
wdym
To a channel in another discord server?
aaaaaaaaaaaaaaaaa
yeah that isn't too hard tbh
you need to fetch the channel
^
sad wanting to help noises
Maybe you could log all the channel IDS in the guild into a JSON
Like a suggestion command for your bot?
Wait
instead of doing message.guild.channels
So it sends to your server?
do someotherguild.channels
you can use client.guilds.cache.find() or client.guilds.cache.get() to find the server you want
@earnest phoenix is it your server the suggestion will send to?
Like
No, the new command
he wants to know if the target server is also owned by you
do as i said, use client.guilds.cache.get(your server id here)
Get the ID of the guild, then the channel
then you can access that guild's channels
yes
Not message.guild
as you can see
message refers to "this message"
message.guild refers to "the guild this message belongs to"
so instead of "the guild this message belongs to" you need to write something that means "this specific guild that i specify with an id"
which is what client.guilds.cache.get() does
it allows you to get a specific guild with an id you specify
yes
and then continue getting its channels and finding the channel
like you were doing before
let gld = client.guilds.cache.get(ID here)
let chn = gld.channels.get(the channel ID)
chn.send(msg)
you can also break it down like that if you prefer
but you can make it a one liner like you had
Either works, but you can use the smart version or the dice version
you just copied and pasted two different things
im trying to explain it to you so you can understand it and write it yourself
thats why im trying to explain it
Sorry for wasting your time.
When? You need help, we're here to give it :)
everything that has a dot, is a chain, like get this from this from this
for example message.guild.channels means get channels from guild from message
but you want channels from a different guild
I know.
Never 'I know' a teacher
Which is the star channel emote
client.guilds.cache.get() means get a guild from the guild cache from the guild manager from client
Putting a dot at the end of your sentence is not gonna do anything different you know
both of them give you exactly the same result, which is a guild
which means, you can use the same continuation of the code on it
for example both message.guild AND client.guilds.cache.get(some id here)
both of them can be followed by .channels.get() or .channels.find() like you had before
meaning, all you need to do, is replace the part that gives you the guild
the rest of the line stays the same
yes you can do that
Looks good
now you have to replace channel with chn everywhere else in that code
because the variable channel no longer exists
You can just do chn.send
Instead of message.channel, because it would send in the wrong location
also, it needs to be guild.channels.cache.get()
Dumb question, wants the difference between fetch and get?
get = gets it from the cache, or undefined if not found in the cache
fetch = gets it from the cache, if not found it the cache tries to get it directly from discord, if not found in discord, returns an error
Oh okay
and since it makes an http request to discord, fetch returns a promise
so it needs await or .then()
It was a good question @pure lion
What is the up
lmao
You're welcome
It was a good question @pure lion
@solemn latch :o
Sorry for being dumb.
There is no dumb in coding, unless you're me
np, hope it helps with future similar things
*sitting around for someone who needs help because I have no life outside this hobby*
Ok DM if you need help I'm gonna go watch paint dry
are there known issues with discord.js's setPresence function? For some reason it occasionally doesnt update my status and just sets it to be empty. atm i update the status to show how many guilds the bot is in and it updates each time that value changes. but as i said, sometimes the status just vanishes completely lol
no errors or anything get thrown either
const count = client.guilds.cache.size;
client.user.setPresence({
status:'online',
activity: {
type: 'WATCHING',
name: `!!help || ${count} guilds`,
}
});
afaik the rate limit for that is not large enough to allow of changing on every single guild change
sigh, i had a feeling it was gonna be some kinda rate limited crap
but couldnt find any info in the docs about the limit for it
Is there a fUnction to lower the temp in my room rn it's 31Β°C and I'm dying
if(temp.C >= 31) {
temp.dont()
}
const fan = new Fan({rpm: 1000});
while(hotaf){ fan.blow() };```
overvolt the fan 
That could also be used for fans of famous people
Lol
bot.on('oh god I can't feel my face', async pain => {
let room = pain.house.rooms.cache.find(r => r.current)
if (room.temp > 30) {
console.log(room.temp)
room.temp.set(fuck anything below 30 fuckkkk aaaaaa).then(() => console.log('thank fuck'))
})
615775892177944627
Hot
You ever just want it dumbed down to ground floor?
Are all user id 11 digits?
Uhhhh
no
Just do id.length (assuming js)
For example, mine is 18.
Max How many digits are there? When I select the bot according to it in the database.I will allocate space accordingly in the database.
Technically none
they add a digit every time they need to...
it'll keep increasing
hmm thx
wHy uSe DaTaBasE wHeN yOu CaN uSe JsOn? π₯΄
cringe and yes there is no max
I use Heroku and the data must be permanent.
any advice on how to get the python discord to work in sublime text 3?
qqq I don't use Heroku, but what do you mean by that. Are you not able to set a table and type by string
@still geyser wym?
u do it the same u would with any text editor, if thats what ur saying
yes was just checking it worked the same thank you
How do you get the bot to only respond to its own mention, and not everyone and here pings? My bot has the respond to mentions code, and it doesn't respond to pings like @wheat valve but instead it responds to both pings of itself, and everyone and here pings. I use discord.js
@wheat valve check if the message author is your bot user id
in DiscordJS its this
if(message.author.id === "your_botID" && message.content.includes("@everyone")){
//do something here
}
something like that should do fine
@quartz hill
function seemsFlakey(potential_flake) {
return /^[0-9]{14,19}$/.test(potential_flake);
}```
there is a javascript function to tell you if a string looks like a snowflake id
its not flawless ofc, as any string matching those conditions would return true. But it should cover all valid snowflake id's also
hi
anyone know what this error is
24.06 00:58:49 [Bot] (node:30) UnhandledPromiseRejectionWarning: Error: 502 Bad Gateway
24.06 00:58:49 [Bot] at IncomingMessage.<anonymous> (/node_modules/dblapi.js/src/index.js:118:25)
24.06 00:58:49 [Bot] at IncomingMessage.emit (events.js:322:22)
24.06 00:58:49 [Bot] at endReadableNT (_stream_readable.js:1187:12)
24.06 00:58:49 [Bot] at processTicksAndRejections (internal/process/task_queues.js:84:21)
24.06 00:58:49 [Bot] (node:30) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
24.06 00:58:49 [Bot] (node:30) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
https://oliy.is-just-a.dev/ozuonq_4788.png and many people came to that realization a long time ago
ive never run into one in the wild
why is mine not there
yes
i might have to play with it
lmao
someone created a team name on my bot which was the n word. as the list of top 50 team names (by size and also score) is public, ive decided i need to add a swear filter to this and have used an external api. Would you say this is too extreme or a good call, as people can play trivia games in non-nsfw channels? has anyone else here implemented a swear filter in any part of their bot and how did you do it?
hmm i havent thought about that
its always been technically against the TOS i wrote for it
my bot has 20k+ user generated entries with no naming restrictions, let me check if there are that kind of names there lmao
on 3 terms, bringing the bot into disripute, attempting to harm or upset users
and another, i forget
but i looked them up in case this user came to me complaining i'd censored his team name π
there will be, i keep finding that kind of stuff in sporks too but generally im more lenient and hands off with sporks, ive always asserted hes self policed like wikipedia as anyone can correct facts on there, but with the trivia bot im the only one who can rename an offensive team name
i'll just settle for complaints
if anyone complains, ill contact the owner and request a change, or change it myself
one thing you could do is require top teams to abide to naming conventions/rules
kinda like sports teams do
yeah, except i dont vet the names before theyre created
they can be named whatever shit they want in the minor/amateur leagues, but once a team goes pro and is listed in rankings, they need to rename into a proper name
I'm making a kind of card that shows an inventory of things.
But the image is not sent, in theory there are no errors in the "drawing"
let imagen = new Discord.Attachment(canvas.toBuffer(),"inventario.png")
channel.send({files: imagen})```
theyre created on the fly with "!trivia create arbitrary name here"
then others join it by that name
the api ive used can return a censored string, so in the case above it would rename their team to ######
wouldnt that difficult people from joining it?
well, it would show thats the new name
i guess thats one way
it'll say "you successfully created and joined the new team ######, {}"
that way if they had say 'ass' in it (the filter is quite strict) their team might be "big ### player group"
for example
π
come to mention it, got no way to rename a team atm, i should add that!
yes
oh, thanks!
With the version change from v11 to v12, are there any changes to the npm canvas?

if you dont define intents in client at all, does that just mean all intents(non Privileged)
yeah
supposedly they will become mandatory in october
so i have something working
but i want my discord bot link to redirect to my website
that did not awnser my question
that was for a conversation before
@misty sigil you mean the user gets redirected to your website after adding the bot?
yes
you'd need oauth2
but how exactly
not sure tbh. you can add a redirect_uri parameter to the invite link, but afaik it only works if the user went through the oauth2 flow
so something like user logs in > gets redirected to bot invite > gets redirected to website
but i havent done that before so idk
wasn't it uri
was it? mb lul
const newPrefix = prefix || bot.user.mention
let args = message.content
.slice(newPrefix.length)
.trim()
.split(/ +/g);
let msg = message.content.toLowerCase();
let cmd = args.shift().toLowerCase();
How do you make the bot respond to its mention when someone pings it, I tried doing that, but it didn't work. Please ping me if you have a solution.
if(message.content.match(new RegExp(`^<@!?${client.user.id}>( |)$`))) you can edit that to fit ur needs @cunning gorge
i belive so let me check my code
ok thx
It is not
ah so hm why would it be a new instance
Ah ok
heres the complete code with it if it helps ```if(message.content.match(new RegExp(^<@!?${client.user.id}>( |)$)))
return message.channel.send(My Prefix Is : eb!);
});
Thanks!
np
what lib
this is code ?
client.ws.ping
or this the ping of the client's server
ah, that's the ping of the websocket
websocket is Discord API ?
well, it's your connection to discord's servers basicall
There's no perfect way really, the most common approach is to send a message, wait for it to be sent then edit in the time it took to send
but it isnt perfect
imho the only number you really need to rely on is the discord api latency
kk
thx
the remove isnt working
TypeError: Cannot read property 'remove' of undefined
mutee.role.remove(muterole.id).then(() => {
message.delete()
mutee.send(`Hello, you have been unmuted in ${message.guild.name} for: ${reason}`).catch(err => console.log(err))
message.channel.send(`${mutee.user.username} was unmuted!`)
})
see
oh nwait i got it
lol
How would I set a canvas image as the discord embed image? js
3000/10
:o
How can i adjust my bot online time
Elaborate?
Where can i find it
Maybe yes
Is anyone else
let afk = new db.table("AFKs"),
authorStatus = await afk.fetch(message.author.id),
mentioned = message.mentions.members.first();
if (mentioned) {
let status = await afk.fetch(mentioned.id);
if (status) {
const embed = new Discord.MessageEmbed()
.setColor(0xffffff)
.setDescription(This user (${mentioned.user.tag}) is AFK: **${status}**)
message.channel.send(embed).then(i => i.delete({timeout: 5000}));
}
}
if (authorStatus) {
const embed = new Discord.MessageEmbed()
.setColor(0xffffff)
.setDescription(**${message.author.tag}** is no longer AFK.)
message.channel.send(embed).then(i => i.delete({timeout: 5000}));
afk.delete(message.author.id)
}
// NOTE:
// The following code is a command:
const Discord = require('discord.js'), db = require('quick.db');
const status = new db.table("AFKs");
let afk = await status.fetch(message.author.id);
const embed = new Discord.MessageEmbed().setColor(0xffffff)
if (!afk) {
embed.setDescription(**${message.author.tag}** now AFK.)
embed.setFooter(Reason: ${args.join(" ") ? args.join(" ") : "AFK"})
status.set(message.author.id, args.join(" ") || AFK);
} else {
embed.setDescription("You are no longer AFK.");
status.delete(message.author.id);
}
message.channel.send(embed)```
is this the right code ?
Uh
Manual Afk?:v
Where can i find it
@dusk sphinx if you are using djs it isclient.uptime
returns a time in ms iirc
because sometimes the message comes later than the Date.now()
so it would result in a negative number
that's why you send a message yourself and use .then or you could await it I guess
what i would reccomend you doing is something like this
message.channel.send("Pinging... sec").then(msg => {
let ping = msg.createdTimestamp - message.createdTimestamp
});
but it's not perfect for ping
true but its still viable and semi-accurate
Do i need download the discord.js?
I-
Did you do npm i discord.js
--save
@fresh hatch get the absolute value of the ping
lemme try
@wanton nova i get 0ms π and api gets 200ms
client.on('message', message => {
let ping = message.createdTimestamp - message.createdTimestamp
let pingembed = new Discord.MessageEmbed()
.setColor("#0000FF")
.setTitle("Ping :ping_pong:")
.addField("Latency: " + ping + "ms")
.addField("API Latency: ", `${client.ws.ping}ms`)
if (message.content.startsWith(`${prefix}ping`)) {
message.channel.send(pingembed);
}
})
because you are subtracting the same number
of course its gonna be 0 lol
what i would reccomend you doing is something like this
message.channel.send("Pinging... sec").then(msg => { let ping = msg.createdTimestamp - message.createdTimestamp });
msg is not defined
put message.channel.send("Pinging... sec").then(msg => { at the top
below client.on
client.on('message', message => {
message.channel.send("Pinging... sec").then(msg => {
let ping = msg.createdTimestamp - message.createdTimestamp
let pingembed = new Discord.MessageEmbed()
.setColor("#0000FF")
.setTitle("Ping :ping_pong:")
.addField("Latency: " + ping + "ms")
.addField("API Latency: ", `${client.ws.ping}ms`)
if (message.content.startsWith(`${prefix}ping`)) {
message.channel.send(pingembed);
}
});
})
like that
like in what sense?
@wanton nova
how they work?
Yeah
@fresh hatch you arent ignoring the bot, put if (message.author.bot) return at the top, below client.on
@pure lion sorry still not understanding, like how they work on the inside or how to use them?
cause i dont wanna explain stuff you probably already know
every letter i type the bot responds @wanton nova
I literally know nothing about arrow functions
@fresh hatch
client.on('message', message => {
if (message.content === "k!ping") {
// ping code
}
});
@wanton nova wouldn't it be better to await a message and then get the ping from that?
@pure lion read up on this
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
An arrow function expression is a syntactically compactΒ alternative to aΒ regularΒ function expression, although withoutΒ its own bindings to theΒ this, arguments, super, or new.targetΒ keywords. ArrowΒ function expressions are ill suited asΒ methods,Β and they cannotΒ be used as const...
Okay thanks :)
true but i dont wanna explain async await
thx @wanton nova
np
it is
it is, but i dont wanna explain it 
let msg = await message.channel.send("hi");
msg.edit("hello");```
actually no i my option
wha
lmao
epic
i need to finish my connect4 game 
:o
:oh:
hey guys i develop bot in python. i'm trying to make bot dashboard in flask but for guild date when i run bot in separate thread in flask i'm running into so many backend issues.
i'm new to flask. i will be happy to hear any help or suggestions or any other way to make dashboard in python
How can I make the bot ignore NSFW words with !urban command when done not in NSFW channel?
@wet osprey use Quart
Well, I want to ignore NSFW words, completely
that's not possible, urban dictionary should absolutely locked to NSFW channels
it's mandatory
I'll lock to urban to NSFW
if (!message.channel.nsfw) {if (msg.content.includes(word list array) {return}
}
Oh oka-
python
yeah, don't, i got a warning for that
Didn't specify
almost got my bot deleted
Shit dude-
yes
Btw if I wanted to make a dashboard, (if I should even think about it at all) how would i prepare my bot to interact as easily as possible (discord.js but you probably know that by now by the amount of time i spend here)
Or just do I use a filter?
you can't use a filter, even if it works
Yeah
yeah, unfortunately
Locked
:sad:
Can I lock the urban only for this server?
In all dimensions
my friends are against
Don't do it
yeah, i know the pain
A mod will personally go to your house and delete the bot
A Mod will hire a hitman*
i even sent a whole essay to a mod regarding this; no means no
Just to let you know
Flazepe: sends a mod an essay
Mod: no
true dat
π ±οΈeon
Bean
:bean:
Why is there no bean
Also
If I wanted to make a dashboard, (if I should even think about it at all) how would i prepare my bot to interact as easily as possible (discord.js but you probably know that by now by the amount of time i spend here)
(please dumb it down to as low a level as possible)
(:))
set up an express server, use template generator to make your site consistent (let's say ejs), set up an oauth application to get user information and connect the dashboard to the same database as your bot so that users can modify settings and then your bot can detect the changes seamlessly
What if you use json files for db, is there an easy way for me to switch to quick.db or anything?
it's the same procedure, no matter what "database" you're using
when a person modifies something, use the same method as how you would change something on the database on your bot
except that it's on the browser tm
i mean yes but it's really slow
Foc
and you know, it's json
it can get corrupted easily
when it rewrites, it gets the whole file first
it's just slow and unreliable
get a proper database first like mongo or postgres
probably
Thx :3
i need help, i am trying to make a configurable modlogs channel but i get this error
setlogschannel code: https://pastebin.com/HvGEn4VB
if i do that it says channel.send is not a function
then channel is null or undefined
i reset the channel and now i get TypeError: Cannot read property 'get' of undefined
as i said its undefined then
do let chan = <msg>.guild.channels.cache.get(channel.id) did he input the channel
and use chan in the rest of the command
what even is channel
ok nvm i fixed it
i just need to add .id behind channel in the file where i set the channel
I haven't do the npm yet
I can't install canvacord :v
why estadouser[user.presence.status] responds with undefined ??
let estadouser = {
"online":"Online",
"idle":"Ausente",
"dnd":"No Molestar",
"invisible":"Invisible/Desconectado",
}
(user = message.author)
how can i add my bot to top.gg
@narrow torrent
Log in to https://top.gg > add bot > follow the instructions
Hoe xan I do something like this please? Language - Javascript
Image invert?
Thanks
Np
why
estadouser[user.presence.status]responds with undefined ??let estadouser = { "online":"Online", "idle":"Ausente", "dnd":"No Molestar", "invisible":"Invisible/Desconectado", }
@jovial nexus log user.presence.status and see what it gives you
Ok, its fixen now thanks
okay nice np
Can someone create a bot that needs help with coding so I'm not bored all the time
What do i need to do with npm
Do i need sign in ?
Idk..
Eng
Do you know any code language
Yes but don't remember
how can I get Mimu in my Dc server?
Mimu is no respond tho
Ik, tho I need it for my server, for welcoming peeps
lol
is there any way to fetch a deleted message on discord.js? i want my bot to send a notification if a message got deleted, even if the message isnt cached/is partial
could anyone suggest me some sort of module that can replace basically any non-alphabetic character in a string
basically if it isn't Aa-Zz delete it
Regex?
too much work as i'd have to literally define every single character
Uh no
Should be negative lookahead Character class negation
i dont know any module that can do that but you basically can do that manually by splitting your string at every character and look at every character i guess
@sick cloud [^A-Za-z]
can i use that in some sort of .replace
Sure
so str.replace(/[^A-Za-z]/, '')
and h a.ha h -- a would become hahaha
Try it out
const { MessageEmbed } = require("discord.js");
exports.info = {
aliases: ["snipe"]
}
exports.run = (client, message, args) => {
const msg = client.fetchAuditLogs(message.channel.id);
if (!msg) return message.reply("Nothing to snipe");
const snipe = new MessageEmbed()
.setAuthor (`Sniped ${msg.author.tag}`, msg.author.displayAvatarURL())
.setDescription(msg.content);
message.channel.send(snipe);
}
cries in spanish
fetchAuditLogs is for a guild, not client
lmao i figured that out from reading it a million times
but what can i do to make it for a
snipe
command
you need to save messages using the messageDelete event
otherwise you cant get them after they are deleted
use the messageDelete event
client.on("messageDelete", message => { do something with the deleted message })
yes
and then it should work
oml- what do i put in the place that says do something with the deleted message
client.on('message', message => {
if (message.content === `${prefix}start`) {
message.channel.send(new Discord.MessageEmbed()
.setColor(`RANDOM`)
.setTitle('Choose your starter!')
.addField('Chose from Sobble, Grookey or Scorbunny')
.setDescription(`Write ".start [pokemon name]" to chose your starter, for e.g .start sobble`)
.setImage('https://imgur.com/a/jWSf4yW'({ dynamic: true, size: 2048, format: 'png' }))
)}
})
what needs changing?
I have made a messageDelete.js file
With my event handler
and for some reason
The event won't trigger
Why are you spamming
exports.run = async (client, message) => {
if (message.author.bot) return;
if (message.channel.type == "dm") return;
console.log("A message was deleted.")
if (client.snipes.has(message.channel.id)) client.snipes.delete(message.channel.id)
client.snipes.set(message.channel.id, message)
}```I tried this and it wouldn't work
And I have no idea why
anyone here with experience with eslint
HOW do i stop this happening
without disabling the rule
wtf
client.on("messageDelete", message => { do something with the deleted message })
@quartz kindle i mean, i activated partial messages in my client options so the event also triggers if the message is not cached
he wants it for a snipe command
oh
that's ::after
just look what they did and replace it
it's probably border or something
Yep, border-left-color
@quartz kindle i found out why, it's because I wans't caching messages
Thanks π
client.on('message', message => {
if (message.content === `${prefix}start`) {
message.channel.send(new Discord.MessageEmbed()
.setColor(`RANDOM`)
.setTitle('Choose your starter!')
.addField('Chose from Sobble, Grookey or Scorbunny')
.setDescription(`Write ".start [pokemon name]" to chose your starter, for e.g .start sobble`)
.setImage('https://imgur.com/OG56YKE.gif')
)}
})
how do i remove the undefined text on the embed?
its a field
fields have a title and a content, you didnt give it a content
for example .addField("title goes here", "content goes here")
oh ok thanks
So I have this MySQL database connection and my bot is perfectly fine but after like 1-2 hours my bot crashes and I get this error:
Error: read ECONNRESET
at TCP.onStreamRead (internal/stream_base_commons.js:205:27)
connection timeout
Thats what I thought
are the Server and the Database close proximity?
so you got the mysql server on the VPS?
yes
Shouldn't be
did you got a overview of the load in the time where it crashed?
does the Hoster restart the vps after a certain time?
@pure lion which is?--
@crude crag aleBot u////u
i know that Heroku restarts the vps in the night
heroku offers a vps?
No but these are online 24/7 and don't get restart without user input
thAts not really how they work though
i currently have a Digital Ocean VPS and additional a Managed Mysql database. But i replace the mysql database now with a MongoDB cluster
One of my friends I'm talking to said it could also be discord api
i dont have this strange behavior
why should the Discord API reset the database Connection?
I'm on my friend's VPS she bought it on Contabo
No
My friend said it could be discord API timing out
I just assumed it was MySQL since i had some problems with ECONNREFUSED a couple days ago
Is there any way to fix it?
what is the ping of the bot to the API?
How do I see?
client.ws.ping
if its better than this you are fine
108
how is your bot's ping so high, super?
Maybe it's due to location?
I think my friend bought the VPS's in the US
Maybe thats why?
funny story. got a Command that accesses a API and someone overflowed the Bot with making some fancy Command parameters
@tulip ledge us is fine
he found something that made the API return 1k datasets per parameter
so the bot got DDosed by the API
is that 40 seconds+ ping
400 seconds
holy god
bcs 1.2 Million Datasets where in the query
but now ive got the command robust enought to not fail for it anymore
1 minute is already annoying AF
for both sides. you either murder the entire enemy team without them seeing you or you die instant on spawning
Yup lol
@tulip ledge the Discord API should be geolocal. the client should select the best possible API server depending on the Ping
but your timeouts are strange. is there some other stuff on the VPS that uses a lot of bandwith?
So discord api is prob not why?
Not that I know of my friend and her friend host on there too
i have this issue when i run a bot with many files on my PC bcs of bad Internet.
Maybe it's caused by one of their things
so i guess something eats the bandwith. that causes the API to time out
mmmh yeah maybe
I heard the other one hosting on the vps has a minecraft server on there maybe that's causing it?
possible
when suddently many users connects
We have unlimited trafic and 1000 Mbit/s per port
since its a VPS you get only 1 gbit
Yeah 1gbit per port
then how many are using the VPS? when there are 4 users and each connects to the internet its possible that each of them get 1/4 of the Speeds
Me, my friend and her friend
BUt I'm pretty sure her friend is hosting like 3 things
when now the Minecraftserver got ~50 Clients and some backround stuff pulls 500Mbits.
then 500Mbits for the other 2 is left
but its strange you dont need so hight speeds for a bot i guess 10Mbits is enought
(atleast for a small bot)
more than 1 shard?
I'm working on a new one
It's not sharded yet
But it uses like 300MB ram
And thats a lot for a discord bot
When it's on it's peek
mysql
MySQL
Enmap isn't exactly light
ye
mysql is better but i think MongoDB is better for Scaling in the longtherm
also you can better loadbalance it
My bot does ALOT of calculations and stuff all at once






