#development
1 messages ยท Page 364 of 1
Like so only one of me
instead of 5
idk what I'm saying rn
Please mention me if you know a solution.
@quiet bobcat maybe: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce
right now you're going
guild.members.forEach(function(member) {
// do stuff
});
you should instead go
for (const member of guild.members) {
// do stuff
}
then you can break; in the middle
const cookies = require('quick.db'); // database
const moment = require('moment');
let today = moment().format('1')
if(message.guild.id === '383790085901910016') return;
cookies.fetchObject(`lastBump_${message.guild.id}`).then(i => {
if (i.text === today) return message.channel.send('**FAILED!** Your server already bumped today');
cookies.updateText(`lastBump_${message.guild.id}`, today).then(() => {
is pissing me off because it just returns the failed message .-.
like js member.user.discriminator
I mean presumably yes
since for..of loops are functionally equivalent to forEach in all the cases I can think of
Weird
because I can't do it
TypeError: Cannot read property 'discriminator' of undefined```
hold up are you using d.js?
Yes?
oh I assumed eris
oh lol
then you'll need to do
for (const [id, member] of guild.members) {
// do stuff
}
where id is the member's snowflake and member is the member object
since d.js stores members as a map and eris stores them as a weird unkeyed collection
ok
hm
Still got this sipurak#4275 jonasjac#4275 jonasjac#4275 jonasjac#4275 jonasjac#4275 jonasjac#4275
even though I had a break
let's see your code
try a different discrim?
for (const [id, member] of guild.members) {
if(member.user.discriminator == args[1]) {
output += member.user.username + '#' + member.user.discriminator + '\n'
found = true
break;
}
}})```
well you're running this for each guild
so probably your bot shares 5 servers with you
Yes...
Actually, alot of people after the nitro update have the #0001 discriminator
yup
yeah
so make the outer forEach a for..of loop as well
and break the outer loop when you find a match
although I don't really know how useful that command would be lol
const cookies = require('quick.db'); // database
const moment = require('moment');
let today = moment().format('1')
if(message.guild.id === '383790085901910016') return;
cookies.fetchObject(`lastBump_${message.guild.id}`).then(i => {
if (i.text === today) return message.channel.send('**FAILED!** Your server already bumped today');
cookies.updateText(`lastBump_${message.guild.id}`, today).then(() => {
why do I keep getting failed? -.- I haven't bumped in like 2 days LMAO.. If you figure it out, mention me ๐
thats very unspecific
You code it.
hm
muted
const Discord = require('discord.js');
const fs = require('fs');
const config = require(`./../../config.json`);
const search = require('youtube-search');
const yt = require('ytdl-core');
var opts = {
maxResults: 1,
key: ''
};
let dispatcher;
function play(message){
if(queue[message.guild.id][0]){
message.channel.send(`Playing song **${queue[message.guild.id][0][0].title}**`);
let stream = yt(queue[message.guild.id][0][0].link, { filter : 'audioonly' });
dispatcher = message.guild.voiceConnection.playStream(stream, { seek: 0, volume: 1 });
dispatcher.on('end', function(){
queue[message.guild.id] = queue[message.guild.id].slice(0);
play(message);
});
}
}
let queue = [];
module.exports.run = function(bot, command, args, message, updateJSON, addFooter){
if(args[0]=='queue'){
if(queue[message.guild.id]==undefined){
queue[message.guild.id] = [];
search(args.slice(1).join(' '), opts, function(err, results) {
if(err) return console.log(err);
queue[message.guild.id][0] = results;
});
}else{
search(args.slice(1).join(' '), opts, function(err, results) {
if(err) return console.log(err);
queue[message.guild.id][0] = results;
message.channel.send(`Queued song **${results[0].title}**`);
});
}
message.guild.members.get(message.author.id).voiceChannel.join();
}
if(args[0]=='play'){
play(message);
}
}
module.exports.help = {
names: ['music'],
usage: 'e-command <args>',
description: 'what?'
}```
I still need help understanding why it doesn't play the second time
change setGame to setActivity
Ik that.
setGame doesn't work anymore
it's eperated
eperated
don't use .setGame(), use setActivity()
Mk.
Anyone know why when I set bot.user.setStatus('invisible') then start the bot up and run a command it replys twice.
probably because you have 2 instances running
But when it is bot.user.setStatus('dnd') it dosent.
Anyone know how to generate graphs/charts in NodeJS?
use canvas or chart js
Any help with this?
(node:11496) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Request to use token, but token was unavailable to the client.
(node:11496) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
events.js:183
throw er; // Unhandled 'error' event
^
Error: socket hang up
at createHangUpError (_http_client.js:331:15)
at TLSSocket.socketOnEnd (_http_client.js:423:23)
at emitNone (events.js:111:20)
at TLSSocket.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1055:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
@bitter sundial This is your Discord.js Server count code. I got this in console.
Only got that error when I added your code.
that's unrelated to the stat post
you've done something very weird to your client[.token]
Anyone know why when using Lavalink the client always reports 0 connected VC?
Mk, Just added code for Server Counter by the ready area. Ran the bot and I see this on the website. https://gyazo.com/0a4d624c7d12a91c8ddd024c4e09ff38
Im not sure if it is updating,
@uncut slate Do you know why?
no, not unless you have an error code to give me
Nope.
@uncut slate This help? https://gyazo.com/99b764dac4fa253b0f399cbd50fae614
that will only post stats on an interval
So I screwed something up?
no
not really
Thats why it didnt update correct?
kinda, sorta
it'll post every X ms
in this case X is a fair bit so you just need to wait for the first cycle ๐คท
or use other code
post on guild join leave and startup
Anyone know why when using Lavalink the client always reports 0 connected VC?
It shouldn'tโข
snekfetch.post(https://discordbots.org/api/bots/stats)
^
ReferenceError: snekfetch is not defined
at Timeout.setInterval [as _onTimeout] (C:\Users\owner\Desktop\Weather Bot\app.js:159:5)
at ontimeout (timers.js:475:11)
at tryOnTimeout (timers.js:310:5)
at Timer.listOnTimeout (timers.js:270:5)
Any Help?
Define snekfetch
how.
Yes
So what do I put>
Now you would do the same for snekfetch
No. you need to figure it out
It says it even in the snekfetch docs
discord.js is the name of the package
if requiring discord.js is require('discord.js'), what would requiring snekfetch be?
keeping in mind snekfetch is the name of the package
lul
@cerulean zinc
.send({ server_count: client.guilds.size })
^
ReferenceError: client is not defined
at Timeout.setInterval [as _onTimeout] (C:\Users\owner\Desktop\Weather Bot\app.js:161:29)
at ontimeout (timers.js:475:11)
at tryOnTimeout (timers.js:310:5)
at Timer.listOnTimeout (timers.js:270:5)
Maybe you dont use client
What do I do to update it then?
Please ask someone else
๐
I'm even suprised how many servers it is in.
nice good luck with ur bot
10 Servers in a day. xD
pretty good
@pale light Have any code for when the bot joins a server that it says the server name in console?
use this
I have tried for a while but ๐ this isnt working https://github.com/RootBotTeam/RootBot
I am trying to push members with a function
(NodeJS - Discord.js)
link to function?
UGH
private Dictionary<ulong, Queue<Tuple<string, string, int, ulong>>> audioqueues = new Dictionary<ulong, Queue<Tuple<string, string, int, ulong>>>();```
this line hurts my head
what the fuck
Makes sense to me
@earnest phoenix wdym push members
yea
it's just spastic line
makes sense
just hurts
@late saffron play middle kids ep playlist
I'm bored, Imma build a Android app
hey, uh since this was here.. i was gonna ask for some help
i'm making a bot
and i followed this tutorial https://medium.com/@renesansz/tutorial-creating-a-simple-discord-bot-9465a2764dc0
yeah
that's all i really got
and from the tutorial
i only really varied on the commands
so my test command is an objection
can you run npm ls discord.js?
lemme do that
ye
thanks for the help people
Use my tutorial :)
What
Bot-Turtorial
Oh rip
isn't discord.io deprecated entirely 
i mean
Yea
im not sure
a great in-depth guide can be found here http://anidiots.guide/
discord.js too 
i didn't even realize discord.io was a thing
Lol
what discord.js deprecated @heady zinc
Use discord.js

no anidiotsguide i meant
oh
thanks lemme use this tutorial
What one
there was discordie and discord.io
lmao you said isn't discord.io deprecated entirely 
and then you said "and discord.js too" right after so i was like "what"
both died
Cause they are both for discord.js and your using discord.io
atm i think they just don't have categories support
and progressively starts breaking
i'm just gonna continue working on my edgybot
If you need help just dm me
Np
edgybot's for a server i have with some friends
we play ao together
and i added a wrightbot today
and there's no edgebot
but the world needs edge
so there
/\.+/g this regex will work ye?
if (command === "leaveserver") {
if(message.author.id !== botowner) {
message.reply('this command is only for bot owner!!!');
return;
}
let guild = bot.guilds.get(args3);
var args3 = message.content.substring(12);
message.channel.send(args3);
message.channel.send(`guild ${guild}`);
//guild.leave();
message.channel.send('Left guild.');
}
when im giving command leaveserver 268324543217532929
parameter 1 sending message on channel 268324543217532929
and parameter 2 sending message on channel guild undefined
@austere meadow
@languid dragon idk if you have it answered already or not but it will work https://please.zbot.me/gMIcypiT.png
ty i console logged it ๐
oh lmao
you should use this https://regex101.com/
its really nice
which message for me ?
http://regexr.com i usually use this
but i was lazy

args3 is a message what im type after command
yeah but what is it
if you do typeof(args3) what do you get
if (command === "leaveserver") {
if(message.author.id !== botowner) {
message.reply('this command is only for bot owner!!!');
return;
}
let guild = bot.guilds.get(args3);
var args3 = message.content.substring(12);
message.channel.send(args3);
message.channel.send(`guild ${guild}`);
//guild.leave();
message.channel.send('Left guild.');
}
when im giving command leaveserver 268324543217532929
parameter 1 sending message on channel 268324543217532929
and parameter 2 sending message on channel guild undefined
read again plz
what
nah i read it
im asking what the type of args3 is because .get only works with a string
actually
what are you doing
args3 isn't defined when you are defining guild
you need to put args3 above let guild
args3 is a string
put var args3 above let guild
what
guild undefined
show code
if (command === "leaveserver") {
if(message.author.id !== botowner) {
message.reply('this command is only for bot owner!!!');
return;
}
var args3 = message.content.substring(12);
let guild = bot.guilds.get(args3);
message.channel.send(args3);
message.channel.send(`guild ${guild}`);
//guild.leave();
message.channel.send('Left guild.');
}
are you sure you aren't chopping off one of the characters in args3 or you have a space in there maybe?
thats the only other thing i can think of
im not sure then sorry
its possible the guild isnt in bot.guilds but other than that im not sure
and if im try to open guild.leave();
console error TypeError: Cannot read property 'leave' of undefined
thet guild is available and my bot is on in it
@austere meadow
will i make the bot have 2 prefix```
guys best program to code on. Im currently using notepad XD
atom
vsc
Jetbrains products
vscode
is there any way through which my bot can be online 24/7?
Is anyone else getting random "Unhandled 'error' event"s?
with Discord.JS i mean
To be precise, I am getting websocket errors
guys where do i put if(message.author.id !== config.ownerID) return; into this ``` if(message.content.startsWith(config.prefix + "prefix")) {
// Gets the prefix from the command (eg. "!prefix +" it will take the "+" from it)
let newPrefix = message.content.split(" ").slice(1, 2)[0];
// change the configuration in memory
config.prefix = newPrefix;
// Now we have to save the file.
fs.writeFile("./config.json", JSON.stringify(config), (err) => console.error);
}```
when i type !prefix "something" it will change my prefix to that thing but i want it to only be me that can do it with the if(message... but it will not work when i try XD
after first line then
do i have to use } else after?
im trying to learn XD
I'd suggest looking up a standard tutorial on how to write in js first
and go through that
because clearly your understanding of logic and syntax is rather lacking
and a tutorial will help you out
this is a easy tutorial but i cant get it to work XD
the command works without the first line but when i try to put it in it wont work
Writing a bot without any experience in a language is never going to be easy
"ownerID":"XkijuX#6667"
That's not an id
whats the id then XD
dsicord -> settings -> appearance -> developer mode -> on
thats an combination of Username + discrim
i did and i only get that
You're lying
If the copy id button is on the right click menu it wont give that
otherwise you havent followed what i said
when i right click i get these options. Profile, mention , change nickname
Follow better than
ohh
i didnt see the other parts
i thought it only was righclick and copy
btw thank you
wait what
what kind of magic is that
which distro are you on
i think that is fedora
ayy
did you try node
sudo rm /bin/node :^)
is there a way to fix this? basically showing wrong stats 24/7 https://jeff-kaplan.needs-to-stop-following.me/03b50b.png
tried reinstalling and restarting vps
U are using the wrong port number I asume.
what does it mean*
and... google?
Press OK? ๐๐ค
With "Post stats for your bot" in the API section do i send or store data? And whats the URL, is it https://discordbots.org/api/bots/ID/stats ?
url: discordbots.org/api/Your bot id here/stats
Okay thanks, just need to try and work our how to send my data to it?
discord.js
you can check the pins in #312614469819826177
Okay thank you
np
Sorry i cant seem to find the post there? Are you able to tell me who made it so i can search it? Thanks
Dont worry found it ๐
kk
Im still have problems with status code that i want to add
-TypeError: Cannot read property 'setPresence' of null
at Object.<anonymous> (/Users/rowinsalomons/Desktop/Lil dumb/bot.js:30:13)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
code?
client.user.setPresence({
status: "online",
activity: {
name: "Eshketit",
type: 0,
url: "none"
}
});
Where it asks for "API KEY" wheres this?
Found it sorry ๐
ok
Still cant seem to figure it out.
are you using bot or client
Client i think
well its saying that client.user is null so
do you have: const bot = new Discord.Client();?
Above the piece of code? Or in the code at all?
I have it like at the top of the code,
at the top
hm client
oh
you should put the setpresence in the ready event
so
client.on('ready', () => {
in there
client.on('ready', () => {
client.user.setPresence...
})
Mkay, ill try that thanks
np
ouch
Well, sorta tho
waht
It doesnt show the "online" part
whats the amount of time till you automatically get unblocked from the api?
hm waht
How long will i be banned for? xD
what version of discord.js are you using @earnest phoenix
well then setPresence is depreciated
What do I replace it with then?
@low rivet Jesus christ, my heroku stuff is actually staying online
did not expect.sh
k
@earnest phoenix really?
Still havent figured it out ripppp
Wait
I might have it
Noop I havent fml
Anyone help?
๐ฆ
.
@earnest phoenix try js client.on('ready', () => { client.user.setGame("Game here") client.user.setStatus('online (can also be away or dnd) }
or js client.user.setPresence({ activity: { name: `game here` } )}
hm
You have too many } and )
You're closing off the on ready event even before you console log it
client.on('ready', () => {
client.user.setPresence({
activity: {
name: `Game Here`
}
})
console.log("I'm ready to listen to commands")
});```
Im new into Js
Yeah
Does it not play a game?
You might have to replace your current activity with this:js activity: { name: `Game name here`, type: 0 //Might be one if it doesn't start playing with 0. }
if (command == "mute") { // creates the command mute
if (!message.member.roles.some(r=>["bot-admin"].includes(r.name)) ) return message.reply("Sorry, you do not have the permission to do this!"); // if author has no perms
var mutedmember = message.mentions.members.first(); // sets the mentioned user to the var kickedmember
if (!mutedmember) return message.reply("Please mention a valid member of this server!") // if there is no kickedmmeber var
if (mutedmember.hasPermission("ADMINISTRATOR")) return message.reply("I cannot mute this member!") // if memebr is an admin
var mutereasondelete = 10 + mutedmember.user.id.length //sets the length of the kickreasondelete
var mutereason = message.content.substring(mutereasondelete).split(" "); // deletes the first letters until it reaches the reason
var mutereason = mutereason.join(" "); // joins the list kickreason into one line
if (!mutereason) return message.reply("Please indicate a reason for the mute!") // if no reason
mutedmember.addRole(mutedrole) //if reason, kick
.catch(error => message.reply(`Sorry ${message.author} I couldn't mute because of : ${error}`)); //if error, display error
message.reply(`${mutedmember.user} has been muted by ${message.author} because: ${mutereason}`); // sends a message saying he was kicked
}```
I'm getting a discord api error while running the mute command
can anyone see what might be wrong
coded in JavaScript
- what is the error
^
Still nothing, weird. Lemme try 1 instead of 0
Yeah try that
the bot does start so its just ignoring the code
hm
Yet again, nothing
Weird
Try this then js activity: { game.name: `Gamename here` game.type: "PLAYING" }
right kirito
If that doesn't work idk what will work @earnest phoenix
you didn't even defined mutedrole if i read that well
it also said something about a discordAPI error
ohhhh
Does anyone know how to remove the blank space? I'm using bulma
Try to check out the discord.js server @earnest phoenix
I can dm you an invite link
Got it already
@gloomy parrot you mean the space inside the cards or between the cards?
ok
inside the cards
i can't actually tell without inspecting it myself really
Hey I maked a code for showing discriminator but now a probalm
If bot found so many discriminator he can't send message cause letter is up to 2000 it's a discord message sending limit & showing this error
content: Must be 2000 or fewer in length.
How to handle it?
a discriminator is 4 letters..
limit it to a specific number of discrim to show
or split the message if you really want but it might be really spammy
Read message carefully
your message isnt formulated carefully
Hey I maked a code for showing discriminator but now a probalm
a discriminator is 4 letters, showing whose discriminator are we talking about, in which context??
I mean if my bot want to sent upto 2000 letter how can do this?
split it up into different messages?
going to be too spammy
If you do 0001 you're going to get the bot ratelimited
So yes, it will be too spammy
Yes @quiet bobcat
I'd say if the output is more than 1999 chars return it with a message saying there are too many users with that discriminator or something
Yes it is my problem
why would you make a function like this
What do you mean?
Searching users with a discrim or limiting the amount of characters??
just casually send 200 usernames with the same discrim
It's just a fun command
Amount of characters
lmao what
and you can also change your discrim if you change name to someone who has your discrim
then you change it once, and your discrim is changed
you only need 1 person with the same discrim
Yes?
And that's the command to find a person with that discrim
You know you can't change into some names because they are too popular right?
Lets say 9999 users have the same name eg Mike
Then you can't change your name into Mike
because all discrims are already taken
you still don't need 200 users for that shit
You'd have to do Mike1
But there is 200 users with the new update which lets you CHANGE discrim with NITRO
Why are we even having this argument?
The problem he had is already solved
So can we just move on?
Thanks
How would I repeat a whole queue? 
go back to the first song once the last ended?
I've tried ๐ค I guess I did it wrong, I'll try again after work
But if you get at least Spanish, that's like a ton of the population there. Idk
Basically
Maybe when I get bored
Hello, yes. I've created a config command which currently only lets you change one thing but when I change that thing from off to on it adds an extra bracket. Leveling from on to off works fine but for some reason off to on adds an extra bracket. The code is: js if(args[1].toLowerCase() == "off") { configs[message.guild.id].leveling = 'off'; message.channel.send(`Level up messages are now **${args[1].toLowerCase()}**`); fs.writeFile("commands/Storage/configs.json", JSON.stringify(configs, null, 4), (err) => { if (err) console.error(err); }) return; } else if(args[1].toLowerCase() == "on") { configs[message.guild.id].leveling = 'on'; message.channel.send(`Level up messages are now **${args[1].toLowerCase()}**`); fs.writeFile("commands/Storage/configs.json", JSON.stringify(configs, null, 4), (err) => { if (err) console.error(err); }) return; }
If you know a fix please @ me. Probs going to sleep soon so sorry if I'm not that fast at responding
using json as a database :megalul:

tf
@quiet bobcat Try changing
(configs, null, 4)
to
(configs)
What username
Nice username
Im gonna see
What username
Nice username
Im gonna see
smh
how to fix this? and the lines of code used for this is var fortunes = [ 'Hell to the nah, to the nah nah nah!', 'fuck no', '***REEEEEEE***', 'Fuck yeah.', 'No.', 'Yes.', 'Tragic :(', 'fucc', 'Your fate is quite depressing.', 'Aaaannddd it is false โช', 'Aaaannddd it is true โช' ] const eightball_embed = new Discord.RichEmbed() .setAuthor('๐ฑ Omobot says: ๐ฑ') .setColor('#9f87ff') .setDescription(message.channel.sendMessage(fortunes[Math.floor(Math.random() * fortunes.length)])); if (!message.content.startsWith(settings.prefix)) return; message.channel.sendEmbed(eightball_embed);
it says it outside the embed for some reason
.setDescription(message.channel.sendMessage(fortunes[Math.floor(Math.random() * fortunes.length)]));
message.channel.sendMessage(
????
The desciption has (sendMessage) in it
Ono
@topaz fjord agreed
@pale light dont ban
convince me
LOL
ok time to move to #general or #memes-and-media
slowly walks away
yea
@south finch no u
lets get out
leaves
I need some help. In discord.js, how would I get the bot to send a welcome message when it joins a guild? (client.on, what??)
client.on guildCreate
Thanks
@earnest phoenix If your talking about when it joins a guild I got a script that shows it in audit log.
console*
But in the mean time. Does anyone know how to make a mention work. For like @pseudo root help
I use discord.js
@austere meadow Yo, Any help?
Like?
if (msg.mentions.first('HELP')
message.channel.send('Blah blah')
Like that?
or you can just do if (message.content.startsWith("<@" + client.user.id + ">"))
.
@austere meadow Wouldnt this work?
if (msg.mentions.first('HELP') message.channel.send('Blah blah')
Could you write one?
im not gonna write one for you but you can use
if (message.content.startsWith("<@" + client.user.id + ">") + " help") {
//stuff
}
thats a basic way to do it
if (message.content.startsWith("<@" + client.user.id + ">") + " help") {
message.channel.send('Blah Blah?')
}
yeah
yeah
I use bot.on
OOF
since discord uses <@! for nicknames
Well its someones fault if they nicknamed my nice bot.
ok 
xD
@austere meadow (node:8528) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): DiscordAPIError: Missing Permissions
(node:8528) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
read what it says
(node:8528) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): DiscordAPIError: Missing Permissions
missing permissions
what
in my other test discord
Mk
Just incase someone tagged it.
@austere meadow What permissions are the bot missing?
@austere meadow Anything wrong with this?
if (message.content.startsWith("<@" + bot.user.id + ">") + 'HELP') { message.channel.send('List of Commands: -weather (City), -ping, -donate, -invite, -discord, -help, -aboutme, -updates') console.log('Help+Mention Command Ran') return; }
Bot is spamming the command.
Mk
thanks, it just makes it much easier to read the code ๐
if (message.content.startsWith("<@" + bot.user.id + ">") + 'HELP') {
message.channel.send('``List of Commands:`` -weather (City), -ping, -donate, -invite, -discord, -help, -aboutme, -updates')
console.log('Help+Mention Command Ran')
return;
}```
change if (message.content.startsWith("<@" + bot.user.id + ">") + 'HELP') {
to if (message.content.startsWith("<@" + bot.user.id + ">" + ' HELP')) {
well, the bot will only register the command if you type help in caps
you're not using msg
you're using the message object
so change js if (message.content.startsWith("<@" + bot.user.id + ">") + 'HELP') {
to
if (msg.startsWith("<@" + bot.user.id + ">") + 'HELP') {
also, you probably don't need that js return;
But.
Help+Mention Command Ran
(node:7856) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): DiscordAPIError: Missing Permissions
(node:7856) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Help+Mention Command Ran
(node:7856) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 4): DiscordAPIError: Missing Permissions
Help+Mention Command Ran
(node:7856) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 6): DiscordAPIError: Missing Permissions
one sec
Can you create embeds in discord.js?
add this line: js if (!msg.channel.permissionsFor(msg.guild.me).has('SEND_MESSAGES')) { console.log('bot does not have send message permission');}
so you're code looks like this, then try it
if (msg.startsWith("<@" + bot.user.id + ">" + ' HELP') {
if (!msg.channel.permissionsFor(msg.guild.me).has('SEND_MESSAGES')) { console.log('bot does not have send message permission');}
message.channel.send('``List of Commands:`` -weather (City), -ping, -donate, -invite, -discord, -help, -aboutme, -updates')
console.log('Help+Mention Command Ran')
return;
}
@strange escarp yes
I'm not seeing any kind of embed object in the reference
it's called RichEmbed
you can also use JSON to make them
Thanks
if you go with JSON, I suggest you use this tool to help make them, https://leovoel.github.io/embed-visualizer/
no problem
@zealous veldt How did you get fired?
And
if (msg.startsWith("<@" + bot.user.id + ">" + ' HELP') {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Function.Module.runMain (module.js:684:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
you're missing a )
^
before {
Mm
Sigh
if (!msg.channel.permissionsFor(msg.guild.me).has('SEND_MESSAGES')) { console.log('bot does not have send message permission');}
^
TypeError: Cannot read property 'permissionsFor' of undefined
at Client.bot.on.message (C:\Users\owner\Desktop\Weather Bot\app.js:30:18)
at emitOne (events.js:116:13)
at Client.emit (events.js:211:7)
at MessageCreateHandler.handle (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:330:35)
at WebSocketConnection.onMessage (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:293:17)
at WebSocket.onMessage (C:\Users\owner\Desktop\Weather Bot\node_modules\ws\lib\event-target.js:120:16)
at emitOne (events.js:116:13)
at WebSocket.emit (events.js:211:7)```
Where do I put the client ID for discordjs?
You dont need to?
Wot
You need the token.
The last library I used needed both the ID and token
@strange escarp Are you using bot.on(''?
<client>.login(<token>);
Or
bot.on
@zealous veldt
if (!msg.channel.permissionsFor(msg.guild.me).has('SEND_MESSAGES')) { console.log('bot does not have send message permission');}
^
TypeError: Cannot read property 'permissionsFor' of undefined
at Client.bot.on.message (C:\Users\owner\Desktop\Weather Bot\app.js:30:18)
at emitOne (events.js:116:13)
at Client.emit (events.js:211:7)
at MessageCreateHandler.handle (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:330:35)
at WebSocketConnection.onMessage (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:293:17)
at WebSocket.onMessage (C:\Users\owner\Desktop\Weather Bot\node_modules\ws\lib\event-target.js:120:16)
at emitOne (events.js:116:13)
at WebSocket.emit (events.js:211:7)```
change msg to message sorry
only change it in that if statement i sent you
if (!message.channel.permissionsFor(msg.guild.me).has('SEND_MESSAGES')) { console.log('bot does not have send message permission');}```
there
dont change anything else
@zealous veldt
yes?
if (!message.channel.permissionsFor(msg.guild.me).has('SEND_MESSAGES')) { console.log('bot does not have send message permission');}
^
TypeError: Cannot read property 'me' of undefined
at Client.bot.on.message (C:\Users\owner\Desktop\Weather Bot\app.js:30:47)
at emitOne (events.js:116:13)
at Client.emit (events.js:211:7)
at MessageCreateHandler.handle (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:330:35)
at WebSocketConnection.onMessage (C:\Users\owner\Desktop\Weather Bot\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:293:17)
at WebSocket.onMessage (C:\Users\owner\Desktop\Weather Bot\node_modules\ws\lib\event-target.js:120:16)
at emitOne (events.js:116:13)
at WebSocket.emit (events.js:211:7)```
oh
that says msg
if (!message.channel.permissionsFor(message.guild.me).has('SEND_MESSAGES')) { console.log('bot does not have send message permission');}```
yeah
whoops, try that
but im not sure if you're using msg or message in your bot
he's using message
he has a var named msg, but thats just a .toUpperCase string of message.content
what does your console say?
Help+Mention Command Ran
cool
you might want to change it to this though
if (!message.channel.permissionsFor(message.guild.me).has('SEND_MESSAGES')) return console.log('bot does not have send message permission');
No.
return should be after console.log
@zealous veldt Right?
Otherwise it cancels console.log
what i sent will prevent the bot trying to send a message when it cant
and no, return wont block the console.log
when you do something like js return console.log('hello world');
it will returns the instruction to run the console.log
and then stops
Ay, I finshed my requirements for certify. I only need 100 Servers now. 90 Servers to go.
lol
@zealous veldt One more thing.
bot.user.setActivity('Prefix: - | Say -help')``` How can I add the server count to this?
Ik that.
so js bot.user.setActivity(`Prefix: - | Say -help | Servers: ${bot.guilds.size}`)
awesome!
Still isn't sure what my bot will do yet
@strange escarp Are you doing discord.jsร
Yes
Just started using it for the first time
I already have a base
I just need it to have a purpose
const Discord = require('discord.js');
const bot = new Discord.Client();
const prefix = '-';
let msg = message.content.toUpperCase();
let sender = message.author;
let cont = message.content.slice(prefix.length).split(" ");
let args = cont.slice(1);
// Commands
// Ping
if (msg === prefix + 'PING') {
message.channel.send('Ping!');
console.log('Ping Command Ran')
}
bot.on('ready', () => {
bot.user.setStatus('dnd') // Can be 'Online', 'idle', 'dnd', 'invisible'.
bot.user.setActivity(`gamestat`) // Can be whatever
});
bot.login('token');```
@strange escarp Then run the node.
and try doing -ping with your bot.
Moderation.
Something unique
how do i get the bot developer rank??
and how long does it take to approve a bot?
@earnest phoenix you get bot developer automatically once you have at least one verified bot
oh okay
does anyone here have any experience with lavalink (more specifically, lavalink.js)? ive been trying to get it working for a while now, but im having this issue where it fails to connect to the voice channel
it consistently times out and i don't know what the issue is https://please.zbot.me/DByN1PLK.png
here's a screenshot of the lavalink server console as well, notice at the bottom it says "Unexpected operation: connect" https://please.zbot.me/7M2T6Tre.png
what server version are you using?
is there any way to check? i just downloaded the latest one from here https://ci.fredboat.com/viewLog.html?buildId=lastSuccessful&buildTypeId=Lavalink_Build&tab=artifacts&guest=1
if you downloaded it recently you're probably with a 2.0 server
rn only the java wrapper supports 2.0
oh
Quick question: Does Javascript have a function like Lua's pcall?
what does pcall do
Basically it wraps the function inside it with a kind of protective shell
So like
a protective shell? what would be the practical use for that
Let's say I gave everyone access to eval

Stupid example I know
But I wrapped it in pcall
They wouldn't be able to access client.token
so kinda like a virtual machine
Yeah
i think there is a way you could do that
Almost like it initializes it's own env
So it prevents them from messing with my bot
js has try catch
Yes but it isn't the same
it's the equivalent of pcall
Yes and no
pcall just returns true, <function returns>
pcall does act a bit like try/catch
or false, error
But it doesn't do exactly what I'm looking for
Isn't pcall "Protected Call"?
although your idea isn't lost
True
i think it could be possible to create a protected enviroment in which u can run javascript
Can you use WebAssembly in Node?
1 sec
I'm new to using node
ok so like
u could make a child_process, run node inside that, and send data through the child channel into that process
and that should be protected
Fair enough
the only thing i'd suggest would be removing the ability to exit the process
That answers my previous question
otherwise you could just create a new process every time
and since you're running an eval, it would be easy to send a string through the channel
its a really smart idea and if you dont mind im gonna try implement it into my bot as well :]
Also just a thought
People who add an eval command to their bot....
It's not a good idea
yeah
Have it run code from the console or something
that's why it should only be restricted to owner only
Only you have access to that
In fact, yesterday
We were messing around in #commands
And accidentally got someone's bot token
Because they didn't secure eval
smh, silly bot devs
sandboxing with a child process ? 
yeet 
sounds sexy
imma steal that
same LOL
Has someone already made a Reddit command?
nah make a better one ;]
everything
Also in Javascript with switch/case can you have it trigger if it matches one of many strings?
inb4 forgets to remove fs
RIP @inner jewel
inb4 js let a = [] while(true) a = [a]
Aaaaaaaaaaaaaaaaaaaaaaa
Well let's see
You're basically placing an array inside of an array inside of an array inside of an array inside of an array inside of an array inside of an array inside of an array ....
and some GC algorithms stack overflow on that
if you were more evil
you could make it use a lot of memory
using string concatenations
while(true) string = string + ' '
If you were more evil, you'd place bytecode in the memory and find a way to execute it.
after a few thousand iterations you'd be creating kbs of garbage each iteration
well, i wanna make a simple bot fr my server, i was hopin somebody could direct me towards resources, (python btw)
i'm super noob
Idk any tutorials, but you might want to read through docs
https://discordpy.readthedocs.io/en/latest/api.html
hmmm thanks
@earnest phoenix When you use the multiple scopes, such as bot and identify (and set require code grant), the user will be redirected to the redirect uri, additionally in the query string is the guildid for the selected guild.
Is there something like deborphan for npm projects?
yo how i make next line on discord js
\n
kk
"\n 1. Do not BEG for SUB Rank, We Take ROLE as Payed Monthly for supporting WORK!" +
like that
Yup like that
can anyone help me out with my bot?
the person i was getting help from earlier made me install python
didnt know multiple languages could be used
well i need to put scripts into my bot, not sure how
ive been asking around
im not really sure
i dont know anything about bots
i just recently have been trying to create one
i have it set up and its in a couple servers already
but its offline and has no use yet
what doi you mean by that
you might want to search up some tutorials, read the python docs, watch some videos;
https://discordpy.readthedocs.io/en/latest/api.html
Are u using discord.js?
not sure
I know the code for activity
o

could you send me it?
Surr
Bu - Today at 4:02 PM
the person i was getting help from earlier made me install python
๐คฆ
Out of all of them, this is the only one that worked for me:
client.user.setActivity('YouTube', { type: 'WATCHING' });
Well, make sure u ended ur last code correctly
never added an6y
And then its as simple as copy that code
@maiden trout I highly suggest you learn an application language such as python or javascript first
thats what the last person said
He was right
i dont want to spend a month trying to learn a lanaguage im only using once
and will probably never use again
if you're not willing to put in the effort then why are you making a bot
i thought it would be more simple than this
Just clone a red bot or smth
Hmh
It's like a language you learn
makes
Wait if your friend does it all the time, why don't you ask them to help
^
because hes retarded and keeps asking me something about lua




