#development
1 messages · Page 1219 of 1
He asked for a template not a whole website
What?
since my bot isn't even published
no it isnt
bruh
Injection? 
ok how should i secure it
You will want to make a server in something like express and use passport
never return a password to front-end is the most important one
SSL certs, state parameter in oauth, don't expose anything sensitive to the frontend

:(
you need to be actively aware of popular web vulns
also make sure to follow-up your requests with XSRF tokens (if you're not doing SSR)
is this not set up correctly to look for either a role OR if the message author is also the guild owner?
} else if (message.member.roles.cache.find(r => r.id === moderation) || message.author.id === owner) {
OR if the message author is also the guild owner
are you sure you're comparing the ids?
why ${client.guilds.cache.reduce((a, b) => a + b.memberCount, 0).toLocaleString()} is showing NaN Users?
are you sure you're comparing the ids?
@earnest phoenix Yes I am sure...the 2 parts work correctly by themselves but putting them together makes it not work
Can someone give me ideas of commands to add into my bot? I'm really out of ideas
My bot is mainly focused on entertainmment
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: module 'discord.ext.commands' has no attribute 'guilds'
geting this issue from a cog
using py
Can someone give me ideas of commands to add into my bot? I'm really out of ideas
@stark pasture commands that return random pictures of dogs or animals or memes or something?
I already have one of these but it's with cats
thanks for the idea
I will make another

Any other idea? 
i need a website 😭
@charred geyser dm
https://sourceb.in/0923adbb35 This is the code...But it's running the else if and not the else statement
${client.guilds.cache.reduce((a, b) => a + b.memberCount, 0).toLocaleString()} why the result is NaN
??
a.memberCount
should i:
a) make a better website
b) add more commands and cleanup code in my bot
hmmm
😮
e) come back tomorrow
https://sourceb.in/f244d2fc33 should skip line 26 and go to line 29 but it's not
bruh
@grim needle moderato
moderator
so does that count as like level up?
Is not spam
yeah
it will just be muted in this server
is that against the rule?
it will just be muted in this server
oh... when will it be unmuted?
when you've disabled it for this server
any automatic command will make your bot be muted until you either remove it or disable it
it actually sent message when a new users joins, not like
@quartz kindle proud?
its someone else's server
its just an example of editing a servers settings using my bot
it displays all servers a user has perms in
and i think it is fairly secure
@fast trench you're doing !a === b
@quartz kindle didn't work lol
@fast trench did you fix it tho?
nope 😅 and I've been told 50 different things in 2 other servers so idk what I've tried at this point
no i mean
i told you that !a === b is wrong
it should be a !== b
did you fix that?
I know you said that...It doesn't work how you said
ok but did you change it? or put it back to how it was before?
change it then show the changed code
<input type="text" name="prefix" value="<%= settings.prefix %>" placeholder="Your prefix."><br><br>
Cannot read property 'prefix' of null
not sure idk py
@fast trench also, it should be an && instead of an || in this if
for your console logs...it logs the id's correctly...and I'll try that
how would i reference a model in ejs
like: value="<%= settings.prefix %>"
i want that the = the prefix in my Schema
That worked @quartz kindle idk why I didn't realize that lol
I have a question 😦
so i used heroku to host my bot for me, but my music command is not working somehow
it is buid succeed, and other command are working perfectly
language:python
heroku is too weak to handle music
heroku is good for begining.

heroku is too weak to handle music
@earnest phoenix no its not
i run it perfectly fine
50+ servers
can play music with no lag whatsoever on like 10 servers at once
because your bot is tiny and nobody uses it lol
?
put it under stress and you'll see how much it begins to choke
no need to be mean tho
because python caches all it wants
for me it works well
because your bot is tiny and nobody uses it lol
@earnest phoenix
...that isn't being rude, is it? i stated that the bot is tiny
and that nobody uses it so there's no stress
well on 10+ servers at once it runs music
we don't count ourselves in how active the bot is
also it depends on how big the other servers are
does ffmpeg work on streams?
ffmpeg works with pretty much any format you can think of
I just googled ffmpeg streaming
@unique nimbus like yt live streams
What’s the equivalent of client.guilds.size in v12 that isn’t client.guilds.cache.size
same question for client.users.size
Why can't it be client.guilds.cache.size? That is the equivalent^^
Because it’s only cached guilds and cached users what about the uncached users and guilds
message.channel.send(${args[1]} is not a valid symbol.);
how do i add a highlight inside of ``
like this
escape the ` symbol
how
\
ok
My bot is in 4 bot lists with 75k+ users so about 300k-400k+ and it’s saying the bot has 100k overall users using client.users.cache.size
How can I put my bot to the test
I calculate the members by adding up the memberCount property of the guilds
What test ?
How can I add my bot to the site
@obtuse jolt client.guilds.cache holds all guilds
@rare crow You go to the homepage, and follow the steps in Add Bot
Okay thank
why the npm youtube-search dont work?
My bot is in 4 bot lists with 75k+ users so about 300k-400k+ and it’s saying the bot has 100k overall users using client.users.cache.size
@obtuse jolt cache is for online mmebers in large servers
it’ll go up and down
iirc
why the npm youtube-search dont work?
As much as you may believe so, we don't have the technology yet to read your mind and see what you mean by "doesn't work" so for now could you explain what you mean by "doesn't work"?
const opts = {
maxResults: 1,
key: process.env.YOUTUBEKEY,
type: "video"
};
await search('space is cool', opts, function (err, results) {
console.log(results)
});```
@split hazel https://i.imgur.com/5TUoEFu.png
well... did you try see if err is defined...
const opts = {
maxResults: 1,
key: process.env.YOUTUBEKEY,
type: "video"
};
await search('space is cool', opts, function (err, results) {
if(err) {return console.log(err)}
console.log(results)
});```
Can i get some ideas for commands for my bot pls? 
how do i complete a process when i catch a error
for some reason my bot appears like "unknow status"
the whole site has been like that
something to do with cloudflare
nothing you did its server side
Can i get some ideas for commands for my bot pls?
hey man why ${client.guilds.cache.reduce((a, b) => a + b.memberCount, 0).toLocaleString()}
the result is NaN?
works for me
a is also an instance of Guild
So you need to use .memberCount on it as well.
@marble geode
help
how do i use github
helphelphelp
i'm a noob i'm so sorry but i need to upload my python code on github for my code to run 24/7
heck I didn't know that
it worked for me
i'm halfway across the world from people using my bot
Using git will probably be your solution, but it takes some time to learn it.
ooh okay
Try npm install discord.js@12.3.1 if you want v12
GitHub hosts your code by making it accessible remotely, but doesn't actually run it in most scenarios. Think of GitHub like your closet for storing stuff.
Since its remote, you're able to download it then run it locally.
i need some help with embeds
sure
whenever i run my bot with it it says "client" is not defined
and i do have it defined
what did you define your client as?
"bot"
i am
whenever i run my bot with it it says "client" is not defined
client is not defined because you defined it as bot
change client to bot
doesn't matter but i recommend you rename everything to client because that's what discord.js use internally
in your embed, avatarURL() is a method so you need to add ()
you should use displayAvatarURL() so that it supports users with no avatars
now i get ReferenceError: Cannot access 'Client' before initialization
is it case sensitive
still regardless if it is or not i still get the same error
up top i have
const bot = new Client();```
Discord.Client()
(also on the front page of the djs website)
and yes javascript is case sensitive
Yeah, It needs to be
const Discord = require("discord.js");
const bot = new Discord.Client();
function ExpCount(exp, level) {
let e1 = 1 - (1.15^level);
let e2 = 1 - (1.15);
let e3 = e1/e2;
let e4 = e3*exp;
return e4;
}
ExpCount(5, 90)
Why is this function not giving me the same result as this :
jesus christ
Btw, Output = 3000.000000000002
the ^ operator is xor, you are searching for **
map = 'MIRAA'
if (!map == 'MIRA' || !map == 'SKELD' || !map == 'POLUS') {
console.log('fix')
message.channel.send('Map must be `SKELD`, `MIRA`, or `POLUS`')
return
} else {
console.log('no fix')
}
//returns 'no fix'
why it returns no fix?
ah nvm
! negates 
yes
btw must it be != or !==
i got it to .toUpperCase()
whats that?
im on phone so it's a bit of a pain to explain, but this doc link might help you
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness
Since its remote, you're able to download it then run it locally.
@sudden geyser that’s what I thought it’s just the context made me think they were hosting it in github, like host host
lol still waiting for my bot to get verified
i havent still solved my problem
how it is returning no fix
i tired !=
and !==
and !==
i dont even know if this is a thing
Your checking MIRA against MIRAA
so it will not return true and do the else
which is no fix
map = 'MIRAA'
if (!map == 'MIRA' || !map == 'SKELD' || !map == 'POLUS') {
console.log('fix')
message.channel.send('Map must be `SKELD`, `MIRA`, or `POLUS`')
return
} else {
console.log('no fix')
}
//returns 'no fix'
@carmine summit
it is negetated
MIRAA ≠ MIRA therefore it’ll go to the else(?)
What I mean is, if map is not equal to map it will log fix
if it is equal, it must log no fix
no
The ! operator turns map to a boolean value
i updated it to != and still doesnt work
Can you post your updated code
map = 'MIRA'
if (map != 'MIRA' || map != 'SKELD' || map != 'POLUS') {
console.log('fix')
message.channel.send(`Error: \`${map}\` is not a valid response. Map must be \`SKELD\`, \`MIRA\`, or \`POLUS\``)
return
} else {
console.log('no fix')
}
//returns 'fix'```
returns fix always
even if it is 'MIRA' or 'MIRAA'
it returns 'fix'
Try replacing the OR operator with the AND operator
IF
map is not MIRA (false)
OR
map is not SKELD (true)
OR
map is not POLUS (true)
= true
AND is for all conditions needs to be true
uh
OR is for any condition that can be true
it works
but im confused
nvm
im an idiot
lol
BTW how do I make a hyperlink to a specific channel?
like #general
bot takes it as a text
<#channelId>
how do you use promise.all to wait for a set of promise actions to finish
like is this right
const actions = items.map((x) => this.delete(x._id));
const results = await Promise.all(actions);
yeah it accepts an array
then i could do like
results.filter((x) => x === true).length
to only get the amount that worked right
though if any promise gets rejected, the entire promise.all will be rejected regardless of whether other promises are resolved
yeah that's fine i've got a try catch to just pass it through
it's a sweep func to delete all items from my db that match a filter so
then i could do like
results.filter((x) => x === true).length
to only get the amount that worked right
yeah that works
actually
if you're using async await
the entire function return is a promise
so I don't think you need to manually resolve or reject it
iirc in async if the rejection is not handled, it will automatically reject
sublime
is it possible to put 🇨 and 🇩 next to eachother without it turning into 🇨🇩
yeet
Do C \u200b D
you don't need to do that
ok
It's a way of getting around it
Lol
😔
i stand corrected
;
you probably have one or two unclosed brackets above
ok
What is not correct? https://hasteb.in/idikumed.js
Unknown stream type
Yeah but why? How can i fix it?
........
so i somehow made a json db that takes up over 700 lines
@sick cloud why
So... You're buffering and shit?
AAAAAA that is cursed
OKAY MISTER BOOLEAN MAN
ok this is about as good as it gets
let boolean = {values:{true:true,false:false},true:function(){return true;},false:function(){return false;},random:function(){return!!Math.round(Math.random())},boolean:function(arg){if(isNaN(arg))throw "Provide a number to boolean";if(arg < 0.5)return false;if(arg>=0.5)return true;}}
@misty sigil >:(
as if it isn’t outlined in #502193464054644737
@pure lion yea actions are queued and it also does back ups
ok fair enough
wouldn't use it in prod of course
My bot has been having very high pings for a week. Initially I thought it was the database, but changing host of the MongoDB database hasn't changed anything. I then already asked in this chat and they told me that the problem was the host, or Heroku Free. I then switched hosts to a Linux VPS, but the pings still remained high. As I was advised last night on this channel, I tried to use the same host for a bot with only the ping command and the pings are all normal. So I ask you, is there anyone who really wants to help me?
Hello
let bioStatus = args.slice(2).join(" ");
if(bioStatus.length > 80) {
const lengthEmbed = new Discord.MessageEmbed()
.setDescription("Your bio contains more than 80 characters.")
.setColor(colors.cyan)
return message.channel.send(bioStatus)
}```
I am making a command
!profile bio set <message>
When the message length is more than 80, it doesn't return
I even putted return message.channel.send(lengthEmbed)
Okay this should in no way be seen as offensive
but
are you braindead
@feral aspen can you see
do your eyeballs work
Why are you being mean?
you can SEE that you defined an condition where, if the message is over 80 characters long, nothing happens
that is basic logic
if you cant do that, how do you even live
if(bioStatus.length > 80) {
this says "if bioStatus is above 80, skip everything inside the brackets"
the brackets: ```
{
const lengthEmbed = new Discord.MessageEmbed()
.setDescription("Your bio contains more than 80 characters.")
.setColor(colors.cyan)
return message.channel.send(bioStatus)
}
surprised pikachu face
What can I do to make it return
define a else {} condition
or no nvm
you just made the > the wrong side
replace the > in your if() statement with <
bruh
wait nonononono
oh no no no 
did you actually test it with a description over 80 chars long
@feral aspen looks like you're sending bioStatus rather than the lengthEmbed
that can be an issue too
What's the error
[arg0, arg1, arg2, arg3] becomes arg2 arg3
so you need to do like !something something else actual description
I have a system like !profile bio set <message> if message is more than 80 characters, it return
but it doesnt return
then the message isnt over 80 chars long
Did you try console logging bioStatus to see if you've got the right thing?
Yes it is right
But it doesnt return if more than 80 characters
It just continues.
Did you try console logging bioStatus.length as well?
Yes
It shows the <message>
Why doesn't it not return
let bioStatus = args.slice(2).join(" ");
if(bioStatus.length > 80) {
const lengthEmbed = new Discord.MessageEmbed()
.setDescription("Your bio contains more than 80 characters.")
.setColor(colors.cyan)
return message.channel.send(lengthEmbed)
}```
It shows the <message>
Do you mean it shows the lenght of the message or the message itself?
HAHA! @obtuse dove
the message it self
@feral aspen what do you mean by that
Please read back before you start to answer or ask questions
I am trying to make a code where, people do !profile bio set <message> if message's length exceeds than 80 characters, it returns saying you cannot put a message more than 80 characters
If bioStatus.length console logs the entire message then you've done something wrong 
Now I made a message and it exceeds, but it doesnt return for some reason
log bioStatus for us
Also, @earnest phoenix you were a real dick when you tried to "help", please don't do that again...
i also just realized i was completely fucking wrong
im sorry, i woke up like 40 mins ago and my bad was really god damn bad until now, my nerves are kind of gone
wont happen again
it doesnt log
wdym
so bioStatus is a string?
huh
if more than 80 characters I make it return, but it doesnt return.
const lengthEmbed = new Discord.MessageEmbed()
.setDescription("Your bio contains more than 80 characters.")
.setColor(colors.cyan)
if(bioStatus.length > 80) return message.channel.send(lengthEmbed)
bio[user.id] = {
name: bot.users.cache.get(user.id).tag,
bio: bioStatus
}
fs.writeFile("./bio.json", JSON.stringify(bio), (err) => {
if(err) console.log(err);
});
console.log(bioStatus)
let newBio = new Discord.MessageEmbed()
.setTitle('Profile Bio')
.setDescription(`Successfully set your bio to **${bioStatus}**`)
.setColor(colors.cyan)
.setFooter(`Created by HamoodiHajjiri!`, bot.user.displayAvatarURL())
.setTimestamp();
message.channel.send(newBio)```
ok
Why it doesn't return?
i dont see anything wrong with that
you say bioStatus.length returns the string right?
no
if the biostatus string exceeds 80 characters, it returns
returns an embed saying you cannot exceed
Did you try console logging
bioStatus.lengthas well?
It shows the <message>
?
Idk what I did, but thank u!
Can i get a pic of Api options section of ur top.gg bot? ( with everything blurred except the URL )
Idk what url to put there :/
!p انا دمي فلسطيني $$ محمد عساف Mohammed Assaf
sude
API is only for DBL
do u know anything about dblapi.js ?
!p I' m my Palestinian blood
!p I'm my Palestinian blood
!p I'm my Palestinian blood
Please can someone help me, i think im getting ddosed / bruteforced.
suddenly only like 10% of ssh connection tries (via putty) actually connect.
This is my resources graph, that went up last night, wthout changing anything to the code the past couple of days.
anyone knows what could be going on?
me?
yes
what i wrote above
"suddenly only like 10% of ssh connection tries (via putty) actually connect.
This is my resources graph, that went up last night, wthout changing anything to the code "
10% is succesful
yes
hmmm
idk but u still can connect normaly right ?
yes 10% of the time
Put it behind cloudflare 
but like, i can only put the domain behind cloudfare right? not the ip?
You can't do much about it unless you know who's doing it and can slap them in the face for it, set up ufw if you haven't already but that's about it
And keep your IP a secret I guess
okay but i think i disabled root ssh access and using ssh key to connect to the only other account, ufw is also set up... so if the attacker doesnt bruteforce my ssh it should be good?
(i done really care about the increased resources, because the website is basically static and still works fine)
I guess
okay, still it really frightening^^
is this kind of attack known? maybe it is not targeted at my bot, but a crawler type thing and will go on to the next when it doesnt succeed for some time?
No clue
guys
is it possible to create restriction command using collection instead of database?
do u know anything about dblapi.js ?
@earnest phoenix No
huh
Im not used these things
How can i do in discord js v 11.5.6 to change the name of a group
group?
dm group channel
probably
is it possible to create restriction command using collection instead of database?
@open rune guys, please... xd
does somone have a welcome api?
So, I am thinking to make restriction command, thus if you use this command, you can restrict the use of intended command for only few roles, but it seems I can only restrict the command only for a role.
and I am currently using collector
im beginner and i need help before my script worked now i have this error C:\Users\artur\DiscordBot>node .
C:\Users\artur\DiscordBot\Main.js:6
client.once('ready', => {
^^
SyntaxError: Unexpected token '=>'
[90m at wrapSafe (internal/modules/cjs/loader.js:1053:16)[39m
[90m at Module._compile (internal/modules/cjs/loader.js:1101:27)[39m
[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)[39m
[90m at Module.load (internal/modules/cjs/loader.js:985:32)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:878:14)[39m
[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)[39m
[90m at internal/main/run_main_module.js:17:47[39m
here code
// JavaScript source code
const discord = require('discord.js');
const client = new Discord.Client();
client.once('ready', => {
console.log('DarkTardis Status - Online')
});
client.login
what should i do with it?
client.once('ready', () => {
}
try this maybe
ok
client.on("ready', () => { //once or on both will work
console.log('DarkTardis Status - Online')
})```
next error C:\Users\artur\DiscordBot>node .
C:\Users\artur\DiscordBot\Main.js:4
const client = new Discord.Client();
^
ReferenceError: Discord is not defined
at Object.<anonymous> (C:\Users\artur\DiscordBot\Main.js:4:16)
[90m at Module._compile (internal/modules/cjs/loader.js:1137:30)[39m
[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)[39m
[90m at Module.load (internal/modules/cjs/loader.js:985:32)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:878:14)[39m
[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)[39m
[90m at internal/main/run_main_module.js:17:47[39m
const Discord = require("discord.js")```
@small zenith error too C:\Users\artur\DiscordBot>node .
C:\Users\artur\DiscordBot\Main.js:6
client.on("ready', () => { //once or on both will work
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Invalid or unexpected token
[90m at wrapSafe (internal/modules/cjs/loader.js:1053:16)[39m
[90m at Module._compile (internal/modules/cjs/loader.js:1101:27)[39m
[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)[39m
[90m at Module.load (internal/modules/cjs/loader.js:985:32)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:878:14)[39m
[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)[39m
[90m at internal/main/run_main_module.js:17:47[39m
@open rune i have this
show code
ok ok, calm down.
// JavaScript source code
const Discord = require('discord.js');
const client = new Discord.Client();
client.on("ready', () => { //once or on both will work
console.log('DarkTardis Status - Online')
})
client.login
ik im calm
client.login(token)
u have client.login or client.login("ur bot token")
i have token in
does somone have a welcome api?
ok
but i dont show it
ok take e look to the quote
did you have installed discord.js library already?
("ready',``` use both `"` or `'`
ok
or `
lel
IT works thx!
thx tomoka
Good
my eye sight weak =w=
say Arigatou for her xddd
Arigatou Tomoka
Arigatou, omaewa mo shindeiru
when will pros come online :/
I want someone to help me with that fkin webhook thing
hey can someone help me
with the referenceerror: mesagge is not defined
const Discord = require("discord.js");
const client = new Discord.Client();
client.on("ready", () => {
console.log("Ready!");
});
const embedz =
new Discord.MessageEmbed()
.setColor("#FF0000")
.setTitle("**Leave/Join traffic**")
.addField("```The bot has joined your voice channel!```") +
"<@" +
message.author.id +
">"
.setImage("https://media.giphy.com/media/Dw2M6GsuAWR68/giphy.gif")
.setfooter("Command hosted for Cameronbra!");
const exampleEmbed =
new Discord.MessageEmbed()
.setColor("#FF0000")
.setTitle("**Leave/Join traffic**")
.addField("```The bot has left your voice channel!```") +
"<@" +
message.author.id +
">"
.setImage("https://media.giphy.com/media/sFuUyrIqP0mpG/giphy.gif")
.setfooter("Command hosted for Cameronbra!");
client.on("message", async (message) => {
if (message.content == "!join") {
if (message.member.voice.channel) {
const connection = await message.member.voice.channel.join();
channel.send(embedz);
}
}
});
client.on("message", async (message) => {
if (message.content == "!leave") {
client.leaveVoiceChannel;
channel.send(exampleEmbed);
}
});```
hey u should put it on event
wdym
thats the reasons message isnt define
when will pros come online :/
I want someone to help me with that fkin webhook thing
@small zenith what kind of problem?
wdym
how do i put it in ane vent
client.on("voiceStateUpdate", (oldState,newState)=>{
//put ur code here
})
huh
but u cant use message cuz voicestateupdate event didn't have message return
i already have an event
client.on("message", async (message) => {
okay, let me try!
wait
uhhm
ok i wrong
it only gave me lots of errors
ur problem is put the code outside the client.on("message")
you mean, the embed?
still doesn't work lmao
(node:14180) UnhandledPromiseRejectionWarning: ReferenceError: Cannot access 'embedz' before initialization
const Discord = require("discord.js");
const client = new Discord.Client();
client.on("ready", () => {
console.log("Ready!");
client.user.setActivity(`on ${client.guilds.size} servers`);
console.log(`Ready to serve on ${client.guilds.size} servers, for ${client.users.size} users.`);
});
client.on("message", async (message) => {
if (message.content == "!join") {
if (message.member.voice.channel) {
const connection = await message.member.voice.channel.join();
message.send(embedz);
const embedz =
new Discord.MessageEmbed()
.setColor("#FF0000")
.setTitle("**Leave/Join traffic**")
.addField("```The bot has joined your voice channel!```") +
"<@" +
message.author.id +
">"
.setImage("https://media.giphy.com/media/Dw2M6GsuAWR68/giphy.gif")
.setfooter("Command hosted for Cameronbra!");
}
}
});
client.on("message", async (message) => {
if (message.content == "!leave") {
client.leaveVoiceChannel;
channel.send(exampleEmbed);
const exampleEmbed =
new Discord.MessageEmbed()
.setColor("#FF0000")
.setTitle("**Leave/Join traffic**")
.addField("```The bot has left your voice channel!```") +
"<@" +
message.author.id +
">"
.setImage("https://media.giphy.com/media/sFuUyrIqP0mpG/giphy.gif")
.setfooter("Command hosted for Cameronbra!");
}
});
new error..
ooowh shit
i fixed it
lel
(node:13696) UnhandledPromiseRejectionWarning: TypeError: "The bot has joined your voice channel!".setImage is not a function
wut the fuck is dis
"<@" +
message.author.id +
">"
keep it inside the field
@orchid pasture i want to send every vote to a channel but idk how to do that
idek how to setup its basic things
(node:3960) UnhandledPromiseRejectionWarning: TypeError: (intermediate value).setColor(...).setTitle(...).addField(...).setImage(...).setfooter is not a function
ffs
client.on("message", async (message) => {
if (message.content == "!leave") {
client.leaveVoiceChannel;
const exampleEmbed =
new Discord.MessageEmbed()
.setColor("#FF0000")
.setTitle("**Leave/Join traffic**")
.addField("<@" + message.author.id + ">" + "The bot has left your voice channel!")
.setImage('https://media.giphy.com/media/sFuUyrIqP0mpG/giphy.gif')
.setfooter("Command hosted for Cameronbra!");
channel.send(exampleEmbed);
what is the problem?
The error is quite self-explanatory: setfooter is not a function
You probably meant setFooter
You should check the docs for what properties/methods/etc. are available (https://discord.js.org/#/docs/main/stable/class/MessageEmbed) when in need.
let see the docs page
@orchid pasture docs wont help me it doesnt have it explained deeply :/
it has explanation for normal users but im beginner in dblapi i never had my.bot here before cuz the long queue it takes 2 months for a bot to get accepted.. :/
and in most cases they try to find any small reason to reject bot
My last bot got rejected cuz of kiss gif
they said its nsfw but i used the gif from OwO bot
ok let's open a webserver for retrieve the hook
Kk
lel my bot was rejected cuz its actually nsfw bot
nsfw bots arent allowed?
yeah i know that
maybe you can put NSFW command inside NSFW channel only
Dank Memer
but i keep it on NSFW channel
Dank Memer has nsfw
my bot doesn't show the members in the guild
client.on('ready', () => {
console.log('Ready!')
setInterval(() => {
let membersCount = client.guilds.cache.map(guild => guild.memberCount).reduce((a, b) => a + b, 0)
client.user.setActivity(`[${membersCount}] Players`, {type: "PLAYING"});
}, 1000 * 60);
});
Dank Memer has nsfw
@bold jetty Zero Two has NSFW command as well
the reasons is i include a NSFW message in description
so nsfw only in nsfw channels
i already waiting for 2 month an just "u rejected cus description can't contains any NSFW"
f
yeah if u prevent and keep in on NSFW ch ur bot can accept
huuu... Not Safe For Wife
not save for while
I want vote updates in my server channel what i have to do
Not Safe For Work
not simply funny water
I want vote updates in my server channel what i have to do
@faint zenith top.gg api
@orchid pasture Nvm i will pay someone to setup it for me
client.on('ready', () => {
console.log('Ready!')
client.on("ready", () => {
console.log(`Bot: Hosting ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`);
client.user.setActivity((`Hosting ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`));```
why is my bot activity not showing?
do not ever put one event listener inside another
^
dont swear
u have 2 ready event
client.user.setActivity("activity", {type: "PLAYING"}) for custom one
PLAYING WATCHING LISTENING for streaming add url
type: "STREAMING", url:""
client.on("ready", () => {
console.log('Ready')
console.log(`Bot: Hosting ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`);
client.user.setPresence((`Hosting ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`));
});
like this?
@small zenith its ok
I currently having 2 library installed, one for status, another one for commands
it still doesn't work
client.on("ready", () => {
console.log('Ready')
console.log(`${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`);
client.user.setPresence((`Hosting ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`));
client.user.setActivity("activity", {type: "Hosting"})
});```
my thought, use discord.io instead, if your code still doesn't work
ooh
what is that
isnt that deprecated as fuck
well, I know, that's why I put it only for bot statuses
discord.io is a lib isnt it a
yes
i have tried everything
but my bot's acitvity is still not changing
it stays blank
thus, I put this:
const Discord = require('discord.io');
const Discordjs = require('discord.js');
thats dumb
lol, I tried many ways to make statuses for my bot
thats literally the dumbest shit i've ever seen
but only discord io work for status, I don't know why
I tried it long time ago, it just bumped some of my commands
could anyone help me tho
client.on("ready", () => {
console.log('Ready')
client.user.setPresence((`Hosting ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`));
client.user.setActivity("activity", {type: "Hosting"})
});```
this bot is not showing anything as activity\
Use just one, Activity or Presence not both.
^ that toooooo
still doesn;t work lmao
console.log('Ready')
client.user.setPresence((` Playing with ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`));
});```
What's with the double parenthesis?
(( ))
client.on("ready", () => {
console.log('Ready')
client.user.setPresence(` Playing with ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`);
});
fuck
still trying
thats d.js v11 code
client.users.cache.size
still
client.channels.cache.size
omg
I am using it lol
no
dont use both discordio and discordjs. why?
1 - it will use more ram, cpu, and other shit
i still have nothing showing
console.log('Ready')
client.user.setPresence(` Playing with ${client.users.cache.size} users, in ${client.channels.cache.size} channels of ${client.guilds.cache.size} guilds.`);
});```
yes, I am still seeking commands for statuses, I am using IO temporarily
no need for the playing with thats put in automatically iirc
- dont copy paste
- use latest versions of the packages
- look the docs before asking from others
- don't spoonfeed.
// Set the client user's presence
client.user.setPresence({ activity: { name: `Playing with ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.` }, status: 'idle' })
.then(console.log)
.catch(console.error);
try it
🥄🥣
🥄🥄🥄🥄🥄🥄
ClientPresence {userID: null, guild: null, status: 'idle', activities: Array(1), clientStatus: null}
and then
how do i fixx this null error?
client.on("ready", () => {
client.user.setPresence({ activity: { name: `Playing with ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.` }, status: 'idle' })
.then(console.log)
.catch(console.error);
});```
It doesn't have to be in the ready event, just the client requires to be connected to the gateway prior to that method.
is there any error log?
Debugger attached.
ClientPresence {userID: null, guild: null, status: 'idle', activities: Array(1), clientStatus: null}
<node_internals>/internal/process/task_queues.js:97
activities:(1) [Activity]
client:Client {_events: {…}, _eventsCount: 2, _maxListeners: undefined, _timeouts: Set(1), _intervals: Set(2)}
clientStatus:null
guild:null
get member:ƒ member() {\n return this.guild.members.cache.get(this.userID) || null;\n }
status:'idle'
if you can set it for your bot, I swear I will copypaste the latest quoted code
it is null, idk how to change that tbh
(@-€;!"?*+#+/ sPoonFeed
ClIEnT......usER.....sEtPreSence({name: true + true, url: null, type: 69})
ahahaha
that i cannot find answers on
if you can set it for your bot, I swear I will copypaste the latest quoted code
i answered to this question....
well lets chage to set activity
if you can't help and can't resist fucking around
don't even reply
it is not like they write my whole code
this is only the fucking presence i am stuck at
client.user.setActivity(`on with ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`, { type: 'WATCHING' })
.then(presence => console.log(`Activity set to ${presence.activities[0].name}`))
.catch(console.error);
client.user.setPresence({name: "something"}) // type & url, status exists too.```
try this snippet
@orchid pasture still gives me undefined
Activity set to on with undefined users, in undefined channels of undefined guilds.
client.user.setPresence({ game: { name: 'with discord.js' }, status: 'idle' })
I got this from stackoverflow
Does someone know to do that when you make an update to the code in github the server downloads it and restart the bot with the new code? automaticly
Awesome what version of DJS are you using?
v12.18.3
In v12 setPresence uses:
{
activity:
{
name: str
},
status: 'idle'
}```
as it's options
Undefined where?
would this code be fine if it's sending 1 message in 1 channel per server that enabled the feature?
await Promise.all(channelList.map(channel => channel.send('foo')));
kinda not possible since the server subscribes to livestreams 
but I at least wanna slow it down
my quick.db is not downloading what to do?
yes
Error?
i try to make code for commands it worked before i added second command what should i do here is script
const Discord = require('discord.js');
const client = new Discord.Client();
const prefix = '!';
client.once('ready', () => {
console.log('DarkTardis status - online');
});
client.on('message', message =>{
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if(command === 'help'){
message.channel.send('!help: shows commands and features.');
message.channel.send('!version: shows versions of bot.');
message.channel.send('more features soon....');
}
{ if(command == 'version'){
message.channel.send('My version is 1.0.0');
};
client.login
here error
C:\Users\artur\DiscordBot\Main.js:30
client.login('NzQzOTM0Mjc1MjM3NDQ1NzUy.Xzb4yA.3rWHe_8NlfAwylE-mrQbvgcwhR4');
SyntaxError: Unexpected end of input
[90m at wrapSafe (internal/modules/cjs/loader.js:1053:16)[39m
[90m at Module._compile (internal/modules/cjs/loader.js:1101:27)[39m
[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)[39m
[90m at Module.load (internal/modules/cjs/loader.js:985:32)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:878:14)[39m
[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)[39m
[90m at internal/main/run_main_module.js:17:47[39m
false alarm
i got something from discord system
someone tried to take my token

- Use codeblocks
- You have an extra bracket right before your second if statement
No worries, just... never share your token again
kk
in the guildMemberAdd event how many roles can the bot add to the member before it reaches the rate limit
i dont think you should be making a bot if you just started coding yesterday but
LoL
make some website first
learn HTMl and css then Javascript
@pale vessel i figured out the canvas package thingy you told me about (it's literally just the HTML canvas) but I don't get how I can send the image generated through the bot
I can use fs to write a test file but that'll take a lot of storage space if multiple people use it at the same time
then u will get better

so basically I'm having trouble making my prefix case sensitive in discord.js
I've tried a lot of things but if anyone knows how they do it
const attachment = new Discord.MessageAttachment(ctx.toBuffer(), "image.png")
I've tried a lot of things but if anyone knows how they do it
@patent geyser just .toLowerCase()
oh damnn i put toLowercase
i still have error help
const attachment = new Discord.MessageAttachment(ctx.toBuffer(), "image.png")
@misty sigil uhhh spoonfeed but thanks
i forgot
ooops
LoL
i regenerated
Kurdy tyaya
this is why you dont make a bot if you dont know how to code
@north bobcat English pls
@earnest phoenix iam kurdish
sry
its str.toLowerCase()
okay
guildMemberAdd?
oh god
str is not defined
maybe you should learn JavaScript basics before continuing
i have error here C:\Users\artur\DiscordBot\Main.js:32
};
SyntaxError: Unexpected end of input
[90m at wrapSafe (internal/modules/cjs/loader.js:1053:16)[39m
[90m at Module._compile (internal/modules/cjs/loader.js:1101:27)[39m
[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)[39m
[90m at Module.load (internal/modules/cjs/loader.js:985:32)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:878:14)[39m
[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)[39m
[90m at internal/main/run_main_module.js:17:47[39m
here is script
code blocks exist
const Discord = require('discord.js');
const client = new Discord.Client();
const prefix = '!';
client.once('ready', () => {
console.log('DarkTardis status - online');
});
client.on('message', message =>{
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if(command === 'help'){
message.channel.send('!help: shows commands and features.');
message.channel.send('!version: shows versions of bot.');
message.channel.send('more features soon....');
if(command ==+ 'version'){
message.channel.send('My version is 1.0.0');
client.login
?
is it a rule to put code in an codeblock?
No?
if not can it be made a rule that code over 10 lines is put in a hastebin or something
....
maybe you should learn JavaScript basics before continuing
@granite echo I forgot to define str whilst typing the code
thank you for being so welcoming to new javascript users
ReferenceError: messageReminderModel is not defined
even though i did
global.messageReminderModel```
i need to use this variable in another function, so how do I go about doing this?
await messageReminderModel.find({}).forEach(data => {```
hmmm, ive never really used messageReminderModel so i cant help sry
thats the name of my variable
i just need to know how to make it usable in another function
Maybe a newbie ask, but whatever.
How do you detect if an user is on a voice channel (message author)
Check if message.member.voice exists and then check if it has a channel: message.member.voice.channel
Okay, i wanted to make a command that mutes in the server all user that are on the same chat with you
(not for play among us, btw)
what should i do with this error C:\Users\artur\DiscordBot>node .
C:\Users\artur\DiscordBot\Main.js:32
};
SyntaxError: Unexpected end of input
[90m at wrapSafe (internal/modules/cjs/loader.js:1053:16)[39m
[90m at Module._compile (internal/modules/cjs/loader.js:1101:27)[39m
[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)[39m
[90m at Module.load (internal/modules/cjs/loader.js:985:32)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:878:14)[39m
[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)[39m
[90m at internal/main/run_main_module.js:17:47[39m
no
That error means you have incorrect brackets somewhere
o wrong channel no its no u, i mistyped
oh and here is code
const Discord = require('discord.js');
const client = new Discord.Client();
const prefix = '!';
client.once('ready', () => {
console.log('DarkTardis status - online');
});
client.on('message', message =>{
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if(command === 'help'){
message.channel.send('!help: shows commands and features.');
message.channel.send('!version: shows versions of bot.');
message.channel.send('more features soon....');
if(command ==+ 'version')
message.channel.send('My version is 1.0.0');
client.login('');
};
btw for code blocks you add these at the start and end ```
Your ending bracket is the closing bracket for the if command === help
kk'
aka backticks
Which leaves the message event open
kk
ye
s
actuall
y
the <>'s are on purpous im not gonna give code that they dont need to work out a lil
You closed the message event prematurely, leaving all code afterwards invalid
o i didn't even see that, one sec
Okay, i made this
-mute all -
} else { message.reply('You need to join a voice channel first!'); }```
If someone knows how to mute i will appreciate
const Discord = require('discord.js');
const client = new Discord.Client();
const prefix = '!';
client.once('ready', () => {
console.log('DarkTardis status - online');
});
client.on('message', message => {
if (!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if (command === 'help') {
message.channel.send('!help: shows commands and features.');
message.channel.send('!version: shows versions of bot.');
message.channel.send('more features soon....');
if (command == + 'version')
message.channel.send('My version is 1.0.0');
}
})
<client>.login('');
@blissful tinsel
@dreamy thistle by learning the basics of js
here
XD okay dude
they go oever voice
iirc
The version command is out of place
out of place in what way
Its inside the help command
Then it will never work lol
how would i add a role to a bot on join?, i completely forgot and cant find it anywhere cuz my wifi sucks
i have guildMemberAdd just stuck on the adding role
client.on("guildMemberAdd", member => {
client.roles.cache.get('752135362947842140')
})
i mean something like this
m.help
m.#commands && #265156322012561408 = no bot commands here
member.roles.add(role)



