#development
1 messages Β· Page 822 of 1

Lol seems like a bad deal π
and the vps prob worth of 3β¬/mo
From me, i simply cannot get scammed, anymore.
π
I have been tricked too many times

And discord has tons of Scammers from Fake Nitro bots to kids selling stuff
Kinda funny actually
client.ping doesn't work anymore π
Client.ws.ping
@shy turret did u just upgraded to v12?
what does ws stand for
webscoket
Lol
yay? nah
i know everything

i dont π
im fast teacher
@restive furnace what's 2 +2?
imagine actually getting money off a bot
44
@finite bough idk do console.log(2+2)
yes
XD
like eval(2+2)
yes it does
I am fast teacher, i can teach everything abt js and discord.js in 1 hours if im on pc or even fastee
i can actually code on my phone pls move #memes-and-media i gues
the only problem is
and on pc i am too fast writer
they dont understand anything
Im trying to install lavalink on raspberry pi 3b, I've already got it running but it comes up with an error
post the error, please?
https://prnt.sc/rgdqdj it uploads the .env file to github, even with that code
it'll not
it does
i
have to reset tokens aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
try *.env
(thats the error)
it wasn't supposed to upload files filtered by gitignore
@restive furnace I got the error
Im trying to install lavalink on a raspberry pi 3, any idea why this error is occurring and how to fix it? https://hastebin.com/ocakevivaq.cs
some times my client takes a while to reach the "ready" state, does anyone know why?
client.on('ready', () => {
console.log('Bot is online!');
var numServers = client.guilds.size + " servers! | ;help";
client.user.setActivity(numServers, {type: 'WATCHING'});
setInterval(async () => {
var numServers = client.guilds.size + " servers! | ;help";
await client.user.setActivity(numServers, {type: 'WATCHING'});
}, 3600000)
})
I had an issue where it wasn't connecting and returned a "Timeout" error. Most of the time it's fine, but occasionally it just hangs and doesn't log in to the bot properly
what is client defined as?
const client = new Discord.Client();
client.commands = new Discord.Collection();
client.aliases = new Discord.Collection();
oh
per usual
I see
Lol nobody ever thinks if that could be the issue π€·π»ββοΈ
feelsbadman
This is true
π
Im trying to install lavalink on a raspberry pi 3, any idea why this error is occurring and how to fix it? https://hastebin.com/ocakevivaq.cs
but it also depends on how many guilds, your connection quality, what you're loading, etc
my bot is not having any issues connecting
api issues are weekly at this point, this is going to start happening more and more often because of the go live limit increase 
2020-03-14T19:19:14.023900+00:00 app[web.1]: (node:4) UnhandledPromiseRejectionWarning: Error: Something took too long to do.
2020-03-14T19:19:14.023927+00:00 app[web.1]: at /app/node_modules/discord.js/src/client/ClientManager.js:40:57
2020-03-14T19:19:14.023927+00:00 app[web.1]: at Timeout._onTimeout (/app/node_modules/discord.js/src/client/Client.js:436:7)
2020-03-14T19:19:14.023928+00:00 app[web.1]: at listOnTimeout (internal/timers.js:549:17)
2020-03-14T19:19:14.023929+00:00 app[web.1]: at processTimers (internal/timers.js:492:7)
Why do you think Heroku gives such a mistake when logging in the bot? It's been like this for the last few days. I have not changed the code.
ow very long sorry
read a few messages above
Use markdown π€¦π»ββοΈ
If used this code window.location = "google.com", redirect to localhost:8090/gooogle.com. But i want redirect to google.com.
Why that's not worked.
then.... just include the protocol?
did you try adding https://
add "https://" to the start
I know
without the protocol, you tell it that it is a relative path, not an absolute one
So i need to add?
yep
yes you need the protocol
Pf
lmaoo
Thx for information
this is the result of google trying to kill protocols from their browsers
Im trying to install lavalink on a raspberry pi 3, any idea why this error is occurring and how to fix it? https://hastebin.com/ocakevivaq.cs (sorry for sending this again)
fucking google it
Is any jobs hiring?
no
zSnails not trying to be rude but why are you so rude for little reason
because hes an angry snail
How to get bot developer role
Submit a bot (you made) and get it approved
have you by any chance tried reading a channel that's literally named frequently asked questions
You could have stopped there
@sudden geyser Thanks
tried to ban u? yes
/bots/{bot.id?}/check only returns if they have or not, not a timestamp right?
Language?
Yes, it's there's only a boolean value returned
Who knows good jobs for me. Payed jobs. DM me. Bot Development
Need a help on discord.js version 11
if(!new RegExp("(https?:\/\/)?(www\.)?(discord\.(gg|io|me|li)|discordapp\.com\/invite)\/.+[a-z]").test(message.content))
But it doesnt work for https://discord.gg/GY....
How can I fix it?
[a-zA-Z0-9]
It works thank you π
My lavalink is giving me Uncaught Promise Rejection Error: WebSocket is not open: readyState 3 (CLOSED)
The lavalink is hosted on raspberry pi
I downloaded it from Cog-Creators/Lavalink-Jars
on github
@heavy marsh np
I am trying to working on something like ...
Every 1 hour search in a group of channel like 10 -15 channels, 100 messages each that contains an invalid invite and delete them.
How can it be done easily on discord.js version 11?
What should I do to prevent the bot's commands from working over DM
what language
Turkish
What programming language are you using?
i really wish that wasnt as common as it is
@sudden geyser english
two times!
I have been waiting for my bot to be approved for a long time
Look up "Programming Language" xFalcon
@cold lion keep waiting
Vodka it takes ~2 weeks to get approved at the moment.
@sudden geyser I dont understand u
**WHAT PROGRAMMING LANGUAGE, PYTHON? JAVA? JAVASCRIPT? WHAT LANGUAGE MAN **
js
okay we're getting somewhere
We fucking did it boys
@turbid apex check if the message was sent in a dm. If you're using a JS lib like discord.js or eris you can use if (!message.channel.guild) {...}
is that your entire code?
just do it similarly to how you did exports.help
if you did <Command>.help.name, you'd be able to do <Command>.conf.guildOnly
is there a way to send a test vote event
After I know "guild0nly" is set to true, the command from the neck dm should not work.
@earnest phoenix button on the site
Anyone know how to fix Unexpected token after updated to discord.js 12.00.00 on glitch ? (I have change the node version and still getting the same error)
which button
can't find one
just use html lol
@earnest phoenix you need to use node.js v12 or higher
check engines in your package.json
and google exists for a bunch of reasons including that one
So i made a command called hug in my bot for it to show a randomized hugging gifs defined in my code but after use the command everything works except the gif doesn't load at all...
Is there something wrong in my code or... What's it...
that is not how tenor works
https://media1.tenor.com/images/34a1d8c67e7b373de17bbfa5b8d35fc0/tenor.gif thats the link you would need for the first gif
Why didn't you do it with the "for loop"
Oh... I see
K then... Imma try that...
@earnest phoenix well what did you search
first two results literally tell you how
and yh cry is right
there's more to those pages than fancy colorful code blocks, read the text that explains it
how do i use dbl.webhook.on
am i missing something because like
dbl.webhook isn't defined
oh okay
Hi
Shard x's Client took too long to become ready.
I have this problem
For my bot
you shoud also probably not take random images from google due to copyright @earnest phoenix
@earnest phoenix you need to use node.js v12 or higher
@quartz kindle yes I did I set it 12.x
and it still doesnt work?
Yep same error
I think discord is kind of acting kind of weird today idk why
Alright. I'm back and I need some help. I have gotten further along in my quest to develop my own bot but I have come upon a road block while trying to program the kick command. I keep getting the same error and I can not seem to find out why. Could someone look over my code and tell me whats going on?
mentions vs mention
hey guys im doing a https request from a discord bot to a website, i should receive back JSON but im getting a 403 forbidden.. i made a small react application and it works fine there.. am i missing some extra configuration/headers? any help would be appreciated
Thank u a lot @dusky marsh
@raven token if you're getting forbidden that means you do not have permission to access that endpoint
you will probably need to pass headers with the required authorisation
i have been trying to mimic browser headers and all but no luck yet
Anyone know how to fix Unexpected token after updated to discord.js 12.00.00 on glitch ? (I have change the node version and still getting the same error)
dude
an unexpected token
is a syntax err
the interpreter found a weird token
which means you fucked it up somewhere
I change the token like 10 times already
@earnest phoenix show full error
/rbd/pnpm-volume/958d50e7-3883-495c-9136-93cc721f0884/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/client/Client.js:40
7:05 AM
} catch {
7:05 AM
^
7:05 AM
7:05 AM
SyntaxError: Unexpected token {
7:05 AM
at createScript (vm.js:80:10)
7:05 AM
at Object.runInThisContext (vm.js:139:10)
7:05 AM
at Module._compile (module.js:617:28)
7:05 AM
at Object.Module._extensions..js (module.js:664:10)
7:05 AM
at Module.load (module.js:566:32)
7:05 AM
at tryModuleLoad (module.js:506:12)
7:05 AM
at Function.Module._load (module.js:498:3)
7:05 AM
at Module.require (module.js:597:17)
7:05 AM
at require (internal/module.js:11:18)
7:05 AM
at Object.<anonymous> (/rbd/pnpm-volume/958d50e7-3883-495c-9136-93cc721f0884/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/index.js:8:11)
I updated it and now it is message.guild.members.random(); is not a function
show your package.json
@quartz kindle {
"//1": "describes your app and its dependencies",
"//2": "https://docs.npmjs.com/files/package.json",
"//3": "updating this file will download and update your packages",
"name": "hello-express",
"version": "0.0.1",
"description": "A simple Node app built on Express, instantly up and running.",
"main": "server.js",
"scripts": {
"start": "node app.js"
},
"dependencies": {
"discord.js": "^12.0.2",
"express": "^4.16.4"
},
"engines": {
"node": "12.x"
},
"repository": {
"url": "https://glitch.com/edit/#!/hello-express"
},
"license": "MIT",
"keywords": [
"node",
"glitch",
"express"
]
}
yes now its correct
read this to learn how to change your code to v12 https://discordjs.guide/additional-info/changes-in-v12.html
Sorry. I am back again. I am working on my ban command now and I keep getting the same error could someone help me find out what I need to fix?
Oh thanks
Where is it saying user is defined?
One moment
you're defining user twice
ie ```js
const user = bla
...
random stuff
...
const user = bla```
lol
there isnt a specific thing you need to change it to
you just cant define 2 variables with the same name using const
first of all check why you are doing that
I updated it and now it is message.guild.members.random(); is not a function
@earnest phoenix
Anyone know a alternative to message.guild.members.random I canβt find one yet
all collection methods have been moved to cache
members.cache.random()
the only things that are not in the cache are API methods, such as .fetch, .create, .edit, .send, etc... things that need to send something to discord
?
i didnt tell you to remove message.guild
members.random() -> members.cache.random()
you just add the cache, nothing else changes
Wait did they change setPresence?
no
Ok
not you sorry
it's a little bit different
refer docs
always do that if you're unsure
the migrating page is also good
Did they remove streaming? Only playing and watching is on the docs
don't think so
what are you-
client.user.setPresence({
game: {
name: "in bed ποΈ",
type: "STREAMING",
url: "https://www.twitch.tv/monstercat"
}
Streaming
i sent a link
the docs has a really good search functionality. people should appreciate and try to actually use it
Is it not activity?
I meant the .set
it used to be game
client.user.setPresence({
game: {
name: "in bed ποΈ",
type: "STREAMING",
url: "https://www.twitch.tv/monstercat"
}
@earnest phoenix
Oh Iβm stupid
same. sometimes.
O I thought it was .setActivity. i guess presence works
i thought you meant the game: { and saying that it should've been activity: { which is correct
Is a say command a good idea?
I would say yea, depending on who you allow to use it and how it is used I guess
UnhandledPromiseRejectionWarning: Error: Shard 1's process exited before its Client became ready.
this error is fucking my bot up when i shard
how do i fix it
if(!message.channel.id==676786881161330690 || !message.channel.id==648905725963272204){
message.channel.send(invalid)
}else{
message.channel.send(worked)
}
Why doesn't this work? No errors, just makes it able to use anywhere and any channel. Btw, worked and invalid are const's of embeds.
Id's are channel ID's
@earnest phoenix what are you trying to achieve?
A channel whitelist
The first if sends an embed saying you can't use that in this channel, but the second one sends a working message
the seconds one always will send
no matter what channel
Hi
I bet you are sure the IDs are correct
message.channel.id != "channelID" @earnest phoenix
Yes
Do I need to use quotes around them?
oh thanks lol
discord lag
is a serious problem
I mean you can try it with the ""
Someone know How can I do my bot get emojis from where it isn't π
Yep
<:emojiname:emojiID>
If my bot isn't in the server where the emoji is, just post the name and not the emoji
oh
O
I think I have to use a function to get emojis but not idea what function XD
So do you want your bot to be able to post emojis for a say command?
my bot can post emojis only from the servers it is in
@earnest phoenix you can't do
if(!message.channel.id==676786881161330690 || !message.channel.id==648905725963272204){
message.channel.send(invalid)
}else{
message.channel.send(worked)
}```
It needs to be `message.channel.id != 676786881161330690`
if(message.channel.id!==676786881161330690 || ( message.channel.id!==648905725963272204)) {
message.channel.send(invalid)
}else{
message.channel.send(worked)
}
@stray topaz so if it can post emojis, what is it you need help with?
My bot can't post emojis from servers where it is not
It still posts the invalid embed
So you are doing <:emojiname:emojiID> Flash?
@earnest phoenix whats the embed then
Let me get it
const worked = new Discord.RichEmbed()
.setTitle(`New shift being hosted by ${message.member.displayName}!`)
.addField("Shift type:", "")
.addField("Game Link:", "")
.addField("Description:", "@<590783420255305739> , ")
.setTimestamp("Module 1.0.0 | ")
const invalid = new Discord.RichEmbed()
.setTitle("There was an error with this shift.")
.setDescription("Sorry, there seemed to be some trouble")
.setTimestamp("Module 1.0.0 | ")
@zenith terrace I removed some private info
Both worked before the whitelist
but now it just sends invalid
And I am using v11
@earnest phoenix Dont put it as .setTimestamp. That means about when the command was used. Put it as .setFooter
If you want the time, put it as .setTimestamp()
@zenith terrace yep that works,
But for this I have to copy Prefix.say <: emojiname: emojiID>
I'm asking if there is a way that if I copy **Prefix.say
** my bot it responds:
.
Hmm
The whitelist problem still persists.
Which part was that
me?
Mhm
@stray topaz I dont know about the bot being able to send it without an embed.
Unless it has the global emoji perm
if(message.channel.id != 676786881161330690 || ( message.channel.id != 648905725963272204)) {
message.channel.send(invalid)
}else{
message.channel.send(worked)
}
But it should
@earnest phoenix ids are strings, not ints
oh
The difference between == and === is that: == converts the variable values to the same type before performing comparison. This is called type coercion. === does not do any type conversion (coercion) and returns true only if both values and types are identical for the two variables being compared.
@earnest phoenix remove them
Meh
and remove those ()
It still didnt work right but I'm exp-
they aren't important
Ok it didnt work with the () then either
are you getting any errors
No, but it sends the invalid embed when the channel is correct
When it should be sending the working embed
show your current code
module.exports = {
name: "normshift",
desc: "Host a shift.",
usage: "",
execute: async (message, args) => {
message.delete()
const worked = new Discord.RichEmbed()
.setTitle(`New shift being hosted by ${message.member.displayName}!`)
.addField("etype:", "ee")
.addField("Game Link:", "")
.addField("Description:", "")
.setFooter("Module 1.0.0")
const invalid = new Discord.RichEmbed()
.setTitle("There was an error with this shift.")
.setDescription("Sorry, there seemed to be some trouble")
.setFooter("Module 1.0.0")
if(message.channel.id !== "676786881161330690" || ( message.channel.id !== "648905725963272204")) {
message.channel.send(invalid)
}else{
message.channel.send(worked)
}
}};
I had to remove some private info in the strings
So some are empty and some are random like ee
if(message.channel.id !== "676786881161330690" || ( message.channel.id !== "648905725963272204")) {
return message.channel.send(invalid)
}else{
message.channel.send(worked)
}
}};```
remove those ()
Done
if(message.channel.id !== "676786881161330690" || message.channel.id !== "648905725963272204") {
return message.channel.send(invalid)
}else{
message.channel.send(worked)
}
}};```
U removed the ( ) yea?
Yes
3 different channels; two are whitelisted and one is not. They all send invalid
Ahhh I feel dumb; I copied a user ID right before pasting it.
Oof
v.v
But it still won't work.
For some reason
And yes, the channel IDs are right this time lol
Hello. I am trying to set up permissions on my server and I keep getting the same error. Could I get some help?
I mean
Im back lol
msg is not defined
no
oooooooooooo
you forgot a ) at the end of the if statement
and use if statements with {}
just for the sake of clean code
u r very helpful thank u a lot
np lol
noice
@earnest phoenix ima try it on my bot
mk
yeah
i told u
msg.member.roles.find()
you're doing msg.member.role.find(), but it's msg.member.roles.find()
your package.json file
but you did npm install discord.js
show what's inside your package.json file
where it says
dependencies
@earnest phoenix change the || to &&
Oh?
Mhm
Discord JS 12
yeah
Thats what I am using
I wasnt expecting that but okay
ok let me try that
or was it msg.member.cache.roles.find()
try both
if the first works then don't try this last one
find should work tho
The unwhitelisted message sents the working one now lol @zenith terrace
unwhitelisted channel sends*
message.delete()
const worked = new Discord.RichEmbed()
.setTitle(`New shift being hosted by ${message.member.displayName}!`)
.addField("etype:", "ee")
.addField("Game Link:", "e")
.addField("Description:", "e")
.setFooter("Module 1.0.0")
const invalid = new Discord.RichEmbed()
.setTitle("There was an error with this shift.")
.setDescription("Sorry, there seemed to be some trouble")
.setFooter("Module 1.0.0")
if(message.channel.id !== "channelID" && message.channel.id !== "channelID") {
return message.channel.send(invalid)
} else {
message.channel.send(worked)
}
};``` @earnest phoenix Thats why I have and it works fine on my bot
so I'm not familiar with everything they changed
Idk what i am doing wrong at this point
.roles.cache.get
I'm on v11, and it doesn't work if it makes any difference
Nope still doesn't work says "Roles" is undifined
Send your code again
oof
hold on
I am screenshoting currentlyu
oof
module.exports = {
name: "normshift",
desc: "Host a shift.",
usage: "",
execute: async (message, args) => {
message.delete()
const worked = new Discord.RichEmbed()
.setTitle(`New shift being hosted by ${message.member.displayName}!`)
.addField("Shift type:", "")
.addField("Game Link:", "")
.addField("Description:", "")
.setFooter("Module 1.0.0")
const invalid = new Discord.RichEmbed()
.setTitle("There was an error with this shift.")
.setDescription("Sorry, there seemed to be some trouble")
.setFooter("Module 1.0.0")
if(message.channel.id !== "676786881161330690" && message.channel.id !== "648717359632351283") {
return message.channel.send(invalid)
}else{
message.channel.send(worked)
}
}};
``` @zenith terrace
uuuuuuuuu
@earnest phoenix remove the double spacing after &&. Should only be one. Idk if it makes a difference but try
show
I will
There is a double spacing
Removed
is it only 1 space now?
I need to use bigger screenshot sorry
Yes
you didn't show the error brosky
got it
that's just the traceback
@dapper hill Do you want only people with the BOT TESTER role to use the command?
Still doesn't work
Yes I want it so if you dont have the perm "Bot Tester" than you can't use the command. (Ping is just a filler for now)
I was told that I need to capitilise the role in the code
even if it isnt capitilized
in discord
is that correct?
try changing .get to .find
.find dont work
no no thats defintly not the error
how come
I tried it before
find is a prototype of arr
thats what we were fixing previously
so it should work
yeah
Array.prototype.find()
@earnest phoenix which part dont work. Which one is it sending
just let me know the error
there isnt a error the Role command just simply doesnt work
u sure
he's using v12 right
ya its like its not even there
send the code for the Role command
ok
if(!msg.member.roles.cache.get(r => r.name ==== "Bot Tester"))
return channel.reply("You dont have the Bot Tester role")``` @dapper hill
if we haven't seen the code then how are we supposed to help lul
@earnest phoenix triple check the IDs
Triple checked
it doesn't send the message right?
so you're making it so that it send the message if the member doesn't have the role?
if(!msg.member.roles.cache.get(r => r.name ==== "Bot Tester"))
return channel.reply("You dont have the Bot Tester role")``` @dapper hill
k

change it from channel.reply to msg.channel.send
also put return thing inside a block or inline
I added that there is now this error
lol of course
i
omg
sorry didnt see ur post
lmao
π«
@earnest phoenix idk. Works fine for me
Sigh
what's the problem?
Scroll ^
i scrolled but to no avail
module.exports = {
name: "normshift",
desc: "Host a shift.",
usage: "",
execute: async (message, args) => {
message.delete()
const worked = new Discord.RichEmbed()
.setTitle(`New shift being hosted by ${message.member.displayName}!`)
.addField("Shift type:", "")
.addField("Game Link:", "")
.addField("Description:", "")
.setFooter("Module 1.0.0")
const invalid = new Discord.RichEmbed()
.setTitle("There was an error with this shift.")
.setDescription("Sorry, there seemed to be some trouble")
.setFooter("Module 1.0.0")
if(message.channel.id !== "676786881161330690" && message.channel.id !== "648717359632351283") {
return message.channel.send(invalid)
}else{
message.channel.send(worked)
}
}};
``` @zenith terrace
@pale vessel
any error?
bruh
I have the bot tester role and it says that I cant use it
No, it works, but the whitelist part doesnt, it always sends working in all channels instead of the whitelisted ones
It sends the worked embed in the non wgitelisted channels
even tho I have the role needed
There r two roles Bots and Bot Testers. its not only bots its like 10 of my friends and me and around 4 bots that we are all working on together
are the ids you defined bad?
it's the one you wanted to whitelist right
Yes
There r two roles Bots and Bot Testers. its not only bots its like 10 of my friends and me and around 4 bots that we are all working on together
@dapper hill You put in the code"Bot Tester"not"Bot Testers"
Both of them
night told me to
&& works
I used || but it didnt work either
channel can't have two ids
nore in the code
what the hell
^my reaction
change it back
@dapper hill Double check the role name on Discord. Make sure it is spelled the same way as in the code
yes it's case sensitive
wha
O
no
Its prefix is &&
shit
&&
and it responds to the prefix
wtf
wow rude
@pale vessel doesnt work
any error?
Hmm
reverse it
don't use &&, bc you're checking if the channel has both ids
message.delete()
const worked = new Discord.RichEmbed()
.setTitle(`New shift being hosted by ${message.member.displayName}!`)
.addField("etype:", "ee")
.addField("Game Link:", "e")
.addField("Description:", "e")
.setFooter("Module 1.0.0")
const invalid = new Discord.RichEmbed()
.setTitle("There was an error with this shift.")
.setDescription("Sorry, there seemed to be some trouble")
.setFooter("Module 1.0.0")
if(message.channel.id !== "ChannelID" && message.channel.id !== "ChannelID") {
return message.channel.send(invalid)
}else{
message.channel.send(worked)
}
};```
My code is changed a little bit but it still works
Meh
unless you're on c
Deal with the pain
switch it?
which requires them after a struct def
literally what you're checking is
if this channel has the id <id> and it also has the id <id> do this
which is impossible
cuz channels only have 1 id
I already did snail
a
yeah i said that
I'm kinda blind tbh
try using some
because you use it
when && works for me xD
weird
rrrEE
fix your machine
so
const thingies = ['id1', 'id2']
if(thingies.some('id') || thingies.some('id')){}?
e
ok
The "CapsLk" feature is on but the letters are all. When its off it does capital letter
π
My keyboard being weird
Ok it fixed itself
it has its own mind 
Yes
&&
O the bot muted?
Kicked
xD
@drowsy sentinel I think you only meant to mute a bot if it does that
No sir/ma'am, I cannot stop bots from sending DMs by muting them.
@pale vessel node:14) UnhandledPromiseRejectionWarning: TypeError: message.channel.id.some is not a function
yeah i ducked up
I'm in v11
:p
Some random messages of mine take 9999 years to send
why
doe
try reversing the thing like: ```js
if (msg.channel.id == "id" || msg.channel.id == "id") {
Valid
}
else {
Invalid
}
===
whatever
== big gay
lul
i do it to save space
i trust zSnails only because of their pfp
@pale vessel now it just sends valid all the time in all channels
just in case, you changed msg to message right?
yes.
can i view the latest code?
module.exports = {
name: "normshift",
desc: "Host a shift.",
usage: "",
execute: async (message, args) => {
message.delete()
const arrays = ['676786881161330690','648717359632351283']
const worked = new Discord.RichEmbed()
.setTitle(`New shift being hosted by ${message.member.displayName}!`)
.addField("Shift type:", "")
.addField("Game Link:", "")
.addField("Description:", "")
.setFooter("Module 1.0.0")
const invalid = new Discord.RichEmbed()
.setTitle("There was an error with this shift.")
.setDescription("Sorry, there seemed to be some trouble")
.setFooter("Module 1.0.0");
if (message.channel.id === "676786881161330690" || message.channel.id === "648717359632351283") {
message.channel.send(worked)
}else{
message.channel.send(invalid)
}
}};
i need to remove arrays
try changing === to ==
because we're stupid
ig
Hey, I was trying creating a simple dashboard for my bot but after doing installation it doesn't run anything and it is hosted on glitch when I turned on debugger it throws this error in console (node:6119) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:1988 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1054:14) (node:6119) 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(). (rejection id: 1) (node:6119) [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.
your webserver refused the connection
but why
Should I, instead of using ||, put the two ID's in different if statements? @pale vessel
nope
yeah i thought so
both
glitch, even tho it can be the same most times with vs
Fun
Hey
hello
.setDescription(`Available commands for PollMate \n \n Prefix: ${}`)
I'm trying to make my prefix somwhat like this
**Prefix: ** pm!
do you know how i could do that?
I'm having trouble putting the prefix in `
make it a variable or require it from a config file and then use ${prefix} or whatever the variable is
if i understand
what you want
communist doggo approval
I can get the prefix ez
then what's the problem?
?
put a backslash
Look
under escape
yes it works
his prefix has `
.setDescription(`Available commands for PollMate \n \n Prefix: `\`${prefix}\``)```
Like that?
yes
or why are you using template literal when there's no variable to put
use normal quotes
Ok.
it doesn't matter
@pale vessel U know how we were struggling to get the ID for the ping command guy?
how?
big oof
rip Void
Right, it works.
im gonna ping discord and tell them to get me help
Name is undefined.
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('message', async message => {
module.exports = {
config: {
name: "leaderboard",
usage: "!leaderboard",
description: "",
permissions: "none"
},
run: async (bot, message, args) => {
if (message.mentions.users.first()) {
var output = await eco.Leaderboard({
filter: x => x.balance > 50,
search: message.mentions.users.first().id
})
message.channel.send(`The user ${message.mentions.users.first().tag} is number ${output} on my leaderboard!`);
} else {
eco.Leaderboard({
limit: 3, //changable
filter: x => x.balance > 50
}).then(async users => {
if (users[0]) var firstplace = await client.fetchUser(users[0].userid)
if (users[1]) var secondplace = await client.fetchUser(users[1].userid)
if (users[2]) var thirdplace = await client.fetchUser(users[2].userid)
message.channel.send(`My leaderboard:
1 - ${firstplace && firstplace.tag || 'Nobody Yet'} : ${users[0] && users[0].balance || 'None'}
2 - ${secondplace && secondplace.tag || 'Nobody Yet'} : ${users[1] && users[1].balance || 'None'}
3 - ${thirdplace && thirdplace.tag || 'Nobody Yet'} : ${users[2] && users[2].balance || 'None'}`)
})
}
}
}})
Error code:
at load (C:\Users\Cools\dog1bot\handlers\command.js:15:36)
at C:\Users\Cools\dog1bot\handlers\command.js:29:27
at Array.forEach (<anonymous>)
at C:\Users\Cools\dog1bot\handlers\command.js:29:14
at FSReqCallback.oncomplete (fs.js:152:23)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fyre@1.0.0 start: `node src/index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fyre@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Cools\AppData\Roaming\npm-cache\_logs\2020-03-15T04_56_51_456Z-debug.log
C:\Users\Cools\dog1bot>```
how are u even
u have a command handler right
yeah
and that code is inside another file right
Where is this "name", phone doesn't help +_+
@zenith terrace same
yeah
why are you creating another client
cause it couldn't define it
and you don't need a message event
so i just 'solved' it by making another one
yeah no
well then it says client isn't defined
pass client as a parameter inside the run function
I just got off my laptop since its past 5am
how would i do that?
do you know how functions work?
not really
I legit cannot find this "name" of undefined
function add(param1, param2) {
return param1 + param2;
}
//we have the add function, which takes in 2 params, when we call the function we'll be passing in 2 numbers to be added
add(2, 2);
//here we are calling the add function and the code inside of the function will be run, in this case param1 + param2 which gets converted to 2 + 2
Idk If I'm explaining this ok
I mean I get the gist out of it
huh
so you need to pass name to the function
so is it possible to then replace the client with the param?
the code is already a mess
@astral yoke yes it is
that code is inside a function
when you do run: async () => {}
that's a function
callback
no
I'm going to use the excuse of it's 1am
I'm not a good teacher
@west raptor understandable
params can be anything you want
so modify them in order to pass client
for example
add client as the last param
and in your command handler pass in client at the end of the function call
I'm should stop
also please learn JavaScript and nodejs @astral yoke
Lol
not even knowing how functions work is kinda concerning while coding a bot
yeah
function? what's that 
sure some people learn like this but it saves so much trouble you just follow a crash course or something
@pale vessel a thing that makes your computer uhh do stuff
computer goes beep boop
oh
Nah it makes your computer buy food
I hate typing on mobile
Same
Especially trying to type code
and no syntax highlighting
tbf syntax highlighting on mobile would just make it worse
not for me
with all the wrapping and shit?
yeah
Guess what guys?!?!?
Im back

How would I make it so if someone doesnt type either of theys commands like ?info Author or ?info Version it will respond with Invalid Command. Right now what it does is it will respond with both so if I type ?Author it will reply with "Version 0.5 Tmax7055" and if I type ?Version it replys with "Version 0.5 Invalid command"
Also could u @ me when you respond because I have this server muted. For reasons.
@dapper hill try something like
//Send message here
} else {
if(args[1] === SomeOtherThing Here) {
// send message here again
}
if(!args[1]) return msg.channel.send("Invalid Command")
That might be why it sends both is because you aren't defining them as seperate args with a else if that makes sense I'm honestly horrible at explaining this stuff lol
no no its fine as long as the code works I can read it and get the jist.
^^ might be a better method
and it looks cleaner
True
wait use switch where @pale vessel
after case 'info'
?
case 'info':
switch (args[1].toLowerCase()) {
case 'version':
break;
case 'author'
break;
default:
break;
}
break;```
ya but if the person doesnt type either I want it to respond with "Invalid command"
there
do I type the message underneath each case?
yes
ok
like normal
If I want to add a || do i have to put paranthisis if I want to do that
so I can make it so you can do capital and lowercase
no you can't do that. you can do something like ```js
case 'one':
case 'two':
stuff
break;
wait i did it for you
so now you only need to type lowercase
because uppercase is already converted to lowercase
just make sure that args[1] exists
you can check that yourself
i can't spoonfeed more






