#development
1 messages · Page 555 of 1
Node dosent work
Have you actually programmed any kind of bot file
Well no one here’s is gonna program a bot for you
Tune in every Wednesday & Friday for Discord.js Videos! Go easy on Ned as it's his first coding tutorial in a while! :D SourceCode: https://github.com/The-So...
Follow this series it’ll take you through the steps of learning how to program a bot
However you should learn how to use JavaScript before anything so try a js learning coarse
Alright, coolio
@fringe rover don't use the source code for the love of god, use a decent guide
Keenser he can use whatever he wants don’t complain
thats where you are wrong kiddo
Not got a clue lolwhat
using youtube tutorials over docs with your knowledge of the language is very discouraged
a) you are diving facefirst into a language and a library you have never seen before
b) you are not learning anything but how to press ctrl c and ctrl v
c) your freedom is restricted and dependent on youtube tutorials, you wont be able to create anything properly yourself
d) you are using someone elses coding style and practices instead of creating your own environment you are comfortable with
But i don’t know
Hi
I have a question
In json i can blabla.push('Test')
But i can blabla.replace('Test', 'Test2')
How do I go ?
push is for array not json (object)
for objects you can blabla.new = "test" and replace with blabla.new = "test2"
to replace a value in an array, you can blabla[blabla.indexOf("test")] = "test2"
is it possible to create global variables to be included in all command files
like in lua (if anybody is familiar) You can create a variable as a global and being able to access it everywhere
blabla[blabla.indexOf("test")] = "test2" @quartz kindle 🤔
you have to send it to each file you want to use it in
assuming you're talking about node.js
@lofty hamlet js let bla = ["test1","test2","test3"] // create blabla array with 3 values bla.indexOf("test2") // get index position of "test2", which is index 1 bla[1] = "test5" // replace value in index 1 with new value
@uneven laurel it should, but there are better/easier ways to do that
Thanks
use the guild's id
DBL's id is 264445053596991498
so just do if(message.guild.id === "264445053596991498") { return }
Guys, in python, how can i check if my bot has permission ?
Could anyone lead me to a solution to make my Canvas support emojis? (nodejs)
use a font that includes emojis and register it on canvas
are you using node-canvas v2 or v1.6
Font awesome is a good one
if(!xp[message.author.id]){
My console is showing that and say Cannot read property "author" of undefined!
most likely because that code is out of the message scope
wdym
send full code
I can invite u to the project can u show me from there?
no
this is the full code
let xpAdd = Math.floor(Math.random() * 7) + 8;
console.log(xpAdd);
if(!xp[message.author.id]){
xp[message.author.id] = {
xp: 0,
level: 1
}
}
let curxp = xp[message.author.id].xp;
let curlvl = xp[message.author.id].level;
let nxtLvl = xp[message.author.id].level * 300;
xp[message.author.id].xp = curxp + xpAdd;
if(nxtLvl <= xp[message.author.id].xp){
xp[message.author.id].level = curlvl + 1;
let lvlup = new RichEmbed()
.setTitle("Level Up!")
.setColor(`#36393e`)
.addField("New Level", curlvl + 1);
message.channel.send(lvlup).then(msg => {msg.delete(5000)});
}
fs.writeFile("./xp.json", JSON.stringify(xp), (err) => {
if(err) console.log(err)
});
@mossy vine ^^^
where are you running that tho
on glitch.com
i mean
in my main file
no thats not what i mean either
What event
are you running it in client.on('message'...
uh should I be?
i know a little bit
i code html, batch, css, ruby, python, and php im learning js
x-www-form-urlencoded
?
@sleek oar yes
yes
Guys, a dumb question:
How can i get my bot top role ?
I'm using cogs
And how can i check if a bot has permissions to do something ? in a error handler ?
@lyric talon do guild.me.hasPermission(perm) because guild.me is the member object of the client
So if i want the ban_members permission it's
guild.me.hasPermission(ban_members) ?
in the top of a command ?
Also to get the bot the “top” role the owner or someone with permission to has to do it the bot itself can’t give itself the highest role
Yea so basically you can also do it so if they don’t reply to the message saying the bot doesn’t have perms and then return
you should just iterate and check the hoist position
JDA - java member.getRoles().get(member.getRoles().size()-1)
Yea dond what fishy said. It’s better to be safe then sorry
some libs have it pre-computed
but that's the idea
you also need to taken account of other permission overwrites
Tho any kind of connection problem could desort them I’ve seen it before but🤷♂️
Integrate your service with Discord — whether it's a bot or a game or your whatever you wildest imagination can come up with.
calculate permission from bit
he also asked And how can i check if a bot has permissions to do something ? in a error handler ?
so 
.hasPermission
Also in JDA
But fishy, i can just check my bot top role, right ?
not really
😮
Because i'm really confused with the permission overwrites and the things that u sad
I would just check my bot role (i don't know how to do this) and see if it's bellow the member that i will ban , role
@lyric talon what library?
OK ok i'll
I'll send the code
Here's the code:
https://hastebin.com/raw/oxadexobim
I think that my error handler is wrong too (the bot missing permissions
but member is the people who will be banned
Yes!
Example: I'll ban you
I want to check if i have permissions
Or if have something that i could take an isinstance(error, IHavePermissions)
then selfmember.guild_permissions.ban_members and selfmember.top_role > othermember.top_role
How can i get the selfmember ? and another question, how can i check if the bot have a permission ?
<sorry for border you with dumb question>
ctx.author, ok
is the selfmember
as I said
the bot is a member as well
so just do member.guild_permissions (or for channel specific permissions: member.permissions_in(channel)) and check for the required permission
good luck
Wait, so if guild.me is a bot as a member class, if i do guild.me.top_role will return me the bot top role ?
it will return the bot's highest role in the hierarchy yes
and > is overridden to compare hierarchy height
what do you mean
That when i tryied to use the await ctx.send the guild.me.top_role it throw me nothing
maybe it doesn't have a role?
await ctx.send('{} - {}'.format(member.top_role, guild.me.top_role))
That should print the member that i'll ban Top role and the bot role
But it's not printing it '-'
are member and guild defined?
just do member.guild for the guild
yes
ok sure lol
json.push is not a function

push is for arrays, not objects
what am i doin wrong?
body
@inner jewel just tried that, doesnt work
log the response
it gives error 400 when i use xhr if that helps
set content type header
still
you can only get a 400 if your body is malformed
or you don't set the content type header
no
that's an invalid multipart body
you need application/json
if you want to send json
still the same thing :/
size: 0,
timeout: 0,
[Symbol(Body internals)]:
{ body:
PassThrough {
_readableState: [Object],
readable: true,
domain: [Object],
_events: [Object],
_eventsCount: 3,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: true,
_transformState: [Object] },
disturbed: false,
error: null },
[Symbol(Response internals)]:
{ url: 'https://discordapp.com/api/webhooks/id/token',
status: 400,
statusText: 'BAD REQUEST',
headers: Headers { [Symbol(map)]: [Object] } } }```
Does anyone use googles cloud to host your bot?
someone uses bloxy for roblox bots?
@nova atlas i do
what have you tried?
yes, ive set up a windows server and ran the RDP
what language is your bot in?
python
i'd advise you to run linux on it
when you set up a compute engine instance, in your google cloud dashboard
you can choose an operating system
i dont know what to do when im in the SSH
worry about that after you set it up
its not set up?
did you set up linux already?
what do you mean set it up? i selected it when i create a new instance
this is eris-lavalink
function getPlayer(channel) {
if (!channel || !channel.guild) {
return Promise.reject('Not a guild channel.');
}
let player = client.voiceConnections.get(channel.guild.id);
if (player) {
return Promise.resolve(player);
}
let options = {};
if (channel.guild.region) {
options.region = channel.guild.region;
}
return client.voiceChannel.join(channel.guild.id, channel.id, options);
}
getPlayer(channel).then(player => {
player.play(track);
player.on('disconnect', (err) => {
if (err) {
console.log(err)
}
player.leave();
});
player.on('error', err => {
return message.channel.createMessage("An issue as occured. Please Try again later.")
});
player.on('stuck', msg => {
return message.channel.createMessage("An issue as occured. Please Try again later.")
})
player.once('end', data => {
if (data.reason && data.reason === 'REPLACED') {
return;
}
player.play(track).shift();
})
});
but it says channel is not defined why is that?

@nova atlas you did this?
i did this
i use ubuntu, but debian should be similar
@earnest phoenix message isn’t defined in the function scope
hm
ive created another instace similar to yours
so now you should have this
@blazing star wdym by defining message
if you open ssh in a browser window, you will be accessing it directly already, and you can start using it
message would be undefined
learn a bit about using linux terminal to install packages
unless the function is in the function where you defined message
for example, you will need to create a folder for your bot, you can run mkdir foldername
you can use ls to get a list of files in the current folder
you can use cd foldername to change folders
winscp is an option
and use apt-get install packagename to install linux packages
also pip install npm install 
as you can see, there are neverending tutorials and ways to do stuff on linux using the terminal alone
digital ocean tutorials are the best
i see
in order to move files from your pc to your vps and vice versa, you will need to use a winscp or sftp client
although google's ssh window does offer you an option to download files
filezilla
i have a whole folder with my bots code, would i be able to import that?
Anyone here use dunst?
if you dont manage to use a 3rd party client, you can use this
to upload a folder its better if you zip it
and then unzip it on the server
once you get the hang of navigating through files and do basic stuff to them via command line, everything becomes easy
ok thanks for the help
in order to use 3rd party clients such as filezilla or putty, you will need to setup an ssh key, which is a bit more complicated
how do i get when user emoji reacts on message ID
events
fould it
it gets user, but i cant figure out how to get only user tags
like user#1234
instead of details
You on discord.js?
yes
messageReaction add passes a user object
You know how to set up events right?
no ;d
Well Ill tell you, you already have some
(I hope)
You should have stuff in your code that says client.on(...){} right?
Or similar
ew one file bots
We dont know if its one file
Can you set up events in other files?
All my events are in my main file atleast
the commands are seperate
yes
well that client.on stuff is an event
i have event for react
its a copypaste but i know what it does
should i just ${user}
i see its not used
user is the person that reacted
Hey i am having a problem with installing the first dependencies for starting a discord bot, could I dm someone with my error code
just post the error code here
It tells you exactly what it is tho
read the error message 
sorry im kinda new at this, ive been learning java in school and just started playing around with this
should it be ' instead of "?
should prob like, show the content of that file
lmao notepad
what kind of quote is that
oh that makes sense
we got a meme here
oh your using that dumb outdated tutorial
https://discordjs.guide use this @toxic minnow
A guide made by the community of discord.js for its users.
It isnt just a font?
" natural
its called notepad
Well in typography, an open quote goes up a closing quote goes down.
Curly quotes and straight quotes arent the same
im having a problem here
let cancer = args.join(" ")
it will get only first argument
but after space is hit it will ignore
how can i include space and text after
args.slice(0).join(" ")
@earnest phoenix
using node.js, how can I use the .getVotes() to fetch the last 1000 votes, and sort them all into a message?
.getVotes returns a object promise right?
iterate through the object and log the keys
not log,
but like put them into an array or something
however you want to handle it
Said I can't put them into a array
and when I tried for(const data of) it didnt work either
(node:7046) UnhandledPromiseRejectionWarning: TypeError: votes is not iterable
show code
let votes = dbl.getVotes().toArray() is what I tried to put it into a array
yeah
gotta do a .then
and it's an object
sorry not sure what to do
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/then
.getVotes().then(votes =>{})
yeah, looked at the api again and found that
ye on https://discordbots.org/api/docs#jslib it shows .then I believe
got a bunch of objects
so I think I got it
no arguments for me to use on the website tho
?
Nevermind I figured it out
and about what I was talking about arguments, I meant these:
.getVotes() doesnt have that so I didnt know what to use
Hey. Does anyone know how to do something on guild join?
i want bot to ignore ids
but when i put ids in blacklist.json
then if (message.author.id === blacklist.users)
return;
it doesnt work
users is like "users": ["id", "id2"]
works
retarded people, abusing commands that they dont have access to lol
now i just need to find a way to write ID directly to blacklist.json
My bot auto blackists spam
teach me master xd
It's kinda simple tbh
There's a global cd of 5 seconds on using a cmd. if you spam it while its on cd after it told you, you get blacklisted
I would lower it
but no one compained yet
I dont use json for a lot of things, but that is one of them yea
All my important data is in dbs
i just wanna blacklist people 😠
I use https://nodejs.org/api/fs.html to read and write
@sturdy delta if your using python you can use this event:
https://discordpy.readthedocs.io/en/rewrite/api.html#discord.on_guild_join
@ruby talon i am using JAvaScript
Oki.
You didn't provide that info so I wouldn't be able to know that.
@amber fractal answered your question then.
depends on what you want
personal opinion i prefer manage messages or server, but you can also allow the server to give indiv. users access or a specific set of roles
anyone got any idea how I could make a reaction on an embed message make my bot kick the user mentioned?
if there were corrupt files in my system, affecting my VSC, where would they be?
@ruby talon
Most likely in the place where your VSC extensions get saved.
Yes.
You have to provide enough info tho.
Language ect.
No not
Um
If you want to send a Message to a channel through the API, you use this
POST channels/{channel.id}/messages
And the JSON parameters
Right?
put a $ in front of the {}
It's not js
that would've been nice to know
Yeah
It's not language specific
I guess
Http API or something like that
But my question is
What if you want to send a DM
Trying to build something through my webhook without directly Interacting with the API library
im not actually sure lemme check something
Okay
Lemme try that
Yeah..
how are u triggering the dm
That's what I'm trying to figure
i mean if u wanna test where the ID comes from do it in ur dms with ur bot with like prefix test then ocmpare it to the browser
sorry i cant be of more assistance
It's cool
my bot was declined 'cause I didn't have anything original about my bot H-Bot Deluxe, but it has custom cogs n stuff
cogs?
yee
wdym
cause its a heavily alted version of Red
whats red
anyone know how I can correct this MySQL error Error: ER_BAD_FIELD_ERROR: Unknown column 'eu' in 'field list'
Theres an unknown column labeled "eu" in "field list"
not from what i can see
show the query
ive fixed it now
use codeblocks for first
how to fix DeprecationWarning: Collection#filterArray: use Collection#filter instead:
use .filter() instead of .filterArray()
how to fix UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions:
check for permissions before doing whatever you're doing
how to fix UnhandledPromiseRejectionWarning: Unhandled promise rejection:
catch promises by using .catch() or by using try/catch if you use async/await
how to fix [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated:
same as above
how to fix TypeError: Cannot read property 'channels' of null:
your message does not contain a guild, perhaps its a DM?
@uneven laurel
Read the error...
thisArray.filter() is what it's telling you to use not thisArray.filterArray()
@quartz kindle
?
@warm marsh thats what he said lmao
Why am I getting an error on this? css fs.writeFile("./warnings.json", JSON,stringify(warns) (err) => { if (err) console.log(err) });
Is that a joke or what?
@rocky dagger do ya see it yet
Lol
ask heroku
If you get pay for heroku, might as well just get a vps
I only use heroku because of the money you get from their student pack
In js is it ${bot.users.size} to check the amount of people not guilds?
@earnest phoenix correcto
Traceback (most recent call last):
File "bot.py", line 1, in <module>
import discord
File "C:\Users\ThatTonybo\AppData\Roaming\Python\Python37\site-packages\discord\client.py", line 38, in <module>
from .state import ConnectionState
File "C:\Users\ThatTonybo\AppData\Roaming\Python\Python37\site-packages\discord\state.py", line 36, in <module>
from . import utils, compat
File "C:\Users\ThatTonybo\AppData\Roaming\Python\Python37\site-packages\discord\compat.py", line 32
create_task = asyncio.async
^
SyntaxError: invalid syntax
whats up here
so apparently this ```js
aliases: [${prefix}bl]
i removed the ${prefix} part and it worked but i want that in there
not looking for advice on how to fix this but that's easily the most ominous message I've gotten in the console
Discord.js thanos snapped my bot
Hey guys :)
Could someone help me ?
I have a command named afk that when someone set this, the bot will send a message to everybody who pings this person.
But when i try to ping this person (considering that he is in the afklist ), the bot doesn't send the message.
Here is my code https://pastebin.com/mZpaT2ZX
It's on pastebin because the hastebin is off for me :/
I don't think that's the best way to define my command, but it was the easier way that i could think.
Instead of using what lib is that?if '@' in message.content: and i use js, so i may be wrong. But does the lib your using have a .mentions property for message objects?
events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::3000
at Server.setupListenHandle [as _listen2] (net.js:1360:14)
at listenInCluster (net.js:1401:12)
at Server.listen (net.js:1485:7)
at Function.listen (/rbd/pnpm-volume/4fc25bdb-071c-4bec-9141-4477c5ce57c3/node_modules/.registry.npmjs.org/express/4.16.4/node_modules/express/lib/application.js:618:24)
at Object.<anonymous> (/app/bot.js:45:5)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
(node:3704) UnhandledPromiseRejectionWarning: Error: Shard 1's process exited before its Client became ready.
at Shard.once (/rbd/pnpm-volume/4fc25bdb-071c-4bec-9141-4477c5ce57c3/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/sharding/Shard.js:88:39)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:116:13)
at Shard.emit (events.js:211:7)
at Shard._handleExit (/rbd/pnpm-volume/4fc25bdb-071c-4bec-9141-4477c5ce57c3/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/sharding/Shard.js:272:10)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
(node:3704) 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: 40)
Help
maybe if you read your error
throw er; // Unhandled 'error' event
^
this is where it erroered
so you arent throwing your errors right
how do i list the no. of text channels
and total categories
add aliases: ["alias"]
@earnest phoenix
uhm all your js files
module.exports.help = {
name: "",
description: "",
usage: ``,
aliases: [""]
}```
add that to all your js files
no
JS files
files ending with .js
not that one as i said
thats main file
my bad
if you have a have a file called example serverinfo type in name: "filename", and etc for all command files
read again^
oh um did you add alias
lol i used to get that error but i forgot how i fixed it 🤦
and i feel pretty brain dead atm
nooo
you don't add it in index
whats the file that starts your bot?
you got this code from menu docs i guess?
mate anyways you put this code in the file that starts your bot.
and remove module.exports.help from there
ok listen
simple question
what file starts your bot?
The code you sent me is from which file?
you don't add that there
are you tryna make a command handler?
then why all that code?
lol
okay
it was pretty ez you just added random stuff
that was the command handler code btw\ lmao
why am i getting this
yeh but im not sure how I can correct that
@quartz kindle ?
Make the function an async function
fonction.channellogs(message)
let xoargs = message.content.split(" ").slice(1).join();
let xoargs1 = message.content.split(" ").slice(2).join();
if (!xoargs) return message.reply("Erreur :Croix: : `Entrez le nom du pokémon à remplacé`")
if (!xoargs1) return message.reply("Erreur :Croix: : `Par quel pokémon voulez-vous le remplacer ?`")
//console.log(Dresseur.Sac.includes(xo03))
if (Dresseur.Sac.includes(xoargs) || (Dresseur.LSSac.includes(xoargs) || (Dresseur.SSac.includes(xoargs)))) {
Dresseur.Sac.indexOf(xoargs)
Dresseur.Sac[1] = xoargs1
var embedGlobal = new Discord.RichEmbed()
.setColor(embedcolor)
.setTitle("Pokémon remplacé")
.setThumbnail(message.author.displayAvatarURL)
.addField("Remplacé : ", xoargs)
.addField("Par : ", xoargs1)
.setFooter(client.user.username + " - by Nebulus")
.setTimestamp()
message.channel.send(embedGlobal)
}
else if (!Dresseur.Sac.includes(xoargs)) {
message.channel.send("Erreur :Croix: : `Pokémon introuvable, sois vous ne l'avez pas capturé sois vous l'avez mal orthographié ex : ?setc Roucool (Normal)`")
}
}```
My code 👁
steven, how do i filter to show the amount of bots in a server,
@amber fractal how do i do that
But the pokemon is not find all the time the answer is : ""Erreur :Croix: : Pokémon introuvable, sois vous ne l'avez pas capturé sois vous l'avez mal orthographié ex : ?setc Roucool (Normal)""
use .fliter() and check if the bot is true
.addField("Humans", message.guild.members.filter(member => !member.user.bot).size, true)
How could I transform that into for bots lol
@desert bough add async before the function, you might wanna read up on it tho
get rid of the !
I think
its not in its own function tho
Thanks.
Do you guys know if patreon has a thing where bots can pull how much has been donated? I saw something similar the other day and it baffled me
Help me plz 
fonction.channellogs(message)
let xoargs = message.content.split(" ").slice(1).join();
let xoargs1 = message.content.split(" ").slice(2).join();
if (!xoargs) return message.reply("Erreur :Croix: : `Entrez le nom du pokémon à remplacé`")
if (!xoargs1) return message.reply("Erreur :Croix: : `Par quel pokémon voulez-vous le remplacer ?`")
//console.log(Dresseur.Sac.includes(xo03))
if (Dresseur.Sac.includes(xoargs) || (Dresseur.LSSac.includes(xoargs) || (Dresseur.SSac.includes(xoargs)))) {
Dresseur.Sac.indexOf(xoargs)
Dresseur.Sac[1] = xoargs1
var embedGlobal = new Discord.RichEmbed()
.setColor(embedcolor)
.setTitle("Pokémon remplacé")
.setThumbnail(message.author.displayAvatarURL)
.addField("Remplacé : ", xoargs)
.addField("Par : ", xoargs1)
.setFooter(client.user.username + " - by Nebulus")
.setTimestamp()
message.channel.send(embedGlobal)
}
else if (!Dresseur.Sac.includes(xoargs)) {
message.channel.send("Erreur :Croix: : `Pokémon introuvable, sois vous ne l'avez pas capturé sois vous l'avez mal orthographié ex : ?setc Roucool (Normal)`")
}
}```
@random rapids https://docs.patreon.com/
But the pokemon is not find all the time the answer is : ""Erreur :Croix: : Pokémon introuvable, sois vous ne l'avez pas capturé sois vous l'avez mal orthographié ex : ?setc Roucool (Normal)""
Oh crap 😂 ty @amber fractal
.addField("Bots", message.guild.members.filter(bot => bot.user.bot).size, true)
That's what I made it
Yeah
py contains a .mentions property
Im not sure what to do after that tho cuz I dont use py
@amber fractal im not sure how I can make my bot.on("message") asynchronous
yes yes i'm using this now 😃 ty, steven
Oh, sorry for the late response
im not sure how I can make my bot.on("message") asynchronous
Np 😃
bot.on('message', async message =>{})
@amber fractal put that in still error
yes
what is the error
^^^^^
SyntaxError: await is only valid in async function```
you need to put async in all the functions that are part of the hierarchy
async function({
async function({
await something() //ok
})
})
async function({
function({
await something() //error
})
})```
if you have a command handler, or modules, you need to put async in the module exports function
there isnt any functions above it
so you need then(async msg =>)
i dont get it @lofty hamlet , what are you trying to do?
Look
aparently my project cant find the mutes.json file even tho its in the same directory and I have var mutes = require('./mutes.json');
i dont know what you want to do
I want when i use : ?replace Args1 Args2
MLy bot send the args
let xoargs1 = message.content.split(" ").slice(2).join();```
With this
When i enter :
?replace Doduo azsq
TRhe bot send :
Doduo,azsq
Par :
azsq
instead of :
Doduo
Par :
azsq
@quartz kindle
.slice(1).join() removes the first item
so if your array is: ["prefix","arg1","arg2","arg3"], when you use .slice(1) you will have ["arg1","arg2","arg3"], then you use .join() and you get arg1,arg2,arg3
🤔 so ?
.join() always puts the items together separated by a comma, if you dont specify an argument
if you want to get only 1 item, not more
dont use join
just get the item directly
array = message.content.split(" ").slice(1); // args without prefix
array[0] // arg 1
array[1] // arg 2
array[2] // arg 3
array.join() // arg1,arg2,arg3```
So i can use : array = message.content.split(" ").slice(1); let xoargs = message.content.split(" ").array[1].join();
🤔
In my case, how do I do?
@quartz kindle
learn js lol
array = message.content.split(" ").slice(1); // ["arg1","arg2"]
message.content.split(" ").array[1] // error, thats not how it works.
// array already contains the sliced message content, you dont need to get it again```
i literally told you what to do
array = message.content.split(" ").slice(1); // args without prefix
array[0] // arg 1
array[1] // arg 2
array[2] // arg 3```
i get this error when trying to exclude the bots id from my filter for reactions const reactions = await msg.awaitReactions(reaction => reaction.emoji.name === "✅" && reaction.user.id != "447752778174038018"); TypeError: Cannot read property 'id' of undefined
is there an alternative
user is not part of reaction
its a second argument in the function
(reaction,user) =>
show how you did it
const reactions = await msg.awaitReactions(reaction, user => reaction.emoji.name === "✅" && user.id != "447752778174038018");
Guys, in the discord.py rewrite, how can i get the time since a person send an specific message ?
why two brackets?
They arent brackets
you cant pass multiple arguments in the short form
like this?
yes
stodd ? 
Stodd, yes
Np
if you're stodd, why is your name stephen then? lmao
Imma find that mod 
why would i be told i dont have permissions when redirecting the monstacord bot to a specific channel when im the admin in the discord
Bot perms?
why does this not do the log when i add the reaction
does it log anything if you remove the filter or allow all?
is it a good idea to encrypt a password by using itself as a key, assuming that I do not want them to be decryptable, but lets say store the encrypted version for comparison reasons only?
@ruby dust for passwords, hashing is always better than encryption, because hashing is unreversible
hm?
encryption = 2-way, encryption and decryption
hashing = 1-way, after hashing there is no going back
huh, is there a specific hashing or can you give me a link to one
the most secure these days is probably b-crypt
alright, thanks
argon2
PBKDF2
bcrypt
scrypt```
Hello this is only for peple with Windows! Sorry Linux, Mac...
Ok so i wanted to do an auto updater in batch and when i open the main file i want to start the updater too and the problem is that i want to check witch the updater (that is a batch file) if it is the update day or past than the update day.
How could i do that, i tried ```
IF %date:~7,2%==13 (GOTO :run_it) else (GOTO :no_run)
:run_it
CLS
REM run whatever command
ECHO Running the command...
DIR C:
GOTO END
:no_run
REM Notify user that it is the wrong day
ECHO Wrong day!
:END```
you're trying to use a fixed update day ?
hello, so I found these two errors exactly one hour a part from each other.
https://hastebin.com/umidohatug.coffeescript
Just wondering if they'd have anything to do with DBL or if I should be worried about something else
dbl is having issues atm
oh, and using node.js
alrighty
a star board like the one in this server?
track reactions and make the bot post the message on another channel when it reaches enough reactions
Yes
From the message?
yes
client.play = (guild, song) => {
const serverQueue = client.queue.get(guild.id);
if (!song) {
serverQueue.voiceChannel.leave();
client.queue.delete(guild.id);
return;
}
const dispatcher = serverQueue.connection.playStream(ytdl(song.url, { filter: 'audioonly'}))
.on('end', reason => {
if(serverQueue.loop[0]) {
serverQueue.songs.push(serverQueue.songs[0]);
}
if (reason === 'Stream is not generating quickly enough.') console.log('Song ended.');
else console.log(reason);
serverQueue.songs.shift();
client.play(guild, serverQueue.songs[0]);
})
.on('error', error => console.error(error));
dispatcher.setVolumeLogarithmic(serverQueue.volume / 100);
serverQueue.channel.send({embed: { color: 65292, title: " Now Playing:", description: `**[${song.title}](${song.url})**
 \`Duration: ${serverQueue.songs[0].duration.hours} hours ${serverQueue.songs[0].duration.minutes} minutes ${serverQueue.songs[0].duration.seconds} seconds\``}}).catch(console.error);
}
this is what i have for the play function
and im trying to make it so when the song is done and it goes to the next song, it edits the embed to that song
how would i do that?
.send().then(msg => save message id somewhere)
on next song: .get(savedid).edit()
or just save the message object itself
@empty axle did you fix it? if not, post your code
does the while loop break instantly when the condition is no longer true, or does it have to finish the last loop that it started?
it checks for the condition when it begins the loop
if the condition is still true then, it will finish the entire loop
else, it doesnt initiate the loop
I mean, I have a few sleeps in one of my loops, so will they end instantly in the middle of the sleep or do all sleeps have to go through?
python? idk how python works, but i assume they will all go through
because the loop is just an initializer for the function
the function itself runs like any other function, and respects timers/sleeps/promises
alright thanks
it’s not an error, it’s a warning saying you have a possible memory leak
How would I fix it?
read the warning
where would I put emitter.setMaxListeners(20)
client.setMaxListeners(...)
so like: bot.setMaxListeners(number)?
yea
alright and the number doesn't have to be in ""
you should put it after you define the client
I did.
dont blindly increase max event listeners
find out why you're adding so many listeners lol
are you using client.on() inside a .on("message)?
show the rest of your code
If you want 1.7k lines sure
put them in a pastebin or whatever
@loud salmon can you please invite my bot back into this server? i fixed the problemn
Yeah..
looks like you're creating a guildCreate listener on every single message
bad practice
I wouldn’t recommend using events inside events unless it’s a one time event that can be used with .on
or it’s not fired every second
Oh I wasn't trying to.
I'm very new to programming
and still don't understand some
basically just move all event listeners outside of each other
they should all be siblings
or use an event handler
which would do that for you
well not really, but it will listen for events
yeah idk how to do that
and not cause any memory leaks
d.js basically already does that for you
no, it handles events
like events in a folder or something
I do that and each module is a class instance of an event
.on("evt1", (){})
.on("evt2",(){})
vs
.on("all",(evt){
if(evt === "evt1") {}
if(evt === "evt2") {}
})
if thats what you're refering to with "event handler"
nope not what i’m referring to
so I moved the second bot.on on top of the first one
like switched the placemenent
I'm not getting that warning anymore
I’m referring to my event handler as
i would just call that adding custom events lol
ok
Hello this is only for peple with Windows! Sorry Linux, Mac...
Ok so i wanted to do an auto updater in batch and when i open the main file i want to start the updater too and the problem is that i want to check witch the updater (that is a batch file) if it is the update day or past than the update day.
How could i do that, i tried
:run_it
CLS
REM run whatever command
ECHO Running the command...
DIR C:\
GOTO END
:no_run
REM Notify user that it is the wrong day
ECHO Wrong day!
:END```
are you using system dates? like windows's date?
people can change their dates and fool your updater
post code
Wait
@quartz kindle
bot.on('messageReactionAdd', (messageReaction, user) => {
let embed = new RichEmbed()
.setColor('GOLD')
.setDescription(`New Star!\n${messageReaction} ${user}`)
.setAuthor(bot.user.username, bot.user.avatarURL)
bot.channels.get('535611718571655210').send(embed)
bot.channels.get('535611718571655210').send(`⭐ | ${messageReaction.channel.name}`)
})
starboards take more work than that, but I don’t see an issue

but what is the issue
oof undefined
what documentation
probably discord.js docs
you should probably use the actual values you want, ie: user.username
not the object
also, dont send two messages in a row, you can send a text and an embed in the same message
yeah you can do <Channel>.send("content", { embed })
also, remember that will look for reactions in ALL servers
that’s why guild configs play a big part in bots
not even checking if its\⭐ tho
yeah true
so ive got this:
bot.on("messageUpdate", function(oldMessage, newMessage) {
});
that displays the old msg and new msg, but how can you find the channel that it was edited in, and the user who edited it?
it can be any reaction 
well, its for testing, so its fine
check the proprieties of the messages
how?
@blazing star
bot.channels.get('535611718571655210').send(`⭐ | ${messageReaction.channel.name}`, { embed })
each of those messages is an object
This?
yeah that works
@silver lintel you know how the message object has many proprieties, such as message.id message.content message.channel etc...
oh yeah
newmessage and oldmessage are basically a message
.author
^
why am i so stupid today
¯_(ツ)_/¯
np
bot.channels.get('535611718571655210').send(`⭐ | ${messageReaction.channel.name}`, { embed })
^
TypeError: Cannot read property 'name' of undefined```

Guys, in discord bot py rewrite, how can i handle a error when the person writes a command that don't have in the code ?
There’s a on_command_error event
nice
Did not work very well
yea
Do you want the code?
nah i’m good
its pretty obvious
yea
you're trying to send an object in the message
you put an object not a stringible propety
like
What 
you cant send a box on discord
ty, var 😃

can u just read the docs for the lib you're using
Do you know what an object is?
But a question. i'm using an error handler for every command
wait, what
wait, what was for me ? haha
yes it was for u
so currently, my bot sends @silver lintel. how do you make it so it is the mention
should work just like that
but its in an embed
in the description
Oh I thought he meant code embed
Hi, I'm from the Pokécord Official Server and we've been getting reports about people getting a 503 error, What is this and could be solve it?
HTTP Status Code 503: The server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay.
Dbl servers = discord servers atm
@royal lotus we know about the issue and are working on a solution
its on our end rn
sorry about that
Thats alright, I just wanted an answer
Because so many ppl come up
And we thought they were banned because of breaking Discord ToS
😂
Thanks for that
Hi could someone help me with a command that automatically logs joins and leaves in a channel called welcome-goodbye .
Guys, could someone help me ?https://hastebin.com/raw/sohepurowa
i don't know what's wrong in my code ?
but the bot don't handle the error
Of course, lachie
larchie
on member join and on member remove
Discord.js
@lyric talon I need it to find the thing, but nvm someone on alternate server helped
let sendChannel = bot.channels.get("ID")
sendChannel.send("MESSAGE")
Would that work?
To find the channel
You would have to get the guild then the channel
bot.guilds.get(id).channels.get(id).send
lol
damn should probably stop talking here, I am using really old d.js
Well unless you sharding
let sendChannel = bot.channels.get("ID")
sendChannel.send("MESSAGE")
What’s shardinf
The act of splitting your client into multiple processess to handle a smaller amount of servers
Yea
basically cloning
hey um
so say u have js [ { ID: 'userInfo_7', data: { username: 'User6', balance: 9999 } }, { ID: 'userInfo_1', data: { username: 'User', balance: 9000 } }, { ID: 'userInfo_4', data: { username: 'User3', balance: 4000 } }, { ID: 'userInfo_8', data: { username: 'User7', balance: 700 } },
and u want only the username and ballance
how would u do that
is that in json or
no its in an array
Oh just an array
like db.startsWith('userBalance', { sort: true, sortBy: '.balance' }); returns that
Can a bot dm a bot?
yea
It'd be easier if it were just an object, I believe
Like my user data is set up something like this { id: {balance: bal, items: {item_name: name}}
I forgot a `}~
well wait a sec, Im a bit retarded
Best to, I dont use that 
what language :?
hm
and what code
the file does not exist
which file
?
the file you are trying to get data from does not exist
ty
ok
😃
@uneven laurel maybe because the message was sent in DM, so there is no guild?
@sterile hearth
Would this work?
If(message.channel.type == dm)
{
Message.channel send(‘this command doesn’t work in DIREct messages’)
Return;
};
discord.js?
prob not





Help


