#development
1 messages · Page 483 of 1
didnt code for long time
isnt that the kali linux dragon?
cheers uber
cheers mate @whole plume
I coded it
nice
owo
are you sure your passing a guild to it?
guild.defaultChannel.send(`Hello!
https://i.imgur.com/3333AN5.png depricated but should work
dm me the full function
correct
its obsolete now with discord
so just is undefined
which is why its depricated
^
@whole plume your best bet is to find a channel named general and send it there.
<guild>.channels.find(_ => _.name === 'general');
@earnest phoenix and I made it send the owner of the server a dm
that would be bad specially if the owner didnt add the bot
a person that has manage_server can add any bot
I recommend to just find a channel named general. also as for perms, you can have a perm checker on some commands that needs it
i already have done the perm checking
then that should be fine even you dont alert the owner
infact I think it has it so if it catches an error it replies with "Uh-oh! Something went wrong, maybe I dont have permissions to run this command!"
When I can't change my Nick
in my opinion at least, its not really a good practice to have a bot dm the owner
when invited
i respect that
@lusty dew become a certified dev and you can change nick
its still extremely wip
I take it that certified dev requires you to have a certification liscense?
sign up
license*
or somethi
in shorter words, the bot must be well built and passing the requirements to get in
oh nice
I failed once
and make everything pretty
not because its well built you can get certified
pretty much this
yikes
i definitely wouldnt
but thankfully I have @earnest phoenix working on @earnest phoenix with me
Let me guess
while Im alone @keen salmon help me
Hentai and nsfw?
I got a lot to work non
Waifu means Wife in Japanese
it also has some simple moderation commands and I plan on adding integration for esports and myanimelist
the rewrite still far from working
copying those wont make the code work lmao
Yea lol
I got my own modules that isnt on npm
all my commands are in the same file rn
My shit is so unorganized
once its mostly finished i'll prolly make it into modules
wait what was the script to display server count on dbl?
https://discordbots.org/api/docs @earnest phoenix
thanks
np
no?
im using some dark magic called visual studio live to help him with his organizational skills
Oh lol
its litterally a remote vscode session
they're cool
i can access his vscode console, connections, file system and save files etc
dark magic
so like
its restricted
to the files your editing
works like google docs
@lusty dew you high again?
I got the windows server vps
gross
u talking to me?
xD
ok
Shh don't tell Oliy
p i n g
p o n g
Using evies enmap, I'm unable to use client.commands.get(command).run()
telling me this is not a function
I've checked the API docs for .run and it doesn't exist yet in the idiotguides thingy it uses it.
commands @keen salmon
no i mean you must put functions into enmap before you can run it
fs.readdir("./commands/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith(".js")) return;
let props = require(`./commands/${file}`);
let commandName = file.split(".")[0];
console.log(`Attempting to load command ${commandName}`);
client.commands.set(commandName, props);
});
});
and btw you mean this enmap.get(cmd)()
two command?
then itll be a very nice problem
try to get it into a variable
if that variable is undefined you might have something wrong
or just console log the enmap
or probably he is doing it wrong
let cmd = client.commands.get(command);
if (!cmd) return;
cmd.run(client, message, args);
it finds the command
you should just cmd() then
alright
did it works
let cmd = client.commands.get(command);
if (!cmd) return;
cmd(channel, userstate, message, self);
console.log cmd
sure
nice erroe
let cmd = client.commands.get(command);
if (!cmd) return;
console.log(cmd);
cmd(channel, userstate, message, self);
console.log(command);
let cmd = client.commands.get(command);
if (!cmd) return;
console.log(cmd);
cmd(channel, userstate, message, self);
do you actually tried too do client.commands.size?
ok did you export your functions at the other files
and log it
owo
@stray wasp show me the log of client.commands.size
alright
@stray wasp is the file you try to load exported correctly
how many commands did you exported one for now?
yes
module.exports = (client, channel, userstate, message, self) => {
client.say(channel, "Hey it works omg!");
}
ok now that it loads, how do you load the command
is what it contains
ok
@sinful lotus probably foreacj
@sinful lotus
fs.readdir("./commands/", (err, files) => {
if (err) return console.error(err);
files.forEach(file => {
if (!file.endsWith(".js")) return;
let props = require(`./commands/${file}`);
let commandName = file.split(".")[0];
console.log(`Attempting to load command ${commandName}`);
client.commands.set(commandName, props);
});
});
nope didn't work
module.exports = (client, channel, userstate, message, self) => {
client.say(channel, "Hey it works omg!");
}
try putting exports.run =
then run it with cmd.run
san Andreas mission complete sound
@Saya#0113

hi
if(command === "cookie"){
let user = message.mentions.users.first();
let razon = args.slice(1).join(' ');
if(!user) return message.channel.send('You must tag someone.');
if(!razon){
razon ='Just wanted to give you a cookie';
}
message.channel.send('**'+ user.username +',** you have received a :cookie: from **'+message.author.username+'**\n\n**Reason:** '+razon+'\n(づ。◕‿‿◕。)づ:・゚✧ :cookie:');
}```
There
Didn't want to send it here lol
I'm sleepy, sorry
what is that for
why post it here
I made the command for a friend and send it in the wrong chat, anyway, use it if you ever want to give a cookie to someone
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5430?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5430?
``` anyone know what this means
when im trying to connect to postgres server
I don't know, man
its looking for it on localhost
if its not on your system that's why
if it is then I cant tell ya
when i try to start the server with pg_ctl i also get that
Right
interesting question coming
member.sendMessage(`${msg.author.tag} sent you some nudes.`, {files: [`./pics/hentai/${files[Math.floor(Math.random()*files.length)]}`]})```
how would I make it mention the author instead of the username#0000
disregard
Would ${msg.author} convert it into a mention?
Why erroring
?
Cant find sqlite moduke
Ok
Wait
Not working
its not sqlite
its looking for module in some weird folder lmao
deletee node modules
and reinstall them
Bot developers can you tell me how to make a spam bot
no, nobody here will help you break Discord's Terms of Service.
@earnest phoenix ^
My package.json
{
"name": "crex",
"version": "0.0.1",
"description": "Bot yapımcısı Foalwy",
"main": "bot.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node bot.js"
},
"engines": {
"node": "8.4.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/An-Idiots-Guide/guidebot.git"
},
"author": "The Idiot's Guide Community",
"license": "MIT",
"bugs": {
"url": "https://github.com/An-Idiots-Guide/guidebot/issues"
},
"homepage": "https://github.com/An-Idiots-Guide/guidebot#readme",
"dependencies": {
"array-sort": "^1.0.0",
"chalk": "^2.4.1",
"cleverbot-node": "^0.3.11",
"cool-images": "^1.0.1",
"dbl.js": "^1.5.0",
"dblapi.js": "^2.2.0",
"discord.js": "^11.2.1",
"enmap": "^0.3.2",
"express": "^4.15.5",
"fortnite": "^4.1.1",
"gifencoder": "^1.1.0",
"isgd": "^1.1.3",
"moment": "^2.18.1",
"moment-duration-format": "^1.3.0",
"node": "^10.8.0",
"opus": "^0.0.0",
"request": "^2.87.0",
"simple-youtube-api": "^5.0.2",
"steam-provider": "^0.2.0",
"superagent": "^3.8.3",
"table": "^4.0.3",
"weather-js": "^2.0.0",
"ytdl-core": "^0.21.1",
"jimp": "^0.2.8",
"figlet": "^1.2.0",
"hastebin-gen": "^1.3.1",
"quick.db": "^4.2.1",
"fortnitetracker-7days-stats": "^3.1.1",
"strict-uri-encode": "^2.0.0",
"cowsay": "^1.3.1",
"google": "^2.1.0",
"cat-names": "^1.0.2",
"canvas": "^1.6.11",
"sqlite": "^3.0.0"
}
}```
why are you telling me
do npm i to install ur modules
No
Aight, someone wanna let me know why this doesn't work?
[JDA MainWS-ReadThread] ERROR JDA - One of the EventListeners had an uncaught exception
org.json.JSONException: JSONArray initial value should be a string or collection or array.
at org.json.JSONArray.<init>(JSONArray.java:179)
at Main.onMessageReceived(Main.java:43)
at net.dv8tion.jda.core.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:410)
at net.dv8tion.jda.core.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:84)
at net.dv8tion.jda.core.handle.MessageCreateHandler.handleInternally(MessageCreateHandler.java:127)
at net.dv8tion.jda.core.handle.SocketHandler.handle(SocketHandler.java:37)
at net.dv8tion.jda.core.requests.WebSocketClient.onDispatch(WebSocketClient.java:996)
at net.dv8tion.jda.core.requests.WebSocketClient.onEvent(WebSocketClient.java:894)
at net.dv8tion.jda.core.requests.WebSocketClient.handleEvent(WebSocketClient.java:873)
at net.dv8tion.jda.core.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:1031)
at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:368)
at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:270)
at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:990)
at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:749)
at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108)
at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)```
code is
if ( event.getMessage().getContentRaw().equals("!dog") ) {
//Use Unirest to get from api.
try {
HttpResponse<JsonNode> jsonResponse = Unirest.get("https://api.thedogapi.com/v1/images/search").asJson();
//Use org.json.jsonobject to parse the json
JSONObject jsonReply = new JSONObject(jsonResponse.getBody());
//Store image url from json reply in "imageUrl"
JSONArray jsonarray = new JSONArray(jsonReply);
String imageUrl = "placeholder";
for (int i = 0; i < jsonarray.length(); i++) {
JSONObject jsonobject = jsonarray.getJSONObject(i);
imageUrl = jsonobject.getString("url");
}
//Send message back with simply just the image url
event.getChannel().sendMessage(imageUrl).queue();
} catch (UnirestException e) {
e.printStackTrace();
}```
org.json.JSONException: JSONArray initial value should be a string or collection or array.
the input was probably not one of those
i guess?
This is the first experience i really have with java.
a couple things
- don't use unirest
- you're using org.json wrong:
- new JSONArray(text goes here)
- new JSONObject(text goes here)
when you do new JSONObject(jsonResponse.getBody()) you're using a constructor that'll treat the body as just a java bean, aka will read it's fields from getters into a new json object, instead of reading the json you already have
- What's wrong with unirest?
- Okay
global state, doesn't follow the http spec properly, abandoned library
wow, okay.
Should I use a fork of the MySQL module?
I was told the main is less stable for huge data retrieval.
is there any particular reason to use a fork ?
so you can contribute to it to make it actually stable and usable
nice meme
Mongodb superior to all databases (unless you have a weirdly relational bot)
there's no "superior" db
Bet
also most bots can use relational databases perfectly fine
most data they have fits perfectly in relational storage
eg levels, prefixes, tags, modlogs, etc
Oh
all can fit easily in relational databases
Im thinking the opposite
Of what being relational means
Ignore my antics
But why not use a nonsql?
Curious
Nosql has proven to be faster that SQL langs
Alot of bots go rogue here with dms
Ive noticed xF
MongoDB scales very well
Structured query langs struggle as your db gets larger
I'd say if you don't care about schemas and the such, you'll be great with mongo
which means if for whatever reason it crashes you lose data
I hear this argument a lot...
Simple answer: back up your data
It's not hard
You should be doing that anyway
How can it even crash 
Have a Cron job do it every minute if youre really conscious about it
this data
is based off 1,000,000 requests
/ records
realistically
will a discord bot ever get this much traffic?
even if they do
there's a lot more factors to consider
not exactly with mongo but using rethink (also document based) has given a lot of headaches in my experience
Indeed
as in the database caches way too much data and fucks up by itself
cc @cosmic plover @hollow abyss
MySQL is suited best for small scale databases in my opinion
With that being said, your application can always grow big
oh no why was I pinged
Which is why mongodb is like a long term investment: you plan for the future
didnt you lose data a couple times with mongo amy
Yes
we're going 10xer mode amyo
I've been using mongo for over a year. I always keep backups and I've been fine.
The few things I have that use mongo are backed up hourly because I've had the most wtf data losses with it
Yes I back up at the top of the hour too.
If my bot gets really big, I can even back up every 30 minutes
mongo is the only db where I've somehow lost the entire database by doing <your database here>'s equivalent of db.collection.find().count()
¯_(ツ)_/¯
having to do backups that frequently is a bad sign imo
You should be doing backups for any data that you remotely care about
doing backups is good, but having to do them because your db might lose all data in normal operation is another story
I don't do it because I expect to lose my data lol.
I do it because it makes sense for any data that's important
well obviously
ofc you back up anything remotely important
But unless you're terrified that your database is gonna mysteriously disappear - as mongo has done to me more times than I want to think about - then the most you ever really need is ~daily backups
Maybe you just had really bad luck lol. I can't really relat to the idea of losing data
On the topic of backup frequency, there's really no reason not to backup hourly
I have a Cron job set up. I just start it and forget about it
"I don't want hundreds of GBs of useless backups daily"
My god
I make more than just bots .-.
What data do you have
I don't really feel like telling my work "Hey, we need to be backing up this non-critical data every hour, even though a full backup of it is ~300GB each time"
doesn't mongodb
take up more disk space
for the same amount of data
that'll add up
over time
especialyl with backups
Export them to network attached storage or something
especially if you have fairly long-term backup retention policies because of <insert requirements here>
@hollow abyss no, wasn't referring to you
ah
i mean
i dont see the instance when
i said i stored all my data
in teh same server
???
It sure sounded like it
if u have multiple servers for data storage
the mongodb backups
will def take up more space
than the sql ones
Actually I have yet to verify this claim
I will say that Mongo has gotten much better in recent years - at least it can actually pass Jepsen nicely now - but it has a god-awful reputation that I don't really wanna trust my data with. And since many, MANY use-cases for databases are relational anyway, Mongo doesn't have much of a point if all you're doing is effectively just dbHandle.save(userInstance) or something
"I'm too lazy to use my database correctly" is not the same as "My data is not relational / structured"
Your data isn't relational. I think it needs counseling. 
someone good with lavalink? im getting error: no http module available
what do i need?
stacktrace?
stack-trace or stacktrace.js
do you know what a stacktrace is?
no, i don't
uhh i need help
you should load your token from a separate sourc
It's invalid syntax
No it isn't
Huh?
That's the file throwing the error
Hm
Also you don't need to import asyncio iirc
Ok
message.channel.send(embed).then(embed => {
embed.react("🎉").then();
const filter = (reaction, user) => {
'🎉' === reaction.emoji.name
};
embed.awaitReactions(filter, {max: 1, time: 100000, error: ['time']})
.then(collected => {
const reaction = collected.first();
if(reaction.emoji.name === '🎉') {
message.author.send(`You just reacted!`)
}
})
.catch(collected => {
message.reply("Couldn't reply as fast as time!")
});
});
}
Wont send the message when i react or anyone else reacts
did you literally paste an emoji in there
??
did you literally paste an emoji as the emoji name
yes
or did you write the emoji name out
lmao don't do that
discord uses names for emojis
hang on a sec
Yeah
okay
message.channel.send(embed).then(embed => {
embed.react(":tada:").then();
const filter = (reaction, user) => {
':tada:' === reaction.emoji.name
};
embed.awaitReactions(filter, {max: 1, time: 100000, error: ['time']})
.then(collected => {
const reaction = collected.first();
if(reaction.emoji.name === ':tada:') {
message.author.send(`You just reacted!`)
}
})
.catch(collected => {
message.reply("Couldn't reply as fast as time!")
});
});
}
this would be your code for that particular emoji
I may need help coding my bot in .py
put the emoji into quotation marks, or remove them completely
I'm not too familiar with the standard DiscordAPI
i use JDA for most of my stuff
Oof i need someone who knows python
I barely do
message.channel.send(embed).then(embed => {
embed.react("🎉").then();
const filter = (reaction, user) => {
'🎉' === reaction.emoji.name
};
embed.awaitReactions(filter, {max: 1, time: 100000, error: ['time']})
.then(collected => {
const reaction = collected.first();
if(reaction.emoji.name === '🎉') {
message.author.send(`You just reacted!`)
}
})
.catch(collected => {
message.reply("Couldn't reply as fast as time!")
});
});
}
only the basic basics
On making a bot in python?
no of the language itself haha
Oh XD
I mean hit me with your problem I might be able to help
@earnest phoenix try using `` instead of ""
just a suggestion ¯_(ツ)_/¯
for the top one
for the emojis
embed.react("🎉").then();
const filter = (reaction, user) => {
'🎉' === reaction.emoji.name
};
embed.awaitReactions(filter, {max: 1, time: 100000, error: ['time']})
.then(collected => {
const reaction = collected.first();
if(reaction.emoji.name === '🎉') {
message.author.send(`You just reacted!`)
}
})
.catch(collected => {
message.reply("Couldn't reply as fast as time!")
});
});
}
that
?
yes
only write the emoji name
^
and not the pasted
that might also work
can anybody help me on hasbin.com fast please
like that, I guess
Uh
Youtube searchbar best IDE
The code got deleted rip me
rip
writing a discord bot in cmd
damn son
that's how I run mine 
Oof my program has an integrated console
nope @olive lantern thats the error im getting and it keeps stopping my bot 😦
what have you got written at line 171 at character 17?
http://prntscr.com/ktb5zq @queen sentinel
const { RichEmbed, version } = require('discord.js');
const config = require('../storages/config.json');
module.exports.run = async (client, message, args) => {
let embed = new RichEmbed()
.setColor("FFFF00")
.setDescription(`React! below`)
message.channel.send(embed).then(embed => {
embed.react(`🎉`).then();
const filter = (reaction, user) => {
':tada:' === reaction.emoji.name
};
embed.awaitReactions(filter, {max: 1, time: 100000, error: ['time']})
.then(collected => {
const reaction = collected.first();
if(reaction.emoji.name === `:tada:`) {
message.author.send(`You just reacted!`)
}
})
.catch(collected => {
message.reply("Couldn't reply as fast as time!")
});
});
}
thats my code

does not work
the api returns emoji names as unicode
😦
Oof
when they are unicode, obviously
im using discord.js @queen sentinel
when they react
yea I do my colours in discord.js like that
oof and here i thought that because its midnight here by me that im tired and lazy now i heard everything xD @queen sentinel
Idk how your API works, but regarding the sending of the message code, you have to tell the
reaction.emoji.name
to catch the latest reaction, and then make it check for
if(reaction.emoji.name === `:tada:`) {
message.author.send(`You just reacted!`)
}
@queen sentinel no, it can also be a string
¯_(ツ)_/¯
i did that
no
My bots are amateur as the come so what do I know
nah i think im much more than you @queen sentinel xD
discord sends the unicode in the name field for reactions
const { RichEmbed, version } = require('discord.js');
const config = require('../storages/config.json');
module.exports.run = async (client, message, args) => {
let embed = new RichEmbed()
.setColor("FFFF00")
.setDescription(`React! below`)
message.channel.send(embed).then(embed => {
embed.react(`🎉`).then();
const filter = (reaction, user) => {
'🎉' === reaction.emoji.name
};
embed.awaitReactions(filter, {max: 1, time: 100000, error: ['time']})
.then(collected => {
const reaction = collected.first();
if(reaction.emoji.name === `:tada:`) {
message.author.send(`You just reacted!`)
}
})
.catch(collected => {
message.reply("Couldn't reply as fast as time!")
});
});
}
exports.config = {
command: 'giveaway',
aliases: ['freegiveaway','free'],
plevel: "Staff",
description: "Checks the API Latency for Discord!",
usage: "ping",
category: "ヅ General ヅ"
};
exports.extra = {
hidden: false
};
Step up your game with a modern voice & text chat app. Crystal clear voice, multiple server and channel support, mobile apps, and more. Get your free server now!
module.exports.run = async (client, message, args) => {
let embed = new RichEmbed()
.setColor("FFFF00")
.setDescription(`React! below`)
message.channel.send(embed).then(embed => {
embed.react(`🎉`).then();
const filter = (reaction, user) => {
if(reaction.emoji.name === `:tada:`) {
message.author.send(`You just reacted!`)
} };
embed.awaitReactions(filter, {max: 1, time: 100000, error: ['time']})
.then(collected => {
const reaction = collected.first();
if(reaction.emoji.name === `:tada:`) {
message.author.send(`You just reacted!`)
}
})
.catch(collected => {
message.reply("Couldn't reply as fast as time!")
});
});
}
legit whaty i have
why are you sending "embed" then defining "embed"
message.channel.send(**embed**).then(**embed** => {
ohhh
lmao
^^
http://prntscr.com/ktb8u7 @queen sentinel like this ?
it might be receiving it's own reaction
oh
hold
also yeah it isnt filtering
embed.awaitReactions(filter, {max: 1, time: 100000, error: ['time']})
those the max
i mean this https://javascript.is-bad.com/5deedb.png
add to the filter
it'll start waiting for reactions before actually reacting
wait your filter is buggered
const filter = (reaction, user) => {
if(reaction.emoji.name === `:tada:`) {
message.author.send(`You just reacted!`)
} };
thats not how the filters work
@slate kayak .setColor(0xff3262) that's how I've always done it
const filter = (reaction, user) => (!user.user.bot && reaction.emoji.name === '🎉');
that woild work
embed.awaitReactions(filter, {max: 1, time: 100000, error: ['time']})
those the max
do anything?
ok so i dont need the ' before and after the ' ? <@&304313580025544704>
@queen sentinel
wow

sorry
what
rip
👏
TRIGGERED
also no need to do js const mystring = `this`;
and no you shouldn't if it works for me @slate kayak
but that's just a theory
a GAME THEORY - thanks for watching
you can just do js const mystring = "this"; //or const mystring = 'this';
i always use '
const filter = (reaction, user) => (!user.user.bot && reaction.emoji.name === '🎉');
^
TypeError: Cannot read property 'bot' of undefined
@queen sentinel if can also be a string
@sick cloud
ok but why does the bot stops for that @queen sentinel ?
http://prntscr.com/ktbar9 just an example from old code
@earnest phoenix One, what the heck is user.user.bot?
oh yea
thats what @sick cloud told me to do
no need for two user
@queen sentinel can you help me on hasbin please as the bot stopped again 😦
Two, and it's more of an opinion, you don't need () around the function
module.exports.run = async (client, message, args) => {
let embed = new RichEmbed()
.setColor("FFFF00")
.setDescription(`React! below`)
message.channel.send(embed).then(embed => {
embed.react(`🎉`)
const filter = (reaction, user) => (!user.bot && reaction.emoji.name === '🎉');
embed.awaitReactions(filter, {max: 1, time: 100000, error: ['time']})
.then(collected => {
const reaction = collected.first();
if(reaction.emoji.name === `:tada:`) {
message.author.send(`You just reacted!`)
}
})
.catch(collected => {
message.reply("Couldn't reply as fast as time!")
});
});
}
what i have now
and it does not work
Should probably await that react method
I'm afraid I'm of no use here 
Haven't a clue, sorry
What is the error?
theres no error
What is not happening ?
just when i react it does not send a message
module.exports.run = async (client, message, args) => {
let embed = new RichEmbed()
.setColor("FFFF00")
.setDescription(`React! below`)
message.channel.send(embed).then(embed => {
embed.react(`🎉`)
const filter = (reaction, user) => (!user.bot && reaction.emoji.name === '🎉');
embed.awaitReactions(filter, {max: 1, time: 100000, error: ['time']})
.then(collected => {
const reaction = collected.first();
if(reaction.emoji.name === `:tada:`) {
message.author.send(`You just reacted!`)
}
})
.catch(collected => {
message.reply("Couldn't reply as fast as time!")
});
});
}
That's cause you set a time of 100 seconds
^^
please console.log collected
okay
no logs
ok then there is something wrong with either your filter or with the max and such
try setting the time to 5000
if(reaction.emoji.name === :tada:) {
message.author.send(You just reacted!)
} won't work
It's a unicode symbol
yes
okay
Custom emojis and unicode emojis are different.
Sure. If you want 100 people to react
what's the max
module.exports.run = async (client, message, args) => {
let embed = new RichEmbed()
.setColor("FFFF00")
.setDescription(`React! below`)
message.channel.send(embed).then(embed => {
embed.react(`🎉`)
const filter = (reaction, user) => (!user.bot && reaction.emoji.name === '🎉');
embed.awaitReactions(filter, {max: 1000, time: 20000000, error: ['time']})
.then(collected => {
const reaction = collected.first();
if(reaction.emoji.name === `🎉`) {
message.author.send(`You just reacted!`)
}
})
.catch(collected => {
message.reply("Couldn't reply as fast as time!")
console.log(collected)
});
});
}
It gets the first reaction
If you want to send everyone a message who reacts you should loop it
how would i do that?
collected.forEach might be a thing
What exactly are you trying to do?
when someone reacts
it sends a message
like everyone
client.on('messageReactionAdd', (reaction, user) => {
if(reaction.emoji.name === "✅") {
console.log(reaction.emoji.users);
na
would not work
Forever?
yes
Just use the messageReactionAdd event
so that
No need for a collector
Good evening, sorry to disturb, Im learning web development and I know html/css and want to learn js and node js etc for web are you doing private teaching ? If one of you do contact me mp for more information
i could, for a price
Yeah we told me there was a lot of web developer
i was a web dev before making a bot so...
Ok
um guys... how to send a message to a specific channel for c#
you get the channel from the guild object and send a message from the channel object simple
I'm trying to find a way to check if a user has a specific role from one server in d.py
yes
calling a function within itself a great way to make mem leaks
if you have event listeners in the function
function lol() {
while(true) {
client.on("all", a => {
console.log(a);
fs.writeFile(`${performance.now()}.txt`,"lol","utf8",(err) => {
console.log(err);
});
});
lol();
}
}```
ever more bettererer
undefined
Can someone help me
That is all I get
In console
var IP = args[0]
Pretty sure
this is the problem
that means that the item at position 0 in array args is undefined or, iirc, the array args might be undefined
Oh ok
its just args[0] is undefined
if args were undefined, you would get args is undefined im dumb
console.log(args) and make sure it has what you expect
I got nothing in console log
nothing? or []? or undefined?
are you sure your passing it propperly?
depending on how long it takes to get what your passing you may also look into async await or some sort of callback to only pass when its recieved what its passing properly
console.log('hello world')
am i developer now?
lol
there should be a challenge here for most conveluded hello world
if i edit a message a bunch of times, will i get ratelimited?
kinda
maybe generate a gif with discords color background instead 👀

-bots @zealous veldt
@ashen stag
@vocal seal
datacenter maintenence
of?
Ye
-bots
@near hill
@full dust
@sinful lotus
bot.on('message', message => {
if(isValidCommand(message.content) == false) return
try{
require(`./commands/${message.content.split(" ")[0].replace(settings.prefix, '')}.js`).execute(message, bot)
} catch(e){
console.log(e)
bot.errorMessage(message, "Command does not exist. Run ~help to see all current commands.")
}
})```
thats not good a practice from my standpoint
you require every time the command is run
basically I will put it in simple terms,
Its like requiring discord.js on every command
eventually, yes I might swap it out for a more efficient version, but for now its fine
I created this premade code for those who want to have a handler
it is also exported on event
I can pretty much explain what I wrote there so just ping me if you dont understand something
ight
@whole plume invalid command responses are frowned upon
-spano
anyone knows a http module for lavalink? (discord.js) (javascript)
you don't need one 
@earnest phoenix do you use a lib for lavalink? This error looks like you use one
ithink i do
Pretty sure you do
Wait do you use appelations lib? 
If yes then you probaly didnt provide host.rest
Aka the rest url to use Lavalinks rest api
one guy told me to install dis "https://www.npmjs.com/package/lavalink"
this is where i got the "lavalink" from
use discord.js-lavalink
No 
yukine pls
No its annoying af that people always come in and do "UHHHH MY LIB IS BETTER"
Like could you post that somewhere else, thanks
it is a better solution tho
like discord.js-lavalink is simpler to use, so it makes sense for this specific user to use it rather than appelations's lib
how do i setup the lavalink http host?
see what i mean ^
sigh
well how do i do it lol
@earnest phoenix https://i.imgur.com/8Kf2OKy.png
@heady zinc thats not my point, he might be new to Js/node but i still dont need people always telling other people to use x lib in here and instead just answer his question help him with his issue
i suck ass at nodejs thts why im confused af
ok i have that hw df do i find a "http" host
thtats the ip where your lavalink server is located + the http port you specified in the config
well i dont have a lavalink server...
and how do i set up one?
how do u download files from github?
@restive silo ffmpeg 
hm
Date.daysBetween = function( date1, date2 ) {var one_day = 1000 * 60 * 60 * 24;var date1_ms = date1.getTime();var date2_ms = date2.getTime();var difference_ms = date2_ms - date1_ms;return Math.round(difference_ms/one_day);};
let created = new Date(message.author.createdAt);
let days = new Date(created.getFullYear(), created.getMonth(), created.getDate());Date.daysBetween(created, new Date())
console.log()
how would i log this
;-;
when i eval without console.log()
got it from stackflow
i logged
created
returns time date
logged days returned the same
i used eval and it worked
as output
Empty console.log()
Also
What do you want to achieve
I can't understand anything
No
penguin!eval Date.daysBetween = function(date1, date2) {
var one_day = 1000 * 60 * 60 * 24;
var date1_ms = date1.getTime();
var date2_ms = date2.getTime();
var difference_ms = date2_ms - date1_ms;
return Math.round(difference_ms / one_day);
};
let created = new Date(message.author.createdAt);
let days = new Date(created.getFullYear(), created.getMonth(), created.getDate());
Date.daysBetween(created, new Date())
there.
console.log(Date.daysbetween...)
tried that
Btw
Your function does not return a result
just add return days
And remove the log from the function so you won't cause recursion
Or do console.log(days)
whats a websocket connection for lavalink?
its how your bot talks to lavalink
how df do you set that up
const dbl = new DBL('Your discordbots.org token', client);
``` this isnt required to get bot info, correct?
or
no
that token is for endpoints that require auth, shown on api docs https://img.69420.me/GWRTra95.png
to get info on a specific bot GET/bots/{bot.id}, no. no auth required
but that code is not just your token, that is making new instance of DBL which posts stats.
const dbl = new DBL(tokendbl, bot);
Anyone know why he does not find my vote when I did it?
dbl.getVotes().then(votes => {
if (votes.find(vote => vote.id == message.author.id)) {
}
})
Hey, I'm trying to get my bot to come online, but it wont work.... I'm using Discord.js... any help?
https://anidiots.guide/ this is a good resource for discord.js bot development, maybe try looking at the Your First Bot section?
kk thx
a copycats guide
no u
👌
okay so I read through it, but I'm pretty sure it doesn't tell me how to turn on the bot :c
@meager stirrup https://discordjs.guide/#/creating-your-bot/
A guide made by the community of discord.js for its users.
this should help then
Did you try running the code?
do you use "player.play("youtubeurl")" for lavalink player.play ?
no it needs the base64 "track" from lavalink
you can get from the loadtracks endpoint
const res = voice.load("ytsearch: rickroll")
player.join(msg.member.voiceChannel.id)
player.play(res)
do i get the base64 via load?
Is discord.js the name of your file?
Im getting this error on lavalink.jar, idfk how to fix it
no... its not,
replace discord.js with the name of your file
kk
@earnest phoenix use the correct auth header in your request
to match the password in application.yml
clearly i did
but i still get the error
ok well clearly ur not
the auth
header
for
request
to
rest
endpoint
const voice = new Node({
password: 'idfk1234', // your Lavalink password
userID: '473043401374302218', // the user ID of your bot
shardCount: 1, // the total number of shards that your bot is running (optional, useful if you're load balancing)
hosts: {
rest: '', // the http host of your lavalink instance (optional)
ws: 'ws://127.0.0.1:80', // the ws host of your lavalink instance (optional)
},
send(guildID, packet) {
// send this packet to the gateway
// you are responsible for properly serializing and encoding the packet for transmission
return gateway.connections.get(Long.fromString(guildID).shiftRight(22).mod(this.shardCount)).send(packet);
},
});
this ?
oh this is your websocket server auth error 
could be...
but is there a fix to this?
did u restart lavalink since changing the config?
long shot but might as well ask
i did
i restarted 100 times still get the same
how to delete a category in js
the errors popup when i type node bot.js
so @earnest phoenix is this rlly a websocket error or something else?
yes
socketserver is ur websocket
hmm ok
When ur bot is nearing completion and starting to come together 
When you think everything works but your Ctrl c+v didn't work right now you have to spend hours on end fixing it.
Or you can just Ctrl+z the mistake 
2018-09-12 14:22:41 | [INFO] | Discordia 2.5.1
2018-09-12 14:22:41 | [INFO] | Connecting to Discord...
2018-09-12 14:22:41 | [ERROR] | 401 - UNAUTHORIZED : GET https://discordapp.com/api/v7/users/@me
2018-09-12 14:22:41 | [ERROR] | Could not authenticate, check token: HTTP Error 0 : 401: Unauthorized
wrong token?
Like wrong bot token?
oh wait I got it
Forgot
bot:login(`Bot My_Token`)
``` the Bot part
you know i might be typing the wrong thing in, what is the thing I type in for Disocrd.js to start the bot? I know it's probably somethng simple and I'm just being dumb
Just how you start any other node.js application
oh k
node.js : The term 'node.js' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:1
- node.js
-
+ CategoryInfo : ObjectNotFound: (node.js:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
The syntax is node file.js
Or node . If the application is in the current working directory
type node YOUR_MAIN_FILE.js
okay i did it, didnt get any message back, but I have it where it gives me something saying "ready" when it works, but it didnt play, and the bot isnt on
how do I get the guild icon when it's the letters? (oauth)
like this https://i.imgur.com/MgwAoEJ.png
How to install base64?
base64 = require("base64")
is there a icon of dbl?

...it's literally this server's icon
its for a website
ok...?
@earnest phoenix yeah I figured so I made it myself https://i.imgur.com/F4X52d8.gifv
you managed to recreated it identicaly 
yeah
function getIcon(guild) {
if(guild.icon) return guild.icon;
const guildName = guild.name;
const name = guildName.replace(/\w+/g, n => n[0]).replace(/\s/g, "");
return `http://via.placeholder.com/512/202225/ffffff.png?text=${name}`;
}```this is what i use
what is placeholder . com
I use CSS to do it
i can't use css for that because i set the favicon
Hey, can someone help me with a problem? I have the Dank Memer bot in our server, and I want to do a gamble function but the bot gives this message to me and no one else on the server "Error: gamble.15.186.21:57.err6530".
This isn't development related
hmm, where do I post it?
In the dank memer support server



