#development
1 messages · Page 513 of 1
@quartz kindle the top level in json can also be an array
{
"token": "",
"fortnitekey": ""
}
Have your saved the files?
my token is in it
i mean, how are you loading the file inside your code
did you save the file first of all?
yes
ok, how are you getting the json contents in index.js?
const config = './config.json';
thats so wrong
no require
lmao
oh yeah lmao
require(config);?
require('file name or lib')
I am such a idiot for forgetting require
also, show your client.login() function
im an idiot always
T H E M I S T A K E S W E M A K E I N T H I S W O R L D
@_@
-_-
i have a russian friend who actually makes and sells kombucha lmao
kombucha is the best
it tastes very good
if I make my own help command in commando do I have to get rid of this
name: '8ball',
group: 'fun',
memberName: '8ball',
description: 'A magic 8 ball that has 20 responses'
});
commando
never used commando, but i dont think you're supposed to remove that
yeah
https://github.com/1Computer1/discord-akairo i recommend this if you dont want to make your own
A bot framework for Discord.js. https://www.npmjs.com/package/discord-akairo - 1Computer1/discord-akairo
its pretty similar to commando but has more
if you're using a framework, dont remove anything
if you want to keep files to a minimum, and use only what you actually need, do your own thing from scratch
How would one make it so when the bot joins a guild it says a message
says a message where?
i need help with my bot
i can't make a help thing where it send and embed into your dms
step 1: make embed
step 2: msg.author.send(embed)
step 3: profit
what if he doesnt use js?
how bout like if i were to do !help how can i get it do send the user the commands and i use .js
.js
message.author.send
what lib?
if he doesn't know how to send a dm with an embed do you really think he would know about eris
he just told you
hey delta
hi
i mean, vil just told him how
does someone know how to use opusscript? ive been tring to send something using playOpusStream and its unintelligible. d.js
and yeah big daddy, you use message.author.send()
i know that
to send a dm to whoever used the command
message.author.send(RichEmbed=(variable for embed))
@ionic barn 1. node-opus 2. it works behind the scenes 3. if you aren't sure it's an opus stream, run playStream and it will be converted

you an embed builder
i tried installing node-opus but it didnt finish
im using a receiver to get user input. thats what my stream is
learn js first
@earnest phoenix https://anidiots.guide/first-bot/using-embeds-in-messages
doc the reads
the reads doc
@earnest phoenix https://www.codecademy.com/learn/introduction-to-javascript
not being mean, but go through this first
its going to make coding bots 10x easier
i kind of know this stuff ugh it weird havent done it for a while i got my bot to spam my dms kind of like a chat bot
but ok
dm me
I am going to take on making levels
Idk why tf someone would do that
@sick cloud, what do you mean by list of shards? How many, shard ids?
i mean, i want to make a shards cmd that shows the avg. ping and status
not sure how to do it
Ahh
For spamming Discord's API
ik
How do you think the bot connects to discord and basically runs?
Connects to Discord api
Yes
Good
yeah
Now can you help me actually setup my bot im actually new to this
I wanna make help commands
Does VSC debugging options support loading in env files?
dont
OH GOD
lmfao
AND FUCKING N++
Alright
bot hunter is exaggerating
Yet i have a server with 700+ people XD
it isn't "bad" code
I mean
Just get a code editor other then n++
like ?
Saves your life
like vscode
Atom
first of all, and most importantly: dont use .on("message") multiple times
@earnest phoenix
if you can that is
why
think about it
anything repeated is redundant
also getting vscode
Good
in programming you want to make as less work for the pc as possible
each on.("message") is always listening to ALL messages you ever receive
having them multiple times, will multiply the amount of work your bot has to do
you're listening to the same message multiple times at once
you can make different functions
and call them all from within one listener
also how am i supposed to run the bot now i got vscode
how do you normally run it
cmd
XD
same way
editor has nothing to do with it
vcs has an integrated terminal no?
ok im on vscode by the way
but still, cmd still works
i dont need to use cmd
you can setup scripts I think in vscode
here dm
me
and group chat with you guys
who?
iyou and the other guys
I can't im just here lurking
first do what i told you
doing them if(!message.content.startsWith(prefix)) return is kinda redundant
put all your commands inside a single .on("message") listener
since your checking if the commands have the prefix already
how
i feel like so dumb
rn
also
if your going to do if/else commands
atleast do if(message.content == "something")
command handler™
@ ken
bak
yay
May you pls help me with this i would be greatful for this
sure
Thanks
dm me
I am making a fortnite stats tracking using the fortnitetracker api; should I put my api keys for stuff in a different .json file as my config file that has my token?
Do ./../config.json
You're in the fortnite.js file correct?
Oh wait rip do ./../../config.json
I think
Cool 
the ./ isnt needed
wait how do I make my bot page look good?
css
css
css
ssc
css
scss
less
scss vs css
less vs scss vs css
css
html
js
Py
XML
scratch
json
jpeg
Groovy ruined it
YEAH
also I keep getting an error that I don't know how to fix
UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toLowerCase' of undefined
this is my code
actually I get a lot of errors
(node:15704) DeprecationWarning: Collection#filterArray: use Collection#filter instead (node:15704) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toLowerCase' of undefined at new User (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\node_modules\fortnite\src\User.js:13:73) at C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\node_modules\fortnite\src\Client.js:61:24 at process._tickCallback (internal/process/next_tick.js:68:7) (node:15704) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:15704) [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.
You didnt show the part of the code where its erroring...
It says there's no errors in the code
toLowerCase is a function...
its still trying to read a prop from an undefined obj
I don't have a file called user
I am using a lib called fortnite in my code
ik
still can't seem to find a fix
didnt we go through this before?
i remember someone with this exact same problem with this exact same lib lol
lol
if i recall correctly it was a problem with the lib itself, although it was an easy fix
but regardless, the lib was so simple, that you could do everything yourself, without it
here's my errors
Error: You must supply a username at Promise (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\node_modules\fortnite\src\Client.js:39:36) at new Promise (<anonymous>) at Client.user (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\node_modules\fortnite\src\Client.js:37:12) at FortniteTracker.run (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\commands\gaming\fortnite.js:24:23) at CommandMessage.run (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\node_modules\discord.js-commando\src\commands\message.js:201:33) at CommandDispatcher.handleMessage (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\node_modules\discord.js-commando\src\dispatcher.js:127:32) at CommandoClient.on.message (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\node_modules\discord.js-commando\src\client.js:68:51) at CommandoClient.emit (events.js:182:13) at MessageCreateHandler.handle (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34) at WebSocketPacketManager.handle (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65) (node:10512) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined at ft.user.then.catch.e (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\commands\gaming\fortnite.js:49:29) at process._tickCallback (internal/process/next_tick.js:68:7) (node:10512) 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: 2)
and
(node:10512) [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. Error: You must supply a username at Promise (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\node_modules\fortnite\src\Client.js:39:36) at new Promise (<anonymous>) at Client.user (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\node_modules\fortnite\src\Client.js:37:12) at FortniteTracker.run (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\commands\gaming\fortnite.js:24:23) at CommandMessage.run (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\node_modules\discord.js-commando\src\commands\message.js:201:33) at CommandDispatcher.handleMessage (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\node_modules\discord.js-commando\src\dispatcher.js:127:32) at CommandoClient.on.message (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\node_modules\discord.js-commando\src\client.js:68:51) at CommandoClient.emit (events.js:182:13) at MessageCreateHandler.handle (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34) at WebSocketPacketManager.handle (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65) (node:10512) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined at ft.user.then.catch.e (C:\Users\PEREZG3_GAMING\Desktop\BotCode\DiscUpgrade\commands\gaming\fortnite.js:49:29) at process._tickCallback (internal/process/next_tick.js:68:7) (node:10512) 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: 4)
I did
then you know what the problem is
When I type in the command I include the username
well, the code says otherwise
and obviously, the code knows what up
so you have to investigate
"why is the username not reaching the function?"
start debugging your code
put a bunch of console logs at various places to understand the code flow, and see until where the username is reaching successfully
const commando = require('discord.js-commando');
const discord = require('discord.js')
const apikey = require('./../../config.json');
const Fortnite = require('fortnite');
const ft = new Fortnite(apikey.Fortnite);
class FortniteTracker extends commando.Command
{
constructor(client)
{
super(client,{
name: 'fortnite',
group: 'gaming',
memberName: 'fortnite',
description: 'Get Fortnite BR stats from PC, XBL, & PSN accounts'
});
}
async run(bot, message, args)
{
let username = args[0];
let platform = args[1] || "pc";
let data = ft.user(username, platform).then(data => {
let stats = data.lifetimeStats;
let kills = stats.find(s => s.stats == 'kills')
let wins = stats.find(s => s.stats == 'wins')
let kd = stats.find(s => s.stats == 'kd')
let mPlayed = stats.find(s => s.stats == 'matchesPlayed')
let tplayed = stats.find(s => s.stats == 'timePlayed')
let asTime = stats.find(s => s.stats == 'avgSurvivalTime')
let embed = new discord.RichEmbed()
.setTitle("Fortnite Stats")
.setAuthor(data.username)
.setColor(0x8B008B)
.addField("Kills", kills.value, true)
.addField("Wins", wins.value, true)
.addField("KD", kd.value, true)
.addField("Matches Played", mPlayed.value, true)
.addField("Time Played", tplayed.value, true)
.addField("Average Survival Time", asTime.value, true)
message.channel.send(embed);
}).catch(e =>{
console.log(e);
message.channel.send("Couldn't find that username in the database");
});
}
}
module.exports = FortniteTracker;
that's my current code
what if the username is 2 words
So where do I add this
not everyone uses python
if its saying there is no username, then you need to check if username is actually valid
@earnest phoenix in your ready event
just do console.log(username) before the let data =
and check your console to see if the username comes up there
So where do I add this @earnest phoenix
anyway im gonna go sleep now, so good luck
Ok
in the lib there's username
@wheat marten
i need help
im very dumb
@coral trellis
hm?
anyone
yeah
state your problem
some other guy fixed my code
also next time let's not ping everybody
appparently
it dosent work
anyone know why client.ping is giving undefined

ok, we need to know what's not working and what the code is
d.js v12 btw
define msg
yeah
here ill pastebin it
maybe you have it as message
im new to this
or mESASSaGE
how do i fix this
pastebin it pls
i wanna seee
some commands are for my gf
@earnest phoenix js client.ws.ping

ew multiple event handlers
lol
XD
WTF
wait
yeah
?
the lack of semicolon might mess stuff up here idk
oof
to many event handlers
you should do that
yeah
Bassicly i want my bot to be a moderation/chat bot for server
i dont know how
Yuo wont be able to accomplish big if ur code is that messy
only simple shit
id start with fixing the event handlers
chat bot as in bot that can chat like a human
yah
ai
bot
well lemme point you to cleverbot
api keys are like $75, no?
just warning you it's gonna be frustrating
and bad
and 99% it's gonna end up trying to make out
@earnest phoenix for cleverbot.io they're free
oh
cleverbot.com is expensive af
i must thinking of translation keys
or no
idk
im guessing cleverbot.com is 99% better
if not
theyre about the same
both equally bad
scammed
ok i signed it
in
signed what
signed into cleverbot.io
oh
lol
ok
not sure why you're starting to work on cleverbot
i suggest you get more familiar with like
@gilded blaze thanks, what about client.ws.send?
discord.js and node.js
^^^^
before dealing with cleverbot and stuff
what do you think im using
discord.js
and node.js
ima losesy coder
i said get more familiar, not "use"
lol
@earnest phoenix What do you mean?
wanna know the funny part
what?
client.ws.send used to be a function
now its not
i have a 700+ server and im this dumb
and discord.js-lavalink just broke

🤦
client.ws.broadcast might be what you are looking for
let me try that
https://discord.js.org/#/docs/main/master/class/WebSocketManager This is the ws property class
i dont think so
All the methods and properties are here
this code was working this morning
so
lmao
join(data, { selfmute = false, selfdeaf = false } = {}) {
const player = this.get(data.guild);
if (player) return player;
this.client.ws.send({
op: 4,
d: {
guild_id: data.guild,
channel_id: data.channel,
self_mute: selfmute,
self_deaf: selfdeaf
}
});
return this.spawnPlayer({
host: data.host,
guild: data.guild,
channel: data.channel
});
}
^ that is discord.js-lavalink code
its trying to use .ws.send
Well discord.js-lavalink used the class before ws was public. Nothing was guaranteed to stay the same.
imma try editing it to broadcast
Might work
If it doesn't, probably won't, then you could ask the developer to update to master
How do you make an account webhook
??
-set
This is why you use FFMPEG.
hello anybody know how i could fix this error please http://prntscr.com/le6y8i
define Commands
How much time it take to accept bot?
read #502193464054644737
K
@slate kayak you might have a typo
You would have done
const Command = require('discord.js-commando')```
And used Command`s` which isn't defined
Hey 😁
ty @fervent delta trying new methods with this NSFW bot of mine 😦
For a anti raid Blacklist mechanism this is script ?
client.on('message', message => {
var args = message.content.split(' ').slice(1, 2).join(' ');
var args2 = message.content.split(' ').slice(2 ).join(' ');
var memberban = args
if(message.content.startsWith(prefix + "gban")) {
message.delete()
if(message.author.id !== "399615681957462016" && message.author.id !== "449247302603767808") return message.channel.sendMessage("Vos permissions sont insuffisantes !");
if(!args) return message.reply("Tu dois ajouter un ID a ban");
//if(args.length != "18") return message.channel.send("Ceci n'est pas un ID");
if(client.guilds.get('508360049136107520').channels.exists('name', args)) return message.reply("🚫 L'utilisateur est déjà gban !");
client.guilds.get("508360049136107520").createChannel(args).then(tt => message.channel.send("🔒 L'utilisateur à été gban de " + client.guilds.array().length + " serveurs"));
client.channels.get('508360049136107520').send("Gban, par "+ message.author.username + ", utilisateur : ** ?" + + "**, raison : " + args2 + "").catch(async(err) => {console.log(err)});
}
if(message.content.startsWith(prefix + "ungban")) {
message.delete()
if(message.author.id !== "399615681957462016" && message.author.id !== "449247302603767808") return message.channel.sendMessage("Tu n'as pas la permission");
if(!args) return message.reply("Tu dois ajouter un ID a ban");
//if(args.length != "18") return message.channel.send("Ceci n'est pas un ID");
if(!client.guilds.get('508360049136107520').channels.exists('name', args)) return message.reply("⛔️ L'utilisateur n'est pas dans la liste");
client.guilds.get("508360049136107520").channels.find("name", args).delete().then(tt => message.channel.send("🔓 L'utilisateur n'est plus gban"));
}
})
client.on("guildMemberAdd", member => {
if(client.guilds.get('503631472448634890').channels.exists('name', member.id)) {
member.ban().then
}else {
return undefined;
}
})
@tropic cobalt its fundamentally wrong.
How can the same user have 2 userIds?
Also format your code using codeblocks
Ah ok 😅😅😅
@tropic cobalt good english 👌
✅ ✅ ✅
Open Chrome => F12 => Profile => Load Heapdump
yeah what I meant is, reading the heapdump itself, its quite confusing
Oh
like what do I need to check here
uhh yea its confusing idk tbh
did you use heapdumps ?
to check your memory usage
maybe theres something that you can advice or stuff to pay in mind
I did and it was confusing to me aswell
I see, because my bot really eats a tons of memory and I'm confused if its on my code or caches
db.fetch(`guild_${message.guild.id}`).then(i => {
^
TypeError: Cannot read property 'then' of null
is there any way to check if a specific reaction removed from the message with reaction collectors?
@amber junco
```languagename
code
```
@west raptor what can i use instead of it then?
let thing = thing
thing.value```
http://prntscr.com/le84wt how to fix this please
files is undefined
also, folder doesnt exist
yes
for example "test\"test"
thats node
well, whoever did the scandir command
as im using a .bat file to run it
you're trying to read the commands folder, right?
yes
http://prntscr.com/le86q7 @quartz kindle it stating that here is the problem but for me it look right
the folder doesnt exist
also thats either fs or node throwing the error tim, i guess it looks for the file/folder in the dir and throws the dir/file thats its looking for
your readdir is throwing an error, but you're not returning on error
so your command is continuing even if it errors
with causes another error (files undefined)
ok so how can i fix this ?
make the folder
are you sure the folder exists? can you send a screen shot for your bot's folder?
http://prntscr.com/le88ua @quartz kindle
try "commands" instead of "./commands"
how do i change url like https://discordbots.org/bot/{botID} to https://discordbots.org/bot/{botName}
in DBL
Or need to be Certified?
How can i send random color embeds, for example if i have this code
const blackembed = 123
const purpleembed = 321
let something embed = new discord.richembed
.setColor // now here idk how to send between black and purple
... code
return message.channel.send(something)
put black and purple into an array and use Math.random()
hey guyz i need help
with what
i'll figure it out
....
do you have permissions to manage server in said server?
^^^^
when i click join,nothing happens
.......
Banned !!!
so i have to copy the invite link and then i join it
or logout & login
sorry for bad-eng
you're using the desktop/mobile app right?
umm...DESKTOP
your account is different in the app and in the website
so you have to logout in the website
what?
and login with your correct account
u can see my account?
no, but thats typically what happens
when my server was new,i can add bots
the desktop app doesnt not access your browser or vice versa
this problem just appeared now
your browser and the app are two separate programs with two separate accounts
you have to make sure the same account is connected in both
now i have to logout from the discord official website?
yes
@west raptor random worked, tnx
yw
@quartz kindle can u plz come to the pm?
whats so hard?
nothin
i have logged out from the website and the app
and logged in from my browser account
hhow long does this take?
it has been 2 days
TWO DAYS
What is it
for
google indexing
^
what are my other options
also, if it's people doing it, it's not a business day
@quartz kindle Thankx Very Much Bro!!!😚
lmao np
@earnest phoenix
i want help
with what
i need help with py
don't mention random people
I have a video for logging out of discord account 😢
In Python, I have a list that looks something like this: [['56385', '10'], ['43139', '40'], ['35174', '30'], ['67921', '400'], ['51128', '100']] and I'm trying to sort it by the second number in each set. The code I have currently looks like this: python from operator import itemgetter sortt = str((sorted(numlist, key = itemgetter(1) )))
This will sort it so that it'd be like [['56385', '10'], ['51128', '100'], ['35174', '30'], ['43139', '40'], ['67921', '400']]. How can I make it sort numerically instead of just sorting by the first digit?
So that'd it look like this: [['56385', '10'], ['35174', '30'], ['43139', '40'], ['51128', '100'], ['67921', '400']]
you need to convert both values to a number to perform numerical comparison
hey guys
else its comparing strings, and ordering alphabetically by string
my bot crossed 2500 servers, and I don't know how to shard
in python
and I can't find the docs
for sharding in python
Ok
Damn :/
ask in the py server or whatever
client = discord.Client() change to client = discord.AutoShardedClient()
Lol I remember the sharding struggles
You wouldn’t believe my awe when it took less than a minute to do after hours of research
How do get the playing status on and status @earnest phoenix
Plain spoonfeed
Yeah spoonfeed the guy whos making "Custom" Bots lol https://gyazo.com/1c513c72789cf74a6b0788900dce1e6c
Exposed lel
Another small thing; in discord.py, is it possible to get a user's name from their ID even if they don't share any servers with you?
ok
@mild quarry no
it's impossible in all libs i think
depends
if they share a server with the bot then u can
@lofty abyss that's not a valid url
Oh
oh
@topaz fjord
what url do i use then?
also the ****
is just so u dont see the ip
@mild quarry http://rapptz.github.io/discord.py/docs/api.html#discord.Client.get_user_info You do not have to share any guilds with the user to get this information, however many operations do require that you do.
Thanks, actually, someone just sent me that link
show your json
{
"prefix": "!",
"token": "also this is here",
"devID": "its here",
"dbUrl": "this stuff is here",
"embed": {
"color": "16051010",
"footer": "Suggestions - Copyright 2018"
},
"channels": {
"feedback": "498421302563176448"
},
"emojis": {
"upvote": "ðŸ‘",
"downvote": "👎"
},
"links": {
"botinvite": "https://discordapp.com/oauth2/authorize?client_id=486189371960328202&scope=bot&permissions=8",
"supportserver": "https://discord.gg/wkSch7q"
},
"apis": {
"dblport": 80,
"dblpassword": "i has my pass here",
"dbltoken": "token is here bro"
}
}
there
i might be using the wrong url am not sure bro
https://my ip is here:80/url
am using that
as the webhook
@topaz fjord
seems good 👀
I know bots can send custom emojis with <:name:id> but is there a shorter way?
No
i have all the last required thing on this, why wont it work for me?
if (!message.member.hasPermission("MANAGE_MESSAGES") || !message.member.hasPermission("ADMINISTRATOR") || message.author.id !== ownerID) return message.channel.send("You Have Not Got The Permission ``Manage Messages``, You Cannot Use This Command!")
Use && instead
it returns when i use the command but my id is equal to ownerID
no
&& means i need all of them
ok wait what
im looking so if i have atleast 1
^^
I know
i need only 1 to be true
Hold on
it works in another command, exact same code, so dont say i did it wrong btw
is this right for the webhook api?
yes
Ok and you don't have one of them am I correct?
.hasPermission has an option that takes checkAdmin in account
well for some reason when my bot had admin but didnt have mute perms it didnt work
anyway, back to the error
if does not have x and x -> return
if person has one if them -> continue
Is what you want ?
yes
Well your code is saying
did discord.js remove fetchMessages in v12?
if person does not have x OR y (meaning if one returns true return) -> return
if person has all of them -> continue
Yes it is
how is it
this kid
I know
im using ||
yes
FUCK SAKE, dude it is correct code, it works on another command
wut
it should work
ping 😠
look what he is sating
if (!message.member.hasPermission("MANAGE_MESSAGES") || !message.member.hasPermission("ADMINISTRATOR") || message.author.id !== ownerID) return
that could would mean if atleast 1 is true it doesnt return
is ownerID a string
admin has manage messages already
@neat falcon leave
look, it should wprk
you dont need .hasPermission("Administrator")
Look at
you dont
yes, but i have it in another command and it works, the exact same code
since d.js takes ADMINISTRATOR into account when checking permissions
the admin part isnt the problem
Please change || to && and watch it work
No
thiskid
because && means they all must be true
actually && would work
how?!
|| checks if even one is true
if (!message.member.hasPermission("MANAGE_MESSAGES") && !message.member.hasPermission("ADMINISTRATOR") && message.author.id !== ownerID) return
// !message.member.hasPermission("MANAGE_MESSAGES") will return true if they don't have the perm
// !message.member.hasPermission("ADMINISTRATOR") will return true if they don't have the perm
// message.author.id !== ownerID will return true if they aren't you
// therefore it will return if they don't have the perms and are not you otherwise it will continue with the code
yes, but if one is true, it should continue
and sure if i add && then all will have to be
essentially they have to be owner to not have the function return with your logic
And they dont have it returns true
! checks if it returns false return true
i know that
Hey, I need help. I'm making the report command but I want to do it by id but I can't.
whawt does the report command do tho
need more info
{
"prefix": "!",
"token": "also this is here",
"devID": "its here",
"dbUrl": "this stuff is here",
"embed": {
"color": "16051010",
"footer": "Suggestions - Copyright 2018"
},
"channels": {
"feedback": "498421302563176448"
},
"emojis": {
"upvote": "ðŸ‘",
"downvote": "👎"
},
"links": {
"botinvite": "https://discordapp.com/oauth2/authorize?client_id=486189371960328202&scope=bot&permissions=8",
"supportserver": "https://discord.gg/wkSch7q"
},
"apis": {
"dblport": 80,
"dblpassword": "i has my pass here",
"dbltoken": "token is here bro"
}
}
what is wrong with this code?
why are you posting it again
Tonkku said theres something wrong
if(command === 'report'){
let target = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
let reason = args.slice(1).join(' ');
if(!target) return message.channel.send('You must mention the person.');
if(!reason) return message.channel.send('You need to place a valid reason and link of the reported');
let reportembed = new Discord.RichEmbed()
.setThumbnail(target.user.avatarURL)
.setAuthor('Report', 'https://cdn.discordapp.com/emojis/465245981613621259.png?v=1')
.setDescription(`New report by ${message.author.username}`)
.setColor(0x66ff66)
.addField('⚠ - Reported member', `${target.user.tag}\n(${target.user.id})`, true)
.addField('⚠ - Reported by', `${message.author.tag}\n(${message.author.id})`, true)
.addField('⚙ - Channel', `${message.channel}`)
.addField('🔨 - Reason and link', `${reason}`)
.addField('💬 - Server name', message.guild.name, true)
.setTimestamp()
.setFooter("Report created by: " + message.author.username, message.author.avatarURL);
client.channels.get("id").send(reportembed)
message.channel.send(`${message.author}, Your report was successfully sent to the server team!`);
}
This is my code.
I want to do the report by id.
Are you trying to send it to a specific channel?
So just right click on the channel you want to send it to, then click copy id
and replace it with the id you copied
Ok
You already are
But im saying I want to report someone by id
You already are
Not by mention him
message.guild.members.get(args[0])
client.users.get
Only that?
No
@west raptor sorry for pinging you but doesnt'work.
May I give you the glitch proyect?
if/else statements 
glitch 
reminds me of old me 
do i hate the old me 
I'm trying to make a loop queue command, but not sure how. The code below just plays the first song in the queue, and then it stops right after...
if(serverQueue.queueLoop){
var queueLegnth = client.queue.get(message.guild.id).songs.length-1;
serverQueue.songs.push(serverQueue.song[0]);
serverQueue.songs.shift();
setTimeout(() => {
play(guild, serverQueue.songs[0]);
}, 50);
}```
So if it's on loop replay the song that ended?
you spelled length wrong
ik
just a heads up
ignore that var tho its not necessary
Basically what I did, is that I push the current playing song to the end of the queue.. Then I skip to the next song and play it..
also you're making it play the same thing every 50ms
Or am i doing something else..
Oh
@earnest phoenix this only activates once a song has ended tho
Here is the full thing: js .on('end', () => { // when the song ends if(!serverQueue.queueLoop){ if (!serverQueue.loop) { // if its not looped serverQueue.songs.shift(); setTimeout(() => { // wait 250ms before playing a song due to songs skipping play(guild, serverQueue.songs[0]); }, 50); } if(serverQueue.loop) { // if it is looped it doens't remove the first item setTimeout(() => { // wait 250ms before playing a song due to songs skipping play(guild, serverQueue.songs[0]); // play the song }, 50); } } if(serverQueue.queueLoop){ serverQueue.songs.push(serverQueue.song[0]); serverQueue.songs.shift(); setTimeout(() => { play(guild, serverQueue.songs[0]); }, 50); } })
what?
I never talked to Savage
i thought he was talking about @marsh lark
Ah
Well do you have any idea on any other method I should use to try and loop the queue
no not really
np
let coinflips_log = message.guild.channels.find(channel => channel.name === `➢-coinflips`); let msg_log = await coinflips_log.send("test_lmao"); const join = "✅"; await msg_log.react(join); const reactions = await msg_log.awaitReactions(reaction => reaction.emoji.name === join); console.log(reactions.get(join))
How can I get that to perform an action every time someone reacts with join?
DiscordJS
you can make a reaction collector
Have any examples/docs for that?
Thanks.
@topaz fjord Have any examples? The docs are confusing af.
i personally don't think the docs are confusing
but i understand how someone can think that
right
it'll be something like
let o = (reaction) => reaction.emoji.name == "✅"
let collector = msg_log.createReactionCollector(o)
or something
const msg = await message.channel.send('gay')
const filter = (reaction, user) => reaction.emoji.name === '👌' && user.id === 'someID'
const collector = msg.createReactionCollector(filter, { time: 15000 });
collector.on('collect', r => console.log(`Collected ${r.emoji.name}`));
collector.on('end', collected => console.log(`Collected ${collected.size} items`));
well i didn't have the events
oof ¯_(ツ)_/¯
So where would I get the reactor's ID from that? @topaz fjord
.users right?
@earnest phoenix your going to end up being the developer of his own bot with this rate of spoonfeeding 
aight
thanks thats it
thanks b
collector.on('collect', r => console.log(`Collected ${r.users}`));
Collected [object Map]
Can someone help me install my scripts to my bot
huh
Idk how to install a script to a discord bot
which programming language and environment?
Caant code on pc
why not
it will crash when i do it
how
did you even install discord.js
yep
so
your "text editor" has npm
thats nice
you still didn't tell us what scripts tho
step 1) dont use your phone
step 2) profit
LOL
Just tell me how to install it
install what @summer escarp
what scripts
@summer escarp to run it you need node
After installing you can run it with node filename.js
that is a nice pfp saddy
what is the node direct download link
@summer escarp https://nodejs.org/en/
can you even run node in android without root?
isnt it arm?
yep
So in discord.js, how can I make an image that has somebody's name on or something?
need
What would be the best way of preventing a pickup on links for my censorbot? Because it picks up random strings from say youtube videos and other sites that have randomized characters. So like i could do js if(arg.match(/http/)) return; //or something along these lines
but someone could then just really easily bypass with like http://fuck and then they could really easily curse
h t t p://f u c k
although best would be request the website and see if it gets a valid response
if your on a fast server
it wont take long
i can request a cat api and get a pic in less than 1.5 seconds
your locally hosting?
ye
i guess it'd be ok
i'm on a 1gpbs uplink dedi soooo
lol
but you should do some req tests
grab a light lib like phin (for node) and just run google and a few other sites through it
well it could also pose a security risk
because someone could just link their website and see the IP, because idc about the bots because it's on a private vpn but it runs really souley on it and i'd rather it not get out i guesS?
as long as you dont send user response back
tbh most the sites i see posing a problem have an embed
it wont expose anything
Oh in that case ok
What would just be the easiest and fastest way instead reqing the whole website just to get that code 200 like you said
are you using node.js or
yeah i am
yeah i am phin on npm open
// say "link" is a link, like "https://google.com"
const p = require('phin');
const res = await p(link);
if (res.statusCode == 200) {
// valid
}
i'd do something like that
you can also use a HEAD request
I'm really bad at reading promises but I see status code in the response but if i do res.statusCode it's undefined
oof
how can i get it lol
no it's statusCode
@queen sentinel can you kick some bots pls
res.headers.statusCode
@sick cloud Which bots, my friend?
if ok is a promise, you have to do await or ok.then()
inb4 await only valid in async function 
If I need the bot to check if it has the permission to send messages in the channel where the command was used, how do you do that?
I tried "if(client.Permissions.missing('SEND_MESSAGES')) return;" at the beginning, it that doesn't work...
*I'm using discord js
there are many ways to do it
!msg.guild.me.hasPermission()
better to check with channel
capital letter property name
.missing
"how do i..."
go and
please
the way i do is msg.channel.permissionsFor(id).has(permission)
So msg.channel.permissionsFor(id).has(permission)
Would be at the beginning, "id" being probably replaced with something like "message.channel.id" and "permission" with "SEND_MESSAGES"?
no, the id here is your user id
or the user you want to check permissions for
the channel you already have
msg.channel <-- the channel where the message was received in
It works! Thanks for helping :)
am i just retarded or smth or am i doing this right
; after the else?
same output
why dream
ive tried filtering
you dont need else if its return in the first if
take it out
ok


