#development

1 messages · Page 326 of 1

shrewd field
#

how

earnest phoenix
#

var args = message.content.split(" ");

tawny lava
#

why var

#

const would be better

earnest phoenix
#

idk I always use var

tawny lava
#

or let

shrewd field
#

const args = message.content.split(" ");

tawny lava
#

yes

#

put that in your message event

earnest phoenix
#

var is a bad habbit for me lol

shrewd field
#

message is not defined

#

it is alone

earnest phoenix
#

put it under your message event

shrewd field
#

here

#

i have to put it in the event

earnest phoenix
#

That's not your message event

shrewd field
#

i know

#

do i need to put it there

tawny lava
#

omfg

#

I said in your message event

earnest phoenix
shrewd field
#

ok

#

i didnt read it

#

guys

#

deadlyfire and lizard

#

how do i make a bot say

#

"playing in 444 servers"

#

hello

tawny lava
#

read the docs

shrewd field
#

i read

tawny lava
#

you can't just expect people to hold your hand through everything

shrewd field
#

i know

#

this is my code

#

but it doesnt show

shrewd field
#

lizard

#

i tried these all of them dont work

#

hello

#
client.user.setGame("hello");
client.user.setPresence({game: "Hello"});
client.user.setPresence("hhee")
#

anyone

languid dragon
#

If you're running it from your localhost i think there's a bug with it and sometimes it wont set the game

shrewd field
#

yes

#

i am

languid dragon
#

if you've read the documentation corrently and followed it, there should be no issue

shrewd field
#

i read it

languid dragon
#

otherwise we're not here to baby-step you through development of a discord bot

shrewd field
#

what do u mean by localhost

languid dragon
#

Deni.

shrewd field
#

i did

#

ken

#

can u tell me why

#

wont work

#

client.user.setGame("hello"); client.user.setPresence({game: "Hello"}); client.user.setPresence("hhee")

bitter sundial
#

you're probably getting rapelimited for doing it 3 times

languid dragon
#

I did tell you, i just told you?

shrewd field
#

told me what

next path
#

I've never been rapelimited @bitter sundial

languid dragon
#

If you're running it from your localhost i think there's a bug with it and sometimes it wont set the game

shrewd field
#

ok

#

wait

#

i will check if it is from the localhost

#

so

#

i need to host it from where so it will work

#

ken

languid dragon
#

Don't take my complete word on this, because i'm not 100% sure, but i know i had the same issue a while back with it not setting the game unless i was hosting on a VPS

shrewd field
#

ok\

languid dragon
#

Since then my issue didn't persist and i was able to on my localhost, its possible that you may need to update Discord.JS

uncut slate
#

"on your localhost"?

#

that doesn't really make a difference, dapi doesn't connect with localhost

languid dragon
#

honestly im clueless, but i had the issue only when running the bot from my system so

#

¯_(ツ)_/¯

uncut slate
#

then you had a different version of D.js likely

#

or your machine had issues

languid dragon
#

possibly

#

i don't have the problem anymore but i've updated everything since, so yeah

uncut slate
#

=<11.1 is known to have a fucked setGame

shrewd field
#

how can i update d.js

#

and know what version i have

restive silo
#

npm update

woven drum
#

npm install discord.js

restive silo
#

^ works also

shrewd field
#

ok

woven drum
#

my code does not update all modules

shrewd field
#

how can i update all

woven drum
#

npm update

earnest phoenix
#

shrewd field
#

ok

#

thx

#

hey

#

why does this say

#

message undifined

restive silo
#

you cant define message outside the message function

shrewd field
#

what

#

yuk

#

u mean another listener

#

ok

languid dragon
#

There is so much wrong with that screenshot

restive silo
#

yep

languid dragon
#

I think you should look for discord.js examples and follow what they do

restive silo
#

you must put this inside the ```js
message => {

}

shrewd field
#

hh

#

ohh

#

ok

#

with the ```js
const

restive silo
#

and your setDescription looks also weird

languid dragon
#

Also everything in set description won't work

shrewd field
#

why

languid dragon
#

Because it doesn't make sense

shrewd field
#

how

languid dragon
#

.setDescription isn't a message

shrewd field
#

i am trying to make a ping command

#

ok

#

how can i do it

earnest phoenix
#

Ping easy

languid dragon
#

Well you're way over complicating it

shrewd field
#

with out description

earnest phoenix
#

For JavaScript it is

shrewd field
#

i know how ping

#

but i want it with embed

earnest phoenix
#

I cant embed

languid dragon
#

Well learn how to do embeds

shrewd field
#

i know how

#

but the rich embed

languid dragon
#

Use the JSON I showed you before

shrewd field
#

waht json

languid dragon
#

No.

shrewd field
#

what

languid dragon
#

I've shown you so many times

shrewd field
#

the

#
message => {

}```
#

this

#

^^^^^^^

#

ken

languid dragon
#

Remove all that shit for the ping command and try this
message.channel.send ({embed:{description:"test embed"}});

shrewd field
#

ok

#

this is what i got

#

ken

#

it is an embed

languid dragon
#

Oh surprise

#

Now use the embed visualizer I sent you the link to before

tawny lava
#

lol

shrewd field
#

huh

languid dragon
#

If u did that in the first place... 👀

shrewd field
#

i didnt

#

ken

languid dragon
#

I know you didnt.

shrewd field
#

ken

#

see

#

this is error for code

languid dragon
#

You don't need that anymore ffs

shrewd field
#

need what

#

look ken can i ask u somethin very clear

tawny lava
#

remove the dd in RichEmbed()

languid dragon
#

He don't even need the richembed anymore :/

shrewd field
#

look ken and lizard

#

i want to make this code

languid dragon
#

Well stop asking us to do it for you 👀

shrewd field
#

i didnt

#

look ken

#

wait

#

i am trying to make the ping command that i have get sent in an embed form

#

in the richembed class

#

where could i put this

#
message.channel.send("Ping?").then(m => m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API latency is ${Math.trunc(client.ping)}ms!`));```
languid dragon
#

There's obvious things you CAN and CAN'T do in Javascript, most of the issues you come to us with are super simple issues implying you haven't the smallest idea of what Javascript is and that's quite frustrating because majority of the answers we give you are correct and you seem to ignore them

shrewd field
#

no i dont

languid dragon
#

I've shown you how to create an embed using the embed visualizer and how to actually put that to use

shrewd field
#

ok i know

#

but my question is

#

where in the rich embed class i can put the code above

#

exapmle

languid dragon
#

It's no different to how you have it there but you're replacing everything inside send () with the embed json

#

You don't need

#

Omg

shrewd field
#

dont need the rich embed

languid dragon
#

Deni

shrewd field
#

i could use the regualr embed

languid dragon
#

Just use the JSON embed

shrewd field
#

which part

languid dragon
#

Functions do not go inside the json and do not go in embeds

shrewd field
#

i can use for this code

#

ok

#

so where can it go

languid dragon
#

Deni you need to learn the basics of code again

#

The function goes where the command is called

#

The embed goes inside the message you wish to send to the discord channel

#

Aka send ()

shrewd field
#

how can i do this

prime cliff
#

Command(Test)
{
Function 1
Embed New Embed{
}
Function 2
SendMessages("", false, embed.build())
}

languid dragon
#

With the embed visualizer I gave you the link to

shrewd field
#

ok how can i do

languid dragon
#

Goodnight.

shrewd field
#

huh

#

why

languid dragon
#

Because you're ignoring me and not taking anything I say into consideration, I've explained how to do things from from the ground up in the most simplistic form I can possibly think of, yet you still persist to have people explain everything, most of, almost all problems you come to this discord server could be fixed by a quick Google search or simply knowing Javascript with common sense and logic

shrewd field
#

ok

languid dragon
#

Also this isn't a support group for learning how to code in JS I think you will find more fulfilled answers on the official documentation discord servers, or servers dedicated to teaching people how to code or deal with coding issues

shrewd field
#

ok

#

i will take what u said into consederation

earnest phoenix
#

lel

#
const Discord = require('discord.js')
exports.run = (client, message, args) => {
    var user = message.mentions.users.first()
    var member = message.mentions.members.first() || message.member
    if (!message.guild.member(message.author).hasPermission('MANAGE_MESSAGES') && message.author.id !== '258970604005359616') return message.reply('Insufficient Permissions!').catch(console.error);  
    var reason = message.content.split(' ').slice(2).join(' ') 
    var modlog = message.guild.channels.find('name', 'mod-log')    
    var muted = message.guild.roles.find('name', 'muted').id || message.guild.roles.find('name', 'Muted');

    if (!user) return message.reply('Please include a user to warn!');    
    if (!reason) return message.reply('Please include a reason!');
    if (!modlog) return message.reply('Please create a mod-log channel!');
    if(!muted) return message.reply('There is currently no muted role. I will create one now!')
    
        member.addRole(muted);

    var embed = new Discord.RichEmbed()
    .setAuthor('Mute Action')
    .setDescription(`${user} has been muted by ${message.author}!`)
    .setColor('#AF82CD')
    .setFooter(`This user has been muted on the ${member.guild} Server!`)
    .setThumbnail(user.displayAvatarURL)
    .addField('User:', user.tag, true)  
    .addField('Guild', message.guild, true)
    .addField('Moderator:', message.author.tag, true)  
    .addField('Reason:', reason, true)  

    modlog.send(embed)
    message.channel.send(`${user} has been muted by ${message.author}!`)
    user.send(embed)

}
median lintel
#

wtf

earnest phoenix
#

xD

#

its a muted command

#

it adds the role

#

but it doesnt work the way i need

next path
#

What's the problem?

prime cliff
#

Urm it says that if there is no muted role it will create one but there is no function to create a role 😛

earnest phoenix
#

um

#

why does it mute the sender if there is no mention provided?

#

dafuq

#

i fixed that

#

xD

#

that was an error

#

lol

#

@prime cliff how can i create a role

#

thats the thing that i was asking

#

xD

#

and how to set perms for that role too

prime cliff
#

🤦

#

read the discord.js docs

earnest phoenix
#

i did

#

xD

prime cliff
#

Then you really shouldnt be stuck on creating a simple mute role

earnest phoenix
#

role.create() ?

#

i only see role.delete()

#

.

keen anvil
#

also you have to sign up first

inner jewel
#

lul

keen nest
#

I'm doing ot

inner jewel
scenic crest
#

@inner jewel doesnt Discordgo supports clients

#

cuz u can literally make applications with discordgo

inner jewel
#

?

scenic crest
#

"Currently, the only client implementation is for JDA."

inner jewel
#

this is for bots to be always online

#

and reboot without losing events

#

reboot without stopping music from playing

#

basically reboot without killing mWS

scenic crest
#

ahhh

#

sounds difficult

inner jewel
#

making clients is actually easy

#

you just need to hook the websocket client for the lib

#

and make it send and receive to/from rabbit

wanton nova
#

ok

earnest phoenix
#
  console.log(`Ran 'help' command successfully`)
  msg.channel.send(`Loading invite link...`)
  m.edit(`Invite me with this: ${keys.oauth}`)
},``` Why does it crash my bot?
#

Plz @ message me

inner jewel
#

what is "m"

deft garnet
#

Ya

earnest phoenix
#

msg

inner jewel
#

"m.edit()"

earnest phoenix
#

m.edit is surposed to edit the message

inner jewel
#

isn't m undefined?

earnest phoenix
#

It works on music it just wont work on other commands

inner jewel
#

you don't have a variable named m on the scope

#

¯_(ツ)_/¯

earnest phoenix
#

Could i just do return m.edit('Test')

inner jewel
#

no

#

because m is undefined

earnest phoenix
#

...

#

How do i define it then

inner jewel
#

replace m with msg

earnest phoenix
#

I did butbit dont work

uncut slate
#

top 10 anime betrayals of all time

#

@earnest phoenix What error did it return?

earnest phoenix
#

I dont say a error it just show like all the null s**t i dint want to know

uncut slate
#

Uhhh..

#

so what's the issue then

inner jewel
#

.-.

earnest phoenix
#

m.edit and msg.edit crashes my bot

restive olive
#

did u async/await it?

earnest phoenix
#

Maybe not

restive olive
#

then there's yo problem

earnest phoenix
#

async m = await m.edit ('test')

#

?

restive olive
#

nu

#

u wanna await the msg the your sending first

#

kay

#

uhm

earnest phoenix
#

So wait the first message and the m.edit normal

restive olive
#

uhh

#

nu

#

await

#

not wait

earnest phoenix
#

Yea i just said it wrong

restive olive
#
bot.on('message', async(message) => {
        if (message.content.startsWith('ping')) {
            var loli = await message.channel.send('pinging...');
            loli.edit('Pong!!!');
        }
    });
``` thats how u do it
#

well if your using discord.js

earnest phoenix
#

loli?

restive olive
#

shhhh

earnest phoenix
#

xD

#

ok

#

But its client.on for me

restive olive
#

kay

#

just async your event

#

like i did

earnest phoenix
#

@restive olive lets see if the await works go into #commands

restive olive
#

kay

earnest phoenix
#

Say "Syntax Error: Unexpected identifier"

restive olive
#

LOL

#

where did u put the async?

earnest phoenix
#

At the start butbits the m = await the m part

restive olive
#

wut

#

nu

#

wat api u using

#

d.js

earnest phoenix
#

Ye

restive olive
#

d.js?

earnest phoenix
#

Node

#

(D.js)

restive olive
#

kay

#

uhm

#

u know your message event right

earnest phoenix
#

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

#

?

restive olive
#

ya

earnest phoenix
#

Yes

restive olive
#

y did u space the client.on

#

anyways

#

async it

#

like

#
client.on('message', async msg => {
});
earnest phoenix
#

Yes

restive olive
#

did u do that?

earnest phoenix
#

Yes but it has stuff in it for perms ans dm commands

restive olive
#

kay

#

all u had to do is add the async next the msg

#

now

earnest phoenix
#

Wat

restive olive
#

all u had to do is add the async next the msg?

earnest phoenix
#

Do you know were i can put a command cool down in the message event?

restive olive
#

uh

#

right after u check the prefix i guess

earnest phoenix
#

Thats not in my message event

restive olive
#

wut

#

i meant like did u async your msg event

earnest phoenix
#

if (!msg.content.startsWith(keys.prefix)) return;?

#

Now i just have to figure out how to add it :|

median lintel
#

i wanna see what the mods rated my application

#

oliy pls

restive olive
#

kay

#

gl

median lintel
#

wrong channel

weary shoal
trim steppe
#

do you need help to change it to eris

#

:^)

weary shoal
#

If you want to

#

I don't have time to

trim steppe
#

eh there's probably no advantage to doing so

#

lol

keen nest
#

I swear.

#

Programing in voice connections is a bitch

jagged plume
#

oh you are using a custom lib lul

keen nest
#

Have been

#

Just haven't gotten around to do doing voice

#

Haven't needed it

#

Just finally finishing the lib up

earnest phoenix
#

anybody python here?

#

@earnest phoenix ```py
allowed_values = ['memes', 'stuff', 'lul']
b = 'memes'

INCOMING PSEUDOCODE

if b has any value allowed_values:
...

how would I do this?
#

hlepy me

#

lul

#

should I use any()

#

or if x in y:

weary shoal
#
allowed_values = ['memes', 'stuff', 'lul']
b = 'memes'

if any(b in s for s in allowed_values):
    # Do stuff```
#

I think

earnest phoenix
#

🤔

#

why not just if b in s

#

@weary shoal ^

weary shoal
#

idk

#

¯_(ツ)_/¯

#

I don't do python I do google

earnest phoenix
#

o so you don't do py

#

:C

abstract mango
#

@earnest phoenix

allowed_values = ['memes', 'stuff', 'lul']
b = 'memes'

if b in allowed_values:
    ...

this would (probably) work

untold python
#

Hi I’m new here

#

Sorry if I disturbed you..

earnest phoenix
#

?

#

@abstract mango it does

#

I'm using it for token verification in flask

#

because I'm bad

neat falcon
#

uh oh codacy

weary lark
jagged plume
#

owo

weary lark
#

first time i seen that error

#

and it will not stop

#

I need to find another hoster

#

i think

scenic crest
#

server host?

weary lark
#

heroku

#

idk who to go with

#

if this keeps happenign

stone kiln
#

i host it on my own laptop 😂

weary lark
#

i think heroku might of upgraded their servers or something

#

;-;

#

can someone suggest a free hosting service please?

stone kiln
#

your own pc/laptop 😂

scenic crest
#

free hosting smh

#

I know some REALLY cheap vps/dedi providers

weary lark
#

Ok.

#

@stone kiln my internet sucks tho. i live in the middle of nowhere in australia

#

lmao

stone kiln
#

lol

scenic crest
#

which is exactly why you should get a paid host

stone kiln
#

my internet is good enough for me to host a website + 4 bots 😂

weary lark
#

so start up a patreon bot and get people to donate

stone kiln
#

SellOutBot 😂

weary lark
#

lots of bots have that option tho

stone kiln
#

mine doesn't just yet

weary lark
#

dabbot, mee6, dyno + more

#

same @stone kiln

scenic crest
#

I have a patreon too !!!

stone kiln
#

i have one but it was for other stuff

shrewd field
#

does anyone know why the error

scenic crest
#

your inline boolean for an embed is not a boolean

shrewd field
#

it is

#

look

languid dragon
#

wow

tawny lava
#

lol

shrewd field
#

lol

#

lizard

#

i have this kick code but it only does the part which says mention a memeber it doesnt kick

tawny lava
#

Idk javascript is for nubs

languid dragon
#

I already told u how to do it Deni 👀

shrewd field
#

huh

#

not kick

#

dude

languid dragon
#

meant the thing vefore

shrewd field
#

boolean

languid dragon
#

y dont u make the commands urself

shrewd field
#

cause

#

i dont know how to do them

languid dragon
#

thought u knew javascript tho

shrewd field
#

i do know js

#

but not to the admin commands extent

languid dragon
#

👀 well if u read the documentation it should be ezpz

shrewd field
#

does the docs have kick

#

command

languid dragon
#

ya

shrewd field
#

and ban and mute and warn

languid dragon
#

the docs has evertything>?/?

shrewd field
#

all the above

#

ok

#

this docs

languid dragon
#

you can only

#

yes

#

you can only kick a guildmember

#

not a user

shrewd field
#

ok

shrewd field
#

ok thanks

#

does the docs have code

#

the code for the command

#

or what

languid dragon
#

if you know js u dont need code

#

its a guildmember

shrewd field
#

ok

#

just asking

languid dragon
#

you get guildmember from client.users.get("id",useridhere);

#

or something like that

tawny lava
#

get is just("id")

#

get("id")

shrewd field
#

ok

supple ocean
#

hey guys anyone know how to make reactions in python 3.6?

#

Tried making coinflip

#
        choice = random.randint(1,2)
        if choice == 1:
            await client.add_reaction(message, '🌑')
        if choice == 2:
            await client.add_reaction(message, '🌕')```
#

says add_reaction doesn't recognized or something

#

anyone?

scenic crest
#

well idk about the actual thing but reactions is risky since the bot may not have perms to react

#

have you checked the docs?

languid dragon
#

duscird is great

scenic crest
#

@supple ocean have you got the exact error message?

languid dragon
#

what that tongue do

supple ocean
#

one minute!

languid dragon
#

lowkey laughed so hard at my joke i coughed on my own saliva

supple ocean
scenic crest
#

hmm idk

supple ocean
#

ok

shrewd field
#

hey

scenic crest
#

hi

shrewd field
#

is this the correct form of doing a kick command

#

and hi

#
client.on("guildMember", guild => {
  console.log(`I kicked ${client.guilds.size}`);
  //param {string} [reason] Reason for kicking user
//  * @returns {Promise<GuildMember>}
//  */
 kick(reason) {
   return this.client.rest.methods.kickGuildMember(this.guild, this, reason);
}
});```
languid dragon
#

no

#

wwhos 420

#

m 420

inner jewel
#

kek

scenic crest
#

xD

shrewd field
#

i used the doccs

#

can someone help

inner jewel
#

@shrewd field no

tawny lava
#

You obviously didn’t

inner jewel
#

that code isn't even valid

#

lul

tawny lava
#

If you did you would’ve noticed that there is no event called guildMember

inner jewel
#

and just pasting lib code won't work

supple ocean
#

Oh btw

#

How do I delete messages? xd

#

Ill try c hecking out brb

uncut slate
#

depends on your lib

supple ocean
#

py

#

3.6

uncut slate
#

that's not your lib

scenic crest
boreal jasper
#

if i want to do a nsfw command should i do

if(!TextChannel.nsfw) return;

?

trim steppe
#

I believe that should be adequate

#

I will check the docs

bitter sundial
#

you should tell them to go to a nsfw channel instead

boreal jasper
#

its in the TextChannel class

earnest phoenix
#

lol

trim steppe
#

Yea

earnest phoenix
#

@boreal jasper I can show ya my nsfw filter if you'd like, you're almost right

#
if not context.message.channel.name.startswith('nsfw'):
            await self.bot.say("`This channel isn't NSFW, dummy! "
                                "Please make a room that starts with 'nsfw'. `")
        else:
boreal jasper
#

i already made the filter

earnest phoenix
#

oh oki

#

thought I'd toss in what I use ^^

boreal jasper
#
if(!message.channel.nsfw) {
    message.channel.send("Wow, your not in a NSFW channel daddy-o!");
};
earnest phoenix
#

ooooo

#

I'll try to incorporate that into mine c:

#

I'm too dumb to tell if yours is py or not

boreal jasper
#

i use js

earnest phoenix
#

oki

#

that was my second guess hehe

boreal jasper
#

hihi

earnest phoenix
#

ouo

boreal jasper
#

-bots @earnest phoenix

gilded plankBOT
#
Poii#6913
Bots

@snow parcel

boreal jasper
#

-botinfo @snow parcel

gilded plankBOT
#
Bot info
ID

321559276252299264

Username

PoiiBot

Discriminator

3146

Short Description

PoiiBot brings to you lots of fun features with constant updates/development being performed.

Library
Prefix

p!

Upvotes

21

Server Count

100 Servers

Owner(s)

@modern folio

Links
earnest phoenix
#

c:

boreal jasper
#

p!help

#

wait

#

wrong channel

earnest phoenix
#

xD

tawny lava
#

I'm bored

earnest phoenix
#

Hi bored I'm poii

tawny lava
#

where my ban perms

#

someone ban this filth

earnest phoenix
#

:(((

#

-cries-

woven drum
#

lol

#

@tawny lava are you happy?

tawny lava
#

wat

woven drum
#

lol

#

no happy lizarde

scenic crest
#

@earnest phoenix hey

#

can we talk here

#

@earnest phoenix

earnest phoenix
#

Oh okay

scenic crest
#

o/

#

thanks

earnest phoenix
#

My bot is a ghost now

#

.>

scenic crest
#

yeah

earnest phoenix
#

I closed studio

#

And its still running

#

@scenic crest sure

scenic crest
#

it takes approximately 30 seconds

#

for it to be offline

earnest phoenix
#

Oh

#

Okie

#

xD

scenic crest
#

are you interested to know why or?

earnest phoenix
#

?

#

Sure!

scenic crest
#

so pretty much discord sends a heartbeat every 30 ish secs

earnest phoenix
#

Ah

#

Understood

scenic crest
#

and then the client (d.js) must return a heartbeat ack

#

saying "hey, I've received it"

earnest phoenix
#

to make sure it's alive

scenic crest
#

if it doesn't, it presumes it's offline

#

so this is why it takes up to 30 secs

#

also, printing guilds to your game is a bad idea

earnest phoenix
#

Oh wow interesting!

#

?

scenic crest
#

because game has ratelimits

#

you can only change game x time in y minutes

earnest phoenix
#

429

#

error 429

#

Oh

scenic crest
#

418

earnest phoenix
#

too many requests

sinful meadow
#

Lie @scenic crest

earnest phoenix
#

429

#

it's 429

sinful meadow
#

That is a lie

earnest phoenix
#

Wait

sinful meadow
#

It doesnt have a rate limit

earnest phoenix
#

I actually think that it's faster than 30 seconds, maybe 15 or 10

#

@sinful meadow yes it does actually

scenic crest
#

it does lmao

earnest phoenix
#

yes it does

sinful meadow
#

if you do it to fast it will

earnest phoenix
#

Wait

#

Can i have my bot on a repeat reset timer?

#

@sinful meadow yes, bc that is how a rate limit works

scenic crest
#

x times in y seconds

#

that's what I said

#

lol

earnest phoenix
#

So every x min it resets?

#

Oh lol

#

wdym reset

#

Like

scenic crest
#

yeah it will reset eventually

earnest phoenix
#

The bot restarts

scenic crest
#

the ratelimit will "run out"

earnest phoenix
#

oh

#

So the status can change

#

OH

sinful meadow
#

Im doing mine every 10 seconds @earnest phoenix

scenic crest
#

nah its; time based

earnest phoenix
#

you dont need to restart the bot to change the status

#

Oh so it changes every 30 sec!

scenic crest
#

to be on the same side; print out guilds to the console

#

that way there prolly won't be any issues

earnest phoenix
#

I printed out guilds to the console lel

scenic crest
#

ah good

earnest phoenix
#
setInterval(() => {
    bot.user.setGame("Playing in " + bot.guilds.size);
}, 1000 * 60 * 2); // 2 minutes```
#

there

#

put that somewhere

#

Oh wow thx

#

Okay

#

Inside onrun?

#

not in the ready event though

scenic crest
#

spoonfeeding

earnest phoenix
#

Oh ok

#

dont put it there

sinful meadow
#

Forbidden lmao

earnest phoenix
#

Thanks! Lel

#

😃

#

bc if the ready event calls more than once, then it will create like 10 timers doing the same thing

#

so ya

#

¯_(ツ)_/¯

#

Oh lol rip

sinful meadow
#

Im setting my game every 10 seconds @earnest phoenix

scenic crest
#

does ready call when you RIP from the socket and reconnect again

#

ok that's good for you null, honestly

earnest phoenix
#

@sinful meadow The rate limit is quicker

scenic crest
#

but you can't change a game every seconds because that'll ratelimit

earnest phoenix
#

like 5/5 seconds

sinful meadow
#

Yea

earnest phoenix
#

that is limit

#

every endpoint has a limit

#

Okay

#

except some basic stuff

sinful meadow
#

I dont go below 10sc

earnest phoenix
#

or API abuse

#

🔨

scenic crest
#

the gist of it is that there are ratelimits

earnest phoenix
#

Okay

#

yes

#

rate limits reduce how fast a bot can do things

#

Aw

#

to prevent abuse

#

Oh!

#

so ya

#

Like spambot prevention

#

Lel

sinful meadow
#

Just yell if you need any help @earnest phoenix

earnest phoenix
#

yea

#

@sinful meadow ALRIGHT!

#

XD

scenic crest
#

yeah pretty much

sinful meadow
#

lel

earnest phoenix
#

Wait

#

like when you try spamming messages very fast in a channel, and it takes a couple seconds to actually send, that is a rate limit @sinful meadow

#

Okay sorry to bug you guys lol

#

oops wrong mention

scenic crest
#

nws I have no life

earnest phoenix
#

But is there an onJoinGuild DM send?

sinful meadow
#

Yea @earnest phoenix lel

earnest phoenix
#

Ik i saw "createDm"

scenic crest
#

uhhh

#

wdym

earnest phoenix
#

hmm

#

I see

#

But i kinda want to make it so

sinful meadow
#

guildMemberAdd @earnest phoenix event

earnest phoenix
#

The bot joins

#

@sinful meadow no

#

no

#

It DMes everyone on the server

#

dont listne to him

sinful meadow
#

-_-

earnest phoenix
#

Like "Hello!"

#

@earnest phoenix dont do that either

scenic crest
#

gonna stop you right there

earnest phoenix
#

Oh

median lintel
#

dont do that

scenic crest
#

don't DM everyone

earnest phoenix
#

Okay

scenic crest
#

or the owner

earnest phoenix
#

Okie

sinful meadow
#

He wants to dm a user on a join

earnest phoenix
#

Ye

scenic crest
#

it's annoying

sinful meadow
#

Im just helping

#

lmao

scenic crest
#

but ye

earnest phoenix
#

Oh sorreh

scenic crest
#

technically you could do it

#

but don't

#

or dblBanne

earnest phoenix
#

Ill just set it to like a repeat

#

So

#

If someone says ---dm(my bot prefix)

scenic crest
#

ye

earnest phoenix
#

Then it DMes them lol i can just have it do that

scenic crest
#

that works

earnest phoenix
#

But how would i go about doing that >.>

#

@earnest phoenix ```js
bot.on("guildCreate" (server) => {
// the bot joined a server, do something with 'server' variable
});

bot.on("guildDelete" (server) => {
// the bot left a server, only basic data can be used from 'server' variable (I think)
});```
@earnest phoenix

#

oops

#

Woah

#

Okay

#

two pings

sinful meadow
#

message.author.send('@set is a cunt')

earnest phoenix
#

lol

sinful meadow
#

@earnest phoenix

#

message.author.send('@set is a cunt')

median lintel
#

msg.author.send("shit")

sinful meadow
#

;p

earnest phoenix
#

that is not how mentions work

scenic crest
#

rude

earnest phoenix
#

but eh

#

Wait

sinful meadow
#

Ik lmfao @earnest phoenix

earnest phoenix
#

lol

scenic crest
#

@reef stump

earnest phoenix
#

So "server" is the message?

sinful meadow
#

It was a joke

earnest phoenix
#

@earnest phoenix no, those events are for when the bot joins/leaves a server

#

i think that is what you meant

#

OH

#

Okay

scenic crest
#

js is fascinating

earnest phoenix
#

Okay yeah that works lol

#

ya

scenic crest
#

the way events and stuff work

#

quite terrible and I'd never use it but still interesting

median lintel
#

so u can make it log when ur bot leaves/join a server

earnest phoenix
#

Okay wait

#

Wut is the DM code?

scenic crest
#

or handle data

sinful meadow
#

message.author.send('@set is a cunt')

earnest phoenix
#

no

#

not what he meant

#

@earnest phoenix that is actually under the message event

sinful meadow
#

-facepalms-

earnest phoenix
#

Okaaayyyy

median lintel
#

this is the longest time we heled out a noob

scenic crest
#

hey @earnest phoenix here is your best friend, the manual

earnest phoenix
#

Lmao

earnest phoenix
#

OML YES

#

THX

#

XDDDDDD

#

@earnest phoenix js bot.on("message", (msg) => { if (msg.channel.type === "dm") { // the author sent this message via direct message, do something special } else { // this message was sent in a regular channel } });

median lintel
#

lmao

scenic crest
#

give it a read if you're stuck before asking other people, often it's documented in here

earnest phoenix
#

^

#

Alright so i read the manual

median lintel
#

*docs

scenic crest
#

no, manual

median lintel
scenic crest
#

RTFM has a better ring than RTFD

#

😉

earnest phoenix
#

bot.id("bot DM channel ID here")

median lintel
#

its the docs tho

scenic crest
#

shh

earnest phoenix
#
    message.reply("Hello! I Am a bot!");
});```
#

This is what i have so far lol

#

Nvm changed it

#
    bot:message("Hello! I Am a bot!");
});```
sinful meadow
#

:? @earnest phoenix

trim steppe
#

comma

earnest phoenix
#

Ohhhhh wait

trim steppe
#

wait what lang is this

sinful meadow
#

js

trim steppe
#

js right?

sinful meadow
#

Yea

trim steppe
#

yea this ain't lua

earnest phoenix
#

OH WAIT

#

Okay i get this now

inner jewel
#

lul

#

bot:message

earnest phoenix
#

Lmao

#

Just realised thats not how that works

#

This guide helps XD

sinful meadow
#

the best command is this @earnest phoenix ```js
message.guild.channels.map(e => e.delete())

#

Dont actually use that btw ^^^^

noble hazel
#

the single best line in all of python programming is

#
[self.loop.create_task(c.delete()) for c in self.get_all_channels()]
sinful meadow
#

lel

inner jewel
#
shards.stream().map(Shard::getJDA).map(JDA::getGuilds).map(Guild::getMembers).filter(this::test).forEach(this::banne);

boolean test(Member m) {
    return m.getGuild().getSelfMember().canInteract(m);
}

void banne(Member m) {
    m.getGuild().getController().ban(m, 7).queue();
}```
sinful meadow
#

Fuck java @inner jewel

#

lmao

inner jewel
#

fuck js

sinful meadow
#

java makes shit more complex

inner jewel
#

full ripoff of java

#

but made worse

scenic crest
#

oh my god natan why

inner jewel
#

and single threaded

sinful meadow
#

Yea @scenic crest

#

plez

#

Natan is killing me

scenic crest
#

no I was whying at his code

sinful meadow
#

im dieing

scenic crest
#

java is generally better than jS

sinful meadow
#

Ik

scenic crest
#

lets face it :^)

inner jewel
#

@scenic crest method ref abuse

#

:^)

scenic crest
#

hey I have an idea

inner jewel
#

could have used flatmap tbh

sinful meadow
#

But java makes shit more bad ig i dont really know never messed with it @inner jewel

inner jewel
#

and a single flatmap call

sinful meadow
#

i cant fully say its bad

inner jewel
#

shards.stream().flatMap(s->s.getJDA().getGuilds().stream().flatMap(g->g.getMembers().stream()))

sinful meadow
#

Cant you make like a control panel and shit with java @inner jewel

inner jewel
#

yes

sinful meadow
#

Like a tiny form window

inner jewel
#

applets

sinful meadow
#

saying like type in a chat or something

inner jewel
sinful meadow
#

I have no clue lmao

inner jewel
#

this is made fully in java

scenic crest
#
public void banne(Long l) {
    String id = String.valueOf(l);
    guild.getController().ban(id, 0, "u suck").complete();
    banne(++l);
}```
#

what could go wrong

earnest phoenix
#

Lmao ban code

sinful meadow
#

@inner jewel

inner jewel
#

@scenic crest ban endpoint can be used as a retrieveUserById

#

:^)

sinful meadow
#

EZ MASS BAN

#
message.guild.members.map(e => e.ban())
earnest phoenix
#

I got a thing going

#

Oml lmao

sinful meadow
#

ahhahahhah

inner jewel
#

@sinful meadow what about perm checks

earnest phoenix
#

Thats basically how to create a spambot lol

sinful meadow
#

I cant easy do that @inner jewel

scenic crest
#

hey I have a good idea let's .forEach over all maps because it uses lambdas and lambdas are cool

inner jewel
#

msg getGuild getMembers forEach _=>_.ban().queue()

#

in scala

#

:^)

sinful meadow
#

😛

earnest phoenix
#

Lol am i the only one that uses vcs

sinful meadow
#

vcs?

#

@earnest phoenix

earnest phoenix
#

Wait

#

Im using commando

#

XD

sinful meadow
#

Ew

#

ew

#

ew

#

ew

earnest phoenix
#

?

#

Nononoonnoo!

sinful meadow
#

Why commando

earnest phoenix
#

Discord commano lol

#

*commando

sinful meadow
#

I know

#

That is ew

#

ew

#

ew

#

ew

earnest phoenix
#

Lol k

sinful meadow
#

I wanna die now

scenic crest
#

I mean it might be good for beginners

#

not everyone can straight up write a good command handler yk

sinful meadow
#

#premadeshit @scenic crest

earnest phoenix
#

Sheet

#

Do i need to re-do my entire bot now?

sinful meadow
#

You dont have to

scenic crest
#

if you wanna

sinful meadow
#

I just dont like commando

scenic crest
#

^

sinful meadow
#

because it has pre made shit

scenic crest
#

I've never used a java command environment

#

I've seen one

sinful meadow
#

Coding your own can learn from your mistakes @earnest phoenix

scenic crest
#

but I don't like them

#

they're not flexible enough

#

nor do they account for custom prefixes

#

I mean, I'm for making your own deffo

inner jewel
#

kek

scenic crest
#

it's great to learn and stuff

inner jewel
#

my command handler is most likely the greatest overcomplication ever done

scenic crest
#

but if it's too difficult then there's no point in it

#

ASMEventBus

inner jewel
#

no

#

it uses asm

#

but not an event bis

#

bus*

#

:^)

scenic crest
#

that was overcomplicated

inner jewel
#

not really

#

was just copy paste

earnest phoenix
#

Well

#

Considering im only 12 years old i think commando will work lmao

#

Im a noob at this xD

scenic crest
#

point

earnest phoenix
#

Hey uh guys?

sinful meadow
#

Uh yea?

earnest phoenix
#

Im getting a deprecation warning

scenic crest
#

ah

earnest phoenix
#

"Permissionshas has been deprecated"

sinful meadow
#

That means a piece of your code is out of date @earnest phoenix

scenic crest
#

deprecated means "dis code is bad dont use it, it will be removed soon"

earnest phoenix
#

Oh sheet

#

It says to use "hasPermissions"

scenic crest
#

usually there are alternatives to that method listed in the docs

sinful meadow
#

send me your code @earnest phoenix

scenic crest
#

ah

#

in which case

#

use that

earnest phoenix
#

But

sinful meadow
#

ill fix it for ya

earnest phoenix
#

I would need to replace

#

All of the commando code

sinful meadow
#

No

#

Only the commands

earnest phoenix
#

That sets my user ID as owner

sinful meadow
#

that require permissions

earnest phoenix
#

Ye

#

Oh

#

OH

#

Okay

sinful meadow
#

send me the code you have @earnest phoenix

earnest phoenix
#

First half

#

const { stripIndents, oneLine } = require('common-tags');
const Command = require('../base');

module.exports = class PrefixCommand extends Command {
constructor(client) {
super(client, {
name: 'prefix',
group: 'util',
memberName: 'prefix',
description: 'Shows or sets the command prefix.',
format: '[prefix/"default"/"none"]',
details: oneLine If no prefix is provided, the current prefix will be shown. If the prefix is "default", the prefix will be reset to the bot's default prefix. If the prefix is "none", the prefix will be removed entirely, only allowing mentions to run commands. Only administrators may change the prefix. ,
examples: ['prefix', 'prefix -', 'prefix omg!', 'prefix default', 'prefix none'],

        args: [
            {
                key: 'prefix',
                prompt: 'What would you like to set the bot\'s prefix to?',
                type: 'string',
                max: 15,
                default: ''
            }
        ]
    });
}

async run(msg, args) {
    // Just output the prefix
    if(!args.prefix) {
        const prefix = msg.guild ? msg.guild.commandPrefix : this.client.commandPrefix;
        return msg.reply(stripIndents`
            ${prefix ? `The command prefix is \`${prefix}\`.` : 'There is no command prefix.'}
            To run commands, use ${msg.anyUsage('command')}.
        `);
    }
scenic crest
#

aaaaa

#

code block please :((

earnest phoenix
#

Second half

#
        if(msg.guild) {
            if(!msg.member.Permissionshas('ADMINISTRATOR') && !this.client.isOwner(msg.author)) {
                return msg.reply('Only administrators may change the command prefix.');
            }
        } else if(!this.client.isOwner(msg.author)) {
            return msg.reply('Only the bot owner(s) may change the global command prefix.');
        }

        // Save the prefix
        const lowercase = args.prefix.toLowerCase();
        const prefix = lowercase === 'none' ? '' : args.prefix;
        let response;
        if(lowercase === 'default') {
            if(msg.guild) msg.guild.commandPrefix = null; else this.client.commandPrefix = null;
            const current = this.client.commandPrefix ? `\`${this.client.commandPrefix}\`` : 'no prefix';
            response = `Reset the command prefix to the default (currently ${current}).`;
        } else {
            if(msg.guild) msg.guild.commandPrefix = prefix; else this.client.commandPrefix = prefix;
            response = prefix ? `Set the command prefix to \`${args.prefix}\`.` : 'Removed the command prefix entirely.';
        }

        msg.reply(`${response} To run commands, use ${msg.anyUsage('command')}.`);
        return null;
    }
};
#

This is the prefix command

scenic crest
#

btw you can do
```javascript
// code goes here
```

earnest phoenix
#

Ik lol

scenic crest
#

for syntax highlighting

earnest phoenix
#

OH

scenic crest
#

yeah

#

try it

sinful meadow
#

@earnest phoenix

#
Replace 
if(!msg.member.Permissionshas('ADMINISTRATOR')

With
if(!msg.member.permissions.has('ADMINISTRATOR')
earnest phoenix
#

// Check the user's permission before changing anything
if(msg.guild) {
if(!msg.member.Permissionshas('ADMINISTRATOR') && !this.client.isOwner(msg.author)) {
return msg.reply('Only administrators may change the command prefix.');
}
} else if(!this.client.isOwner(msg.author)) {
return msg.reply('Only the bot owner(s) may change the global command prefix.');
}

    // Save the prefix
    const lowercase = args.prefix.toLowerCase();
    const prefix = lowercase === 'none' ? '' : args.prefix;
    let response;
    if(lowercase === 'default') {
        if(msg.guild) msg.guild.commandPrefix = null; else this.client.commandPrefix = null;
        const current = this.client.commandPrefix ? `\`${this.client.commandPrefix}\`` : 'no prefix';
        response = `Reset the command prefix to the default (currently ${current}).`;
    } else {
        if(msg.guild) msg.guild.commandPrefix = prefix; else this.client.commandPrefix = prefix;
        response = prefix ? `Set the command prefix to \`${args.prefix}\`.` : 'Removed the command prefix entirely.';
    }

    msg.reply(`${response} To run commands, use ${msg.anyUsage('command')}.`);
    return null;
}

};

#

hOLD ON

#

AH

#
        if(msg.guild) {
            if(!msg.member.Permissionshas('ADMINISTRATOR') && !this.client.isOwner(msg.author)) {
                return msg.reply('Only administrators may change the command prefix.');
            }
        } else if(!this.client.isOwner(msg.author)) {
            return msg.reply('Only the bot owner(s) may change the global command prefix.');
        }

        // Save the prefix
        const lowercase = args.prefix.toLowerCase();
        const prefix = lowercase === 'none' ? '' : args.prefix;
        let response;
        if(lowercase === 'default') {
            if(msg.guild) msg.guild.commandPrefix = null; else this.client.commandPrefix = null;
            const current = this.client.commandPrefix ? `\`${this.client.commandPrefix}\`` : 'no prefix';
            response = `Reset the command prefix to the default (currently ${current}).`;
        } else {
            if(msg.guild) msg.guild.commandPrefix = prefix; else this.client.commandPrefix = prefix;
            response = prefix ? `Set the command prefix to \`${args.prefix}\`.` : 'Removed the command prefix entirely.';
        }

        msg.reply(`${response} To run commands, use ${msg.anyUsage('command')}.`);
        return null;
    }
};
#

.

scenic crest
#

javascript on the same like as ```

earnest phoenix
#
//// Check the user's permission before changing anything
        if(msg.guild) {
            if(!msg.member.Permissionshas('ADMINISTRATOR') && !this.client.isOwner(msg.author)) {
                return msg.reply('Only administrators may change the command prefix.');
            }
        } else if(!this.client.isOwner(msg.author)) {
            return msg.reply('Only the bot owner(s) may change the global command prefix.');
        }

        // Save the prefix
        const lowercase = args.prefix.toLowerCase();
        const prefix = lowercase === 'none' ? '' : args.prefix;
        let response;
        if(lowercase === 'default') {
            if(msg.guild) msg.guild.commandPrefix = null; else this.client.commandPrefix = null;
            const current = this.client.commandPrefix ? `\`${this.client.commandPrefix}\`` : 'no prefix';
            response = `Reset the command prefix to the default (currently ${current}).`;
        } else {
            if(msg.guild) msg.guild.commandPrefix = prefix; else this.client.commandPrefix = prefix;
            response = prefix ? `Set the command prefix to \`${args.prefix}\`.` : 'Removed the command prefix entirely.';
        }

        msg.reply(`${response} To run commands, use ${msg.anyUsage('command')}.`);
        return null;
    }
};
#

Dere we go

median lintel
#

there

scenic crest
#

yep

earnest phoenix
#

Thats the second half

sinful meadow
#

@earnest phoenix

#
Replace 
if(!msg.member.Permissionshas('ADMINISTRATOR')

With
if(!msg.member.permissions.has('ADMINISTRATOR')
earnest phoenix
#

Okie

sinful meadow
#

that should work

median lintel
#

i'd use

if(!msg.member.hasPermission('ADMINISTRATOR')
scenic crest
#

is administrator literally a string in discord.js or are enumerations a thing

sinful meadow
#

Forgot about that one @median lintel

median lintel
#

lool

sinful meadow
#

i mean there is alot

median lintel
#

really?

sinful meadow
#

Yea

#

hasPermission

#

permissions.has

#

Ther eis like

#

5 ways

#

to check

#

;p

scenic crest
#

same in JDA tbh

earnest phoenix
#

Now its saying textchannels.sendmessage

#

Commando is sheet xD

sinful meadow
#

Dont use sendMessage

#

use .send

earnest phoenix
#

Ik