#development

1 messages · Page 513 of 1

quartz kindle
#

how are you loading your json file and using the token value?

hushed berry
#

@quartz kindle the top level in json can also be an array

wheat marten
#
{
    "token": "",
    "fortnitekey": ""
}
zenith moss
#

Have your saved the files?

wheat marten
#

my token is in it

quartz kindle
#

i mean, how are you loading the file inside your code

west raptor
#

did you save the file first of all?

wheat marten
#

yes

west raptor
#

ok, how are you getting the json contents in index.js?

wheat marten
#
const config = './config.json';
quartz kindle
#

thats so wrong

west raptor
#

no require

quartz kindle
#

lmao

wheat marten
#

oh yeah lmao

earnest phoenix
#

require(config);?

west raptor
#

require('file name or lib')

wheat marten
#

I am such a idiot for forgetting require

quartz kindle
#

also, show your client.login() function

west raptor
#

im an idiot always

wheat marten
#

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

quartz kindle
#

@_@

zenith moss
#

-_-

wheat marten
#
   bot.user.setActivity('Microbrewing some local kombucha');
#

perfect 👌

quartz kindle
#

i have a russian friend who actually makes and sells kombucha lmao

wheat marten
#

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'
        });
west raptor
#

commando

wheat marten
#

yes

#

commando is my framework

#

lol

quartz kindle
#

never used commando, but i dont think you're supposed to remove that

wheat marten
#

yeah

west raptor
wheat marten
#

would I be able to remove this

west raptor
#

its pretty similar to commando but has more

quartz kindle
#

if you're using a framework, dont remove anything

west raptor
#

^

#

Most if not everything does something

quartz kindle
#

if you want to keep files to a minimum, and use only what you actually need, do your own thing from scratch

wheat marten
#

How would one make it so when the bot joins a guild it says a message

west raptor
#

says a message where?

earnest phoenix
#

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

quartz kindle
#

what if he doesnt use js?

earnest phoenix
#

he didnt specify what lang so i defaulted to d.js

jagged plume
#

same

#

what if they use eris

#

smh

earnest phoenix
#

how bout like if i were to do !help how can i get it do send the user the commands and i use .js

west raptor
#

.js

ionic barn
#

message.author.send

west raptor
#

what lib?

earnest phoenix
#

if he doesn't know how to send a dm with an embed do you really think he would know about eris

quartz kindle
#

he just told you

west raptor
#

when did he say the lib

#

please tell me

earnest phoenix
#

hey delta

ionic barn
#

hi

quartz kindle
#

i mean, vil just told him how

earnest phoenix
#

he didn't

#

he said .js

#

dm me and hmmm

#

not a lib

#

oeuf

wheat marten
#

❤ djs

#

I don't really like eris

earnest phoenix
#

same

#

someone dm me and ill show you what i have

ionic barn
#

does someone know how to use opusscript? ive been tring to send something using playOpusStream and its unintelligible. d.js

quartz kindle
#

and yeah big daddy, you use message.author.send()

earnest phoenix
#

i know that

quartz kindle
#

to send a dm to whoever used the command

earnest phoenix
#

do you know how to make an embed

#

not really

ionic barn
#

message.author.send(RichEmbed=(variable for embed))

earnest phoenix
#

@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

quartz kindle
#

you an embed builder

ionic barn
#

i tried installing node-opus but it didnt finish

earnest phoenix
#

oof

#

and also im trying to get my bot so it can ban a user

ionic barn
#

im using a receiver to get user input. thats what my stream is

earnest phoenix
#

i dont know anything tbh with bots just simple coder i am

#

XD

west raptor
#

learn js first

quartz kindle
earnest phoenix
#

readthedocs emoji best emoji

quartz kindle
#

doc the reads

earnest phoenix
#

the reads doc

west raptor
#

not being mean, but go through this first

#

its going to make coding bots 10x easier

earnest phoenix
#

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

wheat marten
#

I am going to take on making levels

earnest phoenix
#

why would you even make your bot spam your dms

wheat marten
#

Idk why tf someone would do that

earnest phoenix
#

because

#

i love nifactions

#

notifactions

#

ugh

#

you know what i meant

sick cloud
#

how do you get a list of all your shards

#

on djs

earnest phoenix
#

?

#

@earnest phoenix you can get your account banned from discord because of that

zenith moss
#

@sick cloud, what do you mean by list of shards? How many, shard ids?

sick cloud
#

i mean, i want to make a shards cmd that shows the avg. ping and status

#

not sure how to do it

zenith moss
#

Ahh

earnest phoenix
#

for spamming my dms

#

my own

#

@earnest phoenix

hushed berry
#

For spamming Discord's API

earnest phoenix
#

bruh im running it off my laptop

#

lol

#

im using notepad++ and cmd XD

zenith moss
#

Omfg

#

Your so dumb

earnest phoenix
#

ik

zenith moss
#

How do you think the bot connects to discord and basically runs?

earnest phoenix
#

Connects to Discord api

zenith moss
#

Yes

earnest phoenix
#

i remove the spam commands

#

done

zenith moss
#

Good

earnest phoenix
#

yeah

#

Now can you help me actually setup my bot im actually new to this

#

I wanna make help commands

deep inlet
#

Does VSC debugging options support loading in env files?

earnest phoenix
#

cause my bot is like those chat bots

#

this is what i have

#

lol

#

and more

quartz kindle
#

dont

deep inlet
#

OH GOD

quartz kindle
#

do

#

that

deep inlet
#

YOUR CODE

#

IS SO BAD

earnest phoenix
#

you should consider upgrading to a better IDE

#

ik

quartz kindle
#

lmfao

zenith moss
#

My eyes

#

Reee

deep inlet
#

AND FUCKING N++

earnest phoenix
#

im sorry

#

I'm so new to this

zenith moss
#

Alright

earnest phoenix
#

bot hunter is exaggerating

#

Yet i have a server with 700+ people XD

#

it isn't "bad" code

deep inlet
#

I mean

earnest phoenix
#

It even uses defensive programming

#

and im this dumb 😔

#

very well thought

zenith moss
#

Just get a code editor other then n++

earnest phoenix
#

like ?

zenith moss
#

Saves your life

earnest phoenix
#

like vscode

zenith moss
#

Atom

quartz kindle
#

first of all, and most importantly: dont use .on("message") multiple times

#

@earnest phoenix

earnest phoenix
#

if you can that is

#

why

#

think about it

#

anything repeated is redundant

#

also getting vscode

zenith moss
#

Good

earnest phoenix
#

in programming you want to make as less work for the pc as possible

quartz kindle
#

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

earnest phoenix
#

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

quartz kindle
#

vcs has an integrated terminal no?

earnest phoenix
#

ok im on vscode by the way

quartz kindle
#

but still, cmd still works

earnest phoenix
#

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

quartz kindle
#

first do what i told you

earnest phoenix
#

doing them if(!message.content.startsWith(prefix)) return is kinda redundant

quartz kindle
#

put all your commands inside a single .on("message") listener

earnest phoenix
#

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")

west raptor
#

command handler™

earnest phoenix
#

lol

#

Ken dm me and help me

west raptor
#

@ ken

earnest phoenix
#

my name isn't ken

#

its bak

#

but i can help thank

quartz kindle
#

no, you're ken now

#

barbie's boyfriend

earnest phoenix
#

bak

#

yay

#

May you pls help me with this i would be greatful for this

#

sure

#

Thanks

#

dm me

wheat marten
#

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?

quartz kindle
#

DU

#

Du Hast

#

Du Hast Mich

#

and no, you dont need to, unless you want to

wheat marten
#

oh ok

coral trellis
#

Do ./../config.json

wheat marten
#

oh

coral trellis
#

You're in the fortnite.js file correct?

#

Oh wait rip do ./../../config.json

#

I think

wheat marten
#

lemme try that

#

that works

coral trellis
#

Cool sataniaThumbsup

sick cloud
#

the ./ isnt needed

wheat marten
#

wait how do I make my bot page look good?

earnest phoenix
#

css

west raptor
#

css

wheat marten
#

css

sick cloud
#

ssc

quartz kindle
#

css

sick cloud
#

scss

quartz kindle
#

less

earnest phoenix
#

scss vs css

quartz kindle
#

less vs scss vs css

wheat marten
#

css

bright spear
#

html

wheat marten
#

js

west raptor
#

Py

wheat marten
#

XML

bright spear
#

scratch

quartz kindle
#

json

bright spear
#

jpeg

hushed berry
#

.

#

fun detected

west raptor
#

Groovy ruined it

wheat marten
#

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

hushed berry
#

where does the error occur

#

also

wheat marten
#

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.

hushed berry
#

You didnt show the part of the code where its erroring...

wheat marten
#

It says there's no errors in the code

hushed berry
#

...

#

What does your User.js file look like?

west raptor
#

toLowerCase is a function...

hushed berry
#

its still trying to read a prop from an undefined obj

wheat marten
#

I don't have a file called user

hushed berry
#

oh right

#

mb

#

id guess its because youre passing undefined for username

wheat marten
#

I am using a lib called fortnite in my code

hushed berry
#

ik

wheat marten
#

still can't seem to find a fix

quartz kindle
#

didnt we go through this before?

#

i remember someone with this exact same problem with this exact same lib lol

wheat marten
#

lol

quartz kindle
#

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

wheat marten
#

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)

quartz kindle
#

well, theres your answer

#

read the first line

wheat marten
#

I did

quartz kindle
#

then you know what the problem is

wheat marten
#

When I type in the command I include the username

quartz kindle
#

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

wheat marten
#
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

topaz fjord
#

what if the username is 2 words

earnest phoenix
#

Hey

#

Yes

sick cloud
#

python

#

nice

quartz kindle
#

DU, according to the error you're getting, your problem is here

earnest phoenix
#

So where do I add this

sick cloud
#

not everyone uses python

quartz kindle
#

if its saying there is no username, then you need to check if username is actually valid

sick cloud
#

@earnest phoenix in your ready event

quartz kindle
#

just do console.log(username) before the let data =

#

and check your console to see if the username comes up there

earnest phoenix
#

So where do I add this @earnest phoenix

quartz kindle
#

anyway im gonna go sleep now, so good luck

earnest phoenix
#

Ok

wheat marten
topaz fjord
#

log username

#

and see if its undefined

wheat marten
#

Error: You must supply a username

#

and it said undefined

earnest phoenix
#

@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

gilded blaze
#

@earnest phoenix js client.ws.ping

earnest phoenix
#

ew multiple event handlers

#

lol

#

XD

#

WTF

#

wait

#

yeah

#

?

#

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

#

oh

#

i must thinking of translation keys

#

or no

#

idk

#

if not

#

theyre about the same

#

both equally bad

#

scammed

#

ok i signed it

#

in

#

signed what

#

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

gilded blaze
#

@earnest phoenix What do you mean?

earnest phoenix
#

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

#

🤦

gilded blaze
#

client.ws.broadcast might be what you are looking for

earnest phoenix
#

let me try that

gilded blaze
earnest phoenix
#

i dont think so

gilded blaze
#

All the methods and properties are here

earnest phoenix
#

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

gilded blaze
#

Well discord.js-lavalink used the class before ws was public. Nothing was guaranteed to stay the same.

earnest phoenix
#

imma try editing it to broadcast

gilded blaze
#

Might work

#

If it doesn't, probably won't, then you could ask the developer to update to master

earnest phoenix
#

hm

#

it legit worked this morning

#

d.js update fucked it

wheat marten
#

How do you make an account webhook

bright spear
#

??

jaunty kite
#

-set

hollow fulcrum
#

This is why you use FFMPEG.

slate kayak
bitter sundial
#

define Commands

alpine robin
#

How much time it take to accept bot?

queen sentinel
alpine robin
#

K

fervent delta
#

@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
tropic cobalt
#

Hey 😁

slate kayak
#

ty @fervent delta trying new methods with this NSFW bot of mine 😦

tropic cobalt
#

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;
}

})

fervent delta
#

@tropic cobalt its fundamentally wrong.

#

How can the same user have 2 userIds?

#

Also format your code using codeblocks

tropic cobalt
#

Ah ok 😅😅😅

restive totem
#

@tropic cobalt good english 👌

tropic cobalt
#

✅ ✅ ✅

sinful lotus
#

do anyone here know how to read heapdumps

#

lmao

restive silo
#

Open Chrome => F12 => Profile => Load Heapdump

sinful lotus
#

yeah what I meant is, reading the heapdump itself, its quite confusing

restive silo
#

Oh

sinful lotus
restive silo
#

uhh yea its confusing idk tbh

sinful lotus
#

did you use heapdumps ?

#

to check your memory usage

#

maybe theres something that you can advice or stuff to pay in mind

restive silo
#

I did and it was confusing to me aswell

sinful lotus
#

I see, because my bot really eats a tons of memory and I'm confused if its on my code or caches

earnest phoenix
#

look at the delta

#

and size delta

#

look at which one go up the most

earnest phoenix
#
    db.fetch(`guild_${message.guild.id}`).then(i => {

                                         ^


TypeError: Cannot read property 'then' of null
amber junco
#

Umm.. Hewollo! How do you make text coloured?

#

^^^

#

console.log("Hi")

#

nope

steel heath
#

is there any way to check if a specific reaction removed from the message with reaction collectors?

quartz kindle
#

@amber junco
```languagename
code
```

amber junco
#
Console.log("hi");
#

Umm

#

oops

#

Nope

quartz kindle
#
console.log(hi)
west raptor
#

@earnest phoenix it's not a promise

#

No more at least

amber junco
#
console.log(hi)
#
 console.log(hi)
#

YAY

earnest phoenix
#

@west raptor what can i use instead of it then?

west raptor
#
let thing = thing
thing.value```
slate kayak
west raptor
#

files is undefined

quartz kindle
#

also, folder doesnt exist

west raptor
#

yes

quartz kindle
#

use forward slashes, not backwards

#

backslashes are for escaping characters

west raptor
#

thats not him/her

#

thats the lib it looks like

#

or node

quartz kindle
#

for example "test\"test"

slate kayak
#

thats node

quartz kindle
#

well, whoever did the scandir command

slate kayak
#

as im using a .bat file to run it

quartz kindle
#

you're trying to read the commands folder, right?

slate kayak
#

yes

quartz kindle
#

thats what im saying

#

C:/.../.../../
not C:\...\...\..\

slate kayak
west raptor
#

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

quartz kindle
#

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)

slate kayak
#

ok so how can i fix this ?

west raptor
#

make the folder

quartz kindle
#

are you sure the folder exists? can you send a screen shot for your bot's folder?

slate kayak
quartz kindle
#

try "commands" instead of "./commands"

gloomy fog
#

how do i change url like https://discordbots.org/bot/{botID} to https://discordbots.org/bot/{botName}
in DBL
Or need to be Certified?

echo sapphire
#

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)
quartz kindle
#

put black and purple into an array and use Math.random()

west raptor
#

discord.js has RANDOM for .setColor()

#

so .setColor('RANDOM')

earnest phoenix
#

hey guyz i need help

west raptor
#

with what

echo sapphire
#

i'll figure it out

earnest phoenix
#

Then ask

#

i can't add a bot

#

i can't find my server

#

to add a bot

amber junco
#

....

earnest phoenix
#

do you have permissions to manage server in said server?

quartz kindle
#

go to the discord official website and logout there

#

then login again

earnest phoenix
#

permission?I m the owner

#

and i also can't join a server

amber junco
#

^^^^

earnest phoenix
#

when i click join,nothing happens

amber junco
#

.......

gloomy fog
#

Banned !!!

earnest phoenix
#

so i have to copy the invite link and then i join it

gloomy fog
#

or logout & login

earnest phoenix
#

sorry for bad-eng

quartz kindle
#

you're using the desktop/mobile app right?

earnest phoenix
#

umm...DESKTOP

quartz kindle
#

your account is different in the app and in the website

#

so you have to logout in the website

earnest phoenix
#

what?

quartz kindle
#

and login with your correct account

earnest phoenix
#

u can see my account?

quartz kindle
#

no, but thats typically what happens

earnest phoenix
#

when my server was new,i can add bots

quartz kindle
#

the desktop app doesnt not access your browser or vice versa

earnest phoenix
#

this problem just appeared now

quartz kindle
#

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

earnest phoenix
#

now i have to logout from the discord official website?

quartz kindle
#

yes

west raptor
echo sapphire
#

@west raptor random worked, tnx

west raptor
#

yw

earnest phoenix
#

@quartz kindle can u plz come to the pm?

quartz kindle
#

whats so hard?

earnest phoenix
#

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

topaz fjord
#

What is it

earnest phoenix
topaz fjord
#

for

earnest phoenix
#

my website

#

!!

quartz kindle
#

google indexing

earnest phoenix
#

^

topaz fjord
#

oh

#

it's google

#

What do you expect

earnest phoenix
#

what are my other options

topaz fjord
#

also, if it's people doing it, it's not a business day

earnest phoenix
#

@quartz kindle Thankx Very Much Bro!!!😚

quartz kindle
#

lmao np

earnest phoenix
#

@earnest phoenix

west raptor
#

oh hi aj

#

why are you

#

in

#

development pinging random people

earnest phoenix
#

i want help

west raptor
#

with what

earnest phoenix
#

i need help with py

west raptor
#

oof

#

cant help you there

sick cloud
#

don't mention random people

topaz fjord
#

I have a video for logging out of discord account 😢

mild quarry
#

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']]

quartz kindle
#

you need to convert both values to a number to perform numerical comparison

buoyant oak
#

hey guys

quartz kindle
#

else its comparing strings, and ordering alphabetically by string

buoyant oak
#

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

mild quarry
#

Ok

quartz kindle
#

rip, should have done it before

#

but sorry i cant help you with python

buoyant oak
#

Damn :/

sick cloud
#

ask in the py server or whatever

lone wraith
#

@buoyant oak client = discord.AutoShardedClient()

#

Add this to your code

buoyant oak
#

o

#

cheers mate

lone wraith
#

client = discord.Client() change to client = discord.AutoShardedClient()

last ferry
#

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

earnest phoenix
#

How do get the playing status on and status @earnest phoenix

slender thistle
#

Plain spoonfeed

marsh lark
last ferry
#

Exposed lel

mild quarry
#

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?

restive silo
#

You can fetch the user from the api

#

i dont know how d.py implemented it tho

mild quarry
#

ok

lofty abyss
#

https://*****62:80/url

#

that dont seem to work as my url

#

anyone know why?

hot sleet
#

@mild quarry no
it's impossible in all libs i think

topaz fjord
#

depends

#

if they share a server with the bot then u can

#

@lofty abyss that's not a valid url

mild quarry
#

Oh

lofty abyss
#

oh

#

@topaz fjord

#

what url do i use then?

#

also the ****

#

is just so u dont see the ip

solid cliff
mild quarry
#

Thanks, actually, someone just sent me that link

lofty abyss
#

its the right api token

#

so am confused

topaz fjord
#

show your json

lofty abyss
#
{
    "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

#

am using that

#

as the webhook

#

@topaz fjord

topaz fjord
#

seems good 👀

lofty abyss
#

yeh idk

#

thats what i thought

heady anvil
#

I know bots can send custom emojis with <:name:id> but is there a shorter way?

gilded blaze
#

No

west raptor
#

It can send it :name: iirc if the server has a emoji named that

#

Otherwise no

earnest phoenix
#

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!")
west raptor
#

Use && instead

earnest phoenix
#

it returns when i use the command but my id is equal to ownerID

#

no

#

&& means i need all of them

topaz fjord
#

ok wait what

earnest phoenix
#

im looking so if i have atleast 1

west raptor
#

No

#

Read the logic in ur code

topaz fjord
#

dream

#

|| means only one needs to be true

earnest phoenix
#

^^

west raptor
#

I know

earnest phoenix
#

i need only 1 to be true

west raptor
#

Hold on

lofty abyss
earnest phoenix
#

it works in another command, exact same code, so dont say i did it wrong btw

lofty abyss
#

is this right for the webhook api?

west raptor
#

So I'm back so basically

#

You are saying if any of those return true return

earnest phoenix
#

yes

topaz fjord
#

you know you dont need to check for admin right?

west raptor
#

Ok and you don't have one of them am I correct?

topaz fjord
#

.hasPermission has an option that takes checkAdmin in account

earnest phoenix
#

well for some reason when my bot had admin but didnt have mute perms it didnt work

#

anyway, back to the error

west raptor
#

if does not have x and x -> return
if person has one if them -> continue

#

Is what you want ?

earnest phoenix
#

yes

west raptor
#

Well your code is saying

neat falcon
#

did discord.js remove fetchMessages in v12?

west raptor
#

if person does not have x OR y (meaning if one returns true return) -> return
if person has all of them -> continue

earnest phoenix
#

thats not what it is saying

#

ARE U DUMB

west raptor
#

Yes it is

earnest phoenix
#

how is it

neat falcon
#

this kid

earnest phoenix
#

explain then

#

|| means or

#

&& means and

west raptor
#

I know

earnest phoenix
#

im using ||

#

yes

#

FUCK SAKE, dude it is correct code, it works on another command

west raptor
#

Omg

#

Dude look at the logic in your code

earnest phoenix
#

@topaz fjord back me up here

#

OMG DUDE

#

its correct

topaz fjord
#

wut

earnest phoenix
#

it should work

neat falcon
#

turtle if you actually back him up

#

i'll bear u

topaz fjord
#

ping 😠

earnest phoenix
#

look what he is sating

west raptor
#

Dude

#

If even ONE returns true its going to return

earnest phoenix
#
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

topaz fjord
#

is ownerID a string

earnest phoenix
#

yes

#

i have it in a config

#

which is defined

neat falcon
#

admin has manage messages already

topaz fjord
#

@neat falcon yes

#

they did

earnest phoenix
#

@neat falcon leave

neat falcon
#

why do you need to define both

#

no

#

i don't leave

earnest phoenix
#

look, it should wprk

topaz fjord
#

you dont need .hasPermission("Administrator")

west raptor
#

Look at

topaz fjord
#

you dont

west raptor
#

Your fuckign

#

Logic

#

In your

#

Code

earnest phoenix
#

yes, but i have it in another command and it works, the exact same code

topaz fjord
#

since d.js takes ADMINISTRATOR into account when checking permissions

earnest phoenix
#

the admin part isnt the problem

west raptor
#

Please change || to && and watch it work

earnest phoenix
#

No

neat falcon
#

thiskid

earnest phoenix
#

because && means they all must be true

topaz fjord
#

actually && would work

earnest phoenix
#

how?!

west raptor
#

|| checks if even one is true

earnest phoenix
#

yes

#

i know!

#

thats what i want

topaz fjord
#
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
earnest phoenix
#

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

west raptor
#

You are check if they DONT have it though

#

Checking *

earnest phoenix
#

yes

#

if they dont have it return error

west raptor
#

And they dont have it returns true

earnest phoenix
#

HOW??!

#

brb

#

bak

west raptor
#

! checks if it returns false return true

earnest phoenix
#

i know that

topaz fjord
#

wait

#

bad image

#

@earnest phoenix ^

earnest phoenix
#

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

topaz fjord
#

need more info

lofty abyss
#
{
    "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?

topaz fjord
#

why are you posting it again

lofty abyss
#

Tonkku said theres something wrong

earnest phoenix
#
  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.

west raptor
#

Wdym?

#

Report a user via id?

ivory pebble
#

Are you trying to send it to a specific channel?

earnest phoenix
#

Yes @ivory pebble

#

Exactly @west raptor

ivory pebble
#

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

earnest phoenix
#

Ok

west raptor
#

You already are

earnest phoenix
#

But im saying I want to report someone by id

west raptor
#

You already are

earnest phoenix
#

Not by mention him

west raptor
#

message.guild.members.get(args[0])

earnest phoenix
#

Well.

#

To report someone that is not in the same guild.

#

K

west raptor
#

client.users.get

earnest phoenix
#

Only that?

west raptor
#

No

earnest phoenix
#

K

#

client.users.get(args[0])

#

Is that good?

west raptor
#

Yes

#

Wait

#

What's new Discord.Client() defined as

#

Nvm

earnest phoenix
#

@west raptor sorry for pinging you but doesnt'work.

#

May I give you the glitch proyect?

#

if/else statements tickYes
glitch tickYes
reminds me of old me tickYes
do i hate the old me tickYes

ivory pebble
#

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);
                    }```
west raptor
#

So if it's on loop replay the song that ended?

earnest phoenix
#

you spelled length wrong

ivory pebble
#

ik

earnest phoenix
#

just a heads up

ivory pebble
#

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..

earnest phoenix
#

also you're making it play the same thing every 50ms

ivory pebble
#

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); } })

earnest phoenix
#

what

#

just don't give him code

#

its that easy

ivory pebble
#

what?

earnest phoenix
#

oh yeah

#

uhh

ivory pebble
#

I never talked to Savage

earnest phoenix
#

i thought he was talking about @marsh lark

ivory pebble
#

Ah

#

Well do you have any idea on any other method I should use to try and loop the queue

earnest phoenix
#

no not really

ivory pebble
#

rip

#

I'll ask in another server then, thanks for your help!

earnest phoenix
#

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

topaz fjord
#

you can make a reaction collector

earnest phoenix
#

Have any examples/docs for that?

topaz fjord
earnest phoenix
#

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

topaz fjord
#
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`));
earnest phoenix
#

well i didn't have the events

#

oof ¯_(ツ)_/¯

#

So where would I get the reactor's ID from that? @topaz fjord

#

.users right?

marsh lark
#

@earnest phoenix your going to end up being the developer of his own bot with this rate of spoonfeeding bloblul

topaz fjord
earnest phoenix
#

aight

#

thanks thats it

#

thanks b

#
        collector.on('collect', r => console.log(`Collected ${r.users}`));

Collected [object Map]

summer escarp
#

Can someone help me install my scripts to my bot

west raptor
#

huh

summer escarp
#

Idk how to install a script to a discord bot

earnest phoenix
#

what do you mean by script

#

give us an example @summer escarp

quartz kindle
#

which programming language and environment?

summer escarp
#

Discord js

earnest phoenix
#

one

#

stop coding on mobile

summer escarp
#

Caant code on pc

earnest phoenix
#

why not

summer escarp
#

it will crash when i do it

earnest phoenix
#

how

summer escarp
#

Its old

earnest phoenix
#

did you even install discord.js

summer escarp
#

yep

earnest phoenix
#

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

summer escarp
#

Just tell me how to install it

earnest phoenix
#

install what @summer escarp

summer escarp
#

the scritpa

#

scripts

earnest phoenix
#

what scripts

night imp
#

@summer escarp to run it you need node

#

After installing you can run it with node filename.js

earnest phoenix
#

that is a nice pfp saddy

summer escarp
#

what is the node direct download link

earnest phoenix
quartz kindle
#

can you even run node in android without root?

topaz fjord
#

isnt it arm?

summer escarp
#

yep

wide ruin
#

So in discord.js, how can I make an image that has somebody's name on or something?

sick cloud
#

its not discord.js related

#

but you need canvas

gilded blaze
#

need

slim heart
#

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

earnest phoenix
#

they can always bypass it

#

nothing anybody ever does will every work

topaz fjord
#

h t t p://f u c k

earnest phoenix
#

although best would be request the website and see if it gets a valid response

slim heart
#

yeah thats what i was thinking

#

or like test if it has an embed

sick cloud
#

just a 200 code is all you need

#

not many sites have OG data

slim heart
#

Y e a h

#

my worry is it'll take too long to test

sick cloud
#

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

slim heart
#

im running a speedtest 1s

#

eek idk is this good enough?

sick cloud
#

your locally hosting?

slim heart
#

ye

sick cloud
#

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

slim heart
#

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?

sick cloud
#

as long as you dont send user response back

slim heart
#

tbh most the sites i see posing a problem have an embed

sick cloud
#

it wont expose anything

slim heart
#

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

sick cloud
#

are you using node.js or

slim heart
#

yeah i am

sick cloud
#

okay

#

you could use phin, and just compare the code

#

hold on

slim heart
#

yeah i am phin on npm open

sick cloud
#
// 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

quartz kindle
#

you can also use a HEAD request

slim heart
#

I'm really bad at reading promises but I see status code in the response but if i do res.statusCode it's undefined

sick cloud
#

oof

slim heart
#

how can i get it lol

sick cloud
#

.status maybe

#

i forgot

#

ugh

slim heart
#

no it's statusCode

sick cloud
#

@queen sentinel can you kick some bots pls

slim heart
sick cloud
#

res.headers.statusCode

slim heart
#

oh

queen sentinel
#

@sick cloud Which bots, my friend?

slim heart
#

still not working

#

res.headers isnt even a thing

sick cloud
#

type .status

#

here

slim heart
#

something isnt right idk

#

this is the top

quartz kindle
#

if ok is a promise, you have to do await or ok.then()

earnest phoenix
#

inb4 await only valid in async function kek

high tinsel
#

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

quartz kindle
#

there are many ways to do it

earnest phoenix
#

^

sick cloud
#

!msg.guild.me.hasPermission()

bright spear
#

better to check with channel

earnest phoenix
#

capital letter property name tickYes .missing tickYes "how do i..." tickNo go and readthedocs please

quartz kindle
#

the way i do is msg.channel.permissionsFor(id).has(permission)

high tinsel
#

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"?

quartz kindle
#

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

high tinsel
#

It works! Thanks for helping :)

west raptor
shy rose
#

; after the else?

west raptor
#

same output

topaz fjord
#

why dream

west raptor
#

ive tried filtering

topaz fjord
#

you dont need else if its return in the first if

west raptor
#

i know

#

i like being retarded

topaz fjord
#

take it out

west raptor
#

ok

topaz fjord
#

send that here that code

#

lemme test it