#development

1 messages · Page 541 of 1

quartz kindle
#
a = 5;
b = "5";
a + b // 55
a + Number(b) // 10
keen drift
#

@quartz kindle are you satisfied with my translation

quartz kindle
#

yes

knotty steeple
#

just do

amber fractal
#

use a try and catch @lofty hamlet

#

or add a .catch

knotty steeple
#

parseInt(urthing)

#

turns it into a number

amber fractal
#

if urthing isnt a number tho it wont work i.e if its "five"

#

Thats how its erroring

prime cliff
#

"If a personn write ?gift @User NOTNUMBER my bot crash"
Get some better error handling then a bot should never crash because of that >_>

knotty steeple
#

also

lofty hamlet
#

Yes i know but is it an exemple

knotty steeple
#

it wont crash

#

it will just return undefined

lofty hamlet
#

So ? How ?

knotty steeple
#

i made it return none if its undefined

quartz kindle
#
if(isNaN(Number(a))) { return }```
knotty steeple
inner jewel
#

if(isNotNumber(...)) yeetThatArg()

knotty steeple
#

yett

#

if(!parseInt(a)) { return no }

lofty hamlet
#

He work

#

Thanks

keen drift
#
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]](([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])```
knotty steeple
#

fishy

#

no

keen drift
#

what

amber fractal
#

Too bad Fishy's baguette explaination is 2 messages.

lusty dew
#

How would I go about making a command to check Discord.js docs?

quartz kindle
lusty dew
#

Can someone point me in the right direction if you know

knotty steeple
#

uh

keen drift
#

heck i can't fit the whole code in here

quartz kindle
#

lul

knotty steeple
#

https://discord.js.org/#/docs/main/stable/search?q=thing

#

GET from that i guess

lusty dew
#

Hm

inner jewel
#

scrape the docs or find a js parser

lusty dew
#

Yea

#

Thanks Natan!

earnest phoenix
#

how would you ignore something in a for/of loop

quartz kindle
#

ignore something or skip an iteration?

inner jewel
#

continue

earnest phoenix
#

ignore something

quartz kindle
#

if(!something) {}

#

?

inner jewel
#

for(const thing of things) {
if(shouldIgnore(thing)) {
continue;
}
}

#

or use filter/forEach

earnest phoenix
#

thanks

keen drift
#

for(const thing of things) {
if(shouldIgnore(thing)) {
yeetThatShit();
}
}

earnest phoenix
#

const thing of thing = lmao

lusty dew
#

How would I do a case number type thing for a ban, kick, mute, etc commands

blazing star
#

by storing the current case number in a guild config

last ferry
#

Is there a better way to get the message count in a channel in Discord.NET than just setting the limit to 2,147,483,647 in GetMessagesAsync(); ?

#

Because that just seems counterproductive to me

prime cliff
#

@last ferry if you read the docs or tooltips you can only get a max of 100 messages but you can use GetMessage(messageID) to get older messages thats if you want to track messages/update messages

lusty dew
#

lol

#

Wrong channel

earnest phoenix
#

speaking with increments of 100, the more messages you request the longer it takes for the task to execute

#

also there is no way of getting all messages in a channel and counting them a reliable way, dont spam the api by downloading god knows how much messages, which having 2 billion messages in cache would probably crash your app

flat stratus
lusty dew
#

You don't want too tbh

#

But if you want to really do t

#

it*

#

Look it up I don't bother with gltch

#

glitch

mossy vine
#

Just

#

Replace the files on glitch with your bots files

#

Its fucking intuitive

#

If you cant even figure out glitch you shouldnt even bother with 24/7 hosting

lusty dew
#

Lol

#

I figured it out

#

Just don't want to explain

earnest phoenix
#

dont use a free host, period

waxen quest
#

@flat stratus

uneven depot
sick cloud
#

just make glitch ping itself

modest shore
#

.foreach(fucntion(element) {}) does not work

inner jewel
#

forEach

modest shore
#

ik

#

i noticed it

#

now its working

sick cloud
#

@modest shore your already using map

earnest phoenix
#

can i get some help?

#

npm ERR! file /Users/MELOL/Desktop/SDLB/package.json
npm ERR! code EJSONPARSE
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected token “ in JSON at position 3 while parsing near '{
npm ERR! JSON.parse
npm ERR! JSON.parse “name”: “shittylistb...'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/MELOL/.npm/_logs/2018-12-25T16_45_39_174Z-debug.log

#

newbie

#

i am

modest shore
#

its working now with foreach

sick cloud
#

failed to parse json

#

also use a codeblock in the future

inner jewel
#

you used the wrong quotes

#

vs "
(wrong vs correct)

earnest phoenix
#

yeah i just realized that

#

now

#

`

#
npm install discord.io winston –save
#

??

inner jewel
earnest phoenix
#

what should i do then

sick cloud
#

discord.js if you really wanna use node

inner jewel
#

or eris

sick cloud
#

also why are you installing Winston isn't that just an over glorified logger

earnest phoenix
#

i have node.js right now

#

IDK

#

im following a website tutorial tbh

sick cloud
#

then why are you installing it

#

oh

#

of course

earnest phoenix
#

LOL

sick cloud
#

that outdated one

earnest phoenix
sick cloud
#

no

earnest phoenix
#

lmfao

sick cloud
earnest phoenix
#

TIME TO RESTART

#

lol

sick cloud
#

and stop with the caps

earnest phoenix
#

ok sorr

#

its online

#

so thats good i guess

prime cliff
#

Why the heck is that article under gaming shouldnt it be coding or development lmao

earnest phoenix
#

^

prime cliff
#

@inner jewel the comments on that article also say the " are wrong to copy

#

Good article

earnest phoenix
#

lu

#

l

#

also

#

how do i make my bot not case sensitive

#

?

#

who niccnamed me

#

what do you mean not case sensitive

vagrant flare
#

like the arguments sent to it?

keen drift
#

tfw you expect people to instantly help you but not reply back when they actually help you

covert turtleBOT
earnest phoenix
#

stfu

#

like i type (an example) !lIsT sHitTy oRoChi

#

and the command works

languid dragon
#

how do i make my bot not case sensitive

doesn't that mean your bot is already not case sensitive?

earnest phoenix
#

i can only type !list shitty orochi

#

for the command to work

languid dragon
#

what language are you using

earnest phoenix
#

thats what they want, not what they have

keen drift
#

when you contradict yourself

earnest phoenix
#

convert the given command and the expected command to lowercase/uppercase, then compare

languid dragon
#

lowercase the arguments when you compare them ¯_(ツ)_/¯

#

if you're using javascript it's just ```JS
"".toLowerCase()

#

I suggest you learn how to program in JavaScript before diving into bot development

#

I asked Xignotic to pin some extremely useful books containing information about JavaScript and other stuff
You should read that or at least research online for how to do basic JavaScript functionality

earnest phoenix
#

that's non-javascript-languages-ist

languid dragon
#

huh?

earnest phoenix
#

my point being that there are other languages for bot development that a beginner can learn

west raptor
#

they're using js

earnest phoenix
#

oh they are?

#

then nvm

west raptor
#

yes

earnest phoenix
#

i am

keen drift
vagrant flare
#

when its christmas and i still cant get my bot to receive webhooks. sadface.

#

i have the dbl url set as my_public_ip:port/dblwebhook and am using the dblapi to receive the webhooks, but no luck ;-;

earnest phoenix
#

Hello

#

Could you help

#

I am writing in discord.js

#

And I am wondering how I could make it so it forces a user to mention a role and then the bot recognises the content and adds the role through the @

zenith moss
#

You can’t force people to type stuff

earnest phoenix
#

No,

#

Thats not what I mean

vagrant flare
#

so basically all your commands are initiated through mentioning a role?

earnest phoenix
#

It throws an error if they do not ention

#

YES

#

No

zenith moss
#

“And I am wondering how I could make it so it forces a user to mention a role”

earnest phoenix
#

!join @Yellow

#

Instead of !join Yellow

vagrant flare
#

oh i see

earnest phoenix
#

Would you like to see a code sample?

vagrant flare
#

i am not 100% sure but just check using message.mentions.first() and if its a role give them the role if the mention does not exist, tell them to mention the role

earnest phoenix
#

Hmmm

#

so look

#

I tried doing it

#

but It deosnt work

#
    if (!roleName.content.startsWith("@")) return message.channel.send("Mention the role!")
    if(!args[0]) return errors.noRole(message)
    const role = message.guild.roles.find(role => role.id === roleName);
    if(message.guild.roles.find(role => role.name ===  "GAWD")) return message.channel.send("You cant join a staff role")
    if(!roleName) return errors.cantFindRole(message)
    let member = message.member;


   let joinembed = new Discord.RichEmbed()
  .setAuthor(message.author.tag, message.author.avatarURL)
  .setColor("#bc0000")
  .setDescription("You have successfully joined " + roleName + ". To leave the role, say ``-leave-role <role name>``");
 
  await(member.addRole(role.id)).catch()
  message.channel.send(joinembed);
  message.user.send(joinembed);```
#

I tried to start doing it

inner jewel
#

.find(role => role.id === roleName)

#

also

#

role mentions never start with @

#

they're always <@&ROLEID>

earnest phoenix
#

Ahhh

#

Thank you so

knotty steeple
#

message.mentions.first() this in incorrect btw

earnest phoenix
#

const role = message.guild.roles.find(role => role.id === roleName);

inner jewel
#

message.guild.roles.find(role => role.name === "GAWD") won't help you either

#

it'll just lock the command if any role has that name

earnest phoenix
#

ik You cant join admin roles

inner jewel
#

no

#

that will make the command not work

#

if the role exists

earnest phoenix
#

ohh

#

So what do I do?

vagrant flare
#

i mean you can just do using message.mentions.roles.first

#

and then check the role against what's permitted

knotty steeple
#

not valid

earnest phoenix
#

How would I throw the error message if its not a mention?

vagrant flare
#

what isnt valid?

#

you can have a variable = to that value and if the variable is NULL, there was no role mention

knotty steeple
#

message.mentions.roles.first

languid dragon
#

Are you trying to check for a role mention or a role name or a role I'd?

vagrant flare
#

well obv by first i mean first()

earnest phoenix
#

@languid dragon Role mention

knotty steeple
#

or is it

#

i dont use d.js anymore thonkeyes

languid dragon
#

Use regex

vagrant flare
#

i'm pretty sure its valid samurai

knotty steeple
#

oh ok

#

@earnest phoenix just put the command in a try catch

languid dragon
#
const foundRoles = message.content.match(/[<@&]+([0-9])+[>]/g);

if (foundRoles && foundRoles[0]) {
    const role = message.guild.roles.get(foundRoles[0].replace(/[<@&>]+/g, ''));
}
coral trellis
#
if (message.mentions.roles) {
    if (message.mentions.roles < 0 {
        // Stuff //
    } else {
        //stuff//
    }
}```
vagrant flare
#

or like i said they could just the first value using first()

#

unless you mean they wanna assign multiple roles at once, then sure ig

#

snowy, are you free to help me for a minute with webhooks, i'm like lost.

languid dragon
#

No I'm about to sleep, look in #topgg-api for an example I wrote

vagrant flare
#

i tried everything its just im not receiving anything on my public ip, but thats fine, good night ^^

keen drift
#

@inner jewel help me big boi

uncut slate
#

@coral trellis ur missing a closing paren

coral trellis
#

Yes

inner jewel
#

@keen drift ?

keen drift
#

@inner jewel need sum help with horizontal scaling

earnest phoenix
#

Which database does the site uses? Just asking

amber fractal
#

Can anyone tell me how sharding works, like do I need to make another discord bot on the developers pages, I know the code to shard, but is there anything else I need to do

earnest phoenix
#

Thanks so mch guys I managed to get it to work

#

@languid dragon

#

Sorry for the ping

#

just wanted to thank

keen drift
#

@amber fractal no

#

Sharding is basically attaching additional data to the identify opcode

amber fractal
#

How can I get a total count of shards in a command?

mossy vine
#

Read 👏 the 👏 docs 👏

amber fractal
#

I'm 👏 on 👏 the 👏 docs 👏

keen drift
#

@amber fractal shardmanager

amber fractal
#

Lol thanks

earnest phoenix
#

Hello

keen drift
#

hola

earnest phoenix
#

How to get bot developer?

#

=help

keen drift
#

by submitting a bot

ruby dust
#

well definitely not by trying to use bot commands here

earnest phoenix
#

...

#

My bot

ruby dust
#

we can't see it

#

happy?

keen drift
#

still in queue prob

#

l u l

ruby dust
#

ik

#

needed to show them

#

cause they wouldn't believe

#

cause there are a few people that ask for approval even by posting links to their bot pages

earnest phoenix
#

sorry

#

@ruby dust

keen drift
#

now scroll down

#

all the way down

earnest phoenix
#

"Bot awaiting approval - Please be patient, us humans take time to verify bots!"

ruby dust
#

@bitter sundial would there be a way to make it more obvious by making ^ that message be more visible on top of the page instead of at the very bottom of long description?

amber fractal
#

Is the first shard ID 0?

keen drift
#

yeah

amber fractal
#

Alright

earnest phoenix
#

@earnest phoenix then u need to wait.

#

good job detective

vagrant flare
#

so i have this bot that i host from a pc, and i want to receive webhooks, i have tried the pinned example of an express application in #topgg-api and when i enter :
http://my_public_ip:port/webhook/url in the dbl website and try testing, i do not receive the webhook. I'd appreciate any help at this point ._.

keen drift
#

well can you reach it yourself

vagrant flare
#

you mean by entering the ip and port in the url?

keen drift
#

by if you could reach it in your own browser

vagrant flare
#

yeah hmm i can't O-o that's weird

keen drift
vagrant flare
#

ugh i cant even host it on glitch cuz it doesnt support mysql x.x

keen drift
amber fractal
#

glitch

ruby dust
#

I have a feeling that all free hosts are overrated

keen drift
#

wew

amber fractal
#

As soon as I can afford something real I'll begin using it lol

#

I definitely don't use heroku

ruby dust
#

well today I've just got my first patron so I don't worry about financial issues anymore hosting my bot

amber fractal
#

Wait

#

You're saying people actually support developers or is it inside friends

ruby dust
#

you're saying that mee6 doesn't get any support

#

and nadeko relies on patreon too

amber fractal
#

Them are big bots tho

ruby dust
#

you don't need to be certified to be big

topaz fjord
#

^

#

rhythm isn't certified I believe

ruby dust
#

it is

topaz fjord
#

*mee6

earnest phoenix
#

would this be the way to find direct it to the .js file?

require('./global/functions.js')(client, utils, ytdl);
mossy vine
#

Uhh no

earnest phoenix
#

how then

mossy vine
#

What are you trying to do?

earnest phoenix
#

its a function which im trying to make music commands in a command handler

#

to make the function global

mossy vine
#

Whats the function name?

earnest phoenix
#

handleVideo and play

#

ok

mossy vine
#
require('./global/functions.js').play(client, utils, ytdl)```
earnest phoenix
#

what about handleVideo?

#

are there any good alternitives to toLowerCase

#

let me show you my function file

#

or toUpperCase

mossy vine
#

Same way, just replace the play function with handleVideo and given arguments

earnest phoenix
mossy vine
#

@earnest phoenix no but thanks to js you can simplify them

const lower = toLowerCase
`IM A DIRTY HOISTER`.lower() //`im a dirty hoister```
topaz fjord
#

that's just more work

earnest phoenix
#

tbh

#

did you see it @mossy vine

topaz fjord
#

just use .toLowerCase() and .toUpperCase()

earnest phoenix
#

it makes my commands not work

#

hang on

mossy vine
#

@earnest phoenix ah, personally i would seperate the 2 functions into different exports (in the same file of course)
Then just do what i told you to

inner jewel
earnest phoenix
#

ff

mossy vine
#

oh

earnest phoenix
#

fffff

#

lol but yeah

#
require('./global/functions.js').play(client, utils, ytdl, config);
#

it makes my commands not work

#

like that right?

inner jewel
#

String.prototype.lower = String.prototype.toLowerCase this would do what you wanted @mossy vine

mossy vine
#

Look, im on phone and just writing stuff from memory, i cant check it @inner jewel
@earnest phoenix yup

earnest phoenix
#

anyway

#

its keep saying cant find module ./global/functions.js

#

if (message.content === '+list shitty orochi'.toLowerCase) { message.channel.send('2. Shitty Orochi'); }

#

correct?

#

@mossy vine its keep saying Cant find module ./global/functions.js

mossy vine
#

@earnest phoenix can you show your dirsctories

#

@earnest phoenix toLowerCase is a function..

earnest phoenix
#

i dont get it

#

im an absoulte newbie tbf

mossy vine
#

@earnest phoenix how good are you with javascript?

earnest phoenix
#

eh

#

also why the fuck am i named hoist

#

it annoys me

mossy vine
#

I reccommend you check out w3schools.com it can answer 99% of your questions if you look hard enough

#

Wrong link

#

Smfh

earnest phoenix
#

smfh tbh

mossy vine
#

Wrong link x2

#

UGGH gimme a sec

#

Yup, thats the one

#

@earnest phoenix can you screenshot your bots directory?

earnest phoenix
#

ok

#

this?

mossy vine
#

In the global?

earnest phoenix
#

yes

mossy vine
#

I mean, whats in the global folder bloblul

earnest phoenix
#

i sent you the hastebin before

#

but ok

#

ill send it again

mossy vine
#

I wanna see what files are in the folder, not the contents of the file

earnest phoenix
#

this is in the global folder

mossy vine
#

wtf

#

Whats the error again?

earnest phoenix
#

when i did what you said

#

it said that it cant find ./global/functions.js module

mossy vine
#

Aha, i think i see the issue

#

Youre calling it from a file in the commands folder, right?

earnest phoenix
#

im calling it from the main.js

#

which is the main file

mossy vine
#

The functions?

earnest phoenix
#

yes

#

i can show you my main.js file

#

if that will help

mossy vine
#

Well, still worth a try
require('../global/functions.js')

earnest phoenix
#

but it has this
module.exports = (client, ytdl, config)

#

which it will need

#

require('../global/functions.js')(client, ytdl, config)

#

right?

mossy vine
#

Correct

earnest phoenix
#

ok 1 sec

mossy vine
#

If it errors, show your main.js file

earnest phoenix
#

yea it keeps saying this

#

Error: Cannot find module '../global/functions.js'

mossy vine
#

Show main

amber fractal
#

I thought it was one dot not two

mossy vine
#

Two is for going up a directory

earnest phoenix
#

i dm it to you

amber fractal
#

Oh

#

Thats good to know lol

earnest phoenix
#

@mossy vine i dmed it to you did you see it?

mossy vine
#

Try pasting the require in a command

earnest phoenix
#

ok

#

nvm

#

i fixed it

#

thank you

mossy vine
#

Lmaoo

earnest phoenix
#

XD

mossy vine
#

What did you do?

earnest phoenix
#

client.on('message', message => { if (message.content === '+list shitty innards') { message.channel.send('**1. Shitty Innards**'); } can somebody just edit this to toUpperCase? im so fucking confused

#

i just forgot to transfer the gobal folder

#

XD

#

i just dont get it

mossy vine
#

message.content.toLowerCase()

#

Im not even going to mention how bad thaz code is

earnest phoenix
#

stfu

mossy vine
#

Im tryinf to help you

earnest phoenix
#

ik

mossy vine
#

No reason to be toxic

earnest phoenix
#

its unclear tho

mossy vine
#

Learn javascript then, w3schools.com will answer all of your questions

earnest phoenix
#

i could take it as
client.on('message', message => { message.content.toLowerCase() if (message.content === '+list shitty innards') { message.channel.send('**1. Shitty Innards**'); }

#

if thats what you meant then

#

but im calling it that its not

mossy vine
#

I mean.. Thaz could work

earnest phoenix
#

so does that mean

#

i would be able to write

#

+list shitty orochi OR +list Shitty Orochi?

#

capatlization wouldnt matter? \

amber fractal
#

No that wont do anything

mossy vine
#

Correct

earnest phoenix
#

cause i would think that toUpperCase would be the only one that worked

amber fractal
#

your still using message.content...

mossy vine
#

Oh wait no

#

Steven is rigg

#

Right

amber fractal
#

you'd need to redfeine it as a new variable

#

and use that

#

redefine*

earnest phoenix
#

ok...

mossy vine
#

Do you know how to do that?

earnest phoenix
#

i dont lol

#

thats why Thonk

mossy vine
#

...

earnest phoenix
#

tbh i know basic javascript

mossy vine
earnest phoenix
#

im not a fucking idiot either

amber fractal
#

making a variable is basic

mossy vine
#

Did you even look at the site

earnest phoenix
#

YES

keen drift
mossy vine
#

Please for the love of god, learn javascript. Basic is not enough for a discord bot

earnest phoenix
mossy vine
#

It literally tells you what to do there

amber fractal
#

^

#
var input = "SomEthIng";
var output = input.toLowerCase();

Expected output: something

#

if you actually used it

#

like a console.log

mossy vine
#

Sololearn is decent as well

earnest phoenix
#

got it

keen drift
#

Wew

earnest phoenix
#

not really i just understand theres a fuckload of good websites out there tbh

amber fractal
earnest phoenix
#

uh

#

i have no idea what the fuck im doing

signal eagle
#

ok

mossy vine
#

Then learn javascript and stop bothering us with questions that you can easily google and get answers to in seconds or minutes

keen drift
#

@mossy vine hi can you help me learn JavaScript jerrycheese

mossy vine
#

@keen drift i can direct you to useful resources

keen drift
#

Naw you better personal tutor me

mossy vine
#

Meh, ur cool so ok

keen drift
earnest phoenix
#

fucc bissh

#

boi

amber fractal
#

Javascript:
if(no){return yes}

#

ez

earnest phoenix
#

Hey guys its me again

amber fractal
#

Hi

earnest phoenix
#

I am making an add role command

amber fractal
#

Alright...

earnest phoenix
#

discord.js

keen drift
#

@mossy vine hi what does this do jerrycheese

#
([][[]]+[])[+[]]+(!![]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(+![]+[![]]+([]+[])[([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[!+[]+!+[]+[+[]]]+(![]+[])[+!+[]]+(+[![]]+[+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]]+[+[]])])[+!+[]+[+[]]]
amber fractal
#

You may be missing a )

mossy vine
#

Spamm

earnest phoenix
#

I am just wondering, How would I make a check that sees if the role is a certain list of role before continuing e.g Colour roles allowed but staff roles not

amber fractal
#

does !! work as a double negative tho that'd be awesome

mossy vine
#

Yes it does

amber fractal
#

Are you hard coding in the roles you want it to be?

earnest phoenix
#

fuck it im done for today
thank you guys

keen drift
earnest phoenix
#

@amber fractal I have no choice

mossy vine
#

@earnest phoenix just ifelse?

earnest phoenix
#

?

#

How would you if else it

#

Because Everytime i ||

#

It wont work

mossy vine
#

Thats.. Not an ifelse...

amber fractal
#

I'd suggest then to make an array of the roles you dont want it to have access to. and see if the role they are attempting to give matches any in the array. if it does then return a message or something

earnest phoenix
#

@mossy vine No but I need to list my colours

amber fractal
#

Wait

mossy vine
#

Im going to sleep, ask someone else

amber fractal
#

I think I misunderstood the question

earnest phoenix
#

so like if (msg == blacklist) return

amber fractal
#

You'd have to loop through an array, atleast thats the easiest way I see of doing it if you are hard coding the roles

#

Also, bots cannot give roles that are above them

#

If you want to use that as a solution

earnest phoenix
#

@amber fractal How would I create a blacklist of all the banned roles?

#

In an array?

amber fractal
#

That's what I'd do

#

You know how to iterate through arrays right?

earnest phoenix
#

Nope im pretty new

#

Wait hold on one second

#

look

amber fractal
#

Those are the roles you want it to be able to give, yes?

earnest phoenix
#

Yes

#

I also have a msg variable

#

ill send it

#
    return this.charAt(0).toUpperCase() + this.slice(1);
}``` -This make the first letter of a certain args capital
#

msg = args[0].toLowerCase().capitalize()

#

There

#

Thats to make it non case-sensitive

amber fractal
#

What way are you using discerning between the command and the role to give/user to give it to?

#

Oh wait

earnest phoenix
#

So what happens is

amber fractal
#

You already split it?

earnest phoenix
#

?

amber fractal
#

I hate not being able o give you the code lol

#

Alright

earnest phoenix
#

lol

lofty hamlet
#

Hi

amber fractal
#

Hi

lofty hamlet
#

I have a problem

earnest phoenix
#

Wait

amber fractal
#

Lol

lofty hamlet
#

My code

earnest phoenix
#

idgaf

#

Wait

amber fractal
#

Is the msg variable their entire message or just the command

earnest phoenix
#

Just the role

#

they want

amber fractal
#

OHH

#

I misunderstood everything

earnest phoenix
#

All I want to do is

amber fractal
#

Lol

earnest phoenix
#

check it with the

#

array

#

But im unsure how

amber fractal
#

for(var i = 0; i < array.length; i++) will loop over it

lofty hamlet
earnest phoenix
#

Lol

amber fractal
#

You can figure out what to do after that?

earnest phoenix
#

Not really steven Embarrassed

#

Sorry

lofty hamlet
#

@keen drift ? 😃

keen drift
#

?

earnest phoenix
#

Dm @amber fractal

#

?

amber fractal
#

Sure

keen drift
#

@lofty hamlet yes?

lofty hamlet
#

You can help ?

keen drift
#

wait why me

#

Steven is here

lofty hamlet
#

No you plz

keen drift
#

@amber fractal take over

lofty hamlet
#

You have help me at the last time

#

You are good

keen drift
#

what

amber fractal
#

Helping another person gimme a sec lol

keen drift
#

i did Thonkang

lofty hamlet
#

So here you can help me? 😃 @keen drift

#

Steven is occupied

keen drift
#

uh

lofty hamlet
#

?

keen drift
#

how to look at this code

lofty hamlet
#

Hastebin

#

#

@keen drift

keen drift
#

yeah except idk what Discord.Channel is

#

you should add a check for DiscordChannel to see if it's defined

lofty hamlet
#

Discord.Channel is exemple : 1262137122189

#

No : exemple : 6123132832181288

#

@keen drift

keen drift
#

yeah add a check for DiscordChannel to see if it's defined

#

@amber fractal u available froggyjerry

lofty hamlet
#

??????

#

Hein ?

keen drift
#

DiscordChannel is undefined

lofty hamlet
#

No

keen drift
#

?

lofty hamlet
#

var DiscordChannel = member.guild.channels.get(Discord.Channel);

keen drift
#

My error : Cannot read property 'send' of undefined

lofty hamlet
#

Look

keen drift
#

the only send I see is on DiscordChannel

lofty hamlet
#

var DiscordChannel = member.guild.channels.get(Discord.Channel);

keen drift
#

DiscordChannel.send(attachment);

#

DiscordChannel is undefined

lofty hamlet
#

Impossible : look : var DiscordChannel = member.guild.channels.get(Discord.Channel);

keen drift
#

It's entirely possible

#

If the data is not available in the collection

#

It's undefined

#

.get() only retrieves from cache

#

If it doesn't exist, well, it doesn't

#

it returns undefined

lofty hamlet
#

In what collection ?

keen drift
#

channels collection :?

#

channels is a GuildChannelStore

lofty hamlet
#

var DiscordChannel = member.guild.channels.get(Discord.Channel);

#

And discord.channel is for exemple : 1267217821838

keen drift
#

...

#

it doesn't exist in the cache

lofty hamlet
#

???

#

I don't understand

#

My other command for test

#

Is :

#
var DiscordChannel = message.guild.channels.get(Discord.Channel);
DiscordChannel.send('TEST')
}```
#

Is fonctionnaly

keen drift
#

Returns the element associated with the specified key or undefined if the key can't be found in the Map object.

#

undefined if the key can't be found in the Map object.

lofty hamlet
#

Look my message

#

My other command for test

#

Is :

#
var DiscordChannel = message.guild.channels.get(Discord.Channel);
DiscordChannel.send('TEST')
}```
keen drift
#

ok

lofty hamlet
#

Is fonctionnaly

bright spear
#

i get the feeling they dont know english

keen drift
#

lol

lofty hamlet
#

I'm french -.-

keen drift
#

if baguette doesn't exist in the basket, then you don't get a baguette

bright spear
#

lol

lofty hamlet
#

HU ?

#

So ?

keen drift
#

So... it's what I have been repeating

#

It doesn't exist

#

@bright spear translate

bright spear
#

idk french

#

use google translate

lofty hamlet
#

But my command test is fonctionnaly

keen drift
#

ok

lofty hamlet
#

I use google translate

keen drift
#

but this is different?

lofty hamlet
#

Just look

keen drift
#

I'm l00king

bright spear
#

wait how do you get fonctionnaly with google translate hyperthonk

keen drift
#

new word

lofty hamlet
#

😂

#

ah work

bright spear
#

fishy r u intentionally making it impossible to translate smh

lofty hamlet
#

functional

bright spear
#

i dont think it can translate l00king

keen drift
#

w0w

#

tr8y translat8jbg th8s

lofty hamlet
#

So ?

#

😦

keen drift
#

so... it doesn't exist in the cache

#

hell0

lofty hamlet
#

But my command test is fonctional

#

...

keen drift
#

well idk what to tell you

lofty hamlet
#

So i don't understand

keen drift
#

I didn't make your bot

#

I'm only going by what the interpreter said

lofty hamlet
#

Just look my code ...

keen drift
#

i did look at your code

#

and that's the place where it errors

#

hell0

lofty hamlet
#

.......

amber fractal
#

Yo

lofty hamlet
#

Hi ..

amber fractal
#

So what is the problem?

keen drift
#

He's getting an undefined upon his .send

#

DiscordChannel.send(attachment);

#

It's initialized and declared at var DiscordChannel = member.guild.channels.get(Discord.Channel);

#

.get() returns undefined it's not available in the cache

amber fractal
#

You're trying to send this to a specific channel then?

keen drift
#

then he showed me another command

#

in which I still have no idea where Discord.Channel even come from

#

I only can locate the error origin in the hastebin provided

lofty hamlet
#

Yes Discord.Channel is a string in json

keen drift
#

@amber fractal have fun

lofty hamlet
amber fractal
#

It only says member.guild

lofty hamlet
#

??????

amber fractal
#

You want it to be message.member... dont you?

lofty hamlet
#

Hum

#
        var DiscordChannel = message.guild.channels.get(Discord.Channel);
        DiscordChannel.send('OYEYEEE')
    }```
#

This command is fontional

#

But in guildmmemberadd is not fonctional

#

....

amber fractal
#

...

#

it says message.guild.channels.get

#

The other says member.guild

lofty hamlet
#

Look my code

amber fractal
#

Unless he sent it wrong

lofty hamlet
amber fractal
#

var DiscordChannel = member.guild.channels.get(Discord.Channel);

lofty hamlet
#

?

amber fractal
#

Thats what it says

lofty hamlet
#

?

amber fractal
#

In your code

lofty hamlet
#

Yeah ?

amber fractal
#

it works in the other one

#

because its a different code

lofty hamlet
#

So ?

amber fractal
#

Let me send these

#

Side by side

lofty hamlet
#

Ok so ?

amber fractal
#

message.guild.channels.get vs member.guild.channels.get

lofty hamlet
#

How am I doing?

lofty hamlet
#

?

amber fractal
#

the code you sent is the one that doesnt work right?

lofty hamlet
#

Yes because the first message is a command and the second for guildmemberadd

#

What ?

#

Is not fonctionnal

#

The error is send is not defined

#
        var DiscordChannel = message.guild.channels.get(Discord.Channel);
        DiscordChannel.send('OYEYEEE')
    }```
#

And this code

#

Is fonctional

#

@amber fractal

amber fractal
#

What is the error did you say?

lofty hamlet
#

Cannot read property 'send' of undefined

amber fractal
#

on line 54?

lofty hamlet
#

hum

#

wait

#

I don't know @amber fractal

amber fractal
#

Can you send a picture of the console?

lofty hamlet
#

wait

#

i test

#
    at Client.bot.on (/home/Akimitsu_Dev/welcome.js:136:24)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
(node:19561) 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:19561) [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.
#

@amber fractal

#

My code :

#
    if (Discord.Active == false) return
    var DiscordChannel = member.guild.channels.get(Discord.Channel);

        const applyText = (canvas, text) => {



            const ctx = canvas.getContext('2d');

            // Declare a base size of the font
            let fontSize = 42.5;

            do {
                // Assign the font to the context and decrement it so it can be measured again
                ctx.font = `bold ${fontSize -= 10}px sans-serif`;
                // Compare pixel width of the text to the canvas minus the approximate avatar size
            } while (ctx.measureText(text).width > canvas.width - 300);

            // Return the result to use in the actual canvas
            return ctx.font;
        };

        const canvas = Canvas.createCanvas(700, 250);
        const ctx = canvas.getContext('2d');

        const background = await Canvas.loadImage('./Welcome.png');
        ctx.drawImage(background, 0, 0, canvas.width, canvas.height);


        // Slightly smaller text placed above the member's display name
        ctx.font = 'italic 25px sans-serif';
        ctx.fillStyle = '#2A2A30';
        ctx.fillText('Bienvenue sur le Serveur', canvas.width / 2.7, canvas.height / 2.1);

        // Add an exclamation point here and below
        ctx.font = applyText(canvas, `${member.displayName}`);
        ctx.fillStyle = '#2A2A30';
        ctx.textAlign = 'center'
        ctx.fillText(`${member.displayName}`, canvas.width / 1.7, canvas.height / 1.5);

        ctx.beginPath();
        ctx.arc(125, 125, 100, 0, Math.PI * 2, true);
        ctx.closePath();
        ctx.clip();

        const { body: buffer } = await snekfetch.get(member.user.displayAvatarURL);
        const avatar = await Canvas.loadImage(buffer);
        ctx.drawImage(avatar, 25, 25, 200, 200);

        const attachment = new Discord.Attachment(canvas.toBuffer(), 'Welcome.png');

        DiscordChannel.send(attachment);
})```
amber fractal
#

Thats saying it cant send to something that's undefined not that send is undefined.

lofty hamlet
#

So ?

bright spear
#

dude fishy already explained it to you

split dune
#

add message function to event?

bright spear
#

if its DiscordChannel.send and it has that error then DiscordChannel is undefined

split dune
#

and use message.channel.send?

lofty hamlet
#

But my command welcome test is fonctional

#

....

amber fractal
#

DiscordChannel is an id of a discord channel

#

in a json file

lofty hamlet
#

Yes so ?

amber fractal
#

That wont work in every server you know that right

lofty hamlet
#

Why ?

keen drift
#

...

lofty hamlet
#

Juste correct my error plz$

#

My code is not fonctional

#

...

#

Plz

earnest phoenix
#

we wont just give you fully made code

amber fractal
#

An ID is specific to one channel

#

in one server

lofty hamlet
#

No

amber fractal
#

..?

lofty hamlet
#

I don't understand

#

🤔

#

You can edit my code ?

bright spear
#

nebulus, only you know how your code works

#

we dont

#

we helped you based on the info you gave us

amber fractal
#

272764566411149314 is the id to #development in the Discord Bot List channel and only that

lofty hamlet
#

I gave all my code

bright spear
#

but you coded your bot and only you understand how it works

amber fractal
#

The ID is unique.

lofty hamlet
#

No

bright spear
#

where did you define Discord Thonk

amber fractal
#

Delete that

#

Yea

#

Dont send tokens

bright spear
#

wait wut

#

they send their token??

lofty hamlet
#

It's my bot of developpement osef

amber fractal
#

His picture had a token in it

lofty hamlet
#

I fail

#

It's my bot of developpement osef

bright spear
#

...

#

never leak your token

#

someone can log in to your bot and do anything

#

including destroying a server

amber fractal
#

The bot is still traceable to your account

#

and that

lofty hamlet
#

It's my bot of developpement osef

bright spear
#

that doesnt matter...

lofty hamlet
#

Ok so

#

It's been two hours, I'm waiting for someone to help me!

#

For my code

bright spear
#

...

amber fractal
#

We've been trying

bright spear
#

weve been trying to help you

#

you're not letting us

lofty hamlet
#

You have all of my code

bright spear
#

i asked you where did you define Discord

amber fractal
#

The channel you're trying to send to is non-existant

lofty hamlet
bright spear
#

ok thats the problem

#

Discord.Channel is an ID

amber fractal
#

^

bright spear
#

so that code will only work in the server with that channel

lofty hamlet
#

You want more ?

bright spear
#

no

lofty hamlet
#

No look

bright spear
#

i told you the issue

lofty hamlet
amber fractal
bright spear
#

you're probably using the command in a server that doesnt have that channel

amber fractal
#

Thats a welcome message

lofty hamlet
#

Look i try

amber fractal
#

You seem to be over complicating the task.

lofty hamlet
#

If there is an error is his return

#

Edit my code plz

bright spear
#

...

#

no

amber fractal
#

We cant just give you code

bright spear
#

we explained the issue

#

if you cant understand english its not our problem

lofty hamlet
#

I give all my code

bright spear
#

yes

#

we told you the issue

amber fractal
#

Read the docs, it gives you the code for a server greeting with explaination in the code

#

You dont need to have a json file with channel IDs

#

You are trying to make a welcome message right?

#

WIth a picture.

indigo notch
#

Discordjs big gay

amber fractal
#

its super easy tho

#

it docs how to do everything..

lofty hamlet
#

But my code is walking apart to send that fucking picture!

amber fractal
#

?

lofty hamlet
#

This hastebin is all my code

#

Look

#

And just edit pllzzzzzz

amber fractal
#

We cant just edit

lofty hamlet
#

Why ?

topaz fjord
#

spoonfeed

keen drift
#

help vampire

topaz fjord
#

ur a fish

keen drift
#

ur a turtle

topaz fjord
#

what do you know about vampires

#

heck I've been eaten by vampires

keen drift
#

what do you know about spoons

topaz fjord
#

I eat from one

amber fractal
#

You are one

bright spear
#

🥄

topaz fjord
#

It takes me a while to get to my good so people feed me with a spoon

keen drift
#

hecc there are fish vampires too

lofty hamlet
#

Nobody want help me ?

#

Look! Everything is just I do not understand

#

My command :?welcometest work but why my event addmember is not fonctionnaly is simmilary ! Wtf

#

😦

frozen tiger
#

guys, I have a question.. I made a tempmute system which uses scheduled thread to unmute people. I wonder if this is a good way to do it or if I could use a more effective method ?

amber fractal
#

What method?

#

Oh

#

wait

#

Im an idiot

#

nvm

frozen tiger
#

np x)

keen drift
#

@frozen tiger Perhaps store data in a database, and do periodic checks on that thread

amber fractal
#

what language is it?

frozen tiger
#

Java

amber fractal
#

Oh, Im a newb in java just javascript, sorry

lofty hamlet
#

😞

frozen tiger
#

@keen drift I had this idea but I was like hey, if someone wants a very short this is not good but so I need to check very often but if tons of case are very long, it could cause performance issues

#

Like constantly looping case

#

Sounds horrible

keen drift
#

Yeah, what happens if that thread dies or shut down

#

Does that temp mute ever get resolved

frozen tiger
#

It should never happen x)

keen drift
#

should

frozen tiger
#

tbh when bot starts up, It loops every stored case an re-schedule threads soo I should make check every 30min maybe

#

and reschedule dead threads

keen drift
#

not sure what the cost is of starting a new thread

#

But it's not that bad to query a database for unMuteTime < currentTimestamp

frozen tiger
#

I would query a redis for that honnestly

topaz fjord
#

let's just call Natan and he'll tell us Fishy

keen drift
#

kek

frozen tiger
keen drift
#

if you are that worried about performance on db query, i'd worry about too many threads

frozen tiger
#

this is why I ask here x)

keen drift
#

yeah I'd go with the db route, but idk about yours

frozen tiger
#

I'm afraid tons of thread could lead into crashes

keen drift
#

I have a project on mutes as well

#

But we query db for that

frozen tiger
#

Every minute?

topaz fjord
#

@inner jewel what does it cost to start a new thread

keen drift
#

let me check how often

frozen tiger
#

thanks

inner jewel
#

depends

#

but it's expensive

keen drift
frozen tiger
#

A simple scheduled unmute ? XD

inner jewel
#

what language?

frozen tiger
#

Java

inner jewel
#

java threads are 1:1 with OS threads, so it's expensive

#

use a scheduled executor service

frozen tiger
#

Alright, i'll look for this

#

Thank you

keen drift
frozen tiger
#

wait a minute

#

Is a scheduled timertask considered as a thread ?

inner jewel
#

don't use Timer/TimerTask

frozen tiger
#

okay

keen drift
#

here we can see two java peps talking

#

it's a wild show

frozen tiger
#

shhh you

keen drift
inner jewel
#

each timer = 1 thread

frozen tiger
inner jewel
#

a scheduled executor is way more efficient

#

and the api is also way better

frozen tiger
#

So I should create an instance of ScheduledExecutorService and schedule unmutes through this?

inner jewel
#

yes

#

create one instance

frozen tiger
#

done

#

thank you so much

#

And just another question

#

Is it clean to make this instance final and static in my main class?

#

(don't hit me)

keen drift
frozen tiger
#

XD

#

I have my answer

inner jewel
#

you can

frozen tiger
#

but this is horrible

earnest phoenix
#

How do you check if a user has a permission ?

amber fractal
#

Docs

earnest phoenix
#

Has anybody got any places where I can learn js, basic all they way to advanced?

frozen tiger
#

w3schools?

jagged birch
#

youtube

bright spear
#

codecademy

keen drift
#

pornhub

amber fractal
#
#
next scaffold
#

Hi

#

I need help with sth.

#
function play(guild, song) {
    const serverQueue = queue.get(guild.id);

    if (!song) {
        serverQueue.voiceChannel.leave();
        queue.delete(guild.id);
        return;
    };
    console.log(serverQueue.songs);

    const dispatcher = serverQueue.connection.playStream(ytdl(song.url))
            .on('end', reason => {
            if (reason === 'Stream is not generating quickly enough.') console.log('Song ended.');
            else console.log(reason);
            serverQueue.songs.shift();
            play(guild, serverQueue.songs[0]);
        })
        .on('error', error => console.error(error));
    dispatcher.setVolumeLogarithmic(serverQueue.volume / 5);

    serverQueue.textChannel.send(`🎶 Start playing: **${song.title}**`);
};
#

Anyone know what's wrong with this? I use .js

bright spear
#
  1. what lib
  2. whats the error
next scaffold
#

discord.js

#

error is when the bot joins, it ieaves while posting (undefined) to the console

#

and then sends the 'Start Playing' message

amber fractal
#

I use that exact code lol

#

Slightly different

bright spear
next scaffold
#

so sth is wrong with the part before the serverque.textChannel.send part

#

@amber fractal Can I see that?

amber fractal
#

I can't post the code directly. I'm on phone rn

next scaffold
#

weill RIP ok

#

xD

#

I'll try working on it myself 😛

bright spear
#

so as soon as it joins the vc it leaves without playing anything right?

next scaffold
#

yeah

amber fractal
#

But literally all my bots are open source on github

next scaffold
#

a common error

#

ok steven, I'll see thx

#

@amber fractal welp on your github and yes, it's 99% the same

#

lmfao

proven surge
topaz fjord
#

Almost everyone uses that code

#

It's crawls music bot

bright spear
#

lmao

earnest phoenix
#

Who know the pdo connection?

#

Because i need to write in a database when a user is login to discord in my website

bright spear
#

?

earnest phoenix
#

?

next scaffold
#

Wait

#

how am I supposed to edit the simple-youtube-api module

bright spear
#

wdym edit it

next scaffold
#

nvm