#development

1 messages · Page 831 of 1

quartz kindle
#

wiki says it should be v8

royal portal
#

} catch {

#

Unexpected token {

quartz kindle
#

did you install the new node version?

royal portal
#

But how?

#

I'm trying to but I don't know where to click

quartz kindle
royal portal
#

I don't get that

quartz kindle
#

alternatively, you can use nvm

royal portal
#

I can't

#

It won't work

#

I tried so hard

#

But its all this extracting thing

#

Its annoying

quartz kindle
#

thats how linux works lol

royal portal
#

So what do I do

#

Isn't there a way from terminal

quartz kindle
#

just install nvm using the wget link from their installation instructions

#

then run nvm install 12.16.1

royal portal
#

nvm is node?

quartz kindle
#

nvm is node version manager

royal portal
#

I can't install that

#

Do I have to install the whole thing on github?

#

All the files?

quartz kindle
#

read their installation instructions

royal portal
#

I can't copy or paste the command for some reason

#

It does ^V

#

I installed it but it says command doesnt exist when I try nvm

quartz kindle
#

restart your terminal

royal portal
#

downloading nvm install 12.16.1

#

oo

#

@quartz kindle the only problem now is

#

bot.user.setGame is not a function

#

I'll try setActivity

#

done

quartz kindle
#

gj

royal portal
#

How do I do the

#

catch error

#

and everything

amber fractal
#

Learning js would be a good starting point reading this chat history

royal portal
#

Ye

zenith terrace
#

that catch error is hard to get rid of

#

I more recommend making a new project

earnest phoenix
#

How do I embed a image into my bot description
It's not working like it does in normal HTML

unique nimbus
#

<img src="<url>">?

royal portal
#

Wait

#

How do you catch errors

#

is it

#

msg.reply("blah blah").catch(console.log);

earnest phoenix
#

@royal portal console.error not console.log

royal portal
#

Is that all?

#

The rest is right?

#

And also why is

earnest phoenix
#

I think you have to put a then() before catch(i think)

royal portal
#

${bot.guilds.size} not working?

#

it says undefined

earnest phoenix
#

It's bot.guilds.cache.size

royal portal
#

Aye!

earnest phoenix
#

Is it working now?

#

@royal portal

royal portal
#

Yep

#

I just need to know how to use catch

#

Like where to put

#

msg.reply("test")

#

in that

amber fractal
#

on promises, function().catch(...)

royal portal
#

Where do I put

#

so

earnest phoenix
#

After a function

royal portal
#

msg.reply("test").catch(console.error);

amber fractal
#

on non-promises,

try{
    function()
}catch(e){
    ...
}```
earnest phoenix
#

@unique nimbus that wont work

royal portal
#

Would mine work?

#

I need a catch for msg.reply

amber fractal
#

<Message>.reply() is async, so yes.

earnest phoenix
#

@royal portal mine is like this:
message.reply("Aye!").then().catch(console.error)
Try it and it may work

royal portal
#

Did you use it?

amber fractal
#

I'm saying async

#

I meant promises

#

mb

royal portal
#

You can have msg.reply

#

instead of message

earnest phoenix
#

Yup

royal portal
#

but do you need

#

; at the end?

earnest phoenix
#

It depends on where the function ends...

amber fractal
#

in js, semicolons aren't required to end lines.

#

doesnt matter if you use them

#

I personally dont

#

others do

#

doesn't make a difference that I've seen

royal portal
#

Is his script correct though?

earnest phoenix
#

Mine?

royal portal
#

Yes

#

You said it

earnest phoenix
#

It works for me tho

amber fractal
royal portal
#

'may' work

#

Oh

#

bot.User.setStatus doesn't work anymore

#

What's the new?

earnest phoenix
#

@royal portal It's bot.user.setActivity

amber fractal
#

should work

#

well status is online

#

idle

#

etc

earnest phoenix
#

Hmm

royal portal
#

I use setActivity for the playing status

amber fractal
#

activity is game stuff

earnest phoenix
#

Oh i didn't saw it... Status?

royal portal
#

I want my bot idle

#

(dont ask why lol)

amber fractal
#

setStatus("idle") should work

royal portal
#

I have

earnest phoenix
#

Hmm...

royal portal
#

bot.user.setStatus

#

('idle')

earnest phoenix
#

That doesn't work?

royal portal
#

nope

earnest phoenix
#

That's suspicious

royal portal
#

here's my code

#

bot.on('ready', () => {
console.log('Ready to Protect.');
bot.user.setStatus('idle')
bot.user.setActivity('discord.js | Prefix: !')
});

#

Any ideas?

amber fractal
earnest phoenix
#

@royal portal what's your discord.js version?

royal portal
#

latest

earnest phoenix
#

Hmm.. you mean stable or 12.0.2/12... idk which one is the latest tho... @royal portal

amber fractal
#

stable is 12 now

royal portal
#

Yeah

#

I'm not sure how to make my bot idle mode

amber fractal
#

v11 is now a previous version

royal portal
#

It doesn't give any error

#

It just doesn't do it

earnest phoenix
#

Hmm...

quartz kindle
#

setStatus hasnt been working for me either

#

im not sure why

earnest phoenix
#

That's kinda suspicious

amber fractal
#

Does setPresence work still?

#

it's example also has idle

royal portal
#

Not sure

earnest phoenix
#

Yea that might work

royal portal
#

setStatus only worked for older versions

#

Send code here

quartz kindle
#

i tried sending a status packet to the websocket and it just disconnects me lol

zenith terrace
#

@quartz kindle .setStatus is working for me in v12

quartz kindle
#

yeah so idk

royal portal
#

Not working for me

#

bot.on('ready', () => {
console.log('Ready to Protect.');
bot.user.setStatus('idle')
bot.user.setGame('discord.js | Prefix: !')
});

earnest phoenix
#

Hmm lemme test setStatus on 12.0.2 and tell if it works or not

zenith terrace
#

.setActivity would be for v12

#

or does game work

royal portal
#

I just can't make my bot idle

#

or dnd

#

just online

#

It worked in older version

#

somehow messed up this version

zenith terrace
#

Hmm

royal portal
#

(new)

zenith terrace
#

Lemme try here

#

On mine

royal portal
#

This is so awkward

earnest phoenix
royal portal
#

maybe i forgot the ;

earnest phoenix
#

Hmm...

austere tapir
#

How to creat my own rhythm sever -,-?

royal portal
#

Still not working

#

Its just that one thing lol

earnest phoenix
#

@austere tapir the what server?

austere tapir
#

idk

zenith terrace
#

Hmm it wont set the idle for my bot

austere tapir
#

want to play music in my own sever

#

But can’t

zenith terrace
#

Make a server

austere tapir
#

I don’t know how to use discord-,-

earnest phoenix
#

@zenith terrace you also use discord.js but in which version?

austere tapir
#

Already make a sever

zenith terrace
#

v12

royal portal
#

@zenith terrace setStatus working for you?

zenith terrace
#

No

quartz kindle
#

@earnest phoenix is it really working tho? does it have the yellow icon?

royal portal
#

but theres a legend bot

#

thats has mobile status

#

lol

earnest phoenix
#

@quartz kindle the yellow ball thingy?

quartz kindle
#

because setStatus does change the internal status in the library

#

ye

earnest phoenix
#

Hmm no it's set online green ball status @quartz kindle

quartz kindle
#

yeah

zenith terrace
#

Verify ur email

quartz kindle
#

when you do setStatus, it changes the library's internal status, but doesnt appear to have any effect on discord

austere tapir
#

How ?? 🥺

earnest phoenix
#

But when i do userinfo it shows that the bot is idle... @quartz kindle

royal portal
#

Discord Settings

quartz kindle
#

yes, because useInfo gets it from memory

#

from the library's internal status

royal portal
#

So we can't do setStatus?

#

Is there a different, working way?

zenith terrace
quartz kindle
#

we are not sure Blox

earnest phoenix
#

I think when you set a bot to idle... It doesn't show the yellow ball thingy... But...
Lemme test on dnd... Let's see if it's gonna change the status ball to red

royal portal
#

lemme see

zenith terrace
#

I dont think setStatus is working properly

#

Exact same

royal portal
#

Well it might be a problem with Discord

earnest phoenix
royal portal
#

Yes

earnest phoenix
#

But... I changed the bot status to dnd and instead of red status ball
.. it changed to yellow status ball which is meant for the idle status

#

This got really confusing

royal portal
#

i am confusion

#

Today I upgraded my discord.js and node.js

zenith terrace
#

Tried dnd, not changing

royal portal
#

before the upgrade, setStatus worked

#

so it must be something in the new version

earnest phoenix
#

@zenith terrace i think the setStatus is drunk or something...

zenith terrace
#

I guess we are stuck on the green xD

earnest phoenix
#

nvm found how dumb i am

zenith terrace
#

Oof

earnest phoenix
#

@zenith terrace wait a second

royal portal
#

Guys

#

I have to go now, can you please ping me if you found how to fix it

earnest phoenix
royal portal
#

:o

#

wait how

#

whats the code

zenith terrace
#

Maybe that bot is still on v11

#

Not all bots changed to v12

royal portal
#

Will you guys ping me once you found solution?

earnest phoenix
#

I think we have to wait... For it to upload the status info to the bot data itself... So it could change and no it's on 12.0.2

#

@royal portal whats your problem ?

royal portal
#

We can't set bot status

#

bot.user.setStatus doesnt work

#

I tried setting to idle it just ignores it

#

no errorss

earnest phoenix
#

which language?

royal portal
#

discord.js

earnest phoenix
#

@royal portal you Know what?
Set the bot status with
bot.user.setStatus('idle')
And wait 2 minutes...

quartz kindle
#

wait

#

its working for me lol

royal portal
#

Ok

quartz kindle
#

last time i tested it didnt work at all

earnest phoenix
#

Yea... The solution is patience

#

client.user.setActivity(-help to see my commands | ${client.guilds.size} servers., { type: "LISTENING" })
client.user.setStatus("idle")

royal portal
#

Lemme restart bot

quartz kindle
#

i think its just discord being drunk

earnest phoenix
#

thats whats in my bot

zenith terrace
#

I been waiting 5+ mins since I changed it to dnd

earnest phoenix
#

@zenith terrace it takes maybe?... I have no idea...

#

*more time

royal portal
#

Idk

#

Mine dont work

quartz kindle
#

last time i tested, it didnt do anything and it caused my bot's connection to disconnect/resume
now it worked pretty much instantly

royal portal
#

drunkcord

earnest phoenix
#

@royal portal try this in your ready.js file

royal portal
#

I did

earnest phoenix
#

module.exports = {
execute: async(client, db) => {

console.log(`Ready on client ${client.user.tag} and loaded ${client.commands.size} commands.`)

client.user.setActivity(`Free gay`, { type: "STREAMING" }) 

}
}

#

@quartz kindle i think we talked about the issue and the code tried to fix himself instantly but it still doesn't work for @zenith terrace

quartz kindle
#

lmao

royal portal
#

I'm not talking about the activity

#

I'm taling about status

#

as in idle

earnest phoenix
#

yeah ik

#

Hmm... This got a little suspicious...

royal portal
#

It doesn't work

zenith terrace
#

setStatus is drunk af

earnest phoenix
#

Did you do the code i gave you and wait 2 minutes ? @royal portal

#

Hmm

#

seems to work for me

royal portal
#

a

#

just go make skype bot

#

lol

zenith terrace
#

Oh well. I can do without a different status

royal portal
#

yeah

#

me too

#

status isnt a big problem to me

earnest phoenix
#

It works for me too but it does have latency(Latency is drunk asf rn lmao)

#

Idk who did something to setStatus but it's drunk

royal portal
#

one discord mod

#

'hey lets see what this button does'

#

removes setStatus

#

other mod:

#

'why u do that'

zenith terrace
#

Lol

royal portal
#

'SETSTATUS DRUNK'

#

lol

earnest phoenix
#

Or gives it alcohol or weed and setStatus becomes high asf

royal portal
#

LOL

#

setstatus is in partnership with windows 7

#

end of support

#

setstatus

#

2015 - 2020

#

me gtg now

#

cya ppl

earnest phoenix
#

K then cya

royal portal
#

@earnest phoenix DM me or ping me if it has been fixed yet

zenith terrace
#

It is in a partnership with my internet explorer bot

#

Cya

royal portal
#

so it works instantly

#

without waiting

earnest phoenix
#

K

royal portal
#

cya xd

zenith terrace
#

L

#

My internet explorer bot is even faster than setStatus

earnest phoenix
#

I've literally never seen a code function more drunk than setStatus before

zenith terrace
#

Lol

viral spade
#

switched from discord.js v11 to v12.

This does not work anymore
for (channelTemp of guild.channels) {

i only found
for (channelTemp of guild.channels.cache) {
but i want to traverse all channels of that guild, and like this it does not for the non-cached ones i think.

How can i traverse all of the channels with v12?

earnest phoenix
#

@viral spade guild.cache.channels

quartz kindle
#

no lol

#

guild.channels.cache is correct

earnest phoenix
#

Is it?

quartz kindle
#

channels are all cached by default, unless you tamper with the library

#

there is no such thing as an uncached guild channel in an unmodified discord.js

earnest phoenix
#

Hmm when i don't use cache it doesn't work

viral spade
#

oh ok thx tim! so it should work like this. i will look at other possible problems. thx so far

earnest phoenix
#

@quartz kindle oh it's actually guild.channels.cache i forgot lmao

viral spade
#

Why is this change with all the cache in between? is there something i need to take care of now, that was not present in v11?

earnest phoenix
#

Idk... I think the developers of discord.js wanted to move most of them to cache methods... @viral spade

viral spade
#

i mean wasnt it cached anyways?

earnest phoenix
#

God knows what's going on their mind

quartz kindle
#

they did it to clarify and separate caches and rest methods

viral spade
#

oh ok makes sense

quartz kindle
#

for example channels.get() was a sync caching method, while channels.fetch() is an async rest method

#

they didnt want to keep having them all clumped together

zenith terrace
#

But stil v11 was better 😦

quartz kindle
#

so now its easier to differentiate, ie: manager.X = async rest methods, while manager.cache.X = sync caching/collection methods

zenith terrace
#

no u

earnest phoenix
#

But they made some people triggered because now have to use cache and most people forget about it because they aren't used to it... Like me that i forget about it all the time

quartz kindle
#

yeah, nobody likes changes, even if its a change for the better

zenith terrace
#

If they make the setStatus work better then id be happy

#

Lol

quartz kindle
#

lul

earnest phoenix
#

They should have fixed the setStatus instead of adding more ways to trigger us like cache lmao

zenith terrace
#

Somebody at the office messed up 👀

#

@rich sage

#

@rich sage
690263402337402936

viral spade
#

Tim i need your help again im too stupid...

i had bot.shard, i could access a shards own shard property and retrieve its id within the shard. how can i do this now?

Now i get back a ShardClientUtil with a ids and count value.
i dont even understand why i can access multiple shards within one shard!?

idle mountain
#

I'm just asking to double-check before potentially accidentally blowing up my bot lol

prime cliff
#

@idle mountain yea you can definetely load certain shards at login so you can have 1 app do 1-5 shards and another with 6-10

#

Discord.net does have a few timeout issues though if you try to start the bot with lots of shards, the way i do it is load the first shard then wait for that to become ready and then load the next shard

idle mountain
#

haha that issue is actually why im trying this system

#

The library can’t handle my bot’s 20 shards at all

#

or 30 shards

prime cliff
#

I'm running my bot in 1 app with 18 shards and the way i do it works

idle mountain
#

So I’m just gonna try using this system since it’s essentially just handling a bunch of smaller bots that are sharing ram

#

hmm

#

idk, when I just let it all be in a single object, every few hours a shard will get stuck on the “Disconnecting” state

#

and will never come out of that state, even if I manually shut it off and turn it back on

prime cliff
#

You can start/stop shards manually too

idle mountain
#

With .StopAsync, yeah?

#

If I do that on a shard that’s “disconnecting” it doesn’t do anything

#

the task just delays forever it seems

prime cliff
idle mountain
#

yeah it’s odd

#

so I’m gonna try this system and hopefully it works

prime cliff
#

If you wanted to do it that way you should also take in stuff like notifications or tasks that you run every hour for example posting server count

#

They wont be able to access the servers from your other app unless you setup something for that

idle mountain
#

I’ve already written functions to let it get all the servers across all the instances

#

I just need to know that this isn’t gonna rate limit me somehow or something

#

I’d assume this isn’t really changing much on discord’s side anyways but I wanted to make sure

prime cliff
#

No the client itself will handle logins perfectly fine i have never had any of my tokens reset

idle mountain
#

awesome, thanks!

prime cliff
#

Also the way that i do is on startup load the first shards
await Client.Shards.ElementAt(0).StartAsync();

#

And when that shard becomes available it will start the next shard in

private static int ShardsConnected = 0;
private static Task Client_ShardReady(DiscordSocketClient client)
{
   if (ShardsConnected != MaxShards)
   {
      ShardsConnected++;
      Task.Run(async () =>
      {
         await Client.Shards.ElementAt(ShardsConnected).StartAsync();
      });
   }
}```
So that it does not block the thread
#

And it will stop once all shards are loaded

idle mountain
#

ty! this is all helpful

prime cliff
#

There we go fully edited it with working code, i have an extra ready bool for any of my services to access.

fallen arch
#

anyone knows how to delete mongoDB collection?
like one collection?

viral spade
#

How can i shard my discord.js v12 bot onto different machines?
That means having 2 machines.
Machine 1 with ShardingManager1 that spawns Shard 0-5
Machine 2 with ShardingManager2 that spawns Shard 6-10

How can i do that?

wintry sonnet
#
const colour = require('../colours.json');

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

module.exports.run = async(client, message, args) => {
    let uEmbed = new Discord.RichEmbed()
        .setTitle('Guild Info')
        .setColor(colour.thesportstacker_blue)
        .setImage(message.guild.iconURL)
        .addField('Server Name', `${message.guild.name}`, true)
        .addField('Owned by', `${message.guild.owner}`, true)
        .addField('Total Members', `${message.guild.memberCount}`, true)
        .addField('Created on', `${message.guild.createdAt}`, true)
        .addField('Roles', `${message.guild.roles.size}`)
        message.channel.send(uEmbed);
}

module.exports.config = {
    name: "serverinfo",
    aliases: ["si"]
}```


```Error: Discord.RichEmbed() is not a constructor```
viral spade
#

@wintry sonnet
v11 RichEmbed is in v12 MessageEmbed

wintry sonnet
#

Thanks

earnest phoenix
prime cliff
#

Did you upgrade to djs v12?

earnest phoenix
#

yes

#

@prime cliff

#

bro

prime cliff
#

Have you checked if there is an update for the lib you are using?

copper cradle
#

@prime cliff I don't think python has a library called djs

prime cliff
#

Oh right .py

copper cradle
#

noes

spice pier
#

the fact that the other guy replied with yes

slender thistle
#

Not reading errors

earnest phoenix
#

Why did they change it to MessageEmbed?

smoky spire
#

Consistency

#

Incoming embeds have been MessageEmbed for a while, so they merged RichEmbed into it so there's just one embed class

earnest phoenix
#

Still i'll have to change my code now

smoky spire
#

Sucks

slender thistle
#

@earnest phoenix your cog doesn't have dbl_client property. Simple

earnest phoenix
#

And also i think MessageEmbeds don't work in node version less than 12

smoky spire
#

The whole library doesn't work in node < 12 for djs v12

earnest phoenix
#

Yeah i meant that

#

And glitch has node v10

#

how to put dbl_client @slender thistle

flat pelican
#

read docs

slender thistle
#

What does your current code look like

#

Do you think you're confusing your needed property's name

earnest phoenix
#

`import dbl
import discord
from discord.ext import commands

class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""

def __init__(self, bot):
    self.bot = bot
    self.token = 'dbl_token' # set this to your DBL token
    self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True) # Autopost will post your guild count every 30 minutes

async def on_guild_post():
    print("Server count posted successfully")

def setup(bot):
bot.add_cog(TopGG(bot))`

#

this is my code

#

@slender thistle

slender thistle
#

And where are you trying to access dbl_client

crimson vapor
#

you forgot the token lmao

#

unless you changed it for the help

golden condor
#

Can I have some help with doing aliases?

#

I have this code so far

#
if (command.aliases && Array.isArray(command.aliases)) command.aliases.forEach(alias => client.aliases.set(alias, command.name));```
restive furnace
#

format

golden condor
#
if(!client.commands.get(cmd.slice(prefix.length)) || !client.aliases.get(cmd.slice(prefix.length))) return;    
    client.commands.get(cmd.slice(prefix.length)).run(client,message,args);
       if (client.aliases.has(cmd.slice(prefix.length).toLowerCase())) {
        client.commands.get(client.aliases.get(cmd.slice(prefix.length).toLowerCase())).run(client, message, args)```
#

d.js = v11.6.1

#

@restive furnace you there still?

#

You been typing a long time

restive furnace
#

if i remember right i just did like this: in cmd file: module.exports = { run: /*cmd here */ aliases: ["test", "test2"] } and on command handler /*cmd handler...*/ /* line where you add the command in your commands list */ command.aliases.forEach(a => /*cmdaliases list*/.push(a)); /*cmd handler*/ and on message event: /*before cmd.run*/ if (!client.commands.get(cmd.slice(prefix.lenght)) || !aliases.find(a => a === cmd.slice(prefix.lenght))) return; or smh like that

#

(im on mobile so sry slow typing)

golden condor
#

Oh ok thanks

#

Would this work

#

if (command.aliases && Array.isArray(command.aliases)){ command.aliases.forEach(alias => client.aliases.set(alias, command.name));}

#

And that

#

if (!client.commands.get(cmd.slice(prefix.length)) || !client.aliases.find(a => a === cmd.slice(prefix.length)))return;

#

And can you put the aliases before the run bit

restive furnace
#

try it

#

and if error just send it here.

golden condor
#

It just doesn't work

restive furnace
#

any errors?

golden condor
#

I will see

restive furnace
#

if you're on vsc/webstrom or any other that can be runned as debug mode. so run it as debug mode and type in the console ur aliases array/map name and send screenshot of the contests

golden condor
#

module.exports = {
name: "avatar",
aliases: ['av', 'pfp'],

run: async (client, message, args) => {

#

Is that right?

#

It just wom't wor

restive furnace
#

yes

#

module.exports = {
name: "avatar",
aliases: ['av', 'pfp'],

run: async (client, message, args) => {

#

thats right atleast

golden condor
#

How about the command handler stuff

restive furnace
#

did u try this

if you're on vsc/webstrom or any other that can be runned as debug mode. so run it as debug mode and type in the console ur aliases array/map name and send screenshot of the contests

#

so see if it even adds the aliases

golden condor
#

I will have to use chrome for that

restive furnace
#

what youre using for editing your bots code?

golden condor
#

Glitch

earnest phoenix
#

Wew

golden condor
#

?

restive furnace
golden condor
#

@restive furnace in debug mode what should I look for

restive furnace
#

not anything anymore just read that

#

aand change your version to 11.6

golden condor
#

I've tried that

restive furnace
#

it worjs.

#

works

#

atleast for me

earnest phoenix
#

What's the error?

golden condor
#

I will check it out and try again

#

What should I put in the command handler

earnest phoenix
#

And it's better if you use vscode or some other editor for coding than glitch

golden condor
#

Why

earnest phoenix
#

They have debugging tools

golden condor
#

So does glitch

earnest phoenix
#

Hmm

golden condor
#

you just have to use chrome

#

It isn't that hard

#

Anyway how do I tell if it adds aliases or not using debug

finite bough
#

wut

#

do u know what aliases are

golden condor
#

Yes

earnest phoenix
#
let command = client.commands.get(cmd);
    if (!command) command = client.commands.get(client.aliases.get(cmd));

why dont the aliases work

#

Just console log client.aliases to see if there is anything

golden condor
#

Glitch won't loaf

earnest phoenix
#

no aliases come up

finite bough
#

yea thats a problem with glitch rn

earnest phoenix
#

yet theres aliases in every .js file

finite bough
#

pls wait till the problem is finished

golden condor
#

No

#

I won't

earnest phoenix
#

You would need to load up aliases for each command

finite bough
#

then kindly

#

shut up and quit complaining

earnest phoenix
#

For loop through each command

finite bough
#

read the docs

earnest phoenix
#

can you help me with that

#

im new to js and i dont understand anything to do with the docs

finite bough
#

and see how to make a good command handler

golden condor
#

I have made a command handler

#

So shyt it

finite bough
#

@earnest phoenix u can ask ur questions here dw

golden condor
#

And Shiemi I can't?

earnest phoenix
#

i dont get how to make the aliases work

golden condor
finite bough
#

command handlers are suppose to be made according to the user

golden condor
#

Basically just telling me to piss off

earnest phoenix
#

i dont get it

finite bough
#

u are not giving enough info for us to help

earnest phoenix
#

i have aliases there and it is defined

golden condor
#

I have given ton of indo

earnest phoenix
#

but then it doesnt work with the aliases

#

only the main command

golden condor
#

Yeah same

earnest phoenix
#

command handlers never worked for me

#

last time my bot broke

#

i got a new pc after a few months

#

bot broke so i gave up

#

now im back at it

#

and it actually works but aliases decide to have a nice vacation

finite bough
#

wait

#

glitch is not working

earnest phoenix
#

no

golden condor
#

It isn't

earnest phoenix
#

this bloody bot is pissing on my cornflakes

#

bc is an alias

late hill
#

adding an aliases property to your export won't magically store everything in client.aliases

earnest phoenix
#

but it only works with the main command

#

lol

#

idk where to store it

#

i am confusion

golden condor
#

How does it work then

late hill
#

You update your command handler so that it'll check for the name & aliases

golden condor
#

I did

#

But it didm't work

earnest phoenix
#

i dont think you caught the bit where i said i was new to js and docs make like no sense

late hill
#

You don't need documentation for this

golden condor
#

And I told it set aliases too

late hill
#

It's a programming problem that you have to solve

golden condor
#

In the message event

finite bough
#

yes glitch is down

earnest phoenix
#

yea but

#

wtf

#

when i link them

golden condor
#

You should sign up to their text message thing

earnest phoenix
#

the command doesnt work

late hill
#

show what your initial command handler looked like

earnest phoenix
#
const { readdirSync } = require("fs");

const ascii = require("ascii-table");

const table = new ascii().setHeading("Command", "Load status")

module.exports = (client) => {
    readdirSync("./commands").forEach(dir => {
        const commands = readdirSync(`./commands/${dir}/`).filter(f => f.endsWith(".js"))

        for (let file of commands) {
            let pull = require(`../commands/${dir}/${file}`);

            if (pull.name) {
                client.commands.set(pull.name, pull);
                table.addRow(file, '✅');
            } else {
                table.addRow(file, '❌ -> missing something??');
                continue;
            }

            if (pull.aliases && Array.isArray(pull))
                pull.alises.forEach(alias => client.aliases.set(alias, pull.name));
        }
    });

    console.log(table.toString());
}```
#

i fixed ascii table so that works

#

wtf

late hill
#

Alright

earnest phoenix
#

i SPELT ALIASES WRONG

late hill
#

so

earnest phoenix
#

IN THE FUCKING

#

"pull.alises"

late hill
#

Basically pull is the object you're exporting from each command file

earnest phoenix
#

yes

late hill
#

Do you understand that

earnest phoenix
#

yeah

late hill
#

ok

#

That means that, when you add something to the export

#

such as the aliases property

#

It'll be available in there

regal saddle
#

i guess he already understood.

golden condor
#

Mine works similiarly

regal saddle
late hill
#

So those aliases will be in pull.aliases

#

Now it's up to you

#

to make your command handler work

#

with that information

earnest phoenix
#

mine works similarly! puts picture of read the docs

golden condor
#

Cana you see this

#

If it wrks

#

I thought I still had the link copied

late hill
#

That simply shows you adding an alias property to the export

#

Which as said, doesn't magically make things work

golden condor
#

The link in the message below

#

that message

late hill
#

You have to use the data

earnest phoenix
#
if(cmd.length === 0) return;

    let command = client.commands.get(cmd);
    if (!command) command = client.commands.get(client.aliases.get(cmd));

    if (command)
        command.run(client, message, args);
#

the middle bit

#

i thought that made them work

golden condor
#

@late hill look at the link below the exports thinhg

late hill
#

How about you properly format the code and don't have me checking multiple messages

golden condor
#

Sorry

#

I did it before

#

But I couldn't find

#

So I had to link

earnest phoenix
#

🧠 🤔

golden condor
#

And glitch is down

#

So I can;t access my code

earnest phoenix
#

do you really only use glitch for your code

#

atleast store it in github or vsc

golden condor
#

I do

#

But the one stored doesn't have the aliases

earnest phoenix
#

@finite bough help please

finite bough
#

??

late hill
#

Your client.aliases approach can work but there's 2 issues with it @earnest phoenix

earnest phoenix
#

i dont understand like anything about this

late hill
#

You're checking if pull is an array

#

which is never the case, it's an object with all your command data

#

You also made a syntax error below that

earnest phoenix
#

how

late hill
#

Which doesn't show an error, because your code never reaches that point due to the issue above

earnest phoenix
#

i should just shove it all in bloody index.js

golden condor
#

wesley did you check my one

late hill
#

You probably meant to check if pull.aliases is an array and not just pull..

earnest phoenix
#

for him or me

late hill
#

the syntax error is because you put alises

#

you

earnest phoenix
#

what

#

so

#

(client.pull.aliases

regal saddle
#

Loo

earnest phoenix
#

i dont fucking understand

regal saddle
late hill
#

no

#

The code you wrote
if (pull.aliases && Array.isArray(pull)) checks if pull is an array

golden condor
#

I did that too

earnest phoenix
#

oh

golden condor
#

I wish I had a vps

earnest phoenix
#

so pull.aliases

#

OH

#

it works

golden condor
#

What code did you use

earnest phoenix
#

do you have a handler folder with command.js or any shit in it

golden condor
#

Yes

earnest phoenix
#

idk

#

ok

#
const { readdirSync } = require("fs");

const ascii = require("ascii-table");

const table = new ascii().setHeading("Command", "Load status")

module.exports = (client) => {
    readdirSync("./commands").forEach(dir => {
        const commands = readdirSync(`./commands/${dir}/`).filter(f => f.endsWith(".js"))

        for (let file of commands) {
            let pull = require(`../commands/${dir}/${file}`);

            if (pull.name) {
                client.commands.set(pull.name, pull);
                table.addRow(file, ':white_check_mark:');
            } else {
                table.addRow(file, ':x: -> missing something??');
                continue;
            }

            if (pull.aliases && Array.isArray(pull.aliases))
                pull.aliases.forEach(alias => client.aliases.set(alias, pull.name));
        }
    });

    console.log(table.toString());
}```
#

but you need to do

#

npm i ascii-table

#

because it uses an ascii tabl

#

e

golden condor
#

Why

earnest phoenix
#

if you dont it'll return with errors

#

because it uses an ascii table to hold stuff

golden condor
#

What about the message event

earnest phoenix
#
let command = client.commands.get(cmd);
    if (!command) command = client.commands.get(client.aliases.get(cmd));
#

index.js ^

#

put ```js
client.commands = new Collection();
client.aliases = new Collection();

golden condor
#

Yeah ok thanks

earnest phoenix
#

but define collection

#
const {Collection} = require("discord.js");```
golden condor
#

Ik

earnest phoenix
#

ok

golden condor
#

Discord.Collection

earnest phoenix
#

wait

#

what discord.js you using

#

@golden condor

golden condor
#

11.6

earnest phoenix
#

dont use mine then

#

its for v12

golden condor
#

it should prpbably work

earnest phoenix
#

ok

golden condor
cunning glen
#
CXX(target) Release/obj.target/integer/src/integer.o
../src/integer.cpp: In static member function 'static Result Integer::Cast(v8::Local<v8::String>, uint8_t)':
../src/integer.cpp:329:33: error: no matching function for call to 'v8::String::Value::Value(v8::Local<v8::String>&)'
329 | v8::String::Value utf16(string);
| ^
In file included from /home/container/.cache/node-gyp/12.16.1/include/node/node.h:63,
from ../src/integer.hpp:3,
from ../src/integer.cpp:1:
/home/container/.cache/node-gyp/12.16.1/include/node/v8.h:3158:5: note: candidate: 'v8::String::Value::Value(v8::Isolate*, v8::Local<v8::Value>)'
3158 | Value(Isolate* isolate, Local<v8::Value> obj);
| ^~~~~
/home/container/.cache/node-gyp/12.16.1/include/node/v8.h:3158:5: note: candidate expects 2 arguments, 1 provided
In file included from ../src/integer.hpp:3,
from ../src/integer.cpp:1:
../src/integer.cpp: At global scope:
/home/container/.cache/node-gyp/12.16.1/include/node/node.h:601:43: warning: cast between incompatible function types from 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Object>)' to 'node::addon_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)'} [-Wcast-function-type]
601 | (node::addon_register_func) (regfunc), \
| ^
/home/container/.cache/node-gyp/12.16.1/include/node/node.h:635:3: note: in expansion of macro 'NODE_MODULE_X'
635 | NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
| ^~~~~~~~~~~~~
../src/integer.cpp:408:1: note: in expansion of macro 'NODE_MODULE'
408 | NODE_MODULE(integer, Integer::Init);
| ^~~~~~~~~~~```
#

wtf

#

😦

#

please info it

tight plinth
#

try using sudo

#

wait no

#

thats just compltely normal

cunning glen
#

this problem vds hosting panel in console

#

I can't solve the problem.

tight plinth
#

normally this is not a error

cunning glen
#

used memory problem

tight plinth
#

show entire error

cunning glen
tight plinth
#

try doing npm i bindings

cunning glen
#

I can't use panels

#

this server

tight plinth
#

try running npm i bindings in the shell

cunning glen
#

l dont host self

#

vds hosting

tight plinth
#

what do you use

#

as host

cunning glen
#

🙂

tight plinth
#

you should have shell access

#

even with a vps

cunning glen
#

panel has console but I can't write commands*

#

😦

tight plinth
#

u cant type anything?

#

have u tried

quartz kindle
#

is that heroku?

#

or what host is it?

cunning glen
#

not heroku

#

dashflo it is

#

@tight plinth open the ticket

#

waiting

tight plinth
#

?

cunning glen
#

no different alternative? slonk

quartz kindle
#

the error is that you're trying to install quick.db

#

quick.db is based on better-sqlite3 which is a native module made with C code, not javascript

#

installing native modules requires the system to support the proper build tools to compile it

#

which your hosting provider might not support by default

cunning glen
#

thats true

#

I opened the necessary information as email !

quartz kindle
#

from the little i've seen, it seems they want you to use their integrated mysql databases instead

cunning glen
#

have mysql database table

#

alright

earnest phoenix
#

what can i use for displayAvatarURL or how do i put it in a footer with .setFooter

#

kick, ban, memes, cat, dog

#

8ball

#

minesweeper

#

np

#

ive only got say, ping and am doing a whois / userinfo

#

i started my bot a few hours ago

#

its hosted so i should be good

#

@earnest phoenix do you host your bot

#

if you need my help in doing it ill give you some stuff

#

same

#

i swapped laptops but then my github repo got deleted and the file got corrupted

#

thats nothing

#

i spent 5 months on my bot

#

and then it just flew up to bot heaven

#

and went offline forever

#

3 of my bots

#

another broke down recently

#

;c

ocean violet
#

Guys how do you setup the premium feature

#

Like how to limit premium bots to paid users only

#

No

#

Do you need a dashboard for that?

earnest phoenix
#

my best bot

ocean violet
#

Glitch is having downtime now and I can’t access my project

earnest phoenix
#

use github to store files

#

you prolly have

ocean violet
#

I did

earnest phoenix
#

restore them and use heroku

#

its easy

ocean violet
#

Is Heroku better?

earnest phoenix
#

sort of

flint dew
#

Or use another good host

earnest phoenix
#

glitch is harder to use and heroku has more info about it

#

yeah

flint dew
#

Like DigitalOcean

ocean violet
#

How many free storage does it have

earnest phoenix
#

not sure

#

yeah

#

i use heroku

#

my bot is amazing with it

ocean violet
#

Yea but how many storage is provided for free

earnest phoenix
#

ill check

ocean violet
#

I just bought a vps for 2.5 bucks

#

And then they don’t provide me a ipv4 adress

#

And then I can’t install node v12 on it

flint dew
#

Like how to limit premium bots to paid users only
@ocean violet save premium users IDs in a database, check if message author exists in DB, if not ignore, if it exists, let the bot do the things

ocean violet
#

And then I can’t connect to it

#

@flint dew Uhh how does dyno do the work? If the server owner has premium, everyone can use it

earnest phoenix
#

because the server owner bought it

#

it uses a dashboard

#

takes you to a one-time invite link i think

ocean violet
#

How is it possible to have a one time invite link for a bot lol

flint dew
#

They have a different system obviously

#

How is it possible to have a one time invite link for a bot lol
@ocean violet it's not

ocean violet
#

Dashboard is too complicated for me

flint dew
#

Do the thing I sent earlier then? 👀

ocean violet
#

I don’t know how to use socketio

#

Yea I’m planning to do it after glitch recovers

flint dew
#

What host for you buy your vps from?

ocean violet
#

Vultr

earnest phoenix
#

make a website for a dashboard then host it with netlify or a custom domain

#

idk

ocean violet
#

Worst vps

earnest phoenix
#

ngl

#

thats an example

#

netlify hosting a website doesnt go down

#

its free

ocean violet
#

Yea it’s good

finite bough
#

@golden condor have u fixed ur command handler?

flint dew
#

Vultr is somewhat nice actually. You might have to google "how to access vultr vps through terminal"

golden condor
#

Not yet no

finite bough
#

hmm mind if I dm?

golden condor
#

Sure

ocean violet
#

No they just provide me an ipv6 and a private ipv4 address where I can’t ssh into

#

And if I want a public ipv4 address I have to pay extra 2 dollars a month

flint dew
#

Do they have a web console?

ocean violet
#

Yea

#

Super slow

#

And I can’t even install node v12 on it

#

It shows me that v10 is the latest

flint dew
#

"how to update to latest node version on [OS OF VPS]"

#

I use DigitalOcean now, separated my DB droplet, my website droplet, and my gitea instance though

royal portal
#

I left my bot on for like 4 hours and the setActivity stopped working

ocean violet
#

I tried and it’s not working. I sent them a full refund request

#

Not gonna use Vultr again

flint dew
#

DO is good

#

To code my bot
@earnest phoenix same

royal portal
#

For my bot, the setActivity stops working after a few hours (using discord.js)

ocean violet
#

Js responses quicker than python

quartz kindle
#

wdym

ocean violet
#

I need to sell bots to host my own bot

royal portal
#

@quartz kindle I left my bot on for like 3 hours and the setActivity doesn't work

#

It just removed the playing status

#

And I had to restart bot

#

I'm not sure why it is doing that though

ocean violet
#

@earnest phoenix you can live edit with glitch tho

flint dew
#

I use a dev bot running locally and just git pull the changes

ocean violet
#

Another free hosting platform

flint dew
quartz kindle
#

js doesnt necessarily respond quicker than python, i mean, 99% of response speed is network dependent, nothing to do with language

ocean violet
#

I’ve heard that someone unloads the Minecraft world and then host the bot on a Minecraft hosting platform for free

flint dew
earnest phoenix
#

how to add 2 prefix ina single bot

ocean violet
#

@earnest phoenix it’s not hard, you can set it up running 24/7 under 10 mins

zenith terrace
earnest phoenix
#

@zenith terrace how to add 2 prefix ina single bot

flint dew
#

Check an array

zenith terrace
#

Idk

quartz kindle
#

if(message.content.startsWith(prefix1) || message.content.startsWith(prefix2))

earnest phoenix
#

no discord.py4

quartz kindle
#

ok nvm

flint dew
#

Lmao

#

Check if an array includes a specific character

#

Also use Google lmao

earnest phoenix
#

bot = commands.Bot(command_prefix="/") bro @quartz kindle how to add

flint dew
#

@earnest phoenix use Google

earnest phoenix
#

guys

#

if my bot is deployed with heroku and uses common tags

#

would it still work

#

because i cant put node models into ghub

#

because its over 100 files

quartz kindle
#

you dont need node_modules

flint dew
#

You could, technically. But idk how glitch works so I can't help

earnest phoenix
#

then why wont my bot work with a command

quartz kindle
#

node_modules should always be installed on the target machine using the package.json

earnest phoenix
#

message.guild.members.get

#

does that exist with v12

quartz kindle
#

no

earnest phoenix
#

bruh

#

to what

quartz kindle
#

check the v11 -> v12 guide

earnest phoenix
#

?v12

#

idk

#

where

quartz kindle
#

all collection methods (get,find,filter,reduce,map,etc) were moved to a .cache property

#

members.cache.get
channels.cache.get
guilds.cache.get

#

etc

earnest phoenix
#

so members.guilds.members.cache.get

quartz kindle
#

wat

earnest phoenix
#

message.guild.members.get

to v12 would it be

members.guilds.members.cache.get

quartz kindle
#

no that would make no sense

#

Lol

#

why change message.guild to members.guilds?

earnest phoenix
#

oopd

#

i meant guild

quartz kindle
#

thats a completely different thing

#

anyway, message.guild.members.get -> message.guild.members.cache.get

earnest phoenix
#

i said that

#

so its right or

quartz kindle
#

no you said members.guilds

#

lmao

earnest phoenix
#

i meant guild

quartz kindle
#

but you still said members

earnest phoenix
#

bot = commands.Bot(command_prefix="/") bro @quartz kindle how to add 2 prefix in this

quartz kindle
#

instead of message

earnest phoenix
#

bot = commands.Bot(command_prefix="/") bro how to add 2 prefix in this

quartz kindle
#

maybe ask in their support server

earnest phoenix
#

what

#

oh

quartz kindle
earnest phoenix
#

i realised that

#

js 2020-03-22T11:04:45.077729+00:00 app[Worker.1]: (node:4) UnhandledPromiseRejectionWarning: TypeError: Int16Array.DateTimeFormat is not a constructor

#

well then

#

i keep using v11 stuff

#

dont use it

pale vessel
#

you don't need heroku CLI

flint dew
#

bot = commands.Bot(command_prefix="/") bro how to add 2 prefix in this
@earnest phoenix ask in d.py' support server. Repeatedly asking people who can't help you, won't help you

earnest phoenix
#

ik

#

what is datetimeformat in v12

earnest phoenix
#

i get this error

#

UnhandledPromiseRejectionWarning: TypeError: Int16Array.DateTimeFormat is not a constructor

#
formatDate: function(date) {
        return new Int16Array.DateTimeFormat('en-US').format(date);
    }
quartz hill
#

Is there a code to restart all shards? (discordjs)

solemn quartz
#

guys

#

I need help with a thing

#

i made this:

#

but when i do canalestatusbot.send "send" appears as a word and not a object

storm bluff
#
        await images[0].resize(450, 442).quality(100);
        await images[1]
          .composite(images[0], 140, 354)
          .quality(100)
          .getBuffer(Jimp.MIME_PNG, async (err, buffer) => {
            await message.channel.send(
              new Discord.Attachment(
                buffer,
                "https://cdn.discordapp.com/attachments/676436130790375434/680729481723379735/wanted.png"
              )
            );
          });
      });```
what's problem??
robust moth
celest viper
#

me

#

look : you create these channels

#

and you put number zero

#

after you right click and you take thier id

solemn quartz
#

you just learn how to use guild.channels.create('Member Count: ${guild.membercount}')

#

im gonna give you a link @robust moth to learn it

robust moth
#

Ok

#

Thanks @solemn quartz

cursive dagger
#

bot = commands.Bot(command_prefix="/") bro how to add 2 prefix in this
@earnest phoenix
make command_prefix a list

celest viper
#

why do you wan't to create a second prefix

#

It would just add bugs

earnest phoenix
#

No

#

It wouldn't if done properly lol

robust moth
#

Please dm me @solemn quartz

earnest phoenix
#

@celest viper you can add like a lot prefix in a code just need cases

celest viper
#

const prefixs = ['/', '#'];

earnest phoenix
#

bruh

celest viper
#

bot = commands.Bot(command_prefix=prefixs);

earnest phoenix
#

Lol

solemn quartz
#

Please dm me @solemn quartz
@robust moth ok but wait a sec

#

im searching it

earnest phoenix
#

it doesnt really add bugs, carl has multi prefixes

solemn quartz
#

it is on Discord.js

earnest phoenix
#

also looks like python

#

oh

#

well either way

cursive dagger
#

@celest viper thats js mixed with py

celest viper
#

ok

#

sorry

earnest phoenix
#

commands.Bot(command_prefix=['/', '#']);

#

is fine

celest viper
#

tought you were using js

earnest phoenix
#

js would have a new

#

python is one of the few languages that don't use a new but use .

#

Yeah

#

anyway let's see

robust moth
#

I am waiting @solemn quartz

earnest phoenix
#

it's not guaranteed they can handle an array. lets dig in

#

Better use switch then

#

afaict looks like you'll need to check yourself?

#

switch?

#

Cases

#

hang on it has multi prefixes

solemn quartz
#

@robust moth some days ago i found a really good documentation on discord.js but now i dont find it

#

i only found this

#

new Discord.TextChannel(guilddata);

earnest phoenix
#

-_- python doesnt really have cases

#

Oh

solemn quartz
#

im gonna search more

earnest phoenix
#

@robust moth what are you having trouble with

#

getting the stats or renaming the channels

#

so list is right

#

I don't use python

#

tuple works too

#

wait

#

But thanks

#

ignore me -_-

celest viper
#

are you using js @earnest phoenix ?

earnest phoenix
#

i cant read -_-

slender thistle
#

dict with functions as values
Python version of cases

earnest phoenix
#

thats such a hack

#

but ya

#

@celest viper yes

celest viper
#

ok

#

discord.js?

earnest phoenix
#

i think generally people use if else tho tbh

#

Yeah if else but it's long

solemn quartz
#

@robust moth sorry but I dont find it

earnest phoenix
celest viper
#

switch(var) {

earnest phoenix
#

@solemn quartz

celest viper
#

case 'somethig':

earnest phoenix
#

use the official docs

solemn quartz
#

I am using them

#

lol

robust moth
#

@solemn quartz no problem

earnest phoenix
#

is official docs bad

#

Better get member count update etc for each channel and rename it on update @robust moth

#

Like member count update

#

i mean yeah but like

#

wonder what part he's having trouble with

#

Yeah

#

the events huh... that'd probably be it

#

Yeah

#

Events is the only way to do it

#

ya

#

and filter for bots and users

celest viper
#

big brain

earnest phoenix
#

i guess

#

There is also role update

#

yup

#

update isnt needed bc it doesnt change the count 😛

celest viper
#

big brain @earnest phoenix

twilit rapids
earnest phoenix
#

Hey red name

celest viper
#

you talk like dat to a mod

#

🤦‍♂️

twilit rapids
#

I'm not some kind of god lol

celest viper
#

yeah

twilit rapids
#

Just another random nerd on the internet

earnest phoenix
#

Yeah we like to call others with green name white name etc last year lol

modest maple
#

Lord timo

celest viper
#

lol

earnest phoenix
#

god of time?

#

Timo for the rescue

#

red name is a bad omen durr ThonkDumb

slender thistle
celest viper
#

praise @twilit rapids

earnest phoenix
#

Ok

solemn quartz
#

Guys

#

btw i was asking help 1 hour ago lol

#

then i forgot

earnest phoenix
#

f

#

@solemn quartz read message history