#development
1 messages · Page 1273 of 1
i would've asked there but there's an outage apparently
Oh yay
it's back up
also tbh that video doesn't tell us what the code is, it's usually better to have the code, ideally in a codesandbox to reporduce the issue
Well... yeah... but... the issue you have clearly relates to the code, and seeing that video only hints and what potentially the issues could be, there's no way to really know other than to poke at theories
i'm digging through the values right now to see what state is what at the time of selecting paths
I'm so happy to be allowed to link to proper discord servers >.<
how high or small does a number need to be until it gets expressed in scientific notation (in js)?
I don't remember JS ever switching to scientific notation on its own
but core JS integers can only go up to 9007199254740991
if you need higher than that you need to use BigInt
@umbral zealot How do I call for pm2 in my code?
you don't. it's the other way around
pm2 is a process manager, it launches your code
that's your browser doing it
pm2 start file.ex --name processname
what am i dong
so >= 1e+21
yeah but that's browser display, JS doesn't do that afaik
Ah, okay.
scientific notation is 100% display
It literally can't see those numbers correctly anyway, you can see how it modifies the last number
So I do
pm2 start `../../index.js`
?
the code itself doesnt understand scientific notation
@stable nimbus you can't use template literals in your command prompt, man.
in other words, RTFM
how can i delete element from a string in javascript?
How do I make this regex /^([^\.].*)\.js(on)?$/ to also accept ts extension
${encodeURI(args.join(''))} the value entered here will be deleted if it is a açık
why not just [".js", ".json", ".ts"].some(x => string.toLowerCase().endsWith(x))
why regex
I'm using a package called require-all
its options, requires a regex to be provided
I think I should do, /^([^\.].*)\.(j|t)s(on)?$/
which allows .tson lol
Haha, hvn't thought of that 😅
just take what require-all does and adapt it to use what flazepe said
const Discord = require("discord.js");
module.exports.config = {
name: "meme",
aliases: []
}
module.exports.run = async (client, message, args) => {
const subReddits = ["dankmeme", "meme", "memes"]
const random = subReddits[Math.floor(Math.random() * subReddits.length)]
const img = await randomPuppy(random);
const embed = new Discord.MessageEmbed()
.setColor("RANDOM")
.setImage(img)
.setTitle(`Your meme sir/ma'am. From r/${random}`)
.setURL(`https://reddit.com/r/${random}`)
message.channel.send(embed);
}
Code:
Error:
(node:10840) UnhandledPromiseRejectionWarning: ReferenceError: randomPuppy is not defined
at Object.module.exports.run (C:\Users\admin\apemodicus\commands\meme.js:12:21)
at Client.<anonymous> (C:\Users\admin\apemodicus\index.js:40:34)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\admin\apemodicus\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
(node:10840) 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)
(node:10840) [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.
help anyone?
const randomPuppy = require('random-puppy');
its literally the first line on the npm page

reading what you copypaste is too much effort
I want the text of --koyu removed when the transaction takes place? how can I do
if (args.includes("--koyu")) {
const attachment = new MessageAttachment(`https://api.alexflipnote.dev/supreme?text=${encodeURI(args.join(' '))}&dark=true`,`Supreme.png`)
message.channel.send({files: [attachment]})
return
}
.replace?
yes
msg.content.replace('--koyu, '')
or args.join(' ').replace('--koyu', '') what ever it is
await fillTextWithTwemoji(ctx, emoji, x, y + 8)
It's not writing anything :/
emoji = "❌"
replace with '' instead of ' '
??????????????????????????????????????????????????????????????????????/
how do I add a gif
.setImage?
no its a gif
@earnest phoenix filter your args, args.filter(x => !x.startsWith("--")).join(" ")
Canvas.loadImage()?
Hello guys I'm using mongodb for my bot. But sometimes mongodb service is stopping automatically. So I need to open mongodb service manuall from Services -> Mongodb -> Start. How can I fix this or how can I start mongodb automatically?
I'm using Windows server 2019 with mongodb version 4.4.1
When its started mongodb works in my bot btw*
You can use the child_process module and the execSync function to start the mongod process, if that's what you mean
im saying here, I need to start mongodb from here manually when its stopped
my database url is mongodb://localhost:27017?authSource=admin
https://sourceb.in/fe6cc818a4 problem?
@earnest phoenix there isnt any
tryitand.see
Can someone please help me link to namecheap domain to my Hostwinds VPS?
I've bought the domain, and I believe i've set the nameservers, and the server is online so it should be good, right?
have u setup like apache or somthin
You have to set up ngnix/apache to act as a proxy and forward requests to your express server.
in Squad there are different team voice channels and the team leaders in each voice channel can talk to each other via a team lead channel. would it be possible to create this feature in discord?
const Discord = require("discord.js");
module.exports.config = {
name: "serverinfo",
aliases: ["si"]
}
module.exports.run = async (client, message, args) => {
const embed = new Discord.MessageEmbed()
const serverIcon = message.guild.displayAvatarURL
.setTitle("Server Info")
.setColor(0xfff06e)
.setThumbnail(serverIcon)
.addField("Server Name", message.guild.name)
.addField("Created On", message.guild.createdAt)
.addField("You've been here since", message.member.joinedAt)
.addField("Total Members", message.guild.memberCount);
message.channel.send(serverEmbed);
}
Help?
@misty sigil
define serverIcon above your embed declaration.
Channel for chatting about (bot) development. If you have questions, ask the questions and wait for someone who can answer to help you. Do not ask to ask. Provide all possible information so people know what's up. Just saying "I get an error" doesn't give us enough information on your problem. Do not @mention people randomly.
You are technically doing serverIcon.setTitle.setColor....
And also displayAvatarURL is a function
please note the do not @ mention someone randomly
please note the do not @ mention someone randomly
@misty sigil lmao k
const Discord = require("discord.js"); module.exports.config = { name: "serverinfo", aliases: ["si"] } module.exports.run = async (client, message, args) => { const embed = new Discord.MessageEmbed() const serverIcon = message.guild.displayAvatarURL .setTitle("Server Info") .setColor(0xfff06e) .setThumbnail(serverIcon) .addField("Server Name", message.guild.name) .addField("Created On", message.guild.createdAt) .addField("You've been here since", message.member.joinedAt) .addField("Total Members", message.guild.memberCount); message.channel.send(serverEmbed); }Help?
put the serverIcon part on top of embed and it will work
const Discord = require("discord.js");
module.exports.config = {
name: "serverinfo",
aliases: ["si"]
}
module.exports.run = async (client, message, args) => {
const serverIcon = message.guild.displayAvatarURL
const embed = new Discord.MessageEmbed()
.setTitle("Server Info")
.setColor(0xfff06e)
.setThumbnail(serverIcon)
.addField("Server Name", message.guild.name)
.addField("Created On", message.guild.createdAt)
.addField("You've been here since", message.member.joinedAt)
.addField("Total Members", message.guild.memberCount);
message.channel.send(serverEmbed);
}
@earnest phoenix like this?
bc that aint working
:oooooooooooh:
@misty sigil ik but he told me to do that
so what do I do?
man <i did
doubt
message.guild.displayAvatarURL isnt even a function
@misty sigil but what do I do

https://discord.js.org/#/docs/main/stable/class/Guild?scrollTo=iconURL
@misty sigil I alrdy read that but what do I do Im confused what Crazy Shooting saying
yes
bruuuuuuuuuuuuuuuuuuuuuuuuuuuh
How
const Discord = require("discord.js");
module.exports.config = {
name: "serverinfo",
aliases: ["si"]
}
module.exports.run = async (client, message, args) => {
const embed = new Discord.MessageEmbed()
const serverIcon = message.guild.displayiconURL
.setTitle("Server Info")
.setColor(0xfff06e)
.setThumbnail(ServerIcon)
.addField("Server Name", message.guild.name)
.addField("Created On", message.guild.createdAt)
.addField("You've been here since", message.member.joinedAt)
.addField("Total Members", message.guild.memberCount);
message.channel.send(serverEmbed);
}
@earnest phoenix
How
@obtuse jolt lmao how the hell
u developed it on a mobile lmfao
?
oh
bro just edit it as message.guild.iconURL
const Discord = require("discord.js");
module.exports.config = {
name: "serverinfo",
aliases: ["si"]
}
module.exports.run = async (client, message, args) => {
const embed = new Discord.MessageEmbed()
const serverIcon = message.guild.iconURL()
.setTitle("Server Info")
.setColor(0xfff06e)
.setThumbnail(ServerIcon)
.addField("Server Name", message.guild.name)
.addField("Created On", message.guild.createdAt)
.addField("You've been here since", message.member.joinedAt)
.addField("Total Members", message.guild.memberCount);
message.channel.send(serverEmbed);
}
@obtuse jolt still dont work
what's the error?
brb
brb?
I found it
yesok now
(node:14708) UnhandledPromiseRejectionWarning: TypeError: message.guild.iconURL(...).setTitle is not a function
at Object.module.exports.run (C:\Users\admin\apemodicus\commands\serverinfo.js:11:4)
at Client.<anonymous> (C:\Users\admin\apemodicus\index.js:40:34)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\admin\apemodicus\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
(node:14708) 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)
(node:14708) [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.
error
^^
put it above the embed
Oh my god
lol
Yeah I think everyone knows why
@proven lantern how can i put it as a service?
const Discord = require("discord.js");
module.exports.config = {
name: "serverinfo",
aliases: ["si"]
}
module.exports.run = async (client, message, args) => {
const embed = new Discord.MessageEmbed()
.setTitle("Server Info")
.setColor(0xfff06e)
.setThumbnail(ServerIcon)
.addField("Server Name", message.guild.name)
.addField("Created On", message.guild.createdAt)
.addField("You've been here since", message.member.joinedAt)
.addField("Total Members", message.guild.memberCount);
const serverIcon = message.guild.iconURL()
message.channel.send(Embed);
}
whyyy
doesnt it work
const Discord = require("discord.js");
module.exports.config = {
name: "serverinfo",
aliases: ["si"]
}
module.exports.run = async (client, message, args) => {
const serverIcon = message.guild.iconURL()
const embed = new Discord.MessageEmbed()
.setTitle("Server Info")
.setColor(0xfff06e)
.setThumbnail(ServerIcon)
.addField("Server Name", message.guild.name)
.addField("Created On", message.guild.createdAt)
.addField("You've been here since", message.member.joinedAt)
.addField("Total Members", message.guild.memberCount);
message.channel.send(embed);
}
@autumn aspen
thx
const Discord = require("discord.js");
module.exports.config = {
name: "serverinfo",
aliases: ["si"]
}
module.exports.run = async (client, message, args) => {
const serverIcon = message.guild.iconURL()
const embed = new Discord.MessageEmbed()
.setTitle("Server Info")
.setColor(0xfff06e)
.setThumbnail(ServerIcon)
.addField("Server Name", message.guild.name)
.addField("Created On", message.guild.createdAt)
.addField("You've been here since", message.member.joinedAt)
.addField("Total Members", message.guild.memberCount);
message.channel.send(embed);
}
@obtuse jolt still dont work
can check
Yes what’s wrong now
(node:10884) UnhandledPromiseRejectionWarning: ReferenceError: ServerIcon is not defined
at Object.module.exports.run (C:\Users\admin\apemodicus\commands\serverinfo.js:13:17)
at Client.<anonymous> (C:\Users\admin\apemodicus\index.js:40:34)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\admin\apemodicus\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
(node:10884) 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)
(node:10884) [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.
Error: ^^
If you're fine using throwing logic, you can wrap the thing in a try/catch or .catch() to ignore the error.
Sadly no, I've never worked with MongoDB.
guys please help me :c
@toxic jolt learn js and how to read errors...?
i fixing ssd
Error: Cannot find module 'm3u8stream/lib/parse-time'
Require stack:
- C:\Users\Administrator\Desktop\Cortex\KAPALI\cortexmuzik\node_modules\ytdl-cor
e\lib\info-extras.js
- C:\Users\Administrator\Desktop\Cortex\KAPALI\cortexmuzik\node_modules\ytdl-cor
e\lib\info.js
- C:\Users\Administrator\Desktop\Cortex\KAPALI\cortexmuzik\node_modules\ytdl-cor
e\lib\index.js
- C:\Users\Administrator\Desktop\Cortex\KAPALI\cortexmuzik\komutlar\devam-et.js
- C:\Users\Administrator\Desktop\Cortex\KAPALI\cortexmuzik\bot.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841:27)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (C:\Users\Administrator\Desktop\Cortex\KAPALI\cortexmu
zik\node_modules\ytdl-core\lib\info-extras.js:5:21)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [```
defrags SSD
here error
...
Pudochu the error is coming from a dependency of a dependency
For starters, you could try to rebuild your node_modules folder (npm install) or try manually installing the module.
I've been getting errors like this for 1 month
i tried everything package.json is wrong
Couldn't find package.json for music bot from github
@toxic jolt do you even know js
Did you make the bot?
Server = [Here]()\nServers I'm in = \`${Client.guilds.cache.size}\``)
Why is the code at the end wrong?
first off. what the heck is that?
first off. what the heck is that?
@opal plank just care about the end
second off, if you want help, dont cut the snippet in half
code

ok chill
.addField('Support', `Invite me = [Here]()\nServer = [Here]()\nServers I'm in = \`${Client.guilds.cache.size}\``)
here
there we go
what is the error?
(node:15532) UnhandledPromiseRejectionWarning: ReferenceError: Client is not defined
at Object.module.exports.run (C:\Users\admin\apemodicus\commands\help.js:16:221)
at Client.<anonymous> (C:\Users\admin\apemodicus\index.js:40:34)
at Client.emit (events.js:315:20)
at MessageCreateAction.handle (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\admin\apemodicus\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\admin\apemodicus\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
(node:15532) 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)
(node:15532) [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.
there
upperCase
Then go to bed. Tired programmers are dumbass programmers. And you're already a noob so double trouble there.
unless you me. Drunk tired and productive
very random but anyone here familiar with geometry dash bot development?
How do I
Then go to bed. Tired programmers are dumbass programmers. And you're already a noob so double trouble there.
@umbral zealot quiet
lol
${message.guild.owner}
Can I mention me bc Im the bot creator
I forgot the command
huh?
huh?
@opal plank I wanna mention me
so mention yourself
but that wont mention you
lmao
which is likely not to be you in most cases
toStringing a user resolves to a mention, no?
why do you want to mention yourself
perhaps bot owner?
yes
but that's a not-so-good idea
9/10 you're not going to be in another user's cache
the mention is just going to stay as an id and they aren't going to see your username
your friend is in your cache
@marble oxide you can't see who this is, they aren't in your cache but they are in mine
hey would I get rate limited if my bot deletes a users message and a bot's message at the same time
depending on what's the interval of doing it
your library should handle ratelimits
every endpoint has its ratelimits
depending on what's the interval of doing it
@earnest phoenix u know Goodelad?
im using discord.js sooo
uhh what
even though it rate limits, careful not to spam it too much
just good practice overall
hmm yeah
discord.js does absolutely properly handle ratelimits but if you're asking the question, you should probably reconsider whatever you're doing that might constantly hit against them.
yeah i might reconsider what im doing
@autumn aspen?
@autumn aspen?
@tight plinth no he said smh I cant do a thing witch was me mentioning and cache and boom
nothing hehe
you're not going to appear as a proper user to people who don't have you in their cache
just like you can't see who i mentioned above, they aren't going to see who's in the embed
@native flicker
this is a user in Discord API
i share a server with them
therefore its cached on my end
I share 7 servers with them 😂
i have checked your shared guilds, you arent in DAPI
therefore you should see <@89172987319>
@native flicker specifically
nah
there
sorry, that was discord's autocomplete lol
@autumn aspen
check example above ^^
your bot cache is the users your library has cached to you, thats unrelated to how a user see's the mention
just like the example above, its rendered on the client
therefore you should see <@89172987319>
@opal plank whats that?
a mention
and ID of a user, as a mention, when you do'nt share a server.
can eveyone see it from all servers?
what do you see on this message?
even them u not sharing one with?
you completely misundertood what i said

you completely misundertood what i said
@opal plank oh now i understand
u need a "!"
right

no
i
! just means nicknamed
it doesn't actually
@rough furnace see this? This a mention for someone you don't have a server in common with.
@rough furnace see this? This a mention for someone you don't have a server in common with.
@umbral zealot wow
100% <@!id> is for a user on the server which is nicknamed, yes.
ok but how can ppl see ur name and tag from server u dont sharing with?
Can you see @rough furnace ? Do you see the name and tag? that's your answer.
tldr <@!> used to indicate a nickname way back in 2015, now it's just leftover legacy behaviour and recently the official client switched to using <@!> all the time, while ios and android still have the inconsistent behaviour of switching between <@> and <@!>
thats why you should avoid putting mentions in embeds of users not in the server
cuz you see that atrocity up there
so u doing like this Endph#5742
not <@!>
Yeah just get user.tag and be done with it.
I usually do something like Hindsight#2020 (139412744439988224) so I get both
otherwise, avoid using mentions
so u <@id>
not quite
oh ok
a better approach is <user>.toString()
you can build it manually if you want, but it doesnt hurt to use a more clean way

const Discord = require("discord.js");
module.exports.config = {
name: "uptime",
aliases: ["upt"]
}
module.exports.run = async (client, message, args) => {
function duration(ms) {
const sec = Math.floor((ms / 1000) % 60).toString()
const min = Math.floor((ms / (1000 * 60)) % 60).toString()
const hrs = Math.floor((ms / (1000 * 60 * 60)) % 60).toString()
const days = Math.floor((ms / (1000 * 60 * 60 * 24)) % 60).toString()
return `${days.padStart(1, '0')} days, ${hrs.padStart(2, '0')} hours, ${min.padStart(2, '0')} minutes, ${sec.padStart(2, '0')} seconds. `
}
message.channel.send(`I have been online for: ${duration(client.uptime)} | :electric_plug:`)
}
Im little scared that when it comes to 1 day it wont keep counting
you should worry about that when, and only when, your bot actually reaches that point where it actually stays online an entire day.
aight
you should worry about that when, and only when, your bot actually reaches that point where it actually stays online an entire day.
@umbral zealot but what do u think?
I think you should worry about that when, and only when, your bot actually reaches that point where it actually stays online an entire day.
bruh lol
Literally just exactly what I think.
lmao
${client.guilds.cache.size}
I want to put it in setActivity but I got error and here is my code
client.on("ready", () => {
console.log("Horray, I am online.")
client.user.setActivity("the new commands", ({type: "WATCHING"}))
})
there
you'd think after a few days you'd know how to properly describe your error 
yes but I got 2 bracket wrong
I don't see you using the size thing
You will, clearly, and we're still not going keep spoonfeeding you functional code
I want to fix like this
excuse me, i am collect the channel id to array, can i send message to multiple channel with those ids?
You can by looping over that array and sending for each. Note that you have to be careful about spam though
You can by looping over that array and sending for each. Note that you have to be careful about spam though
@umbral zealot show an example
no
you just refuse to think for yourself and actually do things right
Google “looping an array” and “send message to channel discordjs”
And combine those solutions
thanks ^-^
@umbral zealot ngl I feel bad for Tim, he has to go through this shit daily
So do I >.<
I've been doing this for years. it doesn't get easier to deal with entitled little tylers
It pisses me off so much
People in djs were much better
But i got banned there.. someone got a bit too offended by a meme i posted
"but I don't have time to leaaaaaaarnnnnnnn!" "Just one more thing, I promise it's the last one" "will this work????" 
how can I give an error message if the user does not have activity.type === 'LISTENING' && activity.name === 'Spotify' activity in the forEach loop?
the forEach loop
??
user.presence.activities.forEach((activity) => {
if (activity.type === 'LISTENING' && activity.name === 'Spotify') {
message.channel.send(`${activity.details}`)
}
})
what do you actually want to do
this is an http://xyproblem.info
Asking about your attempted solution rather than your actual problem
if you don't question me to write wrong? i have little knowledge of english.
what
i'm asking you what do you actually want to do
because this is an xyproblem
are you trying check if a user has a spotify activity?
yeah
but If not I want it to give an error message
then use some instead of forEach
bot.on("message", message => {
let PREFIX = ["s-", `<@${bot.user.id}> `];
console.log(PREFIX[1])
if (message.channel instanceof Discord.DMChannel) return;
if (message.author.bot) return;
if (message.content.indexOf([PREFIX[1]]) !== 0) return;
let args = message.content.substring(PREFIX[1].length).split(" ");
switch (args[0].toLowerCase()) {
case "bruh":
message.channel.send("pee fart")
break;
}
});
when i use the bot mention prefix it doesnt respond
bruh
Does it have a nickname?
no
check for both <@> and <@!> formats
ok
Also PREFIX is an array. A string cannot contain an array.
that too ^^
So really there's a better way to do this, with a simple loop
also, why do you use an array if you're just going to keep statically referencing an element out of an array just to check for it
ah
i checked for both formats and it didnt work
Well if we're stupid I guess you can handle it yourself, smart guy.
i know stupid
@errant perch
client netwirk sockt disconnected before secure tls connection was established
Anyway @errant perch you should debug by adding console logs everywhere and seeing what you get. Log the message, the prefix, the result of the indexOf, etc.
uh
const Discord = require("discord.js");
module.exports.config = {
name: "report",
aliases: ["rp"]
}
module.exports.run = async (client, message, args) => {
let rUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
if(!rUser) return message.channel.send("Couldn't find user.");
let reason = args.join(" ").slice(22);
const embed = new Discord.MessageEmbed()
.setTitle("Reports")
.setColor(0xfff06e)
.addField("Reported User", `${rUser} with ID: ${rUser.id}`)
.addField("Reported By", `${message.author} with ID: ${message.author.id}`)
.addField("Channel", message.channel)
.addField("Time", message.createdAt)
.addField("Reason", reason);
//return message.channel.send(reportEmbed); //send msg in current channel
let reportsChannel = message.guild.channels.find(`name`, "reports") //TODO: set reports channel
if(!reportsChannel) return message.channel.send("Couldn't find reports channel.");
message.delete().catch(O_o=>{}); //delete previous message (input command)
return reportsChannel.send(embed);
}
Im trying to make a report command and got an error
I dont know how to do it in 12v
:/
anyone help?
Yes more asking for sooonfeeding, that's what we need.
client.on('message', message => {
if (!message.guild) return;
if (message.content.startsWith('-warn')) {
const user = message.mentions.users.first();
if (user) {
const member = message.guild.member(user);
if (member) {
member
.warn('Optional reason that will display in the audit logs')
.then(() => {
message.reply(`The user will be warned ${user.tag}`);
})
.catch(err => {
message.reply('You cant warn a Moderator!');
console.error(err);
});
} else {
message.reply("That user isn't in this guild!");
}
} else {
message.reply("You didn't mention the user to warn!");
}
}
});
it's a direct copypaste
prblem?
no
Then what's the problem?
.warn('Optional reason that will display in the audit logs')
That tells us nothing of the problem
Oh. Member.warn
That... Doesn't exist, buddy. Not a thing in Discord
That... Doesn't exist, buddy. Not a thing in Discord
@umbral zealot what but how can u do it on other bots`?
lol
There is no concept of warnings in the discord API
Smh
ehm
You're always confused so that's not new.
ye
I have coded a system where i can "Login" and "chat" as my bot
tr yetkili varmı
acil
not the first or the last time somebody's done that
I have coded a system where i can "Login" and "chat" as my bot
@earnest phoenix tf
lmao
-notr @earnest phoenix
@earnest phoenix
İngilizceden başka dillerde sohbet etmek için #general-int kanalını, top.gg hakkında (Türkçe olarak da) destek almak için #support kanalını kullanın.
Bu kanalda Türkçe konuşmayın.
and no need to keep repeating the same message 
how do i sety an embed author? i try doing .setAuthor(message.author.user)
in the embed contruscter but the embed shows <@the user's id>
@earnest phoenix 😩 this channel is for development
Every fuc%ing dog/cat vid i Cry -_-
feel free to tell people in #general or #general-int tho
ok
No it's message.author
yea i did
It's already a user.
Ok show the screenshot
i wreote userna,e wrong
so it says undefined
lol
but i need help on wuthor one
.setAuthor(message.author)
.setTitle(`${message.author.username}'s Profile`)
.addField(`User Account Created Date:`, `${message.author.createdAt}`, true)
.addField(`Username`, `${message.author.username}`, true)
.addField(`4 Digit Discriminator`, `${message.author.discriminator}`, true)
.addField(`Server Nickname`, `${message.guild.member.displayName}`, true)
.addField(`Balance`, `Wallet: **${userinfo[message.author.id].coins}** coins\nBank: **${userinfo[message.author.id].bank}**/**${userinfo[message.author.id].bankmax}** coins\nTotal: **${userinfo[message.author.id].coins +
userinfo[message.author.id].bank}** coins`)
.addField(`Premium`, `**true**`)
message.channel.send(pfp);
return;```
I don't know but that's not normal. Message.author.username CANNOT be undefined.
it gives the discriminator and name correct
how many times can a room name be changed in 1 minute? discord according to api?
I don't know but that's not normal. Message.author.username CANNOT be undefined.
@umbral zealot i wrote it as Message.author.usename without the r accidentaly
Can I get an opinion on this please?
So, I own an entertainment API and all api endpoints will be sourced from different public API's.
I'm not restricting access to any of the endpoints, however, people can purchase more API calls per month.
Would this still count as copyright and selling access to the service?
yea prob
oh I understand.
setAuthor doesn't take an actual user account
it takes a name, icon, url
3 strings.
oop
@earnest phoenix don't try to guess at rate limits. follow the rate limit headers, or let your library handle it. If you think you're going to hit them too much, you should reconsider doing what you want to do. Channels shouldn't be used as timers or counters.
the first is going to be the username or the tag
the second would be the avatar url
how about you look at the docs on how to get a user's avatar instead of guessing 😉
i know the discord api is disabled if
Do you rename the room several times within 1 minute
and I don't know exactly how many times I can do it in 1 minute
then don't do it several times a minute.
but I want it every half minute
brah
If you do something that is close to the rate limits, your bot risks being banned. If you care about being banned, don't do this. If you don't care, then the limits don't matter, your library will handle it.
I'm not sure what 'copyright and selling access' you're talking about
So if I only allow users to pay to lift their rate limits, but make endpoints free to be called to, is that allowed or does it count as copyright?
@bot.command()
async def dep(ctx, arg):
print("idk")
await open_account(ctx.author)
print("ifj")
users = await get_bank_data()
print("eee")
user = ctx.message.author
print("rrrrrrr")
arg = int(arg)
if (int(users[str(user.id)]["wallet"]) > arg - 1):
print("fish")
users[str(user.id)]["bank"]
print("dag")
users[str(user.id)]["wallet"]
print("cock")
await ctx.send("succesfully transfered the cash")
users[str(user.id)]["wallet"] += arg
print("chips")
elif users[str(user.id)]["wallet"] < arg:
await ctx.send("you dont have enough for that")
with open("mainbank.json", "w") as f:
json.dump(users,f)
async def open_account(user):
users = await get_bank_data()
with open("mainbank.json", "r") as f:
users = json.load(f)
if str(user.id) in users:
return False
else:
users[str(user.id)] = {}
users[str(user.id)]["wallet"] = 0
users[str(user.id)]["bank"] = 0
with open("mainbank.json", "w") as f:
json.dump(users,f)
return True
error:
can anyone help?
holyt shpt
?
@earnest phoenix if you make your own API for a service, and it's not the discord API, you can do whatever the hell you want with it man 😛
what else
evie whats a user's url?
Yeah, but my service would be sourced from other third party API's
For example, i'd make my own 8ball endpoint, to call to another public 8ball API
well then you'd have to talk to a lawyer to study those API's terms of service to know what you're allowed or not allowed
we're not laywers.
how do you gert a users d/
I understand, just wanted to get some inputs
url*
Thanks
Users don't have a URL, man.
@zenith knoll do i remove "" aswell?
Users don't have a URL, man.
@umbral zealot 3 strings, a name, a iconurl, and a url
oop
the docs are pretty clear on this
embed.author.icon_url: Not a well formed URL.```
url is invalid
const Discord = require("discord.js");
module.exports.config = {
name: "random",
aliases: ["ra"]
}
module.exports.run = async (client, message, args) => {
if(!args[0]) return message.reply("You didn't specify args 1!")
if(!args[2]) return message.reply("You didn't specify args 2!")
message.channel.send("Your random number is: " + Math.floor(Math.random() * args[2] + args[0]));
}
cant still figure out what makes it (example:) 1 of 3 = 0?
i tried iconURL too
.setAuthor(**${message.author.username}**'s Profile, ${message.member.avatarURL})
What specific exact property of https://discord.js.org/#/docs/main/stable/class/User can help?
...
the docs are really great you know. It's all there.
@zenith knoll what u told me made more errors ;-;
const Discord = require("discord.js");
module.exports.config = {
name: "random",
aliases: ["ra"]
}
module.exports.run = async (client, message, args) => {
if(!args[0]) return message.reply("You didn't specify args 1!")
if(!args[2]) return message.reply("You didn't specify args 2!")
message.channel.send("Your random number is: " + Math.floor(Math.random() * args[2] + args[0]));
}
cant still figure out what makes it (example:) 1 of 3 = 0?
anyone?
You have to call that function in order to get the avatar url of said user @zenith knoll
@earnest phoenix
@autumn aspen you'd know if you took the time to learn javascript.
oops
@autumn aspen you'd know if you took the time to learn javascript.
@umbral zealot Im not on javascript
Im on discord.js
.. no
FFS
wydm no
you're using the discord.js library

lmao
discord.js is a library FOR JS
you're writing javascript you stale muffin.
im gonna commit leave
lol
my brain is hurting
https://discordapp.com/channels/264445053596991498/272764566411149314/759543783616151552
im looking for help if anyone can help
Welcome to every day of my life preaching to preteens that they should learn the language they want to use.
Welcome to every day of my life preaching to preteens that they should learn the language they want to use.
@umbral zealot nothing was wrong hehe
what?
ffs
What's wrong is that you refuse to learn and continue to be a help vampire.
^^^^^
learn js before making a bot
learn how to use arrays, learn how to generate random numbers
If you wanna generate a random num between x and y, Math.round(Math.random()*y)+x. Use that info for your command
I would have a problem that my bot prefix is more than 1 character then it will not respond to anything
CODE:
con.query(`SELECT * FROM servers WHERE sid = '${message.guild.id}' `, (err, rows) => {
if(err) throw err;
const prefix = rows[0].prefix;
if (message.content.startsWith(prefix)) {
if (panic == 1 && message.author.id === process.env.owner) {
const [cmdName, ...cmdArgs] = message.content
.slice(client.prefix.length)
.trim()
.split(/\s+/);
const command = client.commands.get(cmdName);
if (command) {
command.run(client, message, cmdArgs);
}
})```
how do i get a nickname for a user? i tried going into the docs 
.nickname returns undefined
member.nickname
users don't have nicknames, members do
yea
not user.nickname
.guild.members.resolve(userID).nickname
@zenith knoll user .username
@earnest phoenix he asks for a nick
@earnest phoenix you're looking if the message rows[0] but you're slicing the message with the client.prefix.length
So I'll have to assume your client.prefix is 1 character.
const Discord = require("discord.js"); module.exports.config = { name: "random", aliases: ["ra"] } module.exports.run = async (client, message, args) => { if(!args[0]) return message.reply("You didn't specify args 1!") if(!args[2]) return message.reply("You didn't specify args 2!") message.channel.send("Your random number is: " + Math.floor(Math.random() * args[2] + args[0])); }cant still figure out what makes it (example:) 1 of 3 = 0?
@autumn aspen ur flooring it to 0
Hes multiplying by a string
thats the issue
it shouldn't be a problem because you've never bothered using slappey since then it's not good
how this could be corrected
CODE mysql:
con.query(`SELECT * FROM servers WHERE sid = '${message.guild.id}' `, (err, rows) => {
if(err) throw err;
const prefix = rows[0].prefix;
if (message.content.startsWith(prefix)) {
const [cmdName, ...cmdArgs] = message.content
.slice(client.prefix.length)
.trim()
.split(/\s+/);
const command = client.commands.get(cmdName);
if (command) {
command.run(client, message, cmdArgs);
}
})```
@autumn aspen ur flooring it to 0
@zenith knoll and?
One message removed from a suspended account.
stackoverflow go brrr
@earnest phoenix instead of slicing on the client prefix, slice on your row prefix. Ezpz
that results in the result being 0
@earnest phoenix no for me sometime when I type 1 of 3 its pop up 1,2,3
and how because I have always used this so far?
You've always used prefixes with one character, correct?
yes
for this bot, the multi-character one worked for the old one
It couldn't have if the client prefix was always one character
I didn't have more characters than the old one but I didn't use slappe at the time
this hiab has been around since slappey used
Well I don't know how I can explain it more clearly
You're slicing one character.
Your prefix has 2
So slice with the row prefix length, not the client prefix length
stackoverflow go brrr
@earnest phoenix stackover flow go brrrrr
??
Brub
You wish we were in your server.
Why
You wish we were in your server.
@umbral zealot yeah..
So we can see the error?
That would significantly raise the knowledge level
imagine helping YOURSELF instead
thats hard
One message removed from a suspended account.
lmao
anyone know a quick and efficient way to get the spaces in front of a variable?
for example, pretend foo = " lol"... it has 5 spaces in the beginning of the variable and I want the code to detect that
honestly the easiest way is to use regex
i dont want to do for() looping
like... /$( +).*/ match this (any number of spaces before any character) and then count the match
idk how to regex too well but i know the very basics lol
lol
that's pretty basic actually. $ is the start of the string, ( ) captures a group, + is "one or more spaces) and then it's .* which is "anything"
A lotta great regex helper websites
oh oops no it's ^ not $
Regex101 allows you to create, debug, test and have your expressions explained for PHP, PCRE, Python, Golang and JavaScript. The website also features a community where you can share useful expressions.
^start
end$
// start and end
... no.
/pattern/ can be anywhere in between
how do I add:
const moment = require("moment")
like moment reqs and stuff I only got 2 or smh
not specifically the start or end
some npm package ig
ig so
One message removed from a suspended account.
how do I add:
const moment = require("moment")like moment reqs and stuff I only got 2 or smh
@autumn aspen u just added it
some npm package ig
@faint prism fuck
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
how to add npm packages
@sage bobcat ik
lol
One message removed from a suspended account.
yes but if I do it my VSC is gonna updates it?
he knows what a const is
with the pack?
or a rewuire
One message removed from a suspended account.
One message removed from a suspended account.
yes but if I do it my VSC is gonna updates it?
@autumn aspen uh
One message removed from a suspended account.
Holy shit
@sage bobcat answer yes ot no
oke
just save the code
One message removed from a suspended account.
duh
One message removed from a suspended account.
One message removed from a suspended account.
died
just save the code
@zenith knoll what code?
Basically what im trying to do is create a command that allows server managers to set a level and a role that is given at a certain level.
ive made the setup so people can set it up themselves
but i do not know how to save it in the database
so that they can add multiples and also use multiples
how would i make that
https://paste.mod.gg/oyajokanul.js
currently i have this as my model code
so how would i save it and allow multiple levels and roles to be added?
One message removed from a suspended account.
One message removed from a suspended account.
oop
One message removed from a suspended account.
One message removed from a suspended account.
js
One message removed from a suspended account.
i just needa memorize djs functions etc
const mongoose = require('mongoose');
const newTest = new mongoose.Schema({
guildID: String,
guildName: String,
level: Number,
role: String,
});
module.exports.model = mongoose.model('levelrewards', newTest);
module.exports.getLevelsGuild = async (guild) => {
const guildID = guild.id;
const guildName = guild.name;
let guildData;
try {
guildData = await this.model.findOne({ guildID });
} catch (err) {
console.log(err);
}
if (!guildData) {
const newData = new this.model({
guildID,
guildName,
});
guildData = await newData.save();
}
return guildData;
};
module.exports.getLevelsGuildByID = async (guildID) => {
let guildData;
try {
guildData = await this.model.findOne({ guildID });
} catch (err) {
console.log(err);
}
return guildData;
};```
currently i have this as my model code
so how would i save it and allow multiple levels and roles to be added?
@sweet ruin copy?
No you need to learn js
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
I have
i copied the code from my own command yes?
No, you haven't.
One message removed from a suspended account.
One message removed from a suspended account.
Ok ask me smh
It's horribly clear to anyone that knows JS that you don't.
ill just come back later
just ask them to explain what it does
One message removed from a suspended account.
One message removed from a suspended account.
no
One message removed from a suspended account.
no
@autumn aspen u dont even know how math.floor(math.random()) works
Im cody poppy Ik everything
@autumn aspen u dont even know how math.floor(math.random()) works
@zenith knoll yes
One message removed from a suspended account.
u dont
One message removed from a suspended account.
yes
u obv dont know
I got dejavu
This channel is cursed
bc u dont know itll always get 0
2x
One message removed from a suspended account.
One message removed from a suspended account.
bc u dont know itll always get 0
@zenith knoll haha man u wanna see? self?
im so confused at that grammar
lmao
One message removed from a suspended account.
One message removed from a suspended account.
https://www.javascript.com/ might help
JavaScript.com is a resource for the JavaScript community. You will find resources and examples for JavaScript beginners as well as support for JavaScript experts. Learn JavaScript or free with our easy to use input output machine.
idk u might wanna try it
One message removed from a suspended account.
This channel is cursed
@honest perch no Discord is cursed by pretend 13 year old Tylers. like , the whole platform unfortunately.
One message removed from a suspended account.
even i knowjsa bit
@zenith knoll then whats this?
somthing from copied code
code copied from stackoverflow
Hey @autumn aspen explain to me what an array is?
somthing from copied code
@zenith knoll no stfu
ima go eat brbr
oop
One message removed from a suspended account.

One message removed from a suspended account.
the help vampire escapes with an excuse to not answer the question
lmao
anyone else need help >.<
One message removed from a suspended account.
the help vampire escapes with an excuse to not answer the question
@umbral zealot mission failed, well get em next time
me!
oop
One message removed from a suspended account.
I'm procrastinating I need a smart question.
One message removed from a suspended account.
done eating
alr?
yes it was a donut
One message removed from a suspended account.
@autumn aspen
One message removed from a suspended account.
tf
One message removed from a suspended account.
u dont needa leave for a donut
One message removed from a suspended account.
oop
One message removed from a suspended account.
yes
Then explain what an array is. Go.
^
One message removed from a suspended account.
One message removed from a suspended account.
wait I need to take a shit
LMAO
real quick
One message removed from a suspended account.









One message removed from a suspended account.
Heyyyyy everyone it's time to play "ignore this help vampire that's now trolling us"
🧑🏫
please
No seriously I can either go back to writing my reactjs blog platform with graphql or help someone with a bot problem
Im back
tf
One message removed from a suspended account.
so what questiom
No need to spam, man.
explain to me what an array is
One message removed from a suspended account.
Just ignore the kid, Topppat.
One message removed from a suspended account.
wait need to reach the moouse
i dont get how mods here survive
seriously feeding the troll is 100% pointless.
One message removed from a suspended account.
One message removed from a suspended account.
An array is a function
"wHaToop
One message removed from a suspended account.
One message removed from a suspended account.
ok please can we stop.
STARBOARD THAT
@autumn aspen stop trolling ty
starboard his msg
One message removed from a suspended account.
@autumn aspen stop trolling ty
@modern sable ok
yes yes, it's fine. can we get back on the topic of development now
ok
An array is a function
For the record: An array is a data structure
If u take a code and split it can it still be a function with an array?
wait does it escos
take a code and split it
excist?
I'm having an escosistential crisis
escos?
How can I do an normal userinfo command without npm any package
Other than discord.js?
You know how we think people are sometimes slow? This guy makes me think of a gear that's too small or too used up. Spinning super rapidly but achieving no traction.
Awh man, lol
You know how we think people are sometimes slow? This guy makes me think of a gear that's too small or too used up. Spinning super rapidly but achieving no traction.
@umbral zealot and u nerd or what?
He's got the technical jargon down at least
Yeah no shit I'm a nerd. I do programming all day, duh, kid.
nothing
We are all nerds here 🙂
Im going at school
... I'm going to step away because I was about to continue being really insulting and I don't want to keep being a superjerk
returns to udemy razzle course curriculum redaction
Ive never met a programmer who isnt a nerd
Except those who bareass suck at it
ppl who still use var

One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
in js tho 
ppl who still use
var
@thin turret u do
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
What year is this, 2001?
@thin turret u do
@autumn aspen i useconstandlet😎
One message removed from a suspended account.
@autumn aspen i use
constandlet😎
@thin turret man me too?
only same with @sage bobcat
Ok?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
When did I ask










