#development

1 messages · Page 344 of 1

uncut slate
#

mm

#

ideally though, I want centered prev/playpause/next buttons

#

basically how I want it is, sound slider (which opens up vertically on hover) at the far left

#

then there's a gap until the prev/playpause/next buttons (which are centered)

#

and then there's a progress bar for the rest of the space until the far right

earnest phoenix
#

Anyone knows a way i can track the servers the bot is joining?

shy rose
#

guild join event

#

or i think its called GUILD_CREATE thats i think the event handler for it

thorny hinge
#

Yeah guild create

earnest phoenix
#

ok thank you!

earnest phoenix
#

the token is no longer valid

#

but here's an example of how to activate you bot through js

#

@uncut slate I know bulma

rich kiln
#

BANDICAM

#

@uncut slate you can use margin or vertical alignment

#

you dont need to use X css framework

earnest phoenix
#

How do I make a global variable?

#

Like one that is consistant accross all files

#

@earnest phoenix Don't use global variables

#

Just pass it to the next file using functions

#

And how would I do that

#

Lol okay okay I get it

#

Sheesh

#

Sheesh

#

Did I do something wrong?

#

Lol no

#

I'm redircting to you the correct source

#

Boi

#

I didnt mean it literally

#

Then why did you say it?

#

I took it literally

#

🤦

#

lel

#

Google says: nothing

#

Just function parameters

#

Which isnt helpful lel

#

Most of it is HTML

#

Yeah google isnt helpful at all

#

Im just gonna check the MDN documentation again

#

Google is very helpful

prime cliff
#

Google isnt helpful at all xD

#

LMAO

earnest phoenix
#

Boi I ment for what im trying to do

#

Google is a very helpful tool

#

Just not right now

#

Lol node didnt come up at all on google

#

All that came up was stack overflow stuff

#

About function parameters

#

Which isnt helpful at all

#

because you didn't search hard enough

#

Im just gonna search the documentation again

#

Google just kept getting more and more off-topic the farther in I went

earnest phoenix
#

excuses

pale light
#

Lol

earnest phoenix
#

\👀

earnest phoenix
#

hi\

weak parrot
#

Oh god

#

It's happening again

#

White names everywhere!!!

#

😢

serene citrus
#

Hey guys, does require("json-circular-stringify"); lag the bot? I added it because if it's not there, it would make circular reference errors.

inner jewel
#

a require shouldn't lag the bot

#

unless the file is extremely big

#

or has heavy init

rich kiln
#

" unless the file is extremely big"

#

i dont think you can code with a pdf.

serene citrus
#

Well,thing is, everytime I type a command that edits the database in a way, it makes a long pause then does what it's supposed to do

lethal sun
rich kiln
#

ew

#

use json for dbs

#

dont*

#

@serene citrus are you hosting your bot on your pc?

neon pasture
#

He is

#

@rich kiln

rich kiln
#

well this is also a problem

serene citrus
#

@rich kiln Yeah I am.

#

Why is it?

serene crater
#

When dyno.coming on

rich kiln
#

@serene citrus self hosting may lag the bot asf

solar zephyr
#

This isn't the DynoBot support server sorry

earnest phoenix
#

yes self hosting is bad

#

It can cause a lot of lag @AstralProjectionMaster#2171

#

wew left

inner jewel
#

he didn't

#

just offline/invis

#
  • discord being retarded
weak parrot
#

yes self hosting is bad It can cause a lot of lag self hosts 3 bots on one PC without any issue bloblul

quiet bobcat
#

Can someone help me? I want to search for a role eg Admin on a server, with just writing like !search admin

neon pasture
#

remove the member.

prime cliff
#

oof simple mistake

neon pasture
#

user.avatarURL

solar zephyr
#

Nice indentation

thorny hinge
#

@quiet bobcat message.guild.roles.find("name", args)

#

dont change "name"

quiet bobcat
#

Ok

thorny hinge
#

And the args is like if someone does !search blabakabjakejdisjsi

#

Ya know what I mean

quiet bobcat
#

So if I do !search xd it will find the role named xd

#

?

thorny hinge
#

Yes

quiet bobcat
#

👍

#

Thanks alot

thorny hinge
#

If it's not there it returns null

#

You have a user variable defined

#

And you dont use it?

tawny lava
#

@earnest phoenix member.user.displayAvatarURL

thorny hinge
#

Yeah that too

#

Its not message.mention

#

Its message.mentions

#

I would do

var mention = message.mentions.members.first();
if(!mention) mention = message.member;
message.reply(mention.user.displayAvatarURL);
#

:P

#

So if no mention is delivered it gives you the author's avatar

#

wew

#

I keep forgetting that const cant be redefined

#

Lmao

#

But yes it still gives the avatar of a mention

#

It just gives you your avatar if no mention is provided

#

Change const to var

#

or whatever

#

Because const cant be redefined

#

lul

neon pasture
#

@earnest phoenix remove that, I told you thay

#

And don't ping me pls

sinful meadow
thorny hinge
#
const idk = await sql.get(`SELECT FROM something WHERE something = something`);
return idk.something;
}

This doesnt return the value GWlulurdTomStare and I havent done async functions in a while btw lul

solar zephyr
#

You have to await something() or .then it

thorny hinge
#

return await something()?

solar zephyr
#

Wait what

#

something().then(console.log)

#

Or wrap it in an asynchronous function and await it

round solstice
#

Someone developing in Ruby or crystal?

#

If yes, please contact me if you're up for a collab

quiet bobcat
#

How do I make a guild if statement?

#

Like if a guild has that id do this

prime cliff
#

Thats too easy 🤦

quiet bobcat
#

But I tried if(guild.id=382616877110657035)

#

And it didnt work

vale orbit
#

In what language?

umbral pelican
#

probably js kek

viral brook
#

Anyone knows how to convert my Discord4j (java) bot to a webapp so I can host it on Azure? (memory quota exceeded in Heroku, using worker role :()

topaz fjord
#

Host it yourself

viral brook
#

My internet won't do the job o-o

topaz fjord
#

Vps

viral brook
#

any free?

rich kiln
#

no

#

@jonasjac#7756 IDS needs to be a STRING not an INT

#

@quiet bobcat

earnest phoenix
#

helppppp

prime cliff
#

Screaming help wont get you help

earnest phoenix
#

ok..? did it in the past and it did mate

prime cliff
earnest phoenix
#

irdc abt tht mate

#

my rar wont work right.

prime cliff
#

Bad rar file then?

earnest phoenix
#

Its Winrar the good one everyone says they use

twilit flare
#

can someone halp me add a bot to my server? PLZ I NEEEEED IT

earnest phoenix
#

did you check invite?

twilit flare
#

?

earnest phoenix
#

lol

#

hold on

#

@prime cliff My friend made me the bot

#

Ok?

twilit flare
#

ok.

earnest phoenix
#

You know how to make an bot^

twilit flare
#

no. i know bots i like though

earnest phoenix
#

lol no help :/

twilit flare
#

k

solar zephyr
#

the quality of the .rar file doesnt depend on the extractor

earnest phoenix
#

@solar zephyr dm plz

thorny hinge
#
async function getPrefix(){
var foo = await sql.get(`SELECT * FROM prefixes WHERE guildId = ${msg.guild.id}`);
return foo.prefix;
}

Ive console.logged await getPrefix() and I get the right prefix but when I do console.log(await getPrefix().length) I get undefined GWlulurdWut

#

sendMessage is deprecated btw

#

And theres no reason to have the
(message.mentions.members.size === 0) part because the part above covers it ;-;

inner jewel
#

@thorny hinge (await getPrefix()).length

thorny hinge
#

Oh

#

So console.log(await getPrefix()).length? GWflamesThonking looks odd @inner jewel

inner jewel
#

console.log((await getPrefix()).length)

rich kiln
#

we need a #newbiequestions

#

no

#

" my rar wont work right." for people like this

weak parrot
#

I think it's a good idea

rich kiln
#

it is

#

this isnt google's new search engine

earnest phoenix
#

@thorny hinge you can't do that

#

because

#

You aren't waiting for the "await" to finish before you get the "length" property

#

const a = await myFunc();
console.log(a.length);

thorny hinge
#

k

#

Thx

rich kiln
#

'authorization',

#

wyf

earnest phoenix
#

I removed that

solar zephyr
#

(message.mentions.members.size === 0) is redundant

#

(message.mentions.members.size) is enough

#

because 0 is falsy in javascript

glossy sand
#

you're using a single line lambda

#

wrap your code in braces

#

@HaroldCPhillps#1521

earnest phoenix
#

@solar zephyr If the compared value is always a number, I use an integer comparator sign (>, <)

#

I prefer it that way

#

lol

glossy sand
#

i usually go x.length < 1

earnest phoenix
#

same

#

I like it like that

glossy sand
#

it doesn't make sense but it's become a habit

earnest phoenix
#

Same

#

ever since I started using x.indexOf(y) > -1

#

I prefer it that way

glossy sand
#

ok that one I don't do lol

earnest phoenix
#

Lol

#

Looks funny with the -1

pale light
#

-

earnest phoenix
#

Hey uh I have a question

#

How do I get the time a message was created outside an embed?

#

Nvm

smoky rampart
#

👀

earnest phoenix
#

Wait

#

How do I reference the sender of a message as a GuildMember

#

Nvm

umbral pelican
#

👀

earnest phoenix
earnest phoenix
#

Why am I getting this error?

fs.readdir("./commands/", (error, commands) => {
    fs.readdir("./events", (error, events) => {
        fs.readdir("./schedulers", (error, schedulers) => {
            for (let i = 0; i < commands.length; i++) {
                bot.commands.push(require("./commands/" + commands[i]));
                if (i === commands.length - 1) {
                    log("Loaded " + commands.length + " commands!");
                    for (let i = 0; i < events.length; i++) {
                        require("./events/" + events[i])(bot, r);
                        if (i === events.length - 1) {
                            log("Loaded " + events.length + " events!");
                            for (let i = 0; i < schedulers.length; i++) {
                                const schedule = require("./schedulers/" + schedulers[i]);
                                setInterval(schedule.execute, schedule.interval);
                                if (i === schedulers.length - 1) {
                                    log("Loaded " + schedulers.length + " schedulers!");
                                    bot.connect();
                                }
                            }
                        }
                    }
                }
            }
        });
    });
});```
#
/Users/jacobgunther/Documents/Starboy/src/index.js:26
            for (let i = 0; i < commands.length; i++) {
                                        ^

TypeError: Cannot read property 'length' of undefined
    at fs.readdir (/Users/jacobgunther/Documents/Starboy/src/index.js:26:32)```
#

I don't get why, it's defined in the first line of that code

#

nvm figured it out

languid dragon
#

what the heck

#

too many readdir

tawny lava
#

no u need more

languid dragon
#

LIZARD, DONT ENCOURAGE THEM

earnest phoenix
#

@languid dragon It's not too many

#

I can't have any less without it not working

languid dragon
#

yes you can

earnest phoenix
#

how so

languid dragon
#
let dirs = ["./commands/", "./events",  "./sched..."];
for(var i=0;dirs.length>i;i++){
    fs.readdir(dirs[i], (err, res)=>{
        // do stuff with res
    });
}
#

something on the lines of that

earnest phoenix
#

won't work with my code

#

plus that's dumb

languid dragon
#

how is that dumb

#

you know what

#

no

earnest phoenix
#

you're technically still calling readdir the same amount of times

languid dragon
#

yeah

#

but the code is cleaner

earnest phoenix
#

nothing changes

languid dragon
#

brb

#

BRB

earnest phoenix
#

that wont work anyway

languid dragon
#

SH

#

IM DOING THIS

tawny lava
#

lul

languid dragon
#

this is harder than i imagined, considering i have no context lel

#

let dirs = [ "commands", "events", "schedulers" ];
let bot = { "commands":[], "events":[], "schedulers":[] }

for(let i=0;dirs.length>i;i++){
  let complete = 0;
  fs.readdir(__dirname+"/"+dirs[i]+"/", (err, res)=>{
      for(let x=0;res.length>x;x++){
        bot[dirs[i]].push(require(__dirname+"/"+dirs[i]+"/"+res[x]));
        if(x === (commands.length-1)) log(`[${dirs}] => Loaded.`);
        if(dirs[i] === "schedulers") setInterval(bot[dirs[i]][x].execute, bot[dirs[i]][x].interval);
        if(dirs[i] === "events") bot[dirs[i]][x](bot, r);
        complete++;
        if(x === (commands.length-1) && complete === 2) bot.connect();
      }
  });
}
#

LMFAO

earnest phoenix
#

oh my

languid dragon
#

literally does the same thing

#

LOL

#

well i think

earnest phoenix
#

I believe my code is more optimized

languid dragon
#

well

#

ya

#

i shit this out in 5 minutes

earnest phoenix
#

took you 5 minutes...

languid dragon
#

what

#

i was talking to my peers as well

#

wys

#

this gave me an idea for my project though, so thanku xox

earnest phoenix
#

lol

languid dragon
#
const module = require('module');

module();

const module = require('module')();

how do this pl0s

earnest phoenix
#

what

languid dragon
#

dont understand?

earnest phoenix
#

I understand

#

but what are u asking

languid dragon
#

How would i write it in a command.js
so that executing would allow me to simple just write

const module = require('module');

module();
earnest phoenix
#

still.

#

dont.

#

understand.

#

english, please

languid dragon
#

I want to execute ping.js
I don't want to execute it like this

const ping = require('./commands/ping.js');

ping.Execute();

I want to run it like this:

const ping = require('./commands/ping.js')();
OR
ping();
#

understand what i want?

earnest phoenix
#

Then use the bottom option

languid dragon
#

SIGH

#

HOW DO I DO IT

#

IS WHAT I WANNA KNOW

earnest phoenix
#

You're confusing

languid dragon
#

OGUHESOUGHSUHEGOESUHGOUHESUOGHUOESHGo

#

BYE

earnest phoenix
#

gfhdiugfgbdfhgfhfgd

languid dragon
#

im googling this

earnest phoenix
#

bye

#

gl

languid dragon
#

i wont find anything

#

COS I DONT KNOW WHAT ITS CALLED

earnest phoenix
#

modules?

#

module.exports?

languid dragon
#

nah

earnest phoenix
#

methods

#

functions

languid dragon
#

idk

earnest phoenix
#

objects

languid dragon
#

no dude

earnest phoenix
#

chaining functions?

languid dragon
#

fucc it

#

ill google it

#

dw

#

tawny lava
#

ken you're bad

languid dragon
#

you're bad

brittle pelican
#

lol this is a way to make someone mad...

languid dragon
#

ok

earnest phoenix
#

lol

granite vine
#

calling a module object?

earnest phoenix
#

reee\

low niche
earnest phoenix
#

why?

fervent goblet
#

?

earnest phoenix
#

it does not work to install anything!

#

(╯°□°)╯︵ ┻━┻

#

@earnest phoenix it's installed

#

Make sure it's added to PATH

neon pasture
#
for(var guild of bot.guilds.array()){
  count += guild.memberCount.size
}```
#

Why isn't this working?

#

Using eris btw

tawny lava
#

becuse guild.memberCount.size isn't a thing

#

memberCount already gives you a number

neon pasture
#
for(var guild of bot.guilds.values()){
  count += guild.memberCount
}```
Already found a way
fervent goblet
#

@neon pasture no please

#

some people are in multiple guilds with the bot

#

that will be inaccurate

neon pasture
#

so?

#

I don't give a fuck

fervent goblet
#

lol

neon pasture
#

msg.mentions[0].joinedAt It's undefined, but I really don't know how to fix it.

#

Using Eris / Javascript

jagged plume
#

mentions is an array of users

#

not guild members

neon pasture
#

So I need to make it as a variable?

jagged plume
#

what

neon pasture
#

msg.mentions[0], it's now a array

jagged plume
#

noo

#

mentions is the array

#

and you are getting a user object

#

not the guild member one

neon pasture
#

How can I make a guild member object of it then?

#

need to fetch it?

jagged plume
#

guild has a collection of members

neon pasture
#

Isn't it possible to make from User object a Member object?

fervent goblet
#

loop through the members

#

if the member id = the user id

#

user = member

neon pasture
#

But then I need to make a map and shit

jagged plume
#

what the hell

#

it isnt even difficult

#

im not spoonfeeding you, but you literally just have to use .get with the user id as the argument

#

thats what i meant about the collection

#

bot.guilds is also a collection, you should know how to operate one by now lol

uncut slate
#

you don't need to map

#

just get the member object from the members collection

tawny geode
tawny lava
#

probably taken from a tutorial

#

or guide

tawny geode
#

or just downloaded the source code, put a token key and let the bot run

tawny lava
#

kek

tawny geode
#

"i made a bot"

#

they'll never have the feeling to get shitpost muted

#

just like my bot

#

cries

neon pasture
#

cries too

tawny geode
#

cries more

sinful meadow
#

cries even more

tawny geode
#

cries the most

sinful meadow
#

cries even more then the most

tawny geode
#

cries more than anyone else

#

is this a cry fight?

sinful meadow
#

nah

neon pasture
#

lol

cosmic plover
#

cries

vale orbit
#

How to POST / GET datas to your own website with Discord JS?

tawny geode
#

using the many modules nodejs offers

earnest phoenix
#

@tawny geode how many modules do you use?

tawny geode
#

i use superagent to POST stats to discordbot list

restive silo
#

eww

fervent goblet
#

Hey

#

Would it be possible to in a way have unlimited upload emojis? Doesn't have to be in 1 guild, I've been thinking like, use a user token to create guilds if needed, then auto invite the bot, but thats impossible seeing as the bot oauth invite thing has captcha

restive silo
#

no there isn't a way

#

and you should not try to automate that process tbh

uncut slate
#

yes

earnest phoenix
#

hi

proven whale
#

help me make a bot

#

im to stuipid

thorny hinge
#

Do you know any programming languages? @proven whale

proven whale
#

NOPE

thorny hinge
#

Well

umbral pelican
quiet bobcat
#

I suggest watching a tutorial of first learning some programming languages

thorny hinge
#

Yeah

#

javascript

umbral pelican
#

discord bot maker on steam

thorny hinge
quiet bobcat
#

discord bot maker sucks

smoky rampart
#

🤔

#

I learned python/discord.py by reading the source of a redbot cog that was outdated and broken and messing with it to try learning why it was broken

tawny geode
#

i learned javascript by making a discord bot in discord.js

quiet bobcat
#

me too

languid dragon
#

when u fucking hit 100 commits in the same fucking day u created the repository

red delta
#

gg man

languid dragon
#

GG

#

im so fucking tired, this wasn't even meant for this channel

red delta
#

I wonder how that will look in gource

tawny geode
#

ps:eval message.guild.members.size

#

ops

#

wrong channel

red delta
#

Net neutrality is under attack, so I put this in the footer of almost every bot command

quiet bobcat
#

👍

abstract mango
#

@fervent goblet you can actually make 10 guilds

#

10 x 50 = 500

#

soo

fervent goblet
#

yeah

abstract mango
#

(although you have to do it before you get any real guilds)

fervent goblet
#

yeah

earnest phoenix
#

!HELP!

#

i like how a bot dm'd me when i wrote that

fervent goblet
#

UW0T

#

!HELP!

#

LOL

earnest phoenix
fervent goblet
#

ik

#

oh fuck no please no more bots with ! as prefix

earnest phoenix
#

i'm gonna use !"()!"/) as prefix

#

fucking unique

fervent goblet
#

lol

#

!"()!"/)help

earnest phoenix
#

or 8=Dhelp

fervent goblet
#

8====Dhelp

earnest phoenix
#

lol

earnest phoenix
#

@earnest phoenix what theme is that?

earnest phoenix
#

lol

cosmic plover
#

@red delta update jda lol

earnest phoenix
#

NIce

red delta
#

@cosmic plover nice catch

unreal tusk
#

Hey guys! How can I add reactions to message with jda?

thorny hinge
#

Doesn't jda have docs

#

🤔

unreal tusk
#

Docs cant help me

restive silo
#

jda has docs 👀

#

aswell as its completly documented with JavaDocs

languid dragon
#

message is not defined :^]

#

i think you should take a few steps back, read some documentation and try again

#

theres a few things missing/wrong with your code

neon pasture
#

You forget the on chat

#

Or on message part

restive silo
#

your exported function is a void

neon pasture
#

client.on('message', msg => {

languid dragon
#

sure you're passing (client, message, args) ?

#

im assuming this isn't your "main.js"?

#

alright, was gonna say

neon pasture
#

const client = new Discord.Client();

#

O wait

#

This isn't your main file?

#

O lol

earnest phoenix
#

/warn

#

xD

#

@earnest phoenix .-.

#

u failed at life

#
if(!mention) {
mention == message.member
}
#

.-.

#

yes

languid dragon
#

LMFAO

#

@earnest phoenix thats not gonna work

earnest phoenix
#

xD true

languid dragon
#

what he had previously was fine

#

he just had it organised in all the wrong ways

#

and @earnest phoenix i think the issue is that you're not actually passing the message event through the function

earnest phoenix
#

i just realized

languid dragon
#

try checking your command handler is written up properly

#

and if you didn't make the CMD handler urself

#

you should check up on the documentation a little more

#

show me the command

#

and the handler

#

okay for starters

#

=>

#

goes nowhere

#

wrap everything in {}

#

for example

((function) => {

        //code

})
#

get me?

#

as you've done with your other command

#

basically just forgot some brackets

#

if you don't want help? 👀

#

do the same as you've done with other commands 👀

#

so yes.

#

np

#

ye

earnest phoenix
#

the footer text 😏

earnest phoenix
#
[2017-11-22 18:26:29]  Error: val is not a non-empty string or a valid number. val=undefined
[2017-11-22 18:26:29]      at module.exports (C:\Users\JBeda\Desktop\Immortal\node_modules\ms\index.js:33:9)
[2017-11-22 18:26:29]      at Object.exports.run (C:\Users\JBeda\Desktop\Immortal\commands\mute.js:13:66)
[2017-11-22 18:26:29]      at msg.validateArgs.then (C:\Users\JBeda\Desktop\Immortal\node_modules\komada\src\events\message.js:73:15)
[2017-11-22 18:26:29]      at <anonymous>
[2017-11-22 18:26:29]      at process._tickCallback (internal/process/next_tick.js:188:7)
#
const ms = require('ms')
exports.run = (client, msg, args) => {
    let member = msg.mentions.members.first()
    if(!member) {
        msg.channel.send('**NO MEMBER**')
    }
    let muteRole = msg.guild.settings.muteRole
    if(!muteRole) {
        msg.channel.send('**NO MUTE ROLE**')
    }
    let time = args[1]
    member.addRole(muteRole)
    msg.channel.send(`${msg.author} has muted ${member} for ${ms(ms(time), {long: true})}.`)

    setTimeout(function() {
        member.removeRole(muteRole)
        msg.channel.send(`${member.user.tag}, you have been unmuted. The mute has lasted ${ms(ms(time), {long: true})}.`)
    }, ms(time))
    if(!time) {
        member.addRole(muteRole)
        msg.channel.send(`${msg.author} has muted ${member}.`)
    }
}
exports.conf = {
    enabled: true,
    runIn: ['text', 'dm'],
    aliases: [],
    permLevel: 1,
    botPerms: [],
    requiredFuncs: [],
    requiredSettings: ['modRole', 'adminRole', 'modLog', 'muteRole']
}
exports.help = {
    name: 'mute',
    description: 'mute users',
    usage: ''
}
undone plover
#

I have a question about json web apis

#

where do I put the api key in the url?

#

please tag me in your responce

earnest phoenix
#

I has a question too

#

How would I make an event listener for when my bot joins a server?

#

Please tag me too

prime cliff
#

Read the docs for your lib

earnest phoenix
#

@earnest phoenix we aren't google

#

search it up yourself

restive silo
#

@earnest phoenix whatever you gave to the ms module was undefined

#

@undone plover depends on the API

earnest phoenix
#

^

#

usually the API key goes in an Authorization header

#

or even the body data

#

sometimes even the URL query params

#

hey kiddies

#

no

undone plover
#

darn it

#

thanks for the help

earnest phoenix
#

This guy literally helps everyone else, but when I ask he tells me to google it

smoky rampart
#

because it's probably one of the easiest things to find

earnest phoenix
#

But its for literally everything I ask for help with

smoky rampart
#

and he helped by telling you how to find it :D

earnest phoenix
#

But logic: If I came here, it means I already googled it, searched the docs, and tried almost everything I know

restive silo
#

Then you dont know how to use google properly

earnest phoenix
#

Boi I do

smoky rampart
#

what lib do you use

earnest phoenix
#

Most of google is form websites that are vague

#

Im just gonna keep looking ig

smoky rampart
#

what lib

earnest phoenix
#

d.js

restive silo
#

Look at the docs under the guildCreate event

earnest phoenix
#

Okay thank you

restive silo
earnest phoenix
#

That literally helped more then just telling me to "google it"

smoky rampart
#

I just googled

earnest phoenix
#

I did too

#

All unrelated topics

smoky rampart
#

and found it within the top 3 results

earnest phoenix
#

.>

#

Wait

#

How

#

I search something

smoky rampart
#

the documentation

earnest phoenix
#

Google comes up with unrelated topics

smoky rampart
#

unless d.js isn't discord.js

earnest phoenix
#

Oh okay I get how to do it now!

#

It is

#

Alright thank you for pointing me in the right direction

smoky rampart
#

🤔

earnest phoenix
#

Okay wait

#

As my event perameters

#

Nvm

#

Okay yea

#

For my event perameters

#

Should I use member or client

restive silo
#

You use that what the event emits

earnest phoenix
#

Ah, thank you

#

So I should use client

restive silo
#

Look the docs up

earnest phoenix
#

I am currently

restive silo
#

Everything is documented in there

earnest phoenix
#

Cant find the "on" method tho

#

Probs in event emitters

#

Nvm

viscid jay
#

@earnest phoenix which lib

earnest phoenix
#

d.js

viscid jay
#

client.on

earnest phoenix
#

Ik

#

But I need to know how to set up the perameters

viscid jay
#

I don't work much with js though

#

I'm afraid that I am hardly qualified to assist you

earnest phoenix
#

This- this isnt working

smoky rampart
#

hopefully someone that knows d.js will come save the day for you

earnest phoenix
#

Hopefully

#

Because I think I know how to refrence the bot

#

Okay yes I do as a member

#

But im not sure what to put as the perameter

#

Member, message, client

young cradle
#

Which client event emitter are you looking for?

earnest phoenix
#

client.on

#

guildCreate

young cradle
#

Oh guild create

#

It only gives you one object

#

Being a Guild instance

earnest phoenix
#

Yes

young cradle
#

Example

<Client>.on('guildCreate', guild => {
    console.log(guild.name);
});
#

Useless code

#

But you can understand how it works with it

#

And make it useful

#

And i did not close the method, good job me

earnest phoenix
#

Oh so its guild!

#

Thank you

young cradle
#

Ehhh

#

you can call it however you want

earnest phoenix
#

Okay lol

young cradle
#

The callback variable name does not matter codewise

#

You just need to know what it returns to you

#

in this case a Guild instance

earnest phoenix
#

Oh!

#

Okay so thats how it works!

#

Thank you!

young cradle
#

You are welcome

earnest phoenix
#

Okay wait

#

Sorry to bother

#

But if your willing to answer 1 last question?

#

Nvm

young cradle
#

Okay

#

o3o

earnest phoenix
#

I was gonna ask how to refrence the bot member

#

Since theres no message

#

I believe

young cradle
#

Yep

earnest phoenix
#

Aghhh

#

I keep getting all sorts of errors

#

How do I make my code find a guild's default channel in a .find() method?

#

Anybody know?

#

It comes up as an unspecified value

#

Nvm

shy rose
#

Does anyone know how to get bitbucket webhooks into discord i found a site ages ago that could send to that webhook and it would format and foward but ive seemed to have missplaced the bookmark

earnest phoenix
#

I apologise sir, I do not know

shy rose
#

0-0 omg yes after 3 hours of searching and the 46page of google i has found it

earnest phoenix
#

Lol nice bruh

#

I have a question too

#

If anybody is around

#

How do I reference the defaultChannel of a guild in relation to the methods before it

#

Because I keep getting "cannot read name of undefined"

#

As an error

shy rose
#

cause there is no longer a default channel in all servers some have it some dont its optional now

earnest phoenix
#

O sheet

#

How would I create a fixed channel to send a hello message to then

shy rose
#

easy way to tell is if discord sends its welcome message

#

i ask my self that all the time ¯_(ツ)_/¯

young cradle
#

Easiest way would actually to send the message on the first channel you have Send Messages permission

shy rose
#

as im sure many other devs do

earnest phoenix
#

Oh

#

Wow k

#

So the find perameters would be 'permission', 'SEND_MESSAGES'

#

How do we use the api on the site

young cradle
#

Iterate through the <Guild>.channels using on each Channel instance the permissionsFor() method and check if it haves SEND_MESSAGES

earnest phoenix
#

👌

#

How would I turn permissions into a string

#

I was thinking of a .includes() method

#

Nvm

#
client.on('guildCreate', guild => {
    const channel = guild.me.guild.channels.permissionsFor(guild.me);
    if (!channel) return;
    if (channel.has('SEND_MESSAGES')){
        channel.first().send(`Hello!`);
    }
  });
#

I think this should work

topaz fjord
#

i have this right

#

and this button

earnest phoenix
#

?

#

That’s unprotected sex

topaz fjord
#

how can i make the button direct to the fun commands section

earnest phoenix
#

On a website?

topaz fjord
#

yes

earnest phoenix
#

In which way

topaz fjord
#

the button is in 1 file

earnest phoenix
#

Oh!

topaz fjord
#

the thing is in another

earnest phoenix
#

Use an image link

#

I’m too lazy to make my own website lol

#

To the other webpage

#

Lol k

topaz fjord
#

and there are multiple sections in the file that has the section

earnest phoenix
#

XDD jk

#

Just link the image to the major fun-commands section

#

As the website URL

#

Of that section

#

Hold on

topaz fjord
#

how would i do that

earnest phoenix
#

Ill show you

topaz fjord
#

cause i still want them to be able to use that section of the web

earnest phoenix
#
<a href="section_link_here"><img src="Image_name_and_extension_here"></a>
#

When they click it, it will act as an image link

topaz fjord
#

so if i do that

#

and i want it to scroll to utility commands when i click the button?

earnest phoenix
#

That looks actually kinda good

#

Oh scrolling?

topaz fjord
#

yes

earnest phoenix
#

Im not sure about that

topaz fjord
#

auto scrolling to the section

earnest phoenix
#

All I know is basic HTML

#

Rip

#

Wait

topaz fjord
#

i know how to do the auto scrolling in the same file

#

but not auto scrolling to divs in other files

earnest phoenix
#

How do I use .forEach() Methods

#

._.

topaz fjord
earnest phoenix
#

I give up

#

I've been studying this for almost half an hour

#

Nothing is working

abstract mango
#

@topaz fjord ```html
<a href="/commands#utility"><img src="img.png"></a>

next wedge
#

hi

rich kiln
#

@earnest phoenix codecademy is your friend

neon pasture
#

@rich kiln It's not your friend...

earnest phoenix
#

oof

#

i used codecademy while in school

#

for html & css

rich kiln
#

@Jeffrey#7936 it is.

neon pasture
#

Back in the days, it was okay. but now..

earnest phoenix
#

codecademy is hot

#

would be cool if it supported c#

neon pasture
#

You have to pay for everything

#

and it's out dated

rich kiln
#

nah and ikr

#

still its a good start

neon pasture
#

true'

rich kiln
#

mdn wont help too much as ppl expect

uncut slate
#

ahah

#

suggesting codecademy over mdn is up there on my list now

neon pasture
#

mdn?

rich kiln
#

consider suggesting stackoverflow 4 spoonfeed

earnest phoenix
#

👆

earnest phoenix
#

Mdn is great

rich kiln
#

no one said it isnt.

uncut slate
#

codecademy doesn't compare to mdn

rich kiln
#

who said it does.

neon pasture
#

How to convert Timestamp to human readable form date? Javascript

vital lark
#

who the fuck knows

neon pasture
#

someone

rich kiln
#

moment.js is a thing

#

you can also do a MS to HRS converter with math and shit

neon pasture
#

Already got it, just timestamp*1000

unreal tusk
#

Hey guys! How can I add reactions with jda?
I tried some ways of it:

            event.getMessage().addReaction(event.getGuild().getEmoteById("2639")).queue();```
But JDA always throw on second string
```java.lang.IllegalArgumentException: Emote may not be null``` 
or
```[JDA-Thread JDA] ERROR RestAction - RestAction queue returned failure: [ErrorResponseException] 10014: Unknown Emoji```
rich kiln
#

uh

#

the id is wrong.

fervent goblet
#

LOL THAT IS

#

ID*

sinful meadow
#

Ghey @fervent goblet

#

jk

#

love meh

fervent goblet
#

most random

sinful meadow
#

ik

#

\💀

#

rip

#

xD

fervent goblet
#

message.react(💀)

#

l o l

sinful meadow
#

i forgout how to react to the authors message

#

Nvm

#

it works

#

but it didnt work here

earnest phoenix
#

thanksgiving stream starting soon ™

thorny hinge
#

How can I get the user's username and tag in my page?

#

🤔

neon pasture
#

You mean bot page?

thorny hinge
#

Yes

#

Or any page in general

earnest phoenix
rich kiln
#

you need to fix your flexbox css

#

set up a flex-wrap

earnest phoenix
#

what is that

earnest phoenix
#

@earnest phoenix Eww, PHP

#

u'm fixing something for a friend

#

I do only JS

#

same

bitter sundial
#

forgotpassword.php

#

I hope the security is good

quiet bobcat
#

Hopefully

rich kiln
#

@earnest phoenix leave him alon

#

we use what we want to.

#

no one cares if x user is user .xshit

earnest phoenix
#

i have a problem in discord.js, i write:

if(msg.member.roles)

i get this error:

Cannot read property 'roles' of null
#

can anyone help please?

neon pasture
#

A list of roles that are applied to this GuildMember, mapped by the role ID

#

You sure it's a GuildMember object?

earnest phoenix
#

yes

#

msg means the message and from message i can get to GuildMember by .member

neon pasture
#

Returns the GuildMember form of a User object, if the user is present in the guild.

#

.member(user)

#

So it returns the GuildMember object, that's good

rich kiln
#

itll not get the user. it will get the member.

earnest phoenix
#

.author is the user

rich kiln
#

but stikl you can .get() it

earnest phoenix
#

.member is the guildmember

neon pasture
#

guild.member(message.author);

#

that's how you get the GuildMember object

rich kiln
#

.id

jagged plume
#

His way is fine?

earnest phoenix
#

that's another way as well

neon pasture
#

It's not, why would it return a error then?

jagged plume
#

Member is a valid property though

earnest phoenix
#

i dunno

neon pasture
#

Okay

earnest phoenix
#

guild.member(message.author) does not work either

#

wait

neon pasture
#

if(msg.member.roles), but .roles is a array right?

prime cliff
#

Wait what guild.member?

jagged plume
#

Roles is a collection in discord.js

neon pasture
#

yeah, can you even put it inside a if statement?

earnest phoenix
#

fixed it

#

guild.member(msg.author)

neon pasture
#

lol

jagged plume
#

No idea why the member property was returning null.

#

It’s valid

earnest phoenix
#

oh darn

#

now it's cannot read property member of null

jagged plume
#

Unless they changed it, i havent used discord.js in a while

earnest phoenix
#

why would they change it?

jagged plume
#

Pfft im on the developer

#

They do random shit that breaks code all the time

#

They might have changed this, or it’s just a bug with your code

earnest phoenix
#

urgh...

#

so how am i going to do this...

neon pasture
#

send all your code

earnest phoenix
#
function userRole(msg, role) {
  console.log(msg.member.roles)
  if(msg.member.roles !== "")
  if(msg.member.roles.find("name",role)) return true;
  return false;
}
#

i tried !== "" now

#

still not working

#

@earnest phoenix if (msg.member.roles.size < 1) return;

#

.roles isn't a string, it's a Collection which extends a Map

earnest phoenix
#

Hey guys?

#

How do I make my bot interact with VCS

#

Like for instance

#

If I make a restart command

#

It automatically stops the running process and does it again

#

let me try it

#

didn't work

#

Did you put a space after that comma?

#

@earnest phoenix What is your goal?

#

Like what are you trying to do

#

Also I would recommend putting the "return false;" next to the first if statement

#

Okay it looks like your making a role checker

#

my brother asked me to make a bot, and i'm trying to check a member has a specific role through a function

#

Okay

#

Hm

#

Im trying to reference specific things too

#

But

#

Might be able to help you here

#

First off

#

You need a string value instead of "role"

#

I would also recommend putting a space after the comma

#

why?

#

Because its just how it seporates

#

The values

#

If your asking for the string value

#

Well, you dont NEED a string value

#

You can get like a list of roles

#

And reference that there

#

Hm

#

Like

#

ok

#

Wait can you show your current code?

#

Please

#
function userRole(msg, role) {
  console.log(msg.member.roles)
  if (msg.member.roles.size < 1)
  if(msg.member.roles.find("name",role)) return true;
  return false;
}
#

Hm

#

Okay so suggestion: move the return false; next to the first if statement

#

Like this

#
if (msg.member.roles.size < 1) return false;
#

Also

#

You need a space serporating the second if statement with its perameters

#

So like this

#
if (msg.member.roles.find("name",role)) return true;
#

i see your point, but it's more like if the first if isn't triggered, the second one doesn't as well, which won't trigger the return true and it will go to return false

#

Oh

inner jewel
#

no

earnest phoenix
#

Then use brackets and some else statements

inner jewel
#

you don't need a space

#

on ifs

earnest phoenix
#

.

#

Bruh yes you do

inner jewel
#

no you don't

#

that doesn't matter at all

earnest phoenix
#

No

#

I mean

#

He had the space

#

He had no space

#

Seporating the perameters

inner jewel
#

doesn't matter

earnest phoenix
#

From the ac-

inner jewel
#

it won't change what it does

earnest phoenix
#

So your saying

#

where exactly a space is needed?

#
if(yes) return;
#

Works

inner jewel
#

if(a) and if (a)

#

are exactly the same

earnest phoenix
#

Oh

inner jewel
#

when running

earnest phoenix
#

Okay nvm about the space thing then

#

So,

#

You would need else statements

inner jewel
#

you could even do ```js
if

(a

) {

}```

earnest phoenix
#

And brackets for what your trying to do

#

Because like if everything else is wrong

#

Or not according to

#

Alright, BASICALLY

vital lark
#
if (!msg.guild.roles.find("name", "rolename") {
    return false;
} else {
    return true;
}```
earnest phoenix
#

^

inner jewel
#

this is the error

earnest phoenix
#

Ik

#

I suggested he move that

#

But he needs brackets and else statements for what hes trying to do

inner jewel
#

if(has no roles) {
if(has role named that) {
return true
}
}
return false

#

that's what that means

#
function userRole(msg, role) {
    return msg.member.roles.size > 0 && msg.member.roles.find("name", role)
}```
vital lark
#
function userRole(msg, role) {
    if (msg.member.roles.size < 1) return false;
    if (msg.member.roles.find("name", role)) return true
}```
earnest phoenix
#

^

#

it doesn't know what roles mean

#

that's the problem

#

Oh

#

it says cannot read property roles of null

#

Yeah I get the same thing when I try

#

I have code too that does the same

#

Idk why either

#

@earnest phoenix Dis guy seems to know a lot about dis: @inner jewel

#

So try talking to him

#

ok, thanks

#

Np

warm canopy
#

Im talking to him rn

earnest phoenix
#

Lol k

#

Hey guys

#

Same subject

#

Agh

#

How would I reference

#

If I have an array

#

How would I check each value for a permission

#

Then on the first one that has it

warm canopy
#

wdym

earnest phoenix
#

Do something

#

Like

#

Say for channels

#

guild.channels

#

How would I check each channel for permissions

warm canopy
#

all at once?

earnest phoenix
#

No

#

Like

#

I want to check if my bot has permission to send messages there

warm canopy
#

for ex <>checkchannel [channelname] and it says the perms?

earnest phoenix
#

So how would I go through each one

#

?

#

d.js?

warm canopy
#

I only use d.js

earnest phoenix
#

Same

#

But

#

What

#

Ill show you my code

#

Hold on

#
const Discord = require('discord.js');

client.on('guildCreate', guild => {
    const channel = guild.me.guild.channels.array()
    if (!channel) return;
  
});
#

I have the channels going into an array

warm canopy
#
client.on('guildCreate', guild => {
    const channel = guild.me.guild.channels.permissionsFor(guild.me);
    if (!channel) return;
    if (channel.has('SEND_MESSAGES')){
        channel.first().send(`Hello!`);
    }
  });```
#

oh

#

I dont know about that xD

earnest phoenix
#

I tried that

warm canopy
#

what error was there

earnest phoenix
#

Okay lemme try it again

#

And see what error comes up

vital lark
#

An array is this: ```js
const myArray = new Array(["one", "2"]);

warm canopy
#

👌

earnest phoenix
#

Ik what an array is lol

warm canopy
#

I know Rem, but I don't know how to do what he wants is what I meant.

inner jewel
#

guild.me.guild is the same as just guild

earnest phoenix
#

Ik

#

Says its not a function

#

TypeError: guild.me.guild.channels.permissionsFor is not a function

warm canopy
#

then do what he said

#

and just put guild

inner jewel
#

channels.permissionsFor

#

channels is an array

#

there's no permissionsFor function

earnest phoenix
#

Channels is a collection

#

I believe

inner jewel
#

same logic

earnest phoenix
#

Okay

warm canopy
#

Channels is Collection Yes

inner jewel
#

it doesn't have a permissionsFor function

earnest phoenix
#

But then how would I do this 😐

inner jewel
#

you need to get a channel from that

#

eg .channels.first()

earnest phoenix
#

Ah okay

#
const Discord = require('discord.js');

client.on('guildCreate', guild => {
  const channel = guild.channels.first().permissionsFor(guild.me);
  if (!channel) return;
  if (channel.has('SEND_MESSAGES')){
      channel.first().send(`Hello!`);
  }
});
#

My origional code said hello too lol

#

Not saying this is it tho

#

This should work

#

Or not

#

Agh didnt save it

#

🤦

vital lark
earnest phoenix
#

Still didnt work

#

Wait

#

"channel.send() is not a function"

#

OH WAIT

warm canopy
#

FACEPALM

earnest phoenix
#

Wait

#

How would-

vital lark
#
client.on('guildCreate', (guild) => {
    const channel = guild.channels.first().permissionFor(guild.me0;
    if (!channel) { return false; }
    if (channel.has('SEND_MESSAGES')) { return channel.first().send("henlo."); }
});```
earnest phoenix
#

All that does it get permissions for the first channel

#

It doesnt specifically reference it