#development

1 messages Β· Page 394 of 1

earnest phoenix
#

Let us have fun

languid dragon
#

oh

uncut slate
#

ok

languid dragon
#

my favourite command

uncut slate
low owl
#

Ah, I'm not getting to actually develop when I hang around in this Discord all the time

languid dragon
#

wym

uncut slate
#

why can bots talk here

languid dragon
#

RIP

#

same

#

welcome to the club

#

they cant

#

i was using my bot for an example with the eval command earlier

#

i just haven't changed it back yet

#

pls

low owl
#

Talking of improving this Discord server, how do you review suggestions?

#

And why do you often never hear back? 😐

uncut slate
languid dragon
#

did you leave some feedback, there's a lot we may or may not have missed

#

generally i look at them but i cant guarantee remembering them

steel tinsel
#

hey guys, in Discord.js, how can i tell where a "missing permissions" error is occuring?

earnest phoenix
#

you dont

#

d.js sucks with error handling

low owl
#

Can you not try/catch?

#

In other libraries you actually NEED to do that because Discord doesn't provide an API to find out whether you can DM a user or not

#

just as an example

#

Generally try to not rely on try catch though and check by yourself beforehand

hardy moon
#

How to display a number between 100 and 1000 ?

low owl
#

You mean choosing by random?

#

If you mean that, please utilize the search engine of your choice.

earnest phoenix
#

@hardy moon what coding language

hardy moon
#

JS

earnest phoenix
#

(node:41728) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send messages to this user

languid dragon
earnest phoenix
#

bUser.send(banEmbed);

#

y isnt my thing working

#

bUser is the user i banned

languid dragon
#

are you banning the user and then getting the user after you banned him

low owl
#

@languid dragon Stahp, he is just being a lazy piece of.. :S

earnest phoenix
#

no

#

firstly i dm the user then im banning him

languid dragon
#

because you can't send a message to a user that doesn't exist

earnest phoenix
#

ik that lol

languid dragon
#

well show code

earnest phoenix
#

@earnest phoenix if there is an error, send a message that his dm isn’t open or whatever

#

the dms are open

#

im using an alt

low owl
#

Do you "await" the message sending?

#

or use promises?

languid dragon
#

wait

#

did u get that

earnest phoenix
#

Is dat lizard?

languid dragon
#

no

#

]]ev -s (function(){ let user = m.client.users.get('330325177151913984'); user.send('nice meme').then(()=> { /* ban user here */ }) })()

low owl
#

@earnest phoenix still there?

earnest phoenix
#

i didnt use any awaits

low owl
#

Well, either await or promises

languid dragon
#

actually no

#

show ur code

earnest phoenix
#

1 sec

languid dragon
earnest phoenix
#

ignore the //here

low owl
#

:reeee:

languid dragon
#
let member = m.guild.members.get('286166184402092042'); 
member.user.send('nice meme').then(()=> { 
    member.ban() 
})
earnest phoenix
#

alright

#

I'll do something similar then

low owl
#

also use promises

#

they are your friends

languid dragon
#

what Brian said

earnest phoenix
#

i dont know how to use promises but i'll read the docs

languid dragon
#

that's not promising for your code

low owl
#

DoThingA().then(() => DoThingB());

languid dragon
#

ill walk myself out the channel now

low owl
#

I know, wrong syntax

earnest phoenix
#

Alright then, Seems that promises are really useful

#

Thanks for the help guys

#

it worked

#

thank god

#

xddd

uncut slate
#

doThingA().then(doThingB);

low owl
#

Ah, didn't think it would be that similar to C# πŸ€”

uncut slate
#

mhm, you can do that in that specific example

low owl
#

Because of the parameterless lambda

uncut slate
#

mhm

#

and it'd pass on the result from doThingA

low owl
#

Does it actually have a result?

uncut slate
#

it can

low owl
#

Well, figured that, but I meant in the way you wrote it there.

uncut slate
#
function doThingA () {
  return Promise.resolve('ass');
}

const doThingB = console.log;

doThingA().then(doThingB); // logs 'ass'
low owl
#

Oh, I see

#

that's neat

#

And also confusing πŸ€”

uncut slate
#

which part of it

low owl
#

Oh, bad phrasing, I'm not confused

#

but I would imagine code readability suffers

#

if you do that with a lot of things

uncut slate
#

mhm

#

it does

#

in this specific example anyways

languid dragon
#

i love resolving ass

barren valve
#

how long does it usually take for a bot to get its certificate application reviewed?

earnest phoenix
#
const doThingA = async () => "ass";
const doThingB = console.log;
doThingA().then(doThingB);
#

πŸ˜‹

quiet bobcat
#

@barren valve Oliy does them himself so it can take a while

uncut slate
#

it's the same thing, they might not know async functions return promises

#

because you're mixing async and .then

earnest phoenix
#

I know

#

i was showing it can be done a different way

#

ree

uncut slate
#

it can be done in even more ways

earnest phoenix
#

ik

uncut slate
#
const doThingA = () => new Promise(r => r('ass'));
barren valve
#

oh ok thx @quiet bobcat

quiet bobcat
#

np

karmic parcel
#

and if you get too reliant on awaits, you'll end up having blocking code

#

so if you do multiple awaits after another you are waiting for a promise to be resolved one after another, it's best to understand Promises before async/await

#

because you can do Promise.all to do them in parallel

uncut slate
#

(as of right now) async/await is nothing but syntactic sugar anyhows, so yeah, better to understand the basics first

karmic parcel
#

just like classes

#

Object.prototype syntactic sugar

#

but classes are so much easier to understand

earnest phoenix
#

@karmic parcel hey Cyber

#

long time not talk zoomeyes

karmic parcel
#

henlo jacz

earnest phoenix
#

Remember dbl.js? LUL3d

#

when i knew nothing about classes LUL

karmic parcel
#

yaaaa

unreal ferry
#

I'm trying to update server count. Is the token the same as the token used to login the bot?

earnest phoenix
#

lmfao no

unreal ferry
#

How do I get that token?

#

Oh is that "my" token?

quiet bobcat
#

no

#

then press on your bot

#

and then copy that api key

#

@unreal ferry

unreal ferry
#

Thanks!

rare mist
#

yukine i will definitely add that

cunning oxide
#

Anyone know why I cannot get the total amount of members in a single guild with Discord.js?

#

Like it always gives me undefined

drowsy falcon
#

how can i make my bot send help?

#

like for a example

#

gameset (watching etc.) (text) changes the game

#

if i do >gameset help it gives help

cunning karma
#

Wdym?

drowsy falcon
#

ik that its simple but im dumb lol

cunning karma
#

@cunning oxide try message.guild.memberCount

cunning oxide
#

it doesnt work for some reason

cunning karma
#

If it doesnt work too try message.guild.members.size

cunning oxide
#

i get undefined message

cunning karma
#

t!eval message.guild.memberCount

drowsy falcon
#

@cunning karma can you help me?

cunning karma
#

@drowsy falcon yeah grekxx

drowsy falcon
#

look what i sent

lavish mango
#

Did you define message event as msg @cunning oxide

cunning karma
#

@drowsy falcon help for what?

drowsy falcon
#

how can i make my bot send help?
like for a example

gameset (watching etc.) (text) changes the game
if i do >gameset help it gives help

cunning karma
#

It should give help but for what the command or what??

drowsy falcon
#

like

#

if i do >poll (message)

#

it creates the poll

#

if i do >poll help it gives help, how to use this command

cunning karma
#

Oh 🀦

drowsy falcon
#

lol

cunning karma
#

if(args[0 === help]) return message.channel.send("Your help message") @drowsy falcon

#

Simple

drowsy falcon
#

kk

#

thanks for helping

cunning karma
#

And if that not work too try if(args[0] === help) return message.channel.send("your message") @drowsy falcon

#

Did it work??

drowsy falcon
#

wait

#

nah

#

nothing

#

no errors

cunning karma
#

Try the second one

drowsy falcon
#

yeah

#

i tried

cunning karma
#

Show me your code in my server

drowsy falcon
#

kk

sand roost
#

Anybody who could check my queue mechanism to see what i am doing wrong
since its something with the mechanism

earnest phoenix
#

?

lavish mango
#

Nvm I went up higher

earnest phoenix
#

i got this

#

if(wUser.hasPermission("MANAGE_MESSAGES")) return message.reply("That user cannot be warned! :warning: ");

#

but

#

As a higher rank

#

I cannot warn lower ranks with that power

#

is it possible to change that?

#

Seems like you are making it so you cannot warn a person who has manage messages

#

I mean i could change the manage messages perm to something else

#

but for instance if i change it to manage_server mods will be able to warn eachother

#

and thas not what i want

#

What ranks have manage messages, that's what you need to find out

#

Alright

#

Make sure your person your trying to warn doesn't have it

#

I gtg now, bye

#

Got it, Bye

#

Thanks for the help

spring ember
#

I use them so I thought I should share

inner jewel
#

HttpURLConnection

#

yeah no

#

use okhttp

#

it's waaaaaay better

spring ember
#

no

#

rly?

#

ok

inner jewel
#

yes

spring ember
#

faster? what's the difference?

inner jewel
#

okhttp doesn't have a retarded api

#

supports http/2.0 (j9 does too, but i'm not sure if it does by default for url connections it doesn't)

olive crown
#

can someone recommend a vps?

spring ember
#

Ovh

topaz fjord
#

Digital ocean

spring ember
#

Aws, digital ocean

topaz fjord
#

Vultr

#

Galaxy gate

spring ember
#

Search Google

olive crown
#

thanks

minor kelp
#

can anyone help me here

trim plinth
#

what do you need help with

minor kelp
#

on this

#

ak47!killme

#

...

south finch
#

bots dont respond in here

minor kelp
#

when i do it

south finch
trim plinth
minor kelp
#

i want it to play the gif in the embed how i do that.

south finch
#

google it

inner jewel
#

set the embed image to the direct link

minor kelp
#

ah ok

#

i dont know what to put

#

to get it to work

#

@inner jewel help

#

soz for mention btw

earnest phoenix
#

how can u check a specific guild then run this

bot.on('guildMemberAdd', member => {
     var role = member.guild.roles.find('name', 'Supporter');
     member.addRole(role)
 });```
#

```javascript

#

try that

trim plinth
#

@earnest phoenix add the guild parameter in the function + check through ID

earnest phoenix
#

got it

#

voila

#

i'll do that

#

adopt-a-wizurd foundation

trim plinth
#

@earnest phoenix actually nvm I think the guild parameter is useless in this since it's for a specific guild

earnest phoenix
#

alright

#

What can I use then?

#

πŸ€”

trim plinth
#

hint on searching guilds through id: bot.guilds.get

earnest phoenix
#

πŸ‘πŸ»

#

i tried js bot.on('guildMemberAdd', member => { if(bot.guilds.get("396459465093939222")); var role = member.guild.roles.find('name', 'Supporter'); member.addRole(role) });

trim plinth
#

why are you using an if statement with that

frail harness
#

if it's that specific guild

#

also ew hardcoding ids

trim plinth
#

Β―_(ツ)_/Β―

#

if you want to use if, easy way to do it:

if (guild.id === "some guild id") {
    // do some stuffs
}
``` you'd also need to add the guild parameter to the function
#

@earnest phoenix

earnest phoenix
#

alright then, thats fine

topaz fjord
#

bot.guilds.get returns a collection

restive silo
#

@topaz fjord no

#

<Client>.guilds is a Collection which extend map, Map#get returns the value for that key if present, and if not null

topaz fjord
#

@restive silo cucc outta here

proven siren
#

so no matter how many times i use bot.login, it always said, ""bot" is null or not an object." What do i do?

#

i am LOST

restive silo
#

define bot or use the actuall variable for your client object

#

πŸ‘€

proven siren
#

yeah...i dont understand that partπŸ˜…

#

i looked it up but got no where

restive silo
#

sounds like you lack of basic knowledge about your choosen programming language

#

πŸ‘€

proven siren
#

That i dobloblul

restive silo
#

then why not reading stuff up and try to understand the basics first, before actuall making a bot?

#

thats the easier way

proven siren
#

looks like i dont have a choice. Hopefully my laziness wont get the best of me during that timeπŸ˜…

#

thanks for the help though

brisk notch
night imp
#

send it once πŸ€”

brisk notch
#

I am.

night imp
#

some code would be nice

brisk notch
#

ok

earnest phoenix
#

maybe you have more than one instance of the bot running

brisk notch
#

@night imp ```js
exports.run = async (bot, msg, args) => {
await msg.guild.members.fetch();

msg.channel.send(There are **${msg.guild.members.filter(m => !m.user.bot).size}** users. There are **${msg.guild.members.filter(m => m.user.bot).size}** bot${msg.guild.members.filter(m => m.user.bot).size == 1 ? '' : 's'}. In total there are **${msg.guild.members.size}** members.)

};

exports.info = {
name: 'members',
usage: 'members',
description: 'Shows member count.'
};```

delicate zephyr
#

try using return

#

so it stops after sending once

brisk notch
#

now i gotta do that to every command

#

(β•―Β°β–‘Β°οΌ‰β•―οΈ΅ ┻━┻

delicate zephyr
#

try it with one

#

then do it

#

lol

brisk notch
#

wait it happens in a span of time

#

like it fixes when i restart it

earnest phoenix
#

if your shit is sending more than one time then you should do a lot more than put return at the end of your command functions Thonk

brisk notch
#

example?

earnest phoenix
#

find actual problemo

brisk notch
earnest phoenix
#

yes but find the meme that is causing it

brisk notch
#

meme

earnest phoenix
#

meme

earnest phoenix
#

wow

jovial sable
#

How do you get an emoji's ID?

earnest phoenix
#

click open link

jovial sable
#

and make a .js bot send it lol

#

wait what?

earnest phoenix
jovial sable
#

ooh

#

ic

earnest phoenix
jovial sable
#

thank!

earnest phoenix
#

yee

jovial sable
#

thanks*

#

how do i put it in discord.js tho

#

or is this not the place to ask

earnest phoenix
#

send an emoji?

jovial sable
#

yeah

#

bots can send any emoji right?

earnest phoenix
#

yes

#

for animated emoji you can do ![loading](https://cdn.discordapp.com/emojis/393670580232257538.webp?size=128 "loading")

jovial sable
#

oh

earnest phoenix
#

and for regular emoji you can do <loading:393670580232257538>

jovial sable
#

just... stick it in there?

#

does the loading have any specific meaning btw

earnest phoenix
#

loading is the emoji name

#

and the snowflake is the emoji id

jovial sable
#

ohhh i get it

#

sorry my discord app crashed just now

#

imma try it right now

#

thank you!

delicate zephyr
#

Whats the better alternative to Opusscript

#

There is one that works better I can't remember the name of it

#

JS

trim plinth
#

node-opus

delicate zephyr
#

thats the one

#

thanks

austere meadow
#

i have a tag/autoresponse system in my bot, and it has variables (such as %{user} and %{displayname}) which will get the current users name/displayname, im using an object for this and it works fine so far
but i want to extend this functionality further from simple %{user} and %{tag} variables to something like %{random}, which i want to have a syntax like %{random:this is a string|here is another string|this has a 1/3 chance of being chosen}, but i don't know how to implement a syntax like that

#

and obviously the %{random} would be replaced with the randomly chosen response out of those 3 options (or however many the user decides to put)

earnest phoenix
#

I mean, use a regex to capture groups from : group 1| group 2 | so on

austere meadow
#

im pretty shit at regex and i had a go at it myself but didn't really get much success

#

plus there's a lot of issues doing it like this (unless theres some solid regexp that i can create), like only being able to use one %{random} tag, and not being able to use other variables inside the random variable

steel tinsel
#

my console keeps throwing this:

#

    at item.request.gen.end (/rbd/pnpm-volume/768faaa2-1c53-4031-b548-770885ea090a/node_modules/.registry.npmjs.org/discord.js/11.3.2/node_modules/discord.js/src/client/rest/RequestHandlers/Sequential.js:71:65)

    at then (/rbd/pnpm-volume/768faaa2-1c53-4031-b548-770885ea090a/node_modules/.registry.npmjs.org/snekfetch/3.6.4/node_modules/snekfetch/src/index.js:215:21)

    at <anonymous>

    at process._tickCallback (internal/process/next_tick.js:118:7)

(node:7936) 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: 342)```
#

what could this be?

#

i know somewhere it misses permissions, but i don't see the cause

earnest phoenix
#

@steel tinsel if it can read messages but cant send message in the channel can cause missing access, if ur help command dms and the person has dms closed also can cause that, if u have music and a person ask it to join the voice channel and it doesnt have access to talk/join it also sends that error

steel tinsel
#

none of those i suppose

#

no music and no help in DM

spring ember
#

What is the context? Send the code

fleet mason
#
(node:92084) [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.``` Why do i get this error when my bot have **role managing** perm
trim plinth
#

probably your bot doesn't have some other perm that it needs

earnest phoenix
#

try to put ur bot role above the other role

steel tinsel
#

@spring ember i don't know context, i just know it kwwps throwing that error

#

how do i fetch an invite for each one of the guilds the bot is in?

earnest phoenix
#

libary?

#

d.js i presume @steel tinsel

steel tinsel
#

yes

earnest phoenix
#

try to learn how to use .createInvite

steel tinsel
#

i mean fetch an invite

#

not create

earnest phoenix
#

maybe u can do .fetchInvite(invite)

low owl
#

Also, you might want to think about .catch in your promises

earnest phoenix
#

use Client#fetchInvite

#

Dont link old as fuck issues please

#

literally v6 days

earnest phoenix
#

uh, so i tired to kick the user then send him the dm and log the message in the moderation channel but if his dms are closed the user cannot be banned

#

so i tried this

#
  await kUser.send(kickEmbed).then(()=> {
    kickChannel.send(kickEmbed);
  })
}catch(e){
  kickChannel.send(kickEmbed);
  message.guild.member(kUser).kick(kReason);
}
}```
#

I run it and it doesnt do anything

#

nor kick the user or even give a error

#

help?

#

🀦

#

u are supose to console.log(e)

#

and see wats the error

lavish mango
fleet mason
#

I have a question if i use spaces in a switch will it work? / how do i bypass it if it dosent

#

like this case T r e a s u r y:

solemn obsidian
#

string tags?

fleet mason
#
let guildRole = realmeye[message.author.id].guild
switch guildRole: { ```
low owl
#

Won't work

#

If you have a string use quotations

#

every guildRole has an Id though πŸ˜‰

earnest phoenix
#

@earnest phoenix theres no error

fleet mason
#

@low owl they are actually names not ideas because im making a verification bot that uses a api

#

@earnest phoenix ok so it works?

inner jewel
#
switch(x) {
     case "a": a(); break;
     case "b": b(); break;
     default: stuff();
}```
earnest phoenix
#

nop

#

thats the thing

#

no errors

#

and nothing happens

inner jewel
#

@austere meadow for your random thing you'd need an actual parser

#

loop through the chars, keeping track of them

austere meadow
#

fuck i dont know how to use a parser and im using javascript so that doesn't help my case NotLikeThis

#

ill have to look into it but thanks

low owl
#

@fleet mason But you use Discord API guild roles right?

fleet mason
#

@low owl i give them roles and the roles i know how to find but the guild roles is a game

earnest phoenix
#

I got this so far

#
              kickChannel.send(kickEmbed);

              kUser.send(kickEmbed).then(()=> {
        })
        message.guild.member(kUser).kick(kReason);
#

what is kickChannel and kUser?

low owl
#

Your formatting is a bit off and you should also await or promise the actual kick but ah

#

Otherwise looks right I guess

#

Wait, you delete the message and expect an exception?

earnest phoenix
#
  message.delete().catch(O_o=>{})
              kickChannel.send(kickEmbed);

              kUser.send(kickEmbed)
//why do u have this but dont have anything here :/
/*.then(()=> {
        })*/
        message.guild.member(kUser).kick(kReason);```
#

if ur kUser is message.mentions.members.first() then i know where u f up

#

uhh

#

kickChannel is let kickChannel = message.guild.channels.find(name, "moderation_logs");

#

and k user is

#

let kUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));

#

ah

#

just do kUser.kick(the-mods-shitty-reason)

low owl
#

Dude you use catching of errors wrong though :(
That's just being lazy. You can before even executing the command tell if you will get an exception or not, why still use the catch?

earnest phoenix
#

i have a bot that runs on "python" does anyone have an idea how do bot do run on a VPS?

#

alright

#

or is there any site?

#

@earnest phoenix are u using google translate?

#

I'm from another country, helping me translate google ..

#

well most vps are paid

#

I already have a paid one

low owl
#

Then you need to decide what kind of workflow you want to have

#

do you want to manually update your bot? Do you want to use a Ci/Cd etc.?

earnest phoenix
#

@earnest phoenix then pretend ur on ur computer and host it on the vps without closing the console/terminal whatever u call it

#

to run bot in vps screen

low owl
#

Asking again, what kind of workflow do you want to have?

#

Do you know how to use SSH?

earnest phoenix
#

I do not believe

cunning oxide
#

im trying to make sure that when a user is kicked or banned from my server that

#

it doesnt show a "goodbye message"

#

but rather just "user kicked"

#

can anyone help? I'm using discord.js

low owl
#

Do you mean the Discord welcome and leaving messages?

#

Like the official ones?

cunning oxide
#

no

#

like within my bot

#

i have a welcome / leave message

#

that runs on "guildMemberRemove"

#

i'm trying to make it so that when i run a kick command

low owl
#

Well, where exactly is your problem then?

cunning oxide
#

it doesnt show that goodbye message

#

i dont want the bot to run that function when a user is kicked

low owl
#

Try to describe your situation a bit and what you are stuck on

cunning oxide
#

ok

#

one minute

#

but all i want it to send

#

is the kicked embed in a channel

#

one minute

#

this^

#

i dont want the "Goodbye message"

low owl
#

Yes, that is what I understood

#

but I want to know where you are stuck in your project

inner jewel
#

you'll need to read audit logs

#

discord doesn't provide a kick event

cunning oxide
#

how to not get it to send that i guess

#

yeah

#

this thing is being weird

#

i will use the audit logs then

#

didnt think of that i guess

#

lol

#

thanks guys

earnest phoenix
lavish mango
earnest phoenix
#

what do I select from here?

low owl
#

You won't learn anything with that "behavior". You need to try things by yourself or research on your own.

inner jewel
#

^

low owl
#

Always asking others won't help you

#

But to answer your question, any of these. I don't know what desktop/applications is though.

earnest phoenix
#

@cunning oxide u forked that code from source code's channel

#

just saying

cunning oxide
#

@earnest phoenix, yes, the kick i did.

#

@earnest phoenix its a private bot anyway. I'm not using it in any way for my profit or anything + he has been credited and has been asked if i can fork it.

earnest phoenix
#

thats fine

fervent moss
#

Hey

earnest phoenix
#

hi

next bluff
#

Any Discord4J people in here? My bot is running into major issues atm and I can't really tell what exactly is going on. It seems like it is failing to connect to Discord because I keep seeing websocket errors like "Connection reset by peer" and stuff like that. Restarting doesn't seem to fix anything. Anyone have issues similar to this before?

earnest phoenix
#

reset by peer makes me thing you're trying to connect to discord with 2.5K guilds but not sharding

next bluff
#

The bot has about 940 guilds

earnest phoenix
#

:blobhmmm:

next bluff
#

TBH I haven't done much with regard to sharding other than turning it on with the recommended shards method

earnest phoenix
#

Yeah im not sure, Do they have a discord api channel?

#

(probably best to ask there)

next bluff
#

I asked on their server as well

inner jewel
#

afaik reset by peer is a network error

next bluff
#

I should add that connections to other apis have not been affected, it seems to only be a discord issue

fleet mason
#

            switch guildRole : {
              case Friendzoned :
                message.member.addRole(Friendzoned);
                break;
              case Naknoemo:
                messag.member.addRole(Naknoem);
                break;
              case Red Ice:
                message.member.addRole(redI)
                break;
              case nutty:
                message.member.addRole(nutt)
                break;
              case Destructive Dragons:
              message.member.addrole(DestructiveD)
                break;
              case Amigoz:
                message.member.addrole(Amigo)
                break;
              case DOOM:
                message.member.addRole(Doo)
                break;
              case Semii:
                  message.member.addRole(Semi)
                  break;
              case Mini Nut:
                message.member.addRole(MiniN)
                break;
              case Fairy Tail:
                message.member.addRole(FairyT)
                break;
              case T r e a s u r y:
                message.member.addRole(Tres)
                break;
              case Konoha:
                message.member.addRole(Konoh)
                break;
              default:
              message.channel.send("XD")
              }
            }``` what did i do wrong?
#
                   ^^^^^^^^^

SyntaxError: Unexpected identifier
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:607:28)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Client.client.on.message (C:\Users\sande\OneDrive\Bot\EUW Bot\index.js:31:23)```
spring ember
#

Switch (guildRole) {...} Maybe?

#

I think that's the syntax

earnest phoenix
#

i need help :/
error:

                     ^^^^^

SyntaxError: missing ) after argument list
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:383:7)
    at startup (bootstrap_node.js:149:9)
logout

[Process completed]```
code:
```js
client.on("message", async message => {
//cant even do anything
})```
#

I thought it was async (message)

#

it doesnt matter

#

O

#

Lol

#

update node

#

i think my node is updated

#

node -v

#

lemme see

#

v6.11.4

solemn obsidian
#

doesnt support async/await

earnest phoenix
#

yeah you need 7.6+

#

ok

#

get current

#

9.11

#

9.11 or 8?

#

recomended is 8

#

I said above

#

9.11

#

ok

fleet mason
#

@spring ember ok thx but now i got this error ``` case Red Ice:
^^^

SyntaxError: Unexpected identifier
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:607:28)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
at Client.client.on.message (C:\Users\sande\OneDrive\Bot\EUW Bot\index.js:31:23)``` How do i fix it?

inner jewel
#

case "Red Ice"

solemn obsidian
#

string tags

fleet mason
#

ok i have a stupid question ``` if(djksajd) {

}else {
jdsakjds}

earnest phoenix
#

?google

topaz fjord
#

Commands only work in testing channels

woeful plaza
#
client.on('message', function() {

  const duration = moment.duration(client.uptime).format(" D [days], H [hrs], m [mins], s [secs]");

  let replies = ["im in beta!", `im up for ${duration`];

  var interval = setInterval (function () {
    client.user.setActivity(replies)
  }, 1 * 1000);
})
#

doesnt seem to be changing after a while :v

#

some1 help :vvvvvv

topaz fjord
#

You can't set activity as an array

woeful plaza
#

o

topaz fjord
#

You should check out d.js docs

woeful plaza
#

a so thats what im doing wrong :v

earnest phoenix
earnest phoenix
#

How do I make a toggle setting for specific servers

#

Nvm

cunning oxide
#

Hey, can someone help me set up a cooldown for a specific cooldown... I'm having some trouble. I'm using discord.js.

spring ember
cunning oxide
#

Thanks. Where do I even set that cooldown... its weird.

quiet bobcat
#

πŸ€”

#

Wherever you want

hushed oyster
#

Now in the command event add this

earnest phoenix
ruby dust
earnest phoenix
#

any ideas?

topaz fjord
earnest phoenix
#

@topaz fjord then wot

gusty topaz
#

Add type="text/css" in the link element

#

That should work

austere meadow
#

quick question for anyone using a Command class for commands
is there any significant different between doing

exports.settings = {command: 'help', description: 'Displays all available information about commands and help for zBot.', usage: 'help [command]', throttle: {usages: 3, duration: 10}}

and creating a command class, extending it through all of my commands and creating a constructor for all of them? is there any reason i'd actually want to do that compared to just making a settings variable and exporting that

earnest phoenix
#

Depends, More personal preference

gusty topaz
#

Not really

austere meadow
#

ok cheers

#

idk i just see a lot more people using command classes these days and i was just wondering if theres anything to it

earnest phoenix
#

its just cleaner and more structured

#

:theshrug:

heady zinc
#

yuup

#

i do that and yeah there's no real point

trim plinth
#

there isn't anything too special about command classes expect being nicer + more work at some points

austere meadow
uncut slate
#

lots of people like using them for no reason when an object would be faster and simpler instead

#

same goes for maps

spring ember
#

it keeps the code tidy

uncut slate
#

people like using maps for storage where an object would do the exact same thing but faster

spring ember
#

also it depends on the structure

uncut slate
#

it does, hence "lots"

#

I'm talking about (arguably ig) the majority, not everyone

#

not saying classes are useless, they aren't

earnest phoenix
#

@clever yew Maps vs Objects

clever yew
#

What about it

earnest phoenix
#

Write a big essay about how Objects are faster but Maps are more functional

clever yew
#

Map is a collection, you must use it when you want a dynamic keyed collection of key-value

#

You should always avoid plain objects for this feature, since every property you add/remove to/from it, it makes V8 re-compile the entire object from scratch, which is slow

#

Also, Maps are faster than objects, what are you talking about Jacz?

#

540M vs 527M ops/sec respectively

#

Maps don't have the overhead of looking the prototype and parents if a key is missing, as it looks in an internal map which has been optimized in V8 6.4+

#

Object Accessment in JS is kinda spreaded

earnest phoenix
#

cc @uncut slate

austere meadow
#

is there a better way to iterate over the users collection than this or is this the fastest

const users = client.users;
for (const [snowflake, user] of users) { ... }
clever yew
#

Sorry, I couldn't find the exact part from the specification as it's 827 pages long

earnest phoenix
#

@austere meadow depends on what you wanna do

clever yew
#

(About Object Property Accessment)

earnest phoenix
#

do you just want the user object?

#

or do you want key

austere meadow
#

i have a Find class and im basically iterating over all users to find different things based on the query (like id, username, tag, discriminator, etc)

clever yew
#

I'd say usejs for (const user of client.users.values()) { /* ... */ }

austere meadow
#

the user object

clever yew
#

If you need the id, you can access to it via user.id

austere meadow
#

okay ill give that a try

spring ember
#

y const?

clever yew
#

You don't need to cache client.users, the left hand expression of of creates an Iterator instance, therefore it creates the iterator, and for each yielded value from it, run the block

spring ember
#

var is better for most things

clever yew
#

Nope

austere meadow
#

ive just read that its faster to cache it

clever yew
#

var should be avoided at all costs

earnest phoenix
#

No var is not better for most things, var should never be used in ES6+

clever yew
#

It's error prone and it's function-scoped

#

const and let are block-scoped

spring ember
#

oh I guess things are different now, it's been years since I used js

earnest phoenix
#

and var hoists so it can be really fucky

spring ember
#

I thought the only difference is the scope

earnest phoenix
#

nope

clever yew
#

Variable declaration with let and const are faster post V8 6.2 (Node.js 8.3.0 and newer)

spring ember
#

nice to know

clever yew
#

@austere meadow POJOs used to be faster than Maps, yes, but it got a speed boost with TurboFan (which outdates the information from many StackOverflow pages), and lately in V8 6.4, it got another speed boost

earnest phoenix
#

(think you mean Aeth blobhmmm )

clever yew
#

Node.js 10.x will ship V8 6.5, but they're bumping to V8 6.6 once node-sass fixes the issues (which they already did, yesterday)

#

And the release date for Node.js 10.0.0 is set to 24th April

austere meadow
#

oh good to know

earnest phoenix
#

One small step for nodejs

clever yew
#

According to Myles Borins, Node.js' TSC Director

earnest phoenix
#

tries to reference "one small step for man kind" but fails

clever yew
#

(Pretty much who manages it all)

uncut slate
#

interesting stuff, I had no idea @clever yew @earnest phoenix

clever yew
#

I have been studying V8's internals to comprehend many stuff that is under the hood in V8, so I could optimize my applications specially for it

earnest phoenix
#

am very stupid

#

i just ask kyra to explain shit so i learn

uncut slate
#

also, I was surprised to see you suggest a for..of

#

I use them myself but I everyone I know gives me shit for it πŸ™ƒ

earnest phoenix
#

I use for of a fair bit

#

Actually quite useful in some cases

clever yew
#

for..of is actually very performant

#

Its performance in the great majority of things is either as fast or faster than a for loop

#

Since in the primitive for loop, you do:

1. Declare a variable
2. Check the condition
3. Accesses to a position from the array, having to re-calculate the shift position from scratch
4. Run things with it
5. Call third statement
6. Go back to 2.

#

In a for..of loop you do:

1. Initialize the iterator
2. Check if iterator is done
3. Accesses to the current position from the array, being optimized as the position doesn't shift from 0 but by the current position
4. Run things with it
5. Go back to 2.

#

There's some overhead in both, but basically the for loop is optimized by nature (it's very easy to compile to Assembly), the for-of loop is optimized by the V8 engine and is able to skip some things

#

Things such as in a for loop, V8 has to check you're always accessing to numeric properties and it's between 0 and the arrays length (otherwise it checks the prototype chain), which is quite bad. Of course, in some scenarios, this could be optimized (or is already optimized) to avoid the checks, V8 already has this functionality, and I believe it's doing this since TurboFan

#

In a for-of, V8 knows that by nature it'll never access the prototype chain but to each %Element% in the internal array slot, so it doesn't need those checks

#

Both end up with some overhead:

The first needs all those checks plus accessing the internal array slot -> Gets optimized to use the internal array slot directly and shift the position smartly
The for-of has the Iterator overhead, doesn't need to check anything but %Iterator.done% -> Gets optimized like this

#

Conclusion: They're equally fast, main difference is that for-of is way cleaner

#

But if you need index aswell, for is the best solution

#

As I mentioned before, for-of is equally or faster than for in arrays, the reason is because most of us do this:js for (let i = 0; i < arr.length; i++) console.log(arr[i]);Where V8 has to access to arr.length in every iteration (which has some overhead), instead of this:js const arrLength = arr.length; for (let i = 0; i < arrLength; i++) console.log(arr[i]);Which comes to be noticeably faster than the previous. However, this is much readable:js for (const elem of arr) console.log(elem);Isn't it? πŸ˜„

#

And it's as fast as the second code

#

Also much shorter googlemuscleR

heady zinc
#

is that so ZoomEyes

clever yew
#

Another upside of for-of, it works with any iterator, whereas for doesn't

#

You can get completely consistent code with it agooglethumbsup

light tapir
#
>>> for x in range(5):
...     if x/4 == 1:
...         break
... else:
...     print('error')
... 
>>> for x in range(5):
...     if x/5 == 1:
...         break
... else:
...     print('error')
... 
error
#

thats really cool :3

uncut slate
#

@clever yew What do you mean by works with any iterator exactly?

clever yew
#

One moment

earnest phoenix
#

generators right?

uncut slate
#

I understand how Symbol.iterator works, but I don't think that's what kyra is referring to

#

not completely sure

earnest phoenix
#

pretty sure he means generators

clever yew
#

Generator functions return iterators, @earnest phoenix @uncut slate

earnest phoenix
#

I know...

uncut slate
#

yeah, but how does that tie into "using any iterator"

clever yew
#

Map.entries(), Map.values(), Map.keys() are Map's iterators

#

You can do for (const key of myMap.keys()) {} and key will be every key from the Map instance

#

or values and it'll be every value

uncut slate
#

Ohhh, that's what you're referring to

clever yew
#

Or entries and it will be a tuple key-value

#

Same thing for Set, which has all 3 iterators with the same value

#
const myArr = [1, 2, 3];
for (const element of myArr) {}
for (const element of new Set(myArr)) {}```
#

if you put a console.log(element) in both for-of bodies

#

It'll print 1, 2, 3

#

That is, their iterator works the same

#

As they both have Symbol.iterator which yields each element from it

uncut slate
#

gotcha

clever yew
#

No matter what, as long as it has a generator function, you can get each yielded element from it with the for-of

earnest phoenix
#

wdym by "which yields each element from it"

clever yew
#

That's why for-of is very consistent

#

It can iterate over anything that is an iterator

#

Map, Set, Array... they're iterables, you can iterate over all three in the same way

uncut slate
#

Array.prototype[Symbol.iterator] is a generator that yields every value

#

that's why I think he meant

earnest phoenix
#

I know what Symbol.iterator is and all that but like what do you mean when you say yield each element from it

#

aka im confused what yield actually does

uncut slate
#

generators yield

earnest phoenix
#

generator.next Thonk

clever yew
#
function* test() {
  yield 1;
  yield 2;
}
for (const el of test()) console.log(el); // 1, 2```
spring ember
#

generators are great

earnest phoenix
#

they are

clever yew
#

Also thisjs function* test() { yield 1; yield 2; } console.log([...test()]); // [1, 2]

earnest phoenix
#

Yeah i just read the whole Iterators and Generators guide

#

tho i'll forget it in 5 seconds

earnest phoenix
#

if (msg.includes("help") && message.mentions.users.has(bot.user.id)) why does that not work?

#

and msg = message.content

#

@earnest phoenix why dont u just use .startsWith?

clever yew
#

Or a framework that handles that for you

earnest phoenix
#

if (msg.startsWith("<@bot.id> help"))

clever yew
#

There are a couple of bot frameworks that support prefix mention

#

Also, that won't work very well, Speak

#

When the user has a nickname, you'd do <@!userid>

low owl
#

I want to point out that you should not 1) rewrite your code to check prefix for every command 2) check prefix for every command

earnest phoenix
#

hmm

#

no dw

#

(msg.includes("help") && message.isMentioned(bot.user)))

#

ill try that

#

i think the second part is wrong

#

not sure and too lazy to check rn

#

just in case someone does help @cold summit

#

@cold summit help

#

wrong channel

#

nope

#

oh

low owl
#

Only works in testing

earnest phoenix
#

this is about bot development, don't tell me to argue about python and js in here.

#

@low owl

low owl
#

Well, it is kind of bot development related.. in the end you use the tools to make a product and before you do that you should know which tool to use

#

Anyways, seems like you don't want to have a good discussion. Then might as well not do it.

floral stone
#

What discussion @earnest phoenix

earnest phoenix
#

he was shitting on python

#

and saying js was better

#

@floral stone

#

didn't want to make more sparks

floral stone
#

That doesn't mean it's bot development related. Yes, if you are talking about it in a way related to bot development then yeah but a general conversation about superior languages isn't really bot development, more just coding.

earnest phoenix
#

^

#

pat pat

#

not u

floral stone
#

Anyways, it's just a coding language. It's just a preference. Who cares!

earnest phoenix
#

pat thief

lavish mango
low owl
#

πŸ™„

floral stone
#

Really?

lavish mango
earnest phoenix
#

!stats

#

oops wrong channel

dusty sandal
#

for js, how to you detect the amount of characters written

#

class NickCommand extends Command {
    constructor() {
        super('nick', {
            aliases: ['nick'],
            args: [
                {
                    id: 'member',
                    type: 'member'
                }
            ],
            clientPermissions: ['MANAGE_NICKNAMES'],
            userPermissions: ['MANAGE_NICKNAMES'],
            channelRestriction: 'guild'
        });
    }

    exec(message, finna) {
        if (!finna.member) {
            return message.channel.send("**MEMBER NOT FOUND**");    
        }
        
        let args1 = message.content.split(' ').slice(2);
    var argresult = args1.join(' ');
        
        return finna.member.setNickname(`${argresult}`).then(() => {  
            if (argresult === `meme machine`) return message.channel.send('What is this?')
            if (!argresult) return message.channel.send(`_${finna.member}\'s_ **nickname was successfully reset.**`)
            return message.channel.send(`**User's nickname was successfully changed to \`${argresult}\`**.`)
        })
    }
}

module.exports = NickCommand;```
solemn obsidian
#

string.length?

dusty sandal
#

i do an if then statement, ok

#

lets try this first

#

that didnt work

earnest phoenix
#

How can i make a paid version of my bot

glossy mason
#

Paywall features people like, keep a database of paid user IDs (maybe hashed or something to make Discord happy), profit.

earnest phoenix
#

but how do i do that tho

#

@glossy mason

#

question!
how are the search results ordered? clearly not by the number of upvotes..

glossy mason
#

@earnest phoenix Depends. The basic idea is you need some way for people to send money and attach their ID with it (maybe Patreon? not sure how much you can do with their Discord integration). And then as I mentioned, a way to store those IDs so the bot can check against them when a user calls a paid command and only allow paid users to use it. I haven't done any work with payment APIs before, so I'm not fully sure what's out there that could possibly let you do it all automatically.

earnest phoenix
#

how do you store it @glossy mason

#

plus i use patreon

lavish mango
#

With a database

#

I would assume

earnest phoenix
#

What kind

lavish mango
#

Sqlite, json, MySQL

earnest phoenix
#

ill use sqlite

#

so how do i set it up

spring ember
#

what do you want to do @earnest phoenix ?

earnest phoenix
#

@spring ember wdym

spring ember
#

with the database I mean

earnest phoenix
#

store user ids for a premium version of the bot

spring ember
#

choosing database isn't obvious and what others use might not be good for you

#

umm

#

how do you plan to do that?

inner jewel
#

no one here is going to give you a full tutorial on how to make a premium bot

#

if you want it to be automatic, use patreon webhooks and their REST api

#

the easy way would be asking users to provide proof they donated

earnest phoenix
#

IM MAKING ONE @inner jewel JUST PLZ I NEED HELP WITH A DATABASE

#

geez

inner jewel
#

and manually give them permissions

glossy mason
#

"patreon web hooks", ah cool, TIL, thanks.

inner jewel
#

they're a pain tho

#

fyi

earnest phoenix
#

Ohh i want to kill my self irl now because of this bull crap

inner jewel
#
if !CheckMAC(body, request.Header.Get("X-Patreon-Signature"), hmacKey) {
    http.Error(writer, "Invalid signature", http.StatusBadRequest)
    return
}``` ```go
func CheckMAC(message []byte, messageMAC string, key string) bool {
    mac := hmac.New(md5.New, []byte(key))
    mac.Write(message)
    expectedMAC := mac.Sum(nil)
    return hex.EncodeToString(expectedMAC) == messageMAC
}```
earnest phoenix
#

@dire shell

dire shell
#

How would I be able to make a command that checks if the user has voted. If they have then they have access to certain commands

earnest phoenix
#

heey

dire shell
#

Hi?

earnest phoenix
#

lol

dire shell
#

who are you

#

What would the enpoint for the command be?

earnest phoenix
#

What lib?

#

oh wait

low wasp
#

@dire shell if using js dbl.hasVoted("id")

dire shell
#

Id being the members id?

low wasp
#

yes

earnest phoenix
#

im done

#

if i cant figure this out im so done with LIFE

spring ember
#

Read about rest in js first

#

We can help you with questions but not spoon feed you

earnest phoenix
#

my question is how does this have to do with D.JS

#

if it wont work

trim plinth
#

webhooks and dbs don't have anything to do with d.js fyi

spring ember
#

D.js isn't related to patreon rest api and the implementation is up to you

earnest phoenix
#

You know let me explain this

#

I have patreon
someone gets the role
every 10 minutes the people get checked
they get added or removed to a premium version

trim plinth
#

clearly you aren't listening to us because we know what you want

earnest phoenix
#

you know fuck my life

trim plinth
#

use a webhook or patreon rest api

#

done

earnest phoenix
#

im going to go find my knife

trim plinth
#

you're overreacting here

spring ember
#

Don't please

earnest phoenix
#

then help me

trim plinth
#

we are

#

clearly you aren't taking what we are saying and doing it

spring ember
#

Read first and think after about how do you want to implement it

earnest phoenix
#

I CANT READ I HAVE DYSLEXIA

trim plinth
#

then how did you just read his message GWsplHishironwhat

earnest phoenix
#

i can barely read

spring ember
#

Don't be annoying please

#

It's not funny and it's like asking for a spoon feed

trim plinth
#

@earnest phoenix clearly you just want to be spoonfed so just take the time to actually do things yourself and not expect the answer to be handed down to you.

drowsy falcon
#

how can i get the owner of the guild? discord.js

#

message.guild.?

glossy mason
drowsy falcon
#

kk

signal peak
#

can anyone help me figure out how to create a bot??

#

scratch that. on my gfs laptop she wont let me download anything on it. is there anything associated with bosshunting and timers?

clear tiger
floral stone
#

What language do you know

clear tiger
#

How do you find up time for a bot in JS, I tried but the command ended up breaking

alpine lark
#

Any bots for feedback? Where people can leave feedback in a server

clever yew
#

@clear tiger client.uptime

clear tiger
#

Huh

#

I tried that

clever yew
#

@alpine lark You'll need to explain more, but there's a bunch of bots that do that

clear tiger
#

Lemme make sure I did it right

clever yew
#

Or else I'll implement that in mine

clear tiger
#

So it was just an error in my command, thanks @clever yew

#

I had client.user.uptime lol

clever yew
#

yw ^^

clear tiger
#

Now I just need to convert it from whatever number type that is lmao

#

Minutes?

inner jewel
#

milliseconds afaik

clear tiger
#

O

#

That's weird

jovial sable
#

Can anyone tell me how to do a youtube upload notif on discord.js?

earnest phoenix
#

use a rss feed

#

(google it)

jovial sable
#

Oh k thnx

#

How do I put an rss reader on the bot tho

earnest phoenix
#

how to detect if ur bot is nicked? d.js

austere meadow
#

member.nickname will return null if not nicked

earnest phoenix
#

ok

earnest phoenix
#

How to get info using Client ID? Discord.js

pulsar cairn
#

<client>.bot.id

#

if that is wrong then idk

#

cause i haven't used d.js in a while

earnest phoenix
#

I said infomation

#

Like name

#

and this is worng

#

wrong

#

client.user

#

have fun from there

pulsar cairn
#

client.user

earnest phoenix
#

@earnest phoenix I have and I need to get the info

#

I don't want to see my bot info

#

I have my friend client id for test

#

and I want his bot name

#

How to get it

#

^^^^ Discord.js

low owl
#

Why do you have mee6's profile pic? πŸ€”

jovial sable
#

It's color altered tho

low owl
#

Well yea. I just have experienced way to many people that impersonate bots with a similar attitude.

#

Anyways to get back on topic, what do you want now? Be more specific and polite please.

jovial sable
#

If my understanding is correct, he's using his friend's bot and he has the client ID but not the name of the bot... And he wants to obtain the name?

#

@low owl

#

Sorry for the tag

low owl
#

Possibly, but I don't want to try and guess what he wants. Lilly he won't answer anymore anyways.

#

No worries :P

#

Likely*

jovial sable
#

Hehe maybe we should tag him...

low owl
#

Jesus, mobile typing is hard

earnest phoenix
#

client.users.get(the id)

jovial sable
#

Yeah ikr

earnest phoenix
#

or client.fetchUser(id)

low owl
#

Oh.. Good idea πŸ˜…

earnest phoenix
#

or for master client.users.fetch(id);

jovial sable
#

If he just wants the name can't he just look from the discord client

#

Much less hassle

low owl
#

I assume that is users.get, and fetch is actually downloading it into cache and the return.

#

But what do I know

earnest phoenix
#

why would get cache it?

orchid copper
earnest phoenix
#

its already in a Collection

#

lmfao

#

@low owl ofc fetch would cache it

#

but i mean u can disable that

low owl
#

Sorry im confused what you are trying to tell me

jovial sable
#

Forgive me for my ignorance but what's the difference between get and fetch

inner jewel
#

user = get(id);
if(!user) user = fetch(id)
use(user);

#

ez

earnest phoenix
#

Well

#

get gets it from the collection

#

aka its already in cache

#

fetch fetches the user from discord and set's it into cache

jovial sable
#

Ohh ok

earnest phoenix
#

fetch gets it from cache if its in there iirc

#

dont think it does for stable

#

in master it does tho

jovial sable
#

I will never get the hang of this

#

Which do you think is better d.py or d.js

low owl
#

Oh no

earnest phoenix
#

You're comparing a NodeJS library to a Python library

jovial sable
#

?

earnest phoenix
#

just no.

jovial sable
#

Okay

#

I've only ever done js

low owl
#

Well, he's not wrong in doing so lol

#

One can still be more complete than the other

jovial sable
#

How so?

low owl
#

Anyways, we just had that "discussion", more like stupid talk, yesterday

jovial sable
#

Lmao I'll just scroll up

low owl
#

So good luck on that one πŸ˜…

jovial sable
#

Hehe I'll do my best

low owl
#

Nothing worth to read though. It comes down to what you want to use and what you are more experienced in with anyways.

#

Languages and libraries are tools and you have to treat them like that. Some are better for the job than others depending on your project.

jovial sable
#

Nicely phrased.

low owl
#

Thank you πŸ˜„

earnest phoenix
#

How do i make it so this discord wont get level up messages

placid pendant
#

Idk

earnest phoenix
#
client.on("message", message => {
  if (message.author.bot) return;
  if (message.channel.type !== "text") return;
  if (guild.id === "264445053596991498") return; 
// i put that there so this server wont get level up messages

  sqlscore.get(`SELECT * FROM scores WHERE userId ="${message.author.id}"`).then(row => {
    if (!row) {
      sqlscore.run("INSERT INTO scores (userId, points, level) VALUES (?, ?, ?)", [message.author.id, 1, 0]);
    } else {
      let curLevel = Math.floor(0.1 * Math.sqrt(row.points + 1));
      if (curLevel > row.level) {
        row.level = curLevel;
        sqlscore.run(`UPDATE scores SET points = ${row.points + 1}, level = ${row.level} WHERE userId = ${message.author.id}`);
        message.reply(`You've leveled up to level **${curLevel}**! Ain't that dandy?`);
      }
      sqlscore.run(`UPDATE scores SET points = ${row.points + 1} WHERE userId = ${message.author.id}`);
    }
  }).catch(() => {
    console.error;
    sqlscore.run("CREATE TABLE IF NOT EXISTS scores (userId TEXT, points INTEGER, level INTEGER)").then(() => {
      sqlscore.run("INSERT INTO scores (userId, points, level) VALUES (?, ?, ?)", [message.author.id, 1, 0]);
    });
  });
})
#

ok

steel tinsel
#
var args = commandbody.split(' ');
let cooldude;
      
      if(!args.lenght < 1) {
      cooldude = message.author;
      } else if(message.mentions.size >= 0){
      cooldude = message.mentions.members.first().user;
      } else if (args[1].lenght == 18 && args[1].match(/^[0-9]+$/) !== null) {
          cooldude = message.guild.members.find("id", args[1]).user;
      }

      
      let uiembed = {embed: {
    color: 0x4A90E2,
    title: "Profile for " + cooldude.username,
        
    "thumbnail": {
      "url": cooldude.avatarURL
    },
    
    fields: [{
        name: ":tickets: Discriminator",
        value: cooldude.tag
      },
      {
        name: ":id: ID",
        value: cooldude.id
      },
      {
        name: ":battery: Status",
        value: cooldude.presence.status !== null || cooldude.presence.status !== undefined ? statustags[cooldude.presence.status] : statustags['offline']
      },
      {
        name: ":robot: Bot",
        value: cooldude.bot
      },
      {
        name: ":comet: Account created on:",
        value: cooldude.createdAt
      }
    ],
    timestamp: new Date()
  }
};
      message.channel.send(uiembed);```
#

    title: "Profile for " + cooldude.username,

                                     ^

TypeError: Cannot read property 'username' of undefined

at Client.client.on (/app/server.js:593:38)

    at Client.emit (events.js:180:13)

    at MessageCreateHandler.handle (/rbd/pnpm-volume/768faaa2-1c53-4031-b548-770885ea090a/node_modules/.registry.npmjs.org/discord.js/11.3.2/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)

    at WebSocketPacketManager.handle (/rbd/pnpm-volume/768faaa2-1c53-4031-b548-770885ea090a/node_modules/.registry.npmjs.org/discord.js/11.3.2/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:103:65)

    at WebSocketConnection.onPacket (/rbd/pnpm-volume/768faaa2-1c53-4031-b548-770885ea090a/node_modules/.registry.npmjs.org/discord.js/11.3.2/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:333:35)

    at WebSocketConnection.onMessage (/rbd/pnpm-volume/768faaa2-1c53-4031-b548-770885ea090a/node_modules/.registry.npmjs.org/discord.js/11.3.2/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:296:17)

    at WebSocket.onMessage (/rbd/pnpm-volume/768faaa2-1c53-4031-b548-770885ea090a/node_modules/.registry.npmjs.org/ws/4.1.0/node_modules/ws/lib/event-target.js:120:16)

    at WebSocket.emit (events.js:180:13)

    at Receiver._receiver.onmessage (/rbd/pnpm-volume/768faaa2-1c53-4031-b548-770885ea090a/node_modules/.registry.npmjs.org/ws/4.1.0/node_modules/ws/lib/websocket.js:137:47)

    at Receiver.dataMessage (/rbd/pnpm-volume/768faaa2-1c53-4031-b548-770885ea090a/node_modules/.registry.npmjs.org/ws/4.1.0/node_modules/ws/lib/receiver.js:409:14)```
#

it gives this error

heady zinc
#

the error is fairly obvious

steel tinsel
#

ikr

#

but i don't know how it generates

heady zinc
#

inb4 the issue is that typo

earnest phoenix
#

oof

heady zinc
#

actually it probably is lul

#

@steel tinsel check that out ^

steel tinsel
#

fixed?

#

i can't english really well

heady zinc
#

my my

#

it's length not lenght

steel tinsel
#
if(message.mentions.size >= 0){
      cooldude = message.mentions.members.first().user;
      } else if (args[1].lenght == 18 && args[1].match(/^[0-9]+$/) !== null) {
          cooldude = message.guild.members.find("id", args[1]).user;
      } else {
        cooldude = message.author;
      }``` this goes directly to the else
#

input: m:userinfo 403937044474232832

heady zinc
steel tinsel
#

i facepalm

steel tinsel
#

when does discord.js cache an user?

earnest phoenix
#

so ur memory doesnt break

#

if u understand what i mean

#

not a gud phrase but 🀷

steel tinsel
#

when?

#

after the process starts?

sinful lotus
#

is there anyone thats willing to test the serverprefix change command from my bot

#

I just want to see if everything works well

vast bane
#

Hey, my bot got muted for saying "Unknown Command". I just removed it, but will my bot still get muted if it reacts to the message with a ❌ ? If it does i'll just remove it

south finch
#

no

vast bane
#

So ❌ is allowed?

night imp
#

I mean maybe not on this server

vast bane
#

:/

#

Alright, to be sure i'll just remove response completely

south finch
#

it is

#

its fine

#

just as long as its not like spamming posts etc

vast bane
#

Alright

night imp
#

^

#

Like what is your prefix

vast bane
#

e!

south finch
#

wat bot is it

vast bane
#

EdgyBot

#

not fixed yet though

night imp
#

Yeah that's fine

south finch
#

@paper holly

#

okay just let a mod know (dont ping them all) when ur good :]

vast bane
#

Going to build without the response just the ❌ one sec

night imp
#

If it was something generic then no but e! is unique

vast bane
#

@south finch It's fixed, you're the first mod i saw soo

#

xd

south finch
#

done

vast bane
#

Alright, thanks!

ruby dust
#

my help command doesn't have any permission checking, but for some reason whenever someone types help with whatever argument in DM it prints me this error:
AttributeError: 'User' object has no attribute 'guild_permissions'

misty pawn
#

Can someone help me?
I want to use that option to post the servercount ( #312614469819826177 example from duncte123#0001) but the part with Request request = new Request().Builder() gives me the error, that 'Request(okhttp3.Request.Builder)' is not public in 'okhttp3.Request'. Cannot be accessed from outside package
Any ideas on how to fix?

trim plinth
#

use the official libraries because those examples are outdated

misty pawn
#

Another (maybe even stupid) question: From where on the github do I get the latest version of the API?
It says latest version of commit. So 4b27930 or what would it be?

#

Or can I just use LATEST?

#

Alright. works. Thanks @trim plinth

#

Are there any limitationa about f.e. how many times you can change the servercount in a time-period (hour)?

topaz fjord
#

60 per minute

#

I believe

misty pawn
#

so one per second.

ruby dust
#

even that can be considered spamming, it is recommended to do big enough intervals in posting your server count, especially if your bot is not joining that many servers

misty pawn
#

yeah.
I guess I juist update it every time I restart my bot, which is atm 2 or 3 times per day... (on average)

ruby dust
#

the best way in my oppinion is to make a background task that will update it like, lets say, every minute

#

I have mine on every 30 minutes

#

Β―_(ツ)_/Β―

topaz fjord
#

I update every guild create / delete

inner jewel
#

@misty pawn that'd be new Request.Builder()

#

you want to create the inner class Builder, not call a method named Builder in an instance of the outer class Request

misty pawn
#

@topaz fjord I first planned to update every Guild join/leave but meh....

#

My bot won't grow that fast I guess

solemn obsidian
#

only one guy needs to just spam 30 times join&leave event

dusty sandal
#

anyone know the bot tatsumaki and its autorole feature? well i want to know how to make my bot get role ids by itself so it can assign roles no matter which server it is on
im using .js if you need to know

#

ping me if you can help

vast bane
#

Lol, my bot got muted again for the same reason, i fixed the issue but i ran the wrong build of the bot. Could you help me? @uncut slate (you're the first mod i see)

#

my bot is @paper holly

#

It's running the correct build now

uncut slate
#

I'd suggest doing that in a different channel next time

vast bane
#

Oh, sorry, where should I?

uncut slate
vast bane
#

Oh, alright

#

I thought this was the best place