#development

1 messages · Page 925 of 1

grizzled raven
#

so not stink?

sudden geyser
#

Something like class Utility {...} and each method should be prefixed with the keyword, static. So you can just do Utility.somemethod()

grizzled raven
#

thanks

sudden geyser
#

Are some IDs even 16 in length

grizzled raven
#

just for safe keeping

nocturne grove
#

looks like they are already starting with a length of 10

sudden geyser
#

@grizzled raven 7/10 but Clyde's ID is 1 and no clyde support pensiveCowboy

nocturne grove
#

oh no wait, discord didn't exist 1 Jan 2015

earnest phoenix
#

how i do that but in 11v?

newRole.permissions.toArray().join(" - ")
grizzled raven
#

fixed it

earnest phoenix
#

idk how

sudden geyser
#

what happens when you try it

grizzled raven
#

same thing

earnest phoenix
#
(node:2692) UnhandledPromiseRejectionWarning: TypeError: newRole.permissions.toArray is not a function
sudden geyser
#

not you pls

earnest phoenix
#

me?

grizzled raven
#

star eval let mentions = []
@grizzled raven @safe geode @earnest phoenix
message.content.replace(/<@(!)?(1|\d+{16,20})>/g, (s, _, id) => {
mentions.push(id)
return s
})
--silent message.author.send(mentions.join(", "))

#

bruh ok

low wasp
#

Bruh

grizzled raven
#

lets pretend that worked

low wasp
#

We know it didn't

earnest phoenix
#

help plz

grizzled raven
#

wait

earnest phoenix
#

ok

grizzled raven
#

oops forgot to comment the pings

#

lol

#

star eval let mentions = []
// @grizzled raven @safe geode @earnest phoenix
message.content.replace(/<@(!)?(1|\d+{16,20})>/g, (s, _, id) => {
mentions.push(id)
return s
})
--silent message.author.send(mentions.join(", "))

sudden geyser
#

Lil marco it looks fine according to the docs. Can you show what newrole is

grizzled raven
#

see that definitely worked

sudden geyser
#

wrong section pls

grizzled raven
#

ok im done lol

earnest phoenix
#
client.on('roleUpdate', async (oldRole, newRole) => {
if(oldRole.permissions !== newRole.permissions){
let embed = new Discord.RichEmbed
let msgChannel = await logs.obtener(oldRole.guild.id)
if (!msgChannel) return;
let channel = client.channels.get(msgChannel);
embed.setTitle('Spanish letters here');
embed.addField('Mmm', newRole.permissions.toArray().join(" - "))
embed.setColor(amarillo);
channel.send({ embed });}
})
warm marsh
#

permissions.array()

#

iirc

earnest phoenix
#

let me try

sudden geyser
#

permissions is a number.

#

Not an instance of the Permissions class.

warm marsh
#

nvm array is on the Permissions class

grizzled raven
idle yew
#

Hi i needs invite manger bot link from were i can get it

sudden geyser
#

success

warm marsh
#

Or at least I thought.

earnest phoenix
#
(node:2762) UnhandledPromiseRejectionWarning: TypeError: newRole.permissions.array is not a function
#

@grizzled raven u r 11v?

grizzled raven
#

permissions.toArray()

earnest phoenix
warm marsh
#

you're going to have to use new discord.Permissions(newrole.permissions).toArray()

grizzled raven
#

wait let me

sudden geyser
#

@earnest phoenix if you want to use the permissions class you'd need to create a new instance of the class or use the .serialize() method on the Role instance and loop over its properties to get the ones you want.

earnest phoenix
#

is 11v? @warm marsh

warm marsh
#

Yes

#

just make sure you have const discord = require('discord.js'); at the top or something

nocturne grove
#

@sudden geyser it doesn't seem a class it what I mean, it should just be simple and I yeah a class is not the simpleness I need. I just want to do things like

toCode(str) {
  return '`' + str + '`';
}

Not really this, but things like this

grizzled raven
#

oh a role

earnest phoenix
#

@warm marsh i have const Discord

sudden geyser
#

A class is very simple once you understand it.

warm marsh
#

then change the discord to Discord

grizzled raven
#

thought you meant a guildmember

idle yew
#

I need this bot invite manger bot from were i can get it

sudden geyser
#

If you don't want a class just keep an key/value object instead.

earnest phoenix
#

work

warm marsh
#

Alright

nocturne grove
#

are classes better than objects in some way?

earnest phoenix
#

thanks

sudden geyser
#

Like I said the method needs to be static if you don't have to make a new instance.

#

in some ways yeah

#

for example your client uses classes

earnest phoenix
#

i can do ```js
variableofperms[new Discord.Permissions(newRole.permissions).toArray()]

warm marsh
#

variableofperms = [ ...(new Discord.Permissions(...))]

lyric mountain
#

are classes better than objects in some way?
@nocturne grove classes are objects' casts

nocturne grove
#

okay thanks. I will just read a bit more about it @sudden geyser

earnest phoenix
#

i say

variable = {
perm1: "Perm1xd"
}
variable[...(new Discord.Permissions)(...).toArray()]

@warm marsh

lyric mountain
#

you can't have an object without class

nocturne grove
#

I've made enough objects without the word class in it, tho 🤷

lyric mountain
#

but it does have a class

#

all objects belongs to Object class

quartz kindle
#

objects are data storage basically
classes are machines you build on top of objects

earnest phoenix
grizzled raven
#

thats not possible

quartz kindle
#

@earnest phoenix what are you trying to do?

onyx summit
#

Who should you allow editing guild settings on a dashboard.
I would have used manage_guild, but then I noticed that I don't know if that user has that permission without my backend asking my bot about it on every request that needs that information

earnest phoenix
#

@quartz kindle array perms

#

to the event roleUpdate

#

does anyone know how to make a mute command for my bot?

#

@earnest phoenix <user>.addRole('id role')

#

ok thx

#

np

quartz kindle
#

@earnest phoenix you need to explain better because what you showed makes no sense

glad charm
#

@onyx summit when you get the access token you can ping for user info for their guilds then just filter what guilds they have that perm in. No need for your bot to know.

onyx summit
#

yeah I fetch the guilds and then cache it, but I thought then that info is kinda stale

#

like what if they have their permission removed, or get that permission on a server

#

I wouldnt know

#

so my few options are:

  1. refetch the data from discord sometimes
  2. annoy my bot about it
  3. dont care and use the old info
quartz kindle
#

if youre using oauth2, standard practice is just let the token expire (stop refreshing it on session end) and refetch the data when the user visits again and reauths

earnest phoenix
#

@quartz kindle is like

trueorfalse = {
true: "bot",
false: "human"
}
trueorfalse[message.author.bot]
lyric mountain
#

that's.....very wrong

onyx summit
#

@quartz kindle how does that solve my problem?

lyric mountain
#

I don't think you can use booleans as object keys

earnest phoenix
#

@lyric mountain me?

lyric mountain
#

yes

earnest phoenix
#

this work

onyx summit
#

you can index objects with booleans

lyric mountain
#

js is weird af

quartz kindle
#

@onyx summit idk what your problem is, im assuming you're talking about oauth2 on a website/dashboard

earnest phoenix
#

but i dont remember if is true or "true"

#

@onyx summit on my old bot i personally never cached discord data for bearer tokens, always fetched it directly from discord

#

as long as you respect the ratelimit if and whenever you get ratelimited, you're fine

onyx summit
#

uff

earnest phoenix
#

@lyric mountain

  if (command === "test") {
    let falseortrue = {
      false: "Human",
      true: "Bot"
    }
    let user = message.mentions.users.first() || message.author;
    message.channel.send(falseortrue[user.bot])
  }
#

^^

#

this work

onyx summit
#

now I need to worry about ratelimits huh

lyric mountain
#

as I said, js is weird af

hasty lotus
#

hey i've made a color array (hex color) and i'm trying to pick a random color like this :

var random = Math.floor(Math.random() * colors.size)
    console.log(colors.size)
    console.log(random)
    var color = colors[random]``` Which prints me "undefined", and "NaN" out in the console. Does anone know why ?
earnest phoenix
#

oh ok

#

if you're using a library, chances are the lib handles ratelimits for you

#

many libraries automatically pause your requests, put them in a queue and then send them when the RetryAfter header says so

quartz kindle
#

@earnest phoenix you cant do that with an array. you need to process each item of the array individually. Also depends on what you want to output

onyx summit
#

there are libraries for handling oauth requests?

earnest phoenix
#

uh

#

@quartz kindle oh

quartz kindle
#

if you have {perm1:"permOne",perm2:"permTwo"}, and the role has both perms, what do you want it to say?

earnest phoenix
#

you're confusing oauth with sending requests to the api

#

the perm but in spanish @tim

onyx summit
#

yeah I know, I get a token from discord with which I can then make requests to the api

earnest phoenix
#

correct

#

but they're not the same

#

there's no libraries to "handle oauth requests" because you have to implement that yourself, oauth requests are not API requests

#

what is the perm 'USE_VAD'?

#

what i assume you meant with your question is if libraries support making calls to Bearer token endpoints

#

which, yes, almost all of them do

onyx summit
#

yes yes I didnt really mean oauth requests (my bad), but the typical requests to get e.g. the guilds from a user are not the paths a normal lib made for bots would call

quartz kindle
#

so you just want to translate the perms? then do something like this: ```js
let spanish = {
"SEND_MESSAGES":"Enviar Mesaje",
...
}
permissions.toArray().map(perm => spanish[perm])

earnest phoenix
#

@quartz kindle ty

hasty lotus
#

hey i've made a color array (hex color) and i'm trying to pick a random color like this :

var random = Math.floor(Math.random() * colors.size)
    console.log(colors.size)
    console.log(random)
    var color = colors[random]``` Which prints me "undefined", and "NaN" out in the console. Does anone know why ?
quartz kindle
#

array.size is not a thing

#

its array.length

#

size is for Map objects

onyx summit
#

@earnest phoenix do you know any js libs for this?

hasty lotus
#

i tried too

#

but still doesn't work

#

:/

quartz kindle
#

show what you tried

#

also show your array

earnest phoenix
#

eris i guess @onyx summit

#

how do i send an embed without the field

hasty lotus
#

the array is too long

earnest phoenix
#

...don't put a field

hasty lotus
#

it has like ~50 hex color codes

quartz kindle
#

show just a part of it then

hasty lotus
#

const colors = ["#42D69A","#29071D","#0754F"...]

#

like that

earnest phoenix
#

@cry#2046

#

you need a field

#

wtf

cinder patio
#

you don't

earnest phoenix
#

yoo

#

@earnest phoenix

hasty lotus
#

he left

#

:/

earnest phoenix
#

this server just shat on itself

#

uh... no you don't

hasty lotus
#

oh no

#

that's weird

earnest phoenix
#

fields are optional in an embed

quartz kindle
#

then colors.length should work

earnest phoenix
#

you dont but

#

like

#

1 sec

#

1 SEC

hasty lotus
#

so tim ?

#

uh ok

#

idk

#

it's weird

#

🤷‍♂️

quartz kindle
#

show the code where you used colors.length

cinder patio
earnest phoenix
#

i dont want that

#

oh

#

hooy,l fuckckc

hasty lotus
#

??

earnest phoenix
#

discord is buggin man

#

make your title a zero width space

#

i dont want that

#

?

#

i think it's just your internet

#

it's fine on my end

hasty lotus
#

@quartz kindle

    var size = Math.floor(Math.random() * 15) + 20
    var random = Math.floor(Math.random() * colors.lenght)
    console.log(colors.lenght)
    console.log(random)
    var color = colors[random]
    console.log(size)
    var rotate = Math.random() * 5
    console.log(rotate)
    ctx.font = `${size}px Impact`
    ctx.fillStyle = color```
earnest phoenix
hasty lotus
#

it's a canvas thing

#

and it prints it in black

quartz kindle
#

change your field title to a zero-width space

earnest phoenix
#

that

hasty lotus
#

🤷‍♂️

earnest phoenix
#

needs to be there

#

or it wont work

quartz kindle
#

@hasty lotus length not lenght

cinder patio
#

that's not how you spell length, Nini

hasty lotus
#

🤦

#

ok

#

thx

quartz kindle
#

@earnest phoenix this is the unicode for a zero-width space in js \u200b

earnest phoenix
#

i told you

#

should i do it on vsc?

quartz kindle
#

idk how its in py, or whatever you use

earnest phoenix
#

im using py

quartz kindle
#

save the file as unicode

earnest phoenix
#

ill try in vsc

#

its a "?" now

#

it's because you're editing in notepad

#

or some IDE that doesn't support unicode

#

k one sec

#

ill use vsc

#

if you reopen the file you'll see that it placed a question mark

#

it worked

#

in vsc

midnight blaze
#
#!/usr/bin/python -tt
# -*- coding: utf-8 -*-

dunno, did u use that on your code? but, anyway, it works now, ig

near ether
#

why does discord temp-ban my bot for an hour?

earnest phoenix
#

because you're spamming API requests

near ether
#

as in, reactions and other stuff?

earnest phoenix
#

depends what

modest maple
#

as in literally anything

near ether
#

my bot typically sends 100k bytes/s but every so often it jumps to 500k and thats when it gets temp banned, i have no idea why it jumps to 500k because it has never done it before

modest maple
#

messages, reactions, fetches

earnest phoenix
#

anything that makes a REST request contributes to that

#

you mainly get API banned if you spam requests while you're ratelimited

#

This means that you need to send 25,000 requests in 10 minutes that result in a 401, 403 or 429 in order to be auto-banned.

#

where does description go

modest maple
#

well atm youre just making a var called description and doing fuck all with it

earnest phoenix
#

you're either not respecting ratelimits or you're not doing permission checks before you do a certain action, neelio

#

im asking where it goes not what its fucking doing

near ether
#

ah ok

#

would these requests that result in a 401, 403, or 429 code be logged in stderr?

#

because from what im seeing, they dont

earnest phoenix
#

they don't get logged if you don't log them

#

@earnest phoenix

modest maple
#

@earnest phoenix idk why ur asking us where to stick that var :P

earnest phoenix
#

how i join the arguments with +?

    let filter = (msg) => msg.author.id === message.author.id
  message.channel.send("Que quieres buscar?").then(e=> {
e.channel.awaitMessages(filter , {
max: 1 ,
time: 155155,
errors: ["time"]
}).then(async collected => {
  let embed = new Discord.RichEmbed();
  embed.setTitle('Ok Google')
  embed.addField(`Busqueda completa`, `[Link](https://www.google.at/search?ei=uCVsXrqEEIWbsAefxZDYDw&q=${collected.first().content})`)
  embed.setColor(amarillo)
await message.channel.send({ embed })
await message.channel.send("Aqui tienes!")
e.channel.awaitMessages(filter , {
max: 1,
time: 1212,
errors: ["time"]
})
 }).then(async collected => {
console.log(collected.first().content + " relleno")
})
})
modest maple
#

if you mean to set the embed description you gotta set that embed attribute to that

earnest phoenix
#

wtf are you saying

near ether
#

is there a djs way of logging? isnt there a bot.on('debug') in djs, or a node process.on('warn') event i can set up?

modest maple
#

@earnest phoenix its not hard, you have an embed object

#

description is a attribute of that object

midnight blaze
#
embed=discord.Embed(description="hi")
quartz kindle
#

v12 has bot.on("ratelimit")

modest maple
#

set description attribute -> set embed description

earnest phoenix
#

thank you

#

this dumbass was not helping at all

modest maple
#

🤔

midnight blaze
#

dont be rude xD they did not understand what you asked, that happens sometimes

modest maple
#

i mean its not hard, its basic programming

#

and no

earnest phoenix
modest maple
#

ik what they were talking about

earnest phoenix
#

lol what you gave me didnt work either

modest maple
#

but i was actually getting them to think with their brain instead of giving them an easy way out

midnight blaze
#

it works for me

earnest phoenix
#

yo i have a line in my code and it says i need an async for await to work but i have async. and i saved it

#

message.guild.channels.forEach(async (channel, id => {

#

where do i drop it

modest maple
#

because then they go copy paste which is exactly what theyre doing

#

see my point ;P

midnight blaze
#

really? sry, but this is so easy :/ I can not write the whole code for you

earnest phoenix
#

don't use forEach, it's extremely slow

#

@earnest phoenix i say: how i join the arguments with +?

#

do a for loop instead of .forEach

#

ok

modest maple
#

how many languages are you writing this bot in marc? ive seen you ask for help in atleast 2 rn

earnest phoenix
#

ill do it myself thanks for your help

#

it still isnt working

near ether
#

ah i see

#

thanks cry and tim!

earnest phoenix
#

how i join the arguments with + ?

let filter = (msg) => msg.author.id === message.author.id
 message.channel.send("Que quieres buscar?").then(e=> {
e.channel.awaitMessages(filter , {
max: 1 ,
time: 155155,
errors: ["time"]
}).then(async collected => {
 let embed = new Discord.RichEmbed();
 embed.setTitle('Ok Google')
 embed.addField(`Busqueda completa`, `[Link](https://www.google.at/search?ei=uCVsXrqEEIWbsAefxZDYDw&q=${collected.first().content})`)
 embed.setColor(amarillo)
await message.channel.send({ embed })
await message.channel.send("Aqui tienes!")
e.channel.awaitMessages(filter , {
max: 1,
time: 1212,
errors: ["time"]
})
}).then(async collected => {
console.log(collected.first().content + " relleno")
})
})```
#

stop spamming your code

#

nobody knows what you're talking about

#

refer to the link above and see how to properly ask your question

#

like
a+e+i+o+u+1+2+3+4+5

quartz kindle
#

what arguments?

#

where are the arguments in your code?

earnest phoenix
#

my code still isnt working

grizzled raven
#

cool

midnight blaze
#

there are no arguments

earnest phoenix
#

thats 1 line

#
    if (message.member.hasPermission(["KICK_MEMBERS", "BAN_MEMBERS"])) {

        if(message.guild.me.hasPermission("KICK_MEMBERS", "BAN_MEMBERS")) return message.channel.send("Uh oh! Looks like i do not have permission to do this!")

        let mutee = message.mentions.members.first()

        let reason = args.slice(1).join(" ");
        if(!reason) reason = "No reason given" 

        let muterole = message.guild.roles.find(r => r.name === "Muted")
        if(!muterole) {
            try{
                muterole = await message.guild.createRole({
                name:"Muted",
                color: "#514f48",
                permissions: []
                })
                message.guild.channels.for(async (channel, id => {
                    await channel.overwritePermissions(muterole
                        SEND_MESSAGES: false,
                        ADD_REACTIONS: false
                        SPEAK: false
                 })

                })
            } catch(e) {
                console.log(e.stack);
            }
        }
}

mutee.addRole(muterole.id).then(() => {
    message.delete()
    mutee.send(`You have been MUTED in ${message.guild.name} for ${reason}`)
    message.channel.send(":mute:" + ` ${mutee.user.username} has been MUTED!`)
})```
quartz kindle
#

thats not 1 line, thats like 50

earnest phoenix
#

thats 50 lines

#

the line i posted before was 1 line

quartz kindle
#

and what is the problem?

earnest phoenix
#

it says i need an async

#

but i have it

#

message.guild.channels.for(async (channel, id => {

#

on this line

quartz kindle
#

channels.for doesnt exist

earnest phoenix
#

ok

quartz kindle
#

you need a for loop, which is a top-level loop, its not a property of anything, its standalone

#

for discord collections, you can use a for of loop

iron scroll
#

How i can use emoji on canvas? (JavaScript)

grizzled raven
#

get an image of the emoji

quartz kindle
#

custom emojis or default emojis? for custom emojis ^ what he said

indigo cloud
#

does anyone have the kick or ban or mute or music script? for a discord bot

quartz kindle
#

there are a million different ways to code and execute something like that

earnest phoenix
quartz kindle
#

code is written for a very specific context, it will only work in the program it was coded to work on. copying and pasting code is bad practice and will likely never work "out of the box" because it has to be adapted to fix the rest of your code and context

indigo cloud
quartz kindle
#

depends

#

in v12 it wont work

indigo cloud
#

then how do i go back to older version

quartz kindle
#

v11 will stop working in october

#

no point going back to it

#

and even in v11, it wont work out of the box

opal cloak
#

is the bot down?

indigo cloud
#

ok

quartz kindle
#

you still need to define a channel id, and you need to process the ban command itself

#

that code doesnt check what command was used, it only does the banning logic (for v11) for after the ban command was processed

indigo cloud
#

do u know a script for ban?

opaque seal
#

Hi guys, I've been into this problem for a while and couldn't fix it, hopefully you guys can help.
I have an array of objects, every object contains a voice channel id under the property 'hall'
I need to check once in a while if some of these IDs do not corrispond to any channel anymore 'cause maybe the channel got deleted

This is what I tried but it doesn't work properly

// Check halls
        let index = 0;
        let newHalls = halls;
        if(halls){
            halls.forEach(e=>{
                let ccc = message.guild.channels.cache.get(e.hall);
                if(!ccc){
                    let i = newHalls.indexOf(e);
                    newHalls.splice(i, 1);
                }
            })
            halls = newHalls;
            await client.guildSchema.updateOne({id: message.guild.id}, {$set: {'halls': newHalls}})
        }```
This is an example of an object of the array
quartz kindle
#

as i said, there is no scripts you can copy and paste, thats a bad idea 99 times out of 100

#

i dont know any script, i code my own script if i need it

indigo cloud
#

ok

quartz kindle
#

you should not add commands to your bot by copying and pasting them, you should learn how to code them yourself

#

else you will run into tons of problems

indigo cloud
#

alright

near ether
#

would a good way to deal with ratelimits be using bot.on('ratelimit'), logging ratelimitinfo.path (for my reference), and then forcing the bot to wait until ratelimitinfo.timeout has finished before allowing it to make any actions again?

#

or is there a more optimal way, like throttling?

quartz kindle
#

the optimal way is not letting your code reach them in the first place

#

what are you doing that is hitting the rate limit?

near ether
#

so my bot uses reactions for everything, and i just released a new update last night that blew up in popularity. i think its sending out way too many requests for reactions and so it is getting temp-banned, if that makes sense

earnest phoenix
#

Can i upload inside-me domain to image from an command? Is this possible?

near ether
#

thats my hunch, at least

earnest phoenix
#

I want my (prefix) command to allow me to execute it but otherwise restrict it to only people with the "Manage Server Permission"

quartz kindle
#

@opaque seal you can just halls = halls.filter(e => message.guild.channels.cache.get(e.hall))

earnest phoenix
#

Anyone ?

quartz kindle
#

@near ether how many are we talking about and how frequent? because my help command uses 10 reactions and i dont get rate limited

knotty steeple
#

@earnest phoenix yes

near ether
#

turn based battles use at minimum 5 reactions every 5-ish seconds,

#

and then i used a page system with my embeds where you can react with forward or backwards to flip through pages

quartz kindle
#

show your reactions code

knotty steeple
#

you probably need a way to pass image data to upload

quartz kindle
#

does your bot auto-unreact people's reactions?

earnest phoenix
#

yes

knotty steeple
#

but u can just post to ur image server

near ether
#

no, the most it does is clear the reactions on a message once used

#

and i cant really send the code since the reaction code is dispersed everywhere

quartz kindle
#

are you properly awaiting all reactions?

knotty steeple
#

pretty sure u can post a buffer or base64 for an image

#

kyoya

near ether
#

yea i make sure to await every time i react

knotty steeple
#

how do u do that i dont know

quartz kindle
#

did you change the restTimeOffset client option?

earnest phoenix
#

I don't know,how can i post an image to there

near ether
#

i dont know what that is, ill look it up and get back to you

#

thanks!

knotty steeple
#

are u trying to upload from a link

#

of an actual image

near ether
#

ok so no, i havent changed that option

#

its the default at 500

quartz kindle
#

then i'd need to see your code

earnest phoenix
#

anyone know how to turn py into exe

knotty steeple
#

you need a way to compile it

earnest phoenix
#

pyinstaller

quartz kindle
#

look into python builder/compiler

near ether
#

itd be hard to send it because the reaction code is not in a few locations, its in a lot of files spread across a lot of functions. is there anything you would recommend i should look for in my reaction code?

midnight blaze
#

@earnest phoenix Auto PY to EXE

quartz kindle
#

you're using discord.js right?

near ether
#

me? yep

quartz kindle
#

discord.js has a pretty good control over rate limits

#

for example, once i had an april fools event where my bot reacted with "H" "I" to every single message

#

that was hundreds of reactions per minute, they automatically got lots of delay due to the rate limit queue

#

and i didnt get a single rate limit error

white anvil
#

no library is immune to causing 429s

quartz kindle
#

so for you to be getting rate limit errors, there has to be something wrong in your code

white anvil
#

you should be very careful when doing stuff that could potentially surpass discord ratelimits

#

i have been ratelimited before with libs that seemingly had this internal limit

earnest phoenix
#

...you can't surpass discord ratelimits

#

oh

#

you mean

#

yeah

knotty steeple
#

if u setup ur code properly u can easily avoid getting ratelimited

grizzled raven
#

why does return await have unexpected

#

stuff

earnest phoenix
#

preemptive ratelimiting

knotty steeple
#

what stuff

near ether
#

yea thats what my bot goes through, it gets delayed all the time

#

which is intended behaviour

#

it may not even be reactions tbh, it might just be messages?

opaque seal
#

@opaque seal you can just halls = halls.filter(e => message.guild.channels.cache.get(e.hall))
@quartz kindle thank you so much

quartz kindle
#

is your bot sharded?

near ether
#

oops

#

wrong pic

#

one sec

indigo cloud
near ether
onyx hare
#

What’s the line of code needed for the bot to tag the command user eg “prefix.support, bot returns @x.y.z here’s the support link”

near ether
#

when it spikes, thats when i get ratelimited

white anvil
#

@indigo cloud they are different

near ether
#

and yes, my bot has 20 shards

white anvil
#

you cant compare them

quartz kindle
#

are you sure you dont have an infinite loop somewhere?

white anvil
#

they serve different languages

indigo cloud
#

Alright

earnest phoenix
#

@indigo cloud all programming languages are good

white anvil
#

thats subjective

#

depends on what you're doing

knotty steeple
#

some libs and langs are better for specific things

near ether
#

im sure i dont but ill check once more

quartz kindle
#

@near ether so one thing: afaik, shards do not sync rate limits among themselves, so if your code is doing cross-shard stuff, it can interfere with each other's rate limit system

knotty steeple
#

i wouldnt make a game with js and electron

near ether
#

ah ok, my code uses broadcastEval almost everywhere

knotty steeple
#

u can but its bad in performance and in general

#

so u pick something better for it like c#

indigo cloud
white anvil
#

yes

knotty steeple
#

of course

white anvil
#

everything like this has versioning

indigo cloud
#

Alright

white anvil
#

all opensource code

#

and closed source

near ether
#

but still, that doesnt explain why it spikes to such a high bytes sent/s

grizzled raven
#

what the hell is this ```js
Response: Internal Server Error
at RequestHandler.execute (/home/thenoob27/Starboard/node_modules/discord.js/src/rest/RequestHandler.js:158:11)
at processTicksAndRejections (internal/process/task_queues.js:86:5)

white anvil
#

internal server error

knotty steeple
#

all software has versions

white anvil
#

blame discord

grizzled raven
#

my bot is stable

near ether
#

it receives roughly the same amount of bytes

knotty steeple
#

everything has versions

grizzled raven
#

ohh

white anvil
#

yeah its a server error it has nothing to do with your bot

grizzled raven
#

500

near ether
knotty steeple
#

blame discord

near ether
#

more activity than usual but not so significant as to quintuple the sent bytes

grizzled raven
#

hey what ways could you monitor your bot like that

#

asking for me

white anvil
#

grafana

near ether
#

i use google cloud platform and i use their monitoring system

earnest phoenix
#

Error: input stream: Too many redirects I played a playlist, and uhhhhh

near ether
#

its extremely useful

quartz kindle
#

so basically

#

if a rate limit is 5 per 5

#

and shard 1 sends 4, and for some reason, it sends a broadcastEval that makes shard 2 send to the same channel

#

shard 1 will not know that shard 2 sent to the same channel, and shard 2 will not know that shard 1 already sent 4 times

#

causing a rate limit error

earnest phoenix
#

my bot plays 5 songs and then gives me the error Error: input stream: Too many redirects

quartz kindle
#

so i would start investigating your broadcastEvals

near ether
#

alright, this only started happening after my new update so ill just look in the new code

#

thanks for the help!

reef carbon
#

How do I get my dbl token?

quartz kindle
near ether
#

well actually tim now that i think about it, my bcEvals dont broadcast code that require the api except once when the bot is launching

quartz kindle
#

what about stuff like fetching a channel from another shard

near ether
#

nope

#

the only time it fetches with broadcast evals is when someone votes

#

and that doesnt happen enough to warrant a rate limit obv

quartz kindle
#

what kind of stuff did you add on your new code?

digital ibex
#

hi hello

near ether
#

honestly it uses the same design as the old code; bot sends a message, bot reacts, waits for user reaction, then edits embed depending on the user's choice, then bcEvals the important info across shards (does not make an api request)

digital ibex
#
    const cooldowns = new Eris.Collection();
    if (!cooldowns.has(command.name)) {
        cooldowns.set(command.name, new Eris.Collection());
    }

    const now = Date.now();
    const timestamps = cooldowns.get(command.name);
    const cooldownAmount = command.cooldown * 1000;

    if (timestamps.has(message.author.id)) {
        const expirationTime = timestamps.get(message.author.id) + cooldownAmount;

        if (now < expirationTime) {
            const timeLeft = (expirationTime - now) / 1000;
            const p = await message.channel.createMessage(
                `${message.member.mention}, You are being rate limited, slow down! (**${timeLeft} seconds**)`
            );
        }
        timestamps.set(message.author.id, now);
        setTimeout(() => {
            timestamp.delete(message.author.id, cooldownAmount);
            p.delete();
        }, cooldownAmount);
    }```
near ether
#

which is why im so stumped

wise quartz
#

Does a webhook require hosting just like a bot?

digital ibex
#

why isn't that working as a cooldown, using eris?

#

no errors

quartz kindle
#

@wise quartz no

wise quartz
#

@quartz kindle its free to use right?

quartz kindle
#

yes

#

what kind of webhook are you talking about btw

near ether
#

weebhook lmao

bitter silo
#

Hi

#

bot 2 days wait

quartz kindle
#

well, the webhook still needs something to send it

wise quartz
#

Whats it?

quartz kindle
#

so in that sense, it does require some hosting, or a website, or webservice to do it

wise quartz
#

Aha..

quartz kindle
#

a bot can send webhooks, what big bots do it simply have their bots send it

wise quartz
#

Aha

quartz kindle
#

otherwise, webhooks can also be sent by github, twitter, etc

reef carbon
#

How do I get the server count on my top.gg page

wise quartz
#

And how can i do that?

quartz kindle
#

those dont require your bot

reef carbon
#

right now it says n/a

quartz kindle
wise quartz
#

Theres examples on the top.gg github repo @reef carbon

quartz kindle
#

@wise quartz you go to the service you want, like twitter, and in their settings look for webhooks, and use your discord webhook as the url

wise quartz
#

Imma see some youtube tutorials if there is.. that'd help me understand them better

#

But thanks

heavy marsh
#
(node:5076) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function
``` - I am confussed with this error
sudden geyser
#

What version of Node.js are you using.

#

And what is fields

heavy marsh
#

I have to be at 12 sorry i was at 10

#

had*

#

Fixed now

sudden geyser
#

Alright

reef carbon
#

wait

#

im confused

#

i have this code

white anvil
#

bruh nice token leak

#

you might want to delete that

mossy vine
#

sick token

#

go reset

reef carbon
#
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))
#

i have this code

#

but it doesn't show the server count on my bot page

knotty steeple
#

im assuming u didnt change the dbl token

reef carbon
#

no

#

i changed it

#

i didn't want to leak my dbl token

#

but i fixed

earnest phoenix
#

heyy

#

me again

#

lol

#

how do i make categories

#

in my help command

quartz kindle
#

as text or as embed?

modest maple
#

you type it?

earnest phoenix
#

@Tim#2373

#

embed

#

@quartz kindle

#

fuck discord api is ass man

quartz kindle
#

you're using py or js? i dont remember

modest maple
#

its just markdown text

#

theyre py

earnest phoenix
#

py

modest maple
earnest phoenix
#

no.

#

actual categories

#

where you have to type +help moderation

#

to see moderation commands

#

omg im dumb

#

holly shit

#

nvm i got it

#

ill just make a new command

modest maple
#

i did respond but discord died and decided not to send but meh

hardy vector
#
const Discord = require('discord.js')
module.exports = {
    name: 'hug',
    description: 'hug people',
    execute: async(client, message, args) => {
        const gifs = ["https://i.imgur.com/cZWWATV.gif", "https://i.imgur.com/NdUPLO9.gif", "https://i.imgur.com/lyJfpE7.gif"]
        let gif = gifs[Math.floor(Math.random()*(gifs.length)-1)]
        let personebeinghugged = message.mentions.users.first()
        let personhugging = message.author
        if (!personebeinghugged) {
            message.channel.send("who you hugging")
        } else {
        let embed = new Discord.MessageEmbed()
        .setColor("RANDOM")
        .setImage(gifs)
        //.setTitle(`${personhugging.user} hugged ${personebeinghugged}`)
        message.channel.send(embed)
        }
    },
};``` when i do =hug and mention a user it tells me "who you hugging"
earnest phoenix
#

bro

#

message.channel.send("who you hugging")

#

ofc its gonna send that

hardy vector
#

no !personbeinghugged

quartz kindle
#

it should only send that if nobody is mentioned

hardy vector
#

its being triggered if no one is mentioned right

#

?

quartz kindle
#

i dont see anything wrong with the code as it is

mossy vine
#

why does Array.indexOf not work on objects

quartz kindle
#

objects dont have indexes?

mossy vine
#

i mean

#

an array of objects

#

indexOf(someObject)

#

does not seem to work

hardy vector
quartz kindle
#

ah

hardy vector
#

cos this happens

quartz kindle
#

because objects are technically references and not copies

mossy vine
#

aaaa then how do i check if an object already exists in an array of objects

quartz kindle
#

you'd need to stringify it

mossy vine
#

oh wait

#

wouldnt Array.includes work

#

contains*

quartz kindle
#

dont think so

mossy vine
#

wait no

#

it is includes

#

wait what no its contains

quartz kindle
#

do you want to match the entire object? like an exact copy?

mossy vine
#

which one is it wtf

#

yea

quartz kindle
#

array.find(item => JSON.stringify(item) === JSON.stringify(myobj))

mossy vine
#

and if i want to make sure it doesnt exist in the array just do !== instead right?

#

oh wait no

#

!array.find

quartz kindle
#

yup

#

can also use .some() instead

#

if you dont need to return the object found

mossy vine
#

aight its working tyvm

#

hope this wont shit on my performance

quartz kindle
#

it probably will a bit

#

serialization is a bitch

mossy vine
#

considering i managed to get this beauty out of it

#
(await client.getMessages(message.channel_id, 10)).reduce((accumulator, curr) => {
            if (curr.author.username !== message.author.username && !curr.author.bot && !accumulator.some(item => JSON.stringify({ u: curr.author.username, i: curr.author.id }) === JSON.stringify(item)))
                accumulator.push({ u: curr.author.username, i: curr.author.id })
            return accumulator
        }, [])```
quartz kindle
#

what i do is i save their stringified versions

#

so its fast to compare

#

and then json.parse when i need to use them

mossy vine
#

surely there has to be a better way than this lmao

#

but i guess i can expand this for my future needs

hardy vector
#

wait so what about mine did i do something wrong?

quartz kindle
#

wait you're doing that on messages?

mossy vine
#

me?

quartz kindle
#

ye

mossy vine
#

well yea

quartz kindle
#

ah nvm

mossy vine
#

i fetch last x messages and grab every unique authors username and id not including bots and the author and other criteria in the future

quartz kindle
#

yeah its better if you push strings

mossy vine
#

but then i will just have to deserialize them again later

#

well i suppose i could just .map(d => JSON.parse(d)) afterwards

quartz kindle
#

yeah but better deserialize them later once, than serialize them about 90 times?

#

for all the comparisons

mossy vine
#

fair enough

quartz kindle
#

actually, its would be even faster to simply compare the object contents

#

since its only 2 keys

mossy vine
#

and since 1 is the username i really just need to compare the ids

quartz kindle
#

!acc.some(item => item.u === curr.author.username && item.i === curr.author.id)

mossy vine
#

no?

quartz kindle
#

well, yeah

#

idk why you need both username and id, i thought you were comparing id and message for a while

grizzled raven
#

index of object seems to work from my experience

mossy vine
#

i need username and id for later use

grizzled raven
#

actually maybe uts my use

#

i usually use indexOf objects in these scenarios ```js
let exists = arr.find(a => a.key === "3")
if (exists) {
arr.splice(arr.indexOf(exists), 1)
}

quartz kindle
#

that looks like it shouldnt work

dusty onyx
#

howdy- does anyone know how to get a for loop in an embed in discord.py?

quartz kindle
#

but it actually works wtf

#

actually it does make sense

modest maple
#

@dusty onyx wdym a for loop in a embed?

dusty onyx
#

ill send mt code

quartz kindle
#

because when you use array.find() you get the reference of an existing object, and you're comparing references, but if you use a new object, its a new reference, even if the content of the object is the same

dusty onyx
#

`for e in ultimates:
ms = discord.Embed(
'<@!' + str(e) + '>' + " is the Ultimate " + str(ultimates[e]) + '!'.format(message),

            colour=0x008000
        )`
#

ah sorry

#

came out bad

#

but essentially i have a dict that im listing the key and content on each line, for how many items there are in the dict

#

it works fine out of an embed, but id just m u c h rather have it in an embed bc it looks way cleaner

modest maple
#

ah

#

well what you can do

dusty onyx
#

the initial for statement doesnt work btw, i was just experimenting

modest maple
#

is just make the embed object first

#

with discord.Embed()

#

and then do embedobject.description = "some description"

#

and we can iterate round that description

#

without making a new object every time

dusty onyx
#

ooh ok

#

i get an error tho when i define smth with a for loop

modest maple
#

whats the error

dusty onyx
#

well in pycharm i get a red sqiggly line with 'expression expected'

#

and when it runs its invalid syntax

modest maple
#

whats your code atm

#

might just be how you're defining vars

dusty onyx
#

ms.description = for e in ultimates: '<@!' + str(e) + '>' + " is the Ultimate " + str(ultimates[e]) + '!'.format(message_clone)

modest maple
#

ah yeah that wont work like that

#

you basically need

#

for somthing in some_list:
  some_embed.description += some text
#

the += is basically taking the current description already then adding what ever you give it to the end

#

like doing x = x +1 we can do x += 1

dusty onyx
#

ur a genius

astral yoke
#

okay so if i have this let blacklist = bot.db.get(`blacklist_${user.id}`) ? bot.db.get(`blacklist_${user.id}`): "❎ - Not Blacklisted" how would I make it so that if it finds it, aka its true, it would make it say "✅ - Blacklisted"

dusty onyx
#

so id go for e in ms ?

modest maple
#

your original for loop was fine in terms of for e in ultimates

dusty onyx
#

oh yes i see now

#

tysm ur a god send

quartz kindle
#

@astral yoke replace the second db.get() with that

#

db.get() ? blacklisted : not black listed

astral yoke
#

But how would I put it so that if he is it would make it say That it is blacklisted? Cause for now it just says "true"

#

I want it so if like if(blacklist === "true")

#

would that work?

quartz kindle
#

no, you need to save the result

hardy vector
#
const Discord = require('discord.js')
const id = "467030554131562506"
const beautify = require('beautify')
const { MessageEmbed } = require("discord.js")
module.exports = {
    name: 'eval',
    description: 'eval code',
    execute: async(client, message, args) => {
        if(message.author.id === id) {
        

        if (!args[0]) {
            message.channel.send("You need to evaluate something")
        }

        try {
            if (args.join(" ").toLowerCase().includes("token")) {
                return;
            }
            const toEval = args.join(" ")
            const evaluated = eval(toEval)

            let embed = new MessageEmbed()
            .setColor("#00FF0")
            .setTimestamp()
            .setFooter(client.user.username, client.user.displayAvatarURL)
            .setTitle("Eval")
            .addField("To evaluate", `\`\`\`js\n${beautify(args.join(" "), { format: "js" })}\n\`\`\``)
            .addField("Evaluated", evaluated)
            .addField("Type of:", typeof(evaluated));
        } catch (e) {
            let embed = new MessageEmbed()
            .setColor("#FF0000")
            .setTitle("\:x: error!")
            .setDescription(e)
            .setFooter(client.user.username, client.user.displayAvatarURL)

            message.channel.send(embed)
        }
    } else {
        message.channl.send("no")
    }
    },
};``` my eval command isnt rlly an eval command it only does like sending messages so if i do _eval message.channel.send("no") it will say no it wont do anything else i tried to do _eval message.guild.id but nothing happens and no errors why
astral yoke
#

holy

quartz kindle
#
let result = db.get()
let blacklisted = result ? "blacklisted" : "not blacklisted"
if(result) {
  msg.channel.send(blacklisted)
}
#

but if you're going that route, its better to do without ternary

astral yoke
#

I'm doing it in an embed.

quartz kindle
#
result = db.get()
if(result) {
  ...send("blacklisted")
} else {
  ...send("not black listed")
}
astral yoke
#

Thanks Tim!

quartz kindle
#

@hardy vector you never send the embed lol

hardy vector
#

im blind

indigo cloud
#

PS C:\Users\xAutentiqz\Desktop\Discord Bot> node run index.js
internal/modules/cjs/loader.js:960
throw err;
^

Error: Cannot find module 'C:\Users\xAutentiqz\Desktop\Discord Bot\run'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
at Function.Module._load (internal/modules/cjs/loader.js:840:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []

#

how to fix this?

quartz kindle
#

its not node run index.js

#

its just node index.js

earnest phoenix
#

node index.js

sullen portal
#

how do you find how much servers your bot is in

earnest phoenix
#

or nodemon index.js

indigo cloud
#

same thing

quartz kindle
#

check how big the guild cache is

#

in discord.js v12 it would be client.guilds.cache.size

indigo cloud
#

ok

quartz kindle
#

@indigo cloud do you have an index.js file in your Discord Bot folder?

sullen portal
#

thx

indigo cloud
#

yes

quartz kindle
#

type dir

#

what does it show?

indigo cloud
#

Mode LastWriteTime Length Name


d----- 5/13/2020 10:43 PM node_modules
-a---- 5/13/2020 11:16 PM 244 index.js
-a---- 5/13/2020 10:43 PM 3902 package-lock.json
-a---- 5/13/2020 10:46 PM 287 package.json

quartz kindle
#

and when you type node index.js you get an error?

#

which error?

#

should be a different error than the last one

indigo cloud
#

Error: Cannot find module 'discord.js'
Require stack:

  • C:\Users\xAutentiqz\Desktop\Discord Bot\index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (C:\Users\xAutentiqz\Desktop\Discord Bot\index.js:1:17)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [ 'C:\Users\xAutentiqz\Desktop\Discord Bot\index.js' ]
    }
quartz kindle
#

did you install discord.js?

indigo cloud
#

ya

#

i will reinstall it

#

hold up

quartz kindle
#

yes, do npm install discord.js

indigo cloud
#

ik

earnest phoenix
#

how does the pfp command go

#

py

indigo cloud
#

how do i install discord.js v11.4.2

pale vessel
#

you shouldn't

quartz kindle
#

you shouldnt install v11 because it will stop working in october

indigo cloud
#

well most ytubers do it

#

so idk

quartz kindle
#

because they're all outdated

indigo cloud
#

alright

mossy vine
#

because the tutorials are outdated

indigo cloud
#

nvm i will go to my last project

astral yoke
#

@quartz kindle ty for that, i changed it a little but thanks for the help

quartz kindle
#

👍

earnest phoenix
#

help

#

help

#
    at timeout.client.setTimeout (/rbd/pnpm-volume/5b146d33-2649-47dc-b5df-4bb5db586bdc/node_modules/.registry.npmjs.org/discord.js/11.6.4/node_modules/discord.js/src/client/ClientManager.js:40:57)
    at Timeout.setTimeout [as _onTimeout] (/rbd/pnpm-volume/5b146d33-2649-47dc-b5df-4bb5db586bdc/node_modules/.registry.npmjs.org/discord.js/11.6.4/node_modules/discord.js/src/client/Client.js:436:7)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5)
(node:3087) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 6)
(node:3087) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.```
#

why ?

#

help me ?

astral yoke
#

that happened to me as well earlier

quartz kindle
#

discord.js v11 has that bug if some guild is offline

astral yoke
#

i had very high bot ping and had to restart my bot more then once to get the ping to stay down

quartz kindle
#

you should upgrade to v12 if you can, as v11 will stop working in october

white anvil
#

LOL is that really an error that djs fires???

#

that is the most useless thing i have ever seen

quartz kindle
#

its unclear what is the exact reason, but thats one of the symptoms of a dead server

#

because v11 will wait for it until a global timeout happens

#

v12 will only wait for 15 seconds, then automatically assume its dead and connect anyway

#

of course this can also happen for other reasons, such as an infinite loop

#

or stupidly slow files loading

earnest phoenix
#

okey

#

thx

#
    } catch {
            ^
SyntaxError: Unexpected token {
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:617:28)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/rbd/pnpm-volume/5b146d33-2649-47dc-b5df-4bb5db586bdc/node_modules/.registry.npmjs.org/discord.js/12.2.0/node_modules/discord.js/src/index.js:8:11)```
#

v12

#

I updated the version gave such an error

#

?

#

@quartz kindle

quartz kindle
#

you need to update your node.js

#

v12 requires node.js v12 or higher

#

on glitch you can do so by changing your engine settings in your package.json

indigo cloud
#

ok i tried to make ban and kick script tbh took some stuff from google but still can u see if it will work?

#

if (message.content.startsWith("$kick")) {
// Easy way to get member object though mentions.
var member= message.mentions.members.first();
// Kick
member.kick().then((member) => {
// Successmessage
message.channel.send("👋 " + member.displayName + " has been successfully kicked 👉 ");
}).catch(() => {
// Failmessage
message.channel.send("Access Denied");
});
}
});
client.on("message", (message) => {
if (message.content.startsWith("$ban")) {
// Easy way to get member object though mentions.
var member= message.mentions.members.first();
// ban
member.ban().then((member) => {
// Successmessage
message.channel.send("👋 " + member.displayName + " has been successfully banned https://gfycat.com/playfulfittingcaribou 👉 ");
}).catch(() => {
// Failmessage
message.channel.send("Access Denied");
});
}
});

quartz kindle
#

can you use code blocks please

indigo cloud
#

ok

#

let me download it

pale vessel
#

bruh two message events?

sullen portal
#

can someone help me with user storage

pale vessel
#

don't tell me you have an event for every command?

earnest phoenix
#
Resolving: total 393, reused 393, downloaded 0, done
ERROR  ENOENT: no such file or directory, chmod '/rbd/pnpm-volume/5b146d33-2649-47dc-b5df-4bb5db586bdc/node_modules/node/bin/node'```
#

help

pale vessel
#

@indigo cloud

quartz kindle
#

@indigo cloud ? download what?

#

code blocks

#

means this

earnest phoenix
#
Resolving: total 393, reused 393, downloaded 0, done
ERROR  ENOENT: no such file or directory, chmod '/rbd/pnpm-volume/5b146d33-2649-47dc-b5df-4bb5db586bdc/node_modules/node/bin/node'```

help

quartz kindle
#

``` code here ```

indigo cloud
#

yea

#

can i just send a pick?

quartz kindle
#

this is code blocks: ``` code here ```

earnest phoenix
quartz kindle
#

just do that

earnest phoenix
#

help

quartz kindle
#

@earnest phoenix what did you do?

indigo cloud
#

k

earnest phoenix
#

@quartz kindle node

quartz kindle
#

node is not a package

#

remove it from dependencies

indigo cloud
#
        // Easy way to get member object though mentions.
        var member= message.mentions.members.first();
        // Kick
        member.kick().then((member) => {
            // Successmessage
            message.channel.send(":wave: " + member.displayName + " has been successfully kicked :point_right: ");
        }).catch(() => {
             // Failmessage
            message.channel.send("Access Denied");
        });
    }
});
 client.on("message", (message) => {
    if (message.content.startsWith("$ban")) {
        // Easy way to get member object though mentions.
        var member= message.mentions.members.first();
        // ban
        member.ban().then((member) => {
            // Successmessage
            message.channel.send(":wave: " + member.displayName + " has been successfully banned https://gfycat.com/playfulfittingcaribou :point_right: ");
        }).catch(() => {
             // Failmessage
            message.channel.send("Access Denied");
        });
    }
}); ```
#

there

earnest phoenix
#

@quartz kindle

quartz kindle
#

yes, looks correct

#

or just do 14.x

earnest phoenix
#

@earnest phoenix

quartz kindle
#

if it doesnt work, try using 12.x

earnest phoenix
#

has anyone use vds

#

Has anyone use vds

#

@earnest phoenix
@earnest phoenix yes ?

quartz kindle
#

@indigo cloud without seeing your full code idk but it looks like it should work

earnest phoenix
#

Türk varmı

#

@quartz kindle

node v10.15.3, with pnpm
Installing...
Performing headless installation
ERROR  ENOENT: no such file or directory, chmod '/rbd/pnpm-volume/5b146d33-2649-47dc-b5df-4bb5db586bdc/node_modules/node/bin/node'```
indigo cloud
#

Alright

pale vessel
#

stop sending your code

earnest phoenix
#

@earnest phoenix var

#

@earnest phoenix Arda benim bot ilidebir vds de olmasına rağmen offlineye düşüyor

#

hmm

#

vds belki kapanıyor olabilir ?

#

@quartz kindle

node v10.15.3, with pnpm
Installing...
Performing headless installation
ERROR  ENOENT: no such file or directory, chmod '/rbd/pnpm-volume/5b146d33-2649-47dc-b5df-4bb5db586bdc/node_modules/node/bin/node'```

help ?

#

Onu nasıl yapabilirim

quartz kindle
#

then try with v12

earnest phoenix
#

onu aldığın yeri söyle @earnest phoenix

digital ibex
#

hi, what command, in terminal, can i use to restart my bot?

sullen portal
#

can someone help me make a levelling system

earnest phoenix
#

Tamam

sullen portal
#

ctrl + z

#

@digital ibex

digital ibex
#

kk, ty

sullen portal
#

wait

#

@digital ibex its ctrl c

earnest phoenix
#

then try with v12
@quartz kindle ok

sullen portal
#

i accidentally put z ._.

digital ibex
#

that doesn't restart ur bot

sullen portal
#

wdym restart

#

turn it offline?

#

i think thats restarting

#

@digital ibex?

digital ibex
#

thats not using one command in terminal

#

and thats not restarting

sullen portal
#

ctrl c?

digital ibex
#

what

#

no its not

sullen portal
#

wdym restart though

digital ibex
#

that just creates a new line in stdout in terminal or smthing

#

turn it on

earnest phoenix
#

@quartz kindle I did v12 but it still doesn't load all commands

sullen portal
#

node .?

earnest phoenix
#

why ?

digital ibex
#

turn it offline, then turn it on

#

no

sullen portal
#

i use node . to turn it onm

#

on*

digital ibex
#

ok

earnest phoenix
#

@quartz kindle I did v12 but it still doesn't load all commands
help

#

and

#

help

sullen portal
#

oh that

earnest phoenix
#

why my bot is lagged?

sullen portal
#

@earnest phoenix is your thing bot or client

#

do

earnest phoenix
#

@sullen portal what ?

sullen portal
#

bot.setMaxListeners(100)

#

do that

earnest phoenix
#

@sullen portal where ?

sullen portal
#

i do it at the front

#

it worked for me

#

i just put that the front

#

and that error didnt come anymore

#

@earnest phoenix put ; at the end

earnest phoenix
#

bot.setMaxListeners(100);

sullen portal
#

yes

earnest phoenix
#

why my bot is lagged?

#

where should i put this?

sullen portal
#

wdym laggeed

#

lagged*

earnest phoenix
#

@sullen portal where should i put this?

sullen portal
#

like at the front

earnest phoenix
#

lag

sullen portal
#

its slow?

halcyon ember
#

is there a way to pull in json as a variable from a url? I have a url that just has some raw json on it and I want a embed to contain the value of one of the items inside that json is there a way to do that?

quartz kindle
#

@earnest phoenix wdym it doesnt load all commands?

#

which command doesnt load?

sullen portal
#

his went past his max listeners

quartz kindle
#

@halcyon ember make a request to it

sullen portal
#

the data leaked

#

he had a memory leak

#

he reached his max listeners

halcyon ember
#

kk

earnest phoenix
#

@quartz kindle There are 94 commands

sullen portal
#

O_O

quartz kindle
#

and which one doesnt load?

#

that command might be the problem that caused it to not start in v11

dire viper
#

Can anyone help me make a partner bot in discord.py? The bot should have a command where you can choose a channel for the Partner message. And should send a message every 6h in all partner channels. Can anyone help me there? :D

sullen portal
#

@quartz kindle can u help me make a levelling system

zenith terrace
#

I dont think he gonna help zoomeyes

astral yoke
#

start off with this

earnest phoenix
#

@quartz kindle sorry

sullen portal
#

i really need help

astral yoke
#

but if your bot gets mtued dont run to me

sullen portal
#

whats that

earnest phoenix
#

all commands loaded

#

@quartz kindle all commands loaded

astral yoke
#

a package

earnest phoenix
#

but

sullen portal
#

how do you use it @astral yoke

astral yoke
#

bro

#

your a bot developer

sullen portal
#

yeah but a beginner one

astral yoke
#

your bot got approved

honest perch
#

dont attack users

sullen portal
#

ima just read the description

earnest phoenix
#

@quartz kindle all commands loaded but does not send the message I loaded all commands to the console

quartz kindle
#

what message?

zenith terrace
#

poor tim with the pings

earnest phoenix
#
  console.log('Komutları yükledim!')
  console.log(`${client.user.username} ismi ile giriş yaptım!`)
  console.log(`Oyun ismimi ayarladım!`)
  console.log(`Şu an ${client.channels.size} kanala, ${client.guilds.size} sunucuya ve ${client.users.size} kullanıcıya hizmet veriyorum!`)
  console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] BOT: Aktif, Komutlar yüklendi!`);
  console.log(`[${moment().format('YYYY-MM-DD HH:mm:ss')}] BOT: ${client.user.username} ismi ile giriş yapıldı!`);```
file : events/ready.js
#

@quartz kindle

sullen portal
#

@astral yoke can i use a command handler for it

quartz kindle
#

those console.logs do not work?

astral yoke
#

its a package with coding on the documents

#

like uhh

#

wait

earnest phoenix
#

@quartz kindle why ?

quartz kindle
#

are you saying that the code you just posted is inside the ready event and it doesnt work?

earnest phoenix
#

it is necessary to throw these articles into the console after the commands are loaded

#

but not throwing

quartz kindle
#

google translate from turkish to english is very bad lmao

#

show your index.js

#

or whatever your main file is

earnest phoenix
#

okey

#

main file = server.js

earnest phoenix
#

@earnest phoenix

#

how do you do the categories you did

#

that u showed me

#

@earnest phoenix he says show your main file. not your main file's name.

quartz kindle
#

shhh let it die

#

lmao

earnest phoenix
#

lol

lusty furnace
#

How do I know how many servers my bot is in

zenith terrace
#

lmfao

#

bot (or client).guilds.size

lusty furnace
#

All the answers I got before were too basic and then I got confused when I tried to do what they said

quartz kindle
#

by checking the size of your guild cache

#

on discord.js v12 its client.guilds.cache.size

zenith terrace
#

V11 - bot.guilds.size / client.guilds.size

#

Tim ya beat me to V12

#

I was gonna do both lol

lusty furnace
#

What if I don’t use discord.js

zenith terrace
#

What do u use

steel drum
#

what are you using then

lusty furnace
#

It’s not a category on top.gg

#

It’s under “other”

humble plaza
#

Hey guys, I need some advice. Need my bot to run a python script. How would I do that? Tried googling but no result.

steel drum
#

that doesnt help us

zenith terrace
#

that doesnt help on what language it is

modest maple
#

@humble plaza firstly, what language is the main

#

secondly

#

what is le python script

lusty furnace
#

It’s an app that doesn’t use a known language

modest maple
#

3rdly why

quartz kindle
#

an app??

#

like discord bot maker?

#

lmao

zenith terrace
#

then we cant help with it if we dont know the language

steel drum
#

lol

quartz kindle
#

then how do you code it?

lusty furnace
#

It has an easier code system

modest maple
#

no? lmao

quartz kindle
#

does it support scripts?

lusty furnace
#

Not rly

modest maple
#

well then there u go

quartz kindle
#

then thats not even allowed on top.gg lol

steel drum
#

im not sure how you're expecting us to help you then

quartz kindle
#

how do you make commands on it?

lusty furnace
#

Like this:

zenith terrace
#

send screenshot

lusty furnace
zenith terrace
steel drum
#

@quartz kindle would you mind if i dmed you about a few things in relation to the discord bot developer verification process?

regal saddle
#

Bruh

zenith terrace
#

Discord bot maker?

modest maple
#

breh

quartz kindle
#

whats the name of the app?

earnest phoenix
#

discord bot designer i reckon

quartz kindle
#

@steel drum sure

regal saddle
#

Never seen so much people here

zenith terrace
#

@lusty furnace app name?

modest maple
#

We all just lurk

earnest phoenix
#

@zenith terrace thats discord bot designer

quartz kindle
#

@lusty furnace it does support code

modest maple
#

unless someone says an app is an 'easier code system`

earnest phoenix
humble plaza
#

@modest maple
Is it possible to have a bot run some python commands to talk to my raspberry pi. Basically I have an automated plant feeder and I want my bot to water them on command lol.

zenith terrace
#

eh I tried that before

modest maple
#

what language is the base script

#

and yeah its possible

zenith terrace
#

also

humble plaza
#

js

zenith terrace
#

@earnest phoenix blue stacks

earnest phoenix
zenith terrace
#

lmao

#

hacked

#

back in 2019

modest maple
#

@humble plaza You should be able to (I dont know much nodejs) create a sub process and execute the py script with a command e.g python myscript.py

humble plaza
#

Cheers! Something to start off with

#

much appreciated

halcyon ember
#

guys

#

im trying to pull in a json from url using fetch

#

it can display a value

#

but how to I make it send a value inside a value inside a value

#

{"time":1589406571,"global":{"workers":2,"hashrate":0},"algos":{"primesr":{"workers":2,"hashrate":4151801719.4666667,"hashrateString":"4.15 GH"}},"pools":{"riecoin":{"name":"riecoin","symbol":"RIC","algorithm":"primesr","poolStats":{"validShares":"152182","validBlocks":"34","invalidShares":"1468","totalPaid":"765.60657390000000211"},"blocks":{"pending":3,"confirmed":31,"orphaned":0},"workers":{"RSA3aZhFTKABYLGbQBcwcakQDrDtD125VB":{"shares":97,"invalidshares":0,"hashrateString":"2.31 GH"},"RTVUASUkHjMLUae1ZDa2tVwKjyTTwSQVXZ":{"shares":77,"invalidshares":6,"hashrateString":"1.84 GH"}},"hashrate":4151801719.4666667,"workerCount":2,"hashrateString":"4.15 GH"}}}
I want the hashrateString to be printed

#

but when I do algos[0].primesr[0].hashrateString it says cant print empty

quartz kindle
#

[] is for arrays

#

for example

halcyon ember
#

oh

#

how am I supposed to make it display for my json then

quartz kindle
#
[{
  bla:1
}]
``` you see the object is inside of an array, so you have to do [0].bla
halcyon ember
#

ahh

#

makes sense

quartz kindle
#

but if its just ```js
{
bla:1
}

#

in the json you posted there is only objects, no arrays

halcyon ember
#

when i do algos.primesr.hashrateString it says cant read property of undeifined

hardy vector
#
const Discord = require('discord.js')

module.exports = {
    name: 'avatar',
    description: 'Ping!',
    execute: async(client, message, args) => {
        let embed = new Discord.MessageEmbed()
        .setTitle(`${message.author.username}'s Avatar`)
        .setImage(message.member.avatarURL)
        message.channel.send(embed)
    },
};``` my embed only has the title its not sending it with the user avatar
quartz kindle
#

try console.log(yourjson.algos)

halcyon ember
#

yep that worked thanks