#development

1 messages ยท Page 671 of 1

lusty dew
#

Or no?

onyx summit
#

yes you can

#

you can add that:

![Average CPU Usage](https://dashboard.chilo.space/api/v1/badge.svg?chart=system.cpu&alarm=10min_cpu_usage&refresh=auto&label=Average%20CPU%20Usage)
![System Uptime](https://dashboard.chilo.space/api/v1/badge.svg?chart=system.uptime&label=System%20Uptime&refresh=10)\
![Free Memory](https://dashboard.chilo.space/api/v1/badge.svg?chart=system.ram&dimension=free&label=Free%20Memory&refresh=auto&values_color=gray:null|green%3C2000|orange%3C1000|red%3C500)
![Used Disk Space](https://dashboard.chilo.space/api/v1/badge.svg?chart=disk_space._&alarm=disk_space_usage&label=Used%20Disk%20Space&refresh=auto)

into the dbl page

lusty dew
#

In the long description?

onyx summit
#

ye

lusty dew
#

Okay also it works

#

I spammed messages

#

And checked the message size it only chanced 20

#

Cached*

split hazel
#

the error is gone but my bot now wont start

#

I'm getting client took too long to get ready on shard 0

#

so i added timeout and disabled waiting for client ready

#

and its sitting there, adding debug event spams console with channel, user. member, guild objects

onyx summit
#

I see you are having fun

split hazel
#

not really

lusty dew
#

Well mem went from 146mb to 141mb

#

Lol

split hazel
#

Does my sharding file for master look ok?

const token = require('./config.json').token                              
const manager = new ShardingManager('./index.js', { token: token });      
                                                                          
manager.spawn(4, 15000, false);```
im starting to suspect theres something incorrect with it
sudden geyser
#

On master, the last arg should be a number

onyx summit
#

@split hazel false could lead to some serious issue here, not sure tho

#

that would explain why the shard gets flagged because it took too long to get ready

#

because you are passing weird stuff as timeout

split hazel
#

last time i had it just on 4

#

thats when the timeout errors come

#

when it tried launching bot with internal sharding it shows as online but doesnt set status or respond to commands

#

i think the memory leaked

#

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

topaz fjord
#

that error basically means you don't have enough memory to start the bot

split hazel
#

right 30gb memory isnt enough you say Thonk

sudden geyser
#

you oofed up somewhere

onyx summit
#

nodejs has an internal memory limit afaik

#

dunno if that is still like this

viral spade
#

When havin a bot run on multiple vps, and if i only want to run one instance of the bot per vps. do i need sharding at all? Will the servers get assigned to the bots evenly, no server assigned twice?

lusty dew
#

What is the point of uws

#

I heard it causes more problems then it does fix?

onyx summit
#

@viral spade How big is your bot?

#

because clustering is not really an easy thing to do

#

and no, you would need to assign each instance to specific shards

viral spade
#

the bot is not big, but i need to distribute the database load. i do a lot of statistics on the database and i want to brake the database up into the shards

onyx summit
#

what db u use

viral spade
#

mysql at the moment

topaz fjord
#

Most dbs can handle constant reads and writes

#

like heavy heavy ones

onyx summit
#

I don't know what you are doing but I'm sure mysql is able to handle most

viral spade
#

i do like multiple joins and calculation per message sent n any server

topaz fjord
#

my MySQL instance used to have 8 read/writes per second

#

And that was when I had leveling

viral spade
#

i really do calculate a lot per second

abstract crow
#

For a github bot that I am making publicly, should I add the docs to the readme or link the docs in the readme to my website docs?

#

I may have already asked this idk

topaz fjord
#

link the docs

onyx summit
#

ye, but is it actually at its limit?

#

and maybe, you could cache that stuff and then write it every x seconds in one run

viral spade
#

thats my plan, but flush it remotely

#

have a remote persistent, and a local in memory db

topaz fjord
#

as long as the item you're caching isn't constantly changing

viral spade
#

its a statistics bot, every message leads to a write, every message leads to recalculating, rewriting statistics in my database

topaz fjord
#

I don't see a point for a cache then

viral spade
#

isnt that a lot to handle?

topaz fjord
#

For the db? no

#

If you look around on the internet there are people who can push it to 22k operations per second

viral spade
#

but if you have 20k servsers and do 100 operations per message, dont you get close?

topaz fjord
#

100 operations per message

#

the fuck

viral spade
#

I dont know, i have the calculations of a users rank and level, everytime he sends a message, before and after. this calculation involves 4+ joins

wide ruin
#
async run(message) { 
    let main = new Discord.RichEmbed()
      .setTitle('... Help')
      .setDescription('')
      .addField('Add ... to your Discord Server :handshake:', '...')
      .addField('Join the Support Server', '...')
      .setFooter('...')
      .setColor(0xFF8A46)
    message.author.send(main)
  }```
#

that doesnt respond?

viral spade
#

try put the main in curly brackets message.author.send({main})

onyx summit
#

@viral spade do you use d.js?

viral spade
#

y

onyx summit
#

master?

wide ruin
#

i hid it, its not blank

inner jewel
#

.send({main}) won't work

onyx summit
#

^^^

topaz fjord
#

use .send({ embed: main })

inner jewel
#

that's .send({main: main})

wide ruin
#

i havnt needed to do it the whole time though

#

other embeds didnt need that

topaz fjord
#

you could do .send({embed}) if you name it embed

viral spade
#

@onyx summit what do you mean with master? d.js master branch?

onyx summit
#

yes

viral spade
#

idk tbh^^

#

"discord.js": "*"

onyx summit
#

npm ls discord.js

topaz fjord
#

you have to get master from git

wide ruin
#

still nothing @topaz fjord

viral spade
#

why?

onyx summit
#

because

topaz fjord
#

because its not out yet

onyx summit
#

why do I have to swim to not drown?

topaz fjord
#

its beta

viral spade
#

why would i need it?

topaz fjord
#

since its a breaking change

onyx summit
#

he is probably asking why I asked for it

viral spade
#

how so?

onyx summit
#

sec

#

@viral spade (all on master)
you can specify what shards should spawn in the Client constructor:
Meaning server A can log into shard 0-5 and server B can log into shard 6-10
You would probably have a master telling the children (so the servers) on what shard they should log on

viral spade
#

Ok but i only have to assign those number to the shards? then the servers will be distrubuted eually without me doing anything more?

onyx summit
#

by the way how tf do you get that many upvotes

viral spade
#

so i could theoretically hardcode 2 servers, so server1 logs to 0-5 and server 2 to 6-10., without any master?

onyx summit
#

you could

viral spade
#

how i get that mayn upbotes?

onyx summit
#

on dbl

viral spade
#

well users can get xp by upvoting each other and an upvote counts more if they upvote my bot

onyx summit
#

I see

#

okay

viral spade
#

and apparently my bot is really liked

#

which is why i want to be able to scale over 20k servers. before i intrudce new features

onyx summit
#

if you want to talk about shard assignment you should probably ask in the d.js server

#

and hope one of the devs is online xD

#

because you rarely have to cluster over multiple server

viral spade
#

well how many servers does a very database heavy bot have usually, before they decide to cluster it over multiple vps?

onyx summit
#

dunno

#

but maybe, mysql is not the perfect decision for heavy usage

viral spade
#

i show u something

onyx summit
#

I don't know much about databases, but I would probably rather go for PostgreSQL

viral spade
#

so every minute, i count for every user in every voicechannel of any server my bot is in that minute, and add it to the stats

onyx summit
#

uhu

#

so where is the actual bottleneck?

#

the database? or the bot writing to it?

viral spade
#

where its starts to be up constantly is 17:26:00, where the voice munites start adding

#

this 85% disc usage is 30/60 seconds every minute

#

so its critical already, i can stretch this by only doing this run every 5 or 10 minutes and add 5 or 10 minutes every run

#

but i have to think of something different^^

onyx summit
#

windows server mmm

#

anyway

viral spade
#

i had it on a vps running too, but i have a spare pc in my flat that it runs on nicely^^

#

for the moment

#

but it has an ssd and those disc spikes are the same on vps

wide ruin
#

so in d.js a bot has just sent an embed

#

how do i react to that message?

sudden geyser
#

Get the message object, and use the react method

wide ruin
#

wdym?

topaz fjord
#

.send returns Promise<(Message|Array<Message>)>

#

await it

wide ruin
#

ok ive done that

topaz fjord
#

and then use .react on the message object

wide ruin
#

so do i just put .react after the .send(emebd)

#

?

topaz fjord
#

no

wide ruin
#

oh just message.react under it?

topaz fjord
#
const message = await message.channel.send('the docs are great');
message.react('find some emoji');
wide ruin
#

ah

#

thanks

#

also @topaz fjord

#

how do you make a message reaction collector?

topaz fjord
wide ruin
#

i dont get what it means

#

im there already

topaz fjord
#

there's an example at the bottom of it

wide ruin
#
const filter = (reaction, user) => reaction.emoji.name === '๐Ÿ‘Œ' && user.id === 'someID';
const collector = message.createReactionCollector(filter, { time: 15000 });
collector.on('collect', r => console.log(`Collected ${r.emoji.name}`));
collector.on('end', collected => console.log(`Collected ${collected.size} items`));```
topaz fjord
#

yes

wide ruin
#

so the ๐Ÿ‘Œ is what its looking for

topaz fjord
#

message is the message object you get from doing await message.channel.send

#

then change reaction.emoji.name === '๐Ÿ‘Œ' && user.id === 'someID'; to your desired emoj and userID

wide ruin
#

ok thanks

wide ruin
#

@topaz fjord

#
let emb = new Discord.RichEmbed()
        .setTitle('... Help')
        .setDescription('React to load a category, react to ๐Ÿ  to return to this message.')
        .addField('Categories:', '๐Ÿ’ป - General\n๐ŸŽฑ - Generators\n๐Ÿ›ก๏ธ - ... Guard\n๏ธ๐Ÿ› ๏ธ - Utilities\n๐ŸŽ‰ - Fun commands\n๐Ÿ‡ฏ๐Ÿ‡ต - Anime\n๐Ÿ”ž - NSFW Anime\n๐Ÿ“‚ - Logs (coming soon)')
        .setColor(0xFF8A46)
      const main = await message.author.send(emb)
    >>main.react('๐Ÿ’ป')<<
      main.react('๐ŸŽฑ')
      main.react('๐Ÿ›ก')
      main.react('๐Ÿ› ')
      main.react('๐ŸŽ‰')
      main.react('๐Ÿ‡ฏ๐Ÿ‡ต')
      main.react('๐Ÿ”ž')
      main.react('๐Ÿ“‚')```
#

its saying main isnt defined

topaz fjord
#

did the embed send

wide ruin
#

yeah

#

and doesnt react

#

ok so i did an await before the reacts @topaz fjord

#

it reacts now

#

but...

#

the bot sends this:

#

An error occurred while running the command: ReferenceError: main is not defined
You shouldn't ever receive an error like this.

#

nvm i fixed it

trail dagger
#

Someone down to make a sub reddit bot?

#

tagg me

earnest phoenix
#

Paid job?

#

If yes contact oliy

trail dagger
#

it was like something to do together

#

Just wondering @fossil oxide How much do you charge?

pale marsh
trail dagger
#

Ok

earnest phoenix
#

Go in dm with him

onyx summit
#

its for jobs, not collaborations

pale marsh
onyx summit
#

but actually, why isnt there a channel for collabs

trail dagger
#

yea i know that

earnest phoenix
#

what they mean is "i'll do the login, you do the rest, i don't know how to do it so i want someone else to do it for me"

tall perch
#

-help

zealous veldt
#

This channel is not for running bot commands @tall perch

tall perch
#

Okey

zealous veldt
#

@onyx summit if you have suggestions you can make them on our github repo

tall perch
#

How do I add my bot to the server?

#

@zealous veldt

zealous veldt
#

lol faq 1

covert turtleBOT
#
Frequently Asked Questions ๐Ÿ“œ

Click the link to get more information on the question:

  1. How do I add a bot?
tall perch
#

thanks !

onyx summit
#

can you link it

pale marsh
#

Wdym?

zealous veldt
onyx summit
#

thx, posted it

amber fractal
#

when's the last time that was looked at

#

or an issue fixed mmLol

onyx summit
#

that way my thought too but shrug

#

ohhh, the last one was closed 3 days ago

lusty dew
#

How do you get the node version again?

onyx summit
#

in the console or in code

lusty dew
#

Code

onyx summit
#

node -v in shell
or
process.version in code

lusty dew
#

Ah ye thanks

#

Forgot

trail dagger
#

How can i get all members in guild with for example kick permissions?

lusty dew
#

How can I use emojis in a server on my bot?

onyx summit
#

normal: <:name:id>
animated: <a:name:id>

wide ruin
#

discord.js:

#

im getting this error

#

(node:78416) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message

#
at item.request.gen.end (C:\Users\\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:85:15)
    at then (C:\Users\\node_modules\discord.js\node_modules\snekfetch\src\index.js:215:21)
    at process._tickCallback (internal/process/next_tick.js:68:7```
#

what is it saying?

#

unknown message?

sudden geyser
#

the message was probably deleted or you requested a message that doesn't exist

wide ruin
#

so its in the messagedelete bit?

inner jewel
#

deleting/reacting/fetching/any kind of interaction with a deleted message or invalid id

wide ruin
#

messageDelete event is the only time we do that

#

so im guessing there

trail dagger
#

and how can i delete a specified channel again

winged thorn
#

most likely to be await channel.delete()

#

but I'll check docs

#

Yeah it is

wild thorn
#

it's not quite a dev issue but, my bot isn't appearing as "online" on it's DBL webpage, though it is online on discord and operational. I've tried doing a DBL Webhook test which was successful.

#

Does anyone have any ideas as to what wrong?

high comet
#

Hey gotta ask ya something about my account

#

Or why somebody banned me

onyx summit
#

@wild thorn is your bot on this server?

high comet
#

Yes

wild thorn
#

apparently not ๐Ÿ˜ฆ

high comet
#

What ya mean

wild thorn
#

I can't @ mention it

onyx summit
high comet
#

My account???

onyx summit
#

no I meant Nazrin

west spoke
onyx summit
#

I don't think your account is relevant to development

#

rip, gotta fix that, or post stats (I think that will make it show as online too)

wild thorn
#

that's not good?

#

it should only dm when there's incorrect permission to inform a user it has incorrect permissions

west spoke
#

Might wanna dm mods and fix it

lusty dew
#

Question how can I replace the status of the bot/user to an emoji?

#

Cause it just comes back as online, offline, idle, dnd

wild thorn
#

ok

lusty dew
#

But I wanna use emojis instead

#

It's for an info/userinfo command

trail dagger
#

@winged thorn i need the await channel.delete() to delete a specified channel

winged thorn
#

get it by id

#

Get he channel object and delete it

trail dagger
#

cant

winged thorn
#

Why not

trail dagger
#

cant get it by id

winged thorn
#

why not

trail dagger
#

An other command creates a channel named after that member

winged thorn
#

So get it by name instead

trail dagger
#

THAT is what i dont remember how

winged thorn
#

Use discord.utils.get

trail dagger
#

maybe this will make you see what i mean
if ctx.message.channel.name == ctx.message.author.name: the code is wrong btw

winged thorn
#

If you have duplicate channels obviously discord.utils.get won't work if you try to get it by name but

#

Use discord.utils.get

#

or you can loop through every channel in the guild and try to find one with the same name

wide ruin
#
bot.on('messageDeleteBulk', async(messages) => {
    const emb7 = new Discord.RichEmbed()
        .setTitle(':wastebasket: Bulk Message Delete')
        .setDescription('A user has deleted a mass of messages.')
        .addField('Guild:', `${messages.guild.name}`)
        .addField('User:', `${messages.author.tag}`)
        .addField('Channel', `<#${messages.channel.id}>`)
        .addField('Time:', `${messages.createdAt}`)
        .setColor(0xF44336)
        .setFooter('... | Logs', 'https://file.coffee/WdTuqTwGF.PNG')
    bot.channels.get(`609829032644706352`).send(emb7)
});
#

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'name' of undefined

#

how is this meant to be done?

#

error is on the Guild: line

amber fractal
#

I havent looked at it, but I'm guessing messages is a collection

#

you need to get a message

steel cloak
#

yeah it is

amber fractal
#

the others will also error

wide ruin
#

will it work with messages[0] then?

amber fractal
#

it's a collection

#

not an array

#

it extends map

trail dagger
#

@winged thorn channel = discord.utils.get(ctx.guild.text_channels, name=ctx.author)

#

how do you suggest i get it into await channel.delete()

amber fractal
wide ruin
#

how do i get one message then?

#

ok thanks

amber fractal
#

you can use .first()

lusty dew
#

Can you make a bot leave a server with the guild ID?

#

Like client.guilds.get(guildID).leave()

onyx summit
#

client.guilds.get('id').leave()

wide ruin
#

i did that

onyx summit
#

works

wide ruin
#

thanks @amber fractal

lusty dew
#

Well ye but I'm using args wouldn't that be a string @onyx summit

onyx summit
#

ids are always strings

lusty dew
#

Okay

#

And can I put that in a timeout?

onyx summit
#

strings? yes

lusty dew
#

No

#

Not that

onyx summit
#

what u trying to do

lusty dew
#

I'm trying to make a bot leave a guild by the guild ID but wait 4 seconds so it can send an embed

onyx summit
#

just send the embed and then leave?

lusty dew
#

You're not understanding

onyx summit
#

yes

lusty dew
#

I want it to wait 4 seconds

onyx summit
#
setTimeout(guild.leave, 4000)
#

will call guild.leave after 4 secs

lusty dew
#
                    client.guilds.get(input).leave()
                }, 4000)```
onyx summit
#

ye that works too

lusty dew
#

Basically that

#

Okay thanks

#

That's what I was asking!

trail dagger
#
    async def close(self, ctx):
      channel = discord.utils.get(ctx.guild.text_channels, name=ctx.author)
      await ctx.channel.delete()```
This doesnt work 100%, it can delete but it just deleted the channel you typed that in and not the channel named ctx.author

I tried `await ctx.channel.delete(channel)` but only got an error
lusty dew
#

How do I check if my ID matches an array of IDs?

#

Would I have to loop through the array?

onyx summit
#

[array of ids].includes(the id you wanna check)

lusty dew
#

Mk

#

So I could do something like

if(!client.settings.bot_dev.includes(message.author.id))
#

Or something like that

onyx summit
#

if bot_dev is an array yes

lusty dew
#

Okay thanks

steel cloak
#
(node:22868) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit

what would this error mean?

onyx summit
#

you have 11 listeners to the message event

#

this is not very good

#
<client>.on('message'......

is one, and you have 11 from that

steel cloak
#

oh okay,, yeah not good lol. thanks

inner jewel
#

@onyx summit setTimeout(guild.leave, 4000) won't work

#
> class Guild {
... constructor(id) { this.id = id; }
... leave() { console.log("Leaving guild", this.id); }
... }
undefined
> const g = new Guild("123");
undefined
> g.leave()
Leaving guild 123
undefined
> setTimeout(g.leave, 4000)
Timeout {
  _idleTimeout: 4000,
  _idlePrev: [TimersList],
  _idleNext: [TimersList],
  _idleStart: 54613,
  _onTimeout: [Function: leave],
  _timerArgs: undefined,
  _repeat: null,
  _destroyed: false,
  [Symbol(refed)]: true,
  [Symbol(asyncId)]: 677,
  [Symbol(triggerId)]: 4 }
> Leaving guild undefined```
#

you need setTimeout(() => guild.leave(), 4000) or setTimeout(guild.leave.bind(guild), 4000)

onyx summit
#

may want to explain why

inner jewel
#

guild.leave isn't bound to any instance

#

guild.leave() passes the instance

#

but just getting the leave function doesn't

onyx summit
#

ahh

#

okay

inner jewel
#

so you need to bind or create a closure that calls guild.leave()

onyx summit
#

yes, I get that now

#

I had similar issues with that in ts, by doing
event.on('stuff', this.somefunc)

inner jewel
#

ts is a superset of js

onyx summit
#

bec it was out of context crying

inner jewel
#

it's js with static types

onyx summit
#

Ik

thin jacinth
#

Anyone looking for python bots help?

earnest phoenix
#

No

onyx summit
#

wait, are you doing reverse support?

#

like asking people if they need help

winged thorn
thin jacinth
#

Just exploring the channel

#

k nvm

#

but sometimes that works

winged thorn
#

I also offer my assistance services to those using discord.py

#

For the low low price of 1 cookie

thin jacinth
#

btw can you advice me some cloud services?

#

bcuz Im lookin for a free way to save some user data into a cloud

earnest phoenix
#

Somebody know how make a bot make a channel?

winged thorn
#

what language and what library

earnest phoenix
#

discord.js javascript

winged thorn
#

Here is the relevant documentation

earnest phoenix
#

Ok, thanks!!

earnest phoenix
trim saddle
#

@earnest phoenix it's discord.ext

earnest phoenix
#

ok

#

let me try

trim saddle
#

very bad way to hide your token

earnest phoenix
#

its not all token so none cares

#

its bot token

#

not mine tho

trim saddle
#

do you have the module installed?

earnest phoenix
#

no ?

#

i have

#

sorry i have

trim saddle
#

if you don't have discord.py installed you can't use it

earnest phoenix
#

but for this i use python

#

its installed

upper salmon
#

which version?

earnest phoenix
#

3.7.2

#

latest

upper salmon
#

so u don't need to use this

trim saddle
#

python3.7 -m pip install discord.py

earnest phoenix
#

i already installed

#

@trim saddle

upper salmon
#
import discord

client = discord.Client()

@client.event
async def on_ready():
  print("a")

client.run(token)
trim saddle
#

then it should be working

earnest phoenix
#

@upper salmon im trying

#

now

#

btw keep it client or change it to bot ?

#

@upper salmon

upper salmon
#

if you want

trim saddle
#

@upper salmon theres a difference between discord.Client and commands.Bot

upper salmon
#

this is for discord == 1.2.2

earnest phoenix
#

Some help ? xd

trim saddle
#

yeahh

earnest phoenix
#

Every time i do something i need to get errors

trim saddle
#

discord.Client only allows you to use events

earnest phoenix
#

what to change to

trim saddle
#

@earnest phoenix are you sure you got the right module?

broken shale
#

bruh

earnest phoenix
#

i use python

#

not module when i f5

upper salmon
#

py -m pip install discord.py --upgrade

broken shale
#

Also first question: Do you have any solid knowledge with Python @earnest phoenix

upper salmon
#

and try again

grim aspen
#

@earnest phoenix stop revealing your token

earnest phoenix
#

@broken shale small

grim aspen
#

put it in a .env or something

earnest phoenix
#

its bot token

broken shale
#

I think you should learn a bit more py before making a bot

#

And bot token can be very powerful

grim aspen
#

you don't realize how bad leaking your bot token is

broken shale
#

So keep it SAFE

earnest phoenix
#

ok ill try again

#

installed the py

onyx summit
#

everyone can log into your bot with the token

#

its basically a password

idle mountain
#

if people get hold of your bot they can make it do literally anything, they can make it leave all of its servers or nuke all of its servers, I'd suggest you reset it and properly remove it when you upload a screenshot

onyx summit
#

and if you don't want your server raided and all channels deleted you better not fcking share it

grim aspen
#
  1. bots, if their token is stolen, you can be banned because of it
earnest phoenix
#

@onyx summit well bot is test so no problem

#

and it didnt work

sudden geyser
#

A small thing I've had with my ping command. When I run channel.send(...).then((msg) => {...}) and minus msg.timestamp - message.timestamp, I sometimes get a negative number. Anyone know how to fix this, I could use Math.abs but I don't know why it would be negative in the first place

broken shale
#

show code

sudden geyser
#
// eris lib
return message.channel.createMessage("Pinging...").then((msg) => {
    return msg.edit(`${Constants.EMOJIS.PING_PONG} Pong! Response time: \`${msg.timestamp - message.timestamp}ms\``);
});```
broken shale
#

This is mine js msg.channel.send(something).then(x => { m.createdTimeStamp - msg.createdTimeStamp })

amber fractal
#

different lib

broken shale
#

oh you're eris

amber fractal
#

your on d.js

broken shale
#

noticed

amber fractal
#

ye

sudden geyser
#

I believe it does the same on both libraries, it might be something not even library-related

#

I'd have to check

earnest phoenix
#

fun fact, that kind of a ping command is not accurate

amber fractal
#

well subtraction obviously isnt lib related

broken shale
#

lol

sudden geyser
#

really? how would it be then

#

ya

broken shale
#

try message - msg

earnest phoenix
#

you'd have some sort of a stopwatch and you'd time how much time it takes to send the request

#

cause subtracting the timestamps includes internal api latency

sudden geyser
#

ahh, okay. I'll try it out

broken shale
#

True but me: Lazy asf

earnest phoenix
#

yeah, it's not like it's a big difference

broken shale
#

plus or take 5% marginal error

earnest phoenix
#

pretty much

floral bloom
#

As my message has been lost, I will post again.

Discord.js
Will someone please recommend a (good) NPM package to auto detect a language and translate it?
Ping with response please!

topaz fjord
#

just use the google translate api

earnest phoenix
#

Hello
who can help me create a bot

abstract crow
#

How do I find out what role was removed? In Discord.JS

#
changes: [ { key: '$remove', old: undefined, new: [Array] } ],

topaz fjord
#

there is an event for it

broken shale
#

lol

topaz fjord
#

another way you could do it is that you store the roles before the delete and after the delete and compare their values

wary needle
#

just check for difference in roles before and roles after

abstract crow
#

Should I run my bot and website together as one instance?

#

Because if my web dashboard contains code that needs to be sent to the bot, how do I do that?

onyx summit
#

ipc

abstract crow
#

ipc?

onyx summit
#

Is an option

inner jewel
#

i just share the same database on both

abstract crow
#

Right but lets say the dashboard I can send messages through

inner jewel
#

and send a message over pubsub to notify the bot that data was changed

onyx summit
#

Intern process communication = IPC

abstract crow
#

How can I coordinate that with the bot saying to do x

inner jewel
#

send a message to the bot which says "do x"

abstract crow
#

Send code

#

I need to send code to the bot

#

User inputs message
Bot sends message

onyx summit
#

then eval it

abstract crow
#

Huh?

#

How can I do that over the website

inner jewel
#

you send a message to the bot

onyx summit
#

You could either have predefined scenarios that are ran when the dashboard sends something specific to the bot

abstract crow
#

The message or the code?

inner jewel
#

a message can be whatever, eg {"action": "send", "content": "hello world"}

abstract crow
#

How do I set that up tho @onyx summit

inner jewel
#

then the bot reads that and does the action

#

don't send code and eval it

abstract crow
#

Right

inner jewel
#

that's a massive security hole

abstract crow
#

Would you guys happen to know how I can make those functions and then send that?

inner jewel
#

eg you send to the bot "eval bot.guilds.get('id').channels.get('other id').send('${message}')"

onyx summit
inner jewel
#

then users get a full RCE on your bot

#

if they set the message as ' + bot.token + ', they have your token now

abstract crow
onyx summit
#

There is an example folder in the GitHub

inner jewel
#

sending data can be just an http server on the bot

#

then the website does a request to that

#

or eg a pubsub thing such as nats or rabbitmq or even redis

abstract crow
#

What would you use?

inner jewel
#

i use nats to communicate between bot and website

lusty dew
#

How do you connect your bot with the dashboard?

inner jewel
#

and just write directly to the database from the website

abstract crow
#

@lusty dew We already said Oauth2

lusty dew
#

I thought you guys meant with users

#

My bad

#

I'm still trying to figure out this emoji ID thing

inner jewel
#

user presses save on the dashboard -> settings get sent -> website cleans input, writes to db -> website notifies bot about which guild was updated and by who

#

so the bot can write that to the log channel

abstract crow
#

Ok so let me get this straight. To tell the bot to run a certain function with x parameters what thing do I use?

#

Gotcha

inner jewel
#

i just send json payloads

abstract crow
#

Confoosed

inner jewel
#

then it's basically handlers[message.type](message)

abstract crow
#

Ok is there a way that I can make a HTTP request with the bot? Like change the data of the url from the website, and then the bot just waits for it automatically

inner jewel
#

that's what handles messages on the bot's end

abstract crow
#

This is way to confusing for me lol

inner jewel
abstract crow
#

Can't I just run a second instance of the bot and then run the specific function?

#

Blank 2nd instance

#

1st instance has the main code
2nd instance has the predefined scenarios and functions that connect with the website

inner jewel
#

i just have both on the same instance

#

i need data from my cache anyway

abstract crow
#

Ok, but would a 2nd instance be bad/allowed?

inner jewel
#

ยฏ_(ใƒ„)_/ยฏ

#

sounds like overengineering to me

#

also you'd need to login two instances

onyx summit
#

It would be allowed, but it makes even harder to manage ratelimits

inner jewel
#

which would double startup time

onyx summit
#

aka your library won't be able to handle them good

abstract crow
#

Ik its just then I don't get the separate github repos and organization

pallid pike
#

Hey

abstract crow
#

Unless they are in the same folder

onyx summit
#

Hey

pallid pike
#

Just found out the bots have a server and now Iโ€™m here

abstract crow
#

lol

#

Wassup

pallid pike
#

Nothing much

abstract crow
#

Welcome to the world's(worst) best server

#

what nothing

#

Great server ๐Ÿ˜ƒ

inner jewel
#

i just have a bunch of things like this on my bot that handle messages from the website

pallid pike
#

Woah

abstract crow
#

WAY TO CONFUSING

#

PLS NO

#

Imma just run one instance lol

pallid pike
#

That looks complicated

#

Ngl

#

Iโ€™m not that good with coding so I see it as complex

earnest phoenix
#

when i used to run my old public bot, i had my bot and website separated each to their own server

#

the website had small websocket support so the information between the bot and the website could be exchanged

#

if that helps

abstract crow
#

How would I do that?

earnest phoenix
#

in node? no idea, i did everything in .net c#

inner jewel
#

run a websocket server on one side

#

connect to it on the other

abstract crow
#

I have no idea how to do that lol

#

Any module or is it built in

onyx summit
#

I still don't get why you would choose IPC but ok

inner jewel
#

just google "node websocket client" and "node websocket server"

#

because you need to move data around

#

IPC is just a generic name

abstract crow
#

Is that safe tho?

inner jewel
#

inter process communication

abstract crow
#

And actually like good?

inner jewel
#

it's as safe as you make it

#

if you run it without ssl and without authentication then no

onyx summit
#

no, normal websockets are not encrypted

inner jewel
#

wss is encrypted

#

if you have https, you can have wss

abstract crow
#

Ok so the website is the server

earnest phoenix
#

use wss with an auth key and you're all g

inner jewel
#

just let something like nginx terminate the ssl connection

abstract crow
#

And the bot is the client?

onyx summit
#

Uhhh

broken shale
#

so complicated talk here

inner jewel
#

and get a certificate from let's encrypt

broken shale
#

I can actually learn something mmLol

abstract crow
#

I have HTTPS

inner jewel
#

then you can just use that

onyx summit
#

i would say the bot is the server, so the website can make request to it

inner jewel
#

or regular unencrypted websockets if both processes are on the same machine

#

making the website be the server is easier imo

#

it already needs to handle http requests

abstract crow
#

How would I make it encrypted with HTTPS?

inner jewel
#

which is half of the websocket spec

#

if it's localhost, you don't even need it

abstract crow
#

And can the server recognize the clients request and do something?

inner jewel
#

if not, the same way you'd do https for your domain

abstract crow
#

Like if the client says ok do x function with y variables

inner jewel
#

websockets are a full duplex channel

abstract crow
#

Can the server interperate that as console.log(y)

inner jewel
#

both sides can send and receive at the same time

abstract crow
#

Ok so I don't even need WSS?

inner jewel
#

if both are on the same server and connect via localhost, no

abstract crow
#

Ok cool

#

And then the server can understand the request and do something with it?

inner jewel
#

you should still have authentication

abstract crow
#

Right

lusty dew
#

When you forget what you were trying to do oof

onyx summit
#

A dashboard

lusty dew
#

No decided not to do that yet

#

I want help with that tbh i don't wanna do it all on my own

#

Wanna have a partner

#

Unless my other bot Dev knows html and CSS i don't think he does though

#

Oh yee

#

User info command

#

And info cmd

#

Does d.js master have a thing for nitro?

broken shale
#

yes

lusty dew
#

It has a thing for Boosters

#

Oh?

broken shale
#

wym by nitro

inner jewel
#

what thing for nitro

broken shale
#

take my first msg back

#

explain wym by nitro first

lusty dew
#

I'm talking about if they have an active nitro subscription

inner jewel
#

no

#

bots can't get that info

#

you need oauth

lusty dew
#

Oh oof

#

But they can get client Status and boosting subscription

broken shale
lusty dew
#

Ye that's for boosting iirc

inner jewel
#

UserProfile

#

bots can't view profiles

broken shale
#

ik

#

oauth needed

#

If you wanna set it up

lusty dew
#

I don't know how to do the OAuth thing to use it

broken shale
#

I prob would cuz Im bored as fk and I would like to use mutualguilds

inner jewel
#

mutual guilds aren't sent over oauth

lusty dew
#

How would I setup OAuth to use this?

inner jewel
#

you need to loop all your guilds and check if the user is in there

broken shale
#

No I meant this

#

Print out all guild names the user is in

grizzled canyon
#

How do I implement a vote-to-use-this-feature system?

lusty dew
#

@inner jewel So how would I setup OAuth to allow me to access UserProfile

#

?

inner jewel
#

you don't

lusty dew
#

Wait what

inner jewel
#

oauth2 is explained here

lusty dew
#

Then how do I access UserProfile

inner jewel
#

there's no way to get an user's profile at all

#

unless you make an userbot

#

you can get parts of that with oauth

#

but not in a single request

lusty dew
#

Then why have it in the docs?

inner jewel
#

because that's for client accounts

#

which can be used with d.js

#

but will get you banned from discord

lusty dew
#

Hn

#

So they are promoting things that can get you banned

#

Oof

#

Okay thanks for the help!

broken shale
#

lmao

inner jewel
#

they aren't promoting that

#

they just didn't remove support

broken shale
#

Called laziness

lusty dew
#

Ah mk

inner jewel
#

if you try getting help with that you'll probably get nothing

broken shale
lusty dew
#

Mk

#

Kinda sad you can't get if they have active nitro oof

#

Don't people who boost get a booster role automatically or do the server owners have to make the role?

split lantern
#

@broken shale its actually not laziniess its actually just the fact that d.js follows semver

#

so v12 already has all user bot stuff removen

#

but stable ( eg v11.5 ) cant just throw it out

alpine lark
#

I need some d.js

#

Help

#

My command handler isnโ€™t working

lusty dew
#

Show code and error someone will be able to help you faster and easier @alpine lark

#

How can I compare if the users account was created to today's date

idle basalt
#

javascripts date object

lusty dew
#

Ye but user.createdAt > Date.now()

#

Doesn't work

jolly nova
#

Discord.py > Discord.js

lusty dew
#

Hm?

jolly nova
lusty dew
#

No

#

Why would I use d.py?

jolly nova
#

Nvm

lusty dew
#

I see what you did there

#

It's just a question

jolly nova
lusty dew
#

Why use d.py give me a valid reason and I'll believe it's better then d.js

#

;3

#

Jk

inner jewel
#

1. it's not js

jolly nova
lusty dew
#

Lol

#

How can I compare if the users account was created to today's date

jolly nova
lusty dew
#
if(client.user.createdAt > Date.now()){
message.channel.send('Im old!')
}else{
message.channel.send('Im young')
}
#

I evaled that and it returned the I'm young thing

jolly nova
#

import time

inner jewel
#

because a user will never be newer than now

lusty dew
#

True

inner jewel
#

a user can't have been created in the future

lusty dew
#

Didn't think about that

#

All I'm trying to do is check if they are older then 1 year and if not then format the time in a different way

inner jewel
#

get the difference between current time and user account creation

jolly nova
#

I am trying to figure out how to delete a message after certain time If anyone knows

inner jewel
#

and check if it's greater than 1 year

lusty dew
#

How would I check if it's greater then 1 year

inner jewel
#

you'll get a difference in milliseconds

lusty dew
#

Okay

inner jewel
#

compare that to how many milliseconds you have in a year

lusty dew
#

Ahhh mk

#

Thanks

#

:3

#

Didn't think about that

fast tendon
#

m!eat @fast tendon

warm marsh
#

Date.now() - createdTimestamp >= 31536000000ย  ? true : false;

lusty dew
#

3.154e+10

#

Could I use that

warm marsh
#

Use whatever you want. It's your code.

lusty dew
#

I meant

#

Will Js support that time format

warm marsh
#

Yes.

lusty dew
#

It didn't give me the whole number

#

Mk thanks

warm marsh
#

Also, createdAt returns a date, you might wanna use createdTimestamp instead.

inner jewel
#

Date objects are converted to numbers when needed

lusty dew
#

So should I use createdAt or createdTimestamp

#

?

inner jewel
#

both work

lusty dew
#

Okay

alpine lark
#

Keeps saying query isnโ€™t defined

amber fractal
#

why does no one know how that works

#

it says it cannot read the property that is query of undefined

#

so the object you are attempting to get query from isnt defined

alpine lark
#

How is it not defined tho

lusty dew
#

Because you didn't define it properly @alpine lark

#

Probably some typos

shrewd violet
#

how do you open cmds for a folder

#

help

opaque eagle
#

That question is very vague

shrewd violet
#

wdym

opaque eagle
#

What language are u using, wdym by open โ€œforโ€ a folder

shrewd violet
#

like open this

opaque eagle
#

Ohhhhhh

#

You can open a folder by using open <PATH> I think

#

Itโ€™ll open in file explorer

shrewd violet
#

Where is that

opaque eagle
#

I suggest you go through some sort of terminal for beginners guide online

shrewd violet
#

I am

opaque eagle
#

Anidiots.guide is a Discord bot guide

#

Iโ€™m talking about one that teaches you how to use the terminal

shrewd violet
#

Iโ€™m on andiots

opaque eagle
#

Also donโ€™t use anidiots.guide to make a bot, itโ€™s a really bad option

shrewd violet
#

Iโ€™m not

#

Wait

opaque eagle
#

Then why is it open in the background

shrewd violet
#

So donโ€™t follow its tutorial?

opaque eagle
#

Anidiots.guide is made for those with imposter syndrome

shrewd violet
#

Oh

opaque eagle
#

The one I showed you is the official guide and itโ€™s audited constantly by lots of active devs in the community

shrewd violet
opaque eagle
#

Yeah, use that site

shrewd violet
#

Ok

opaque eagle
#

But to answer your question you need to do:

open <PATH-TO-FOLDER> to open a folder within file explorer, and cd PATH-TO-FOLDER> to go to a folder in the command line itself

shrewd violet
#

Ok

#

But which

#

Should I do

opaque eagle
#

If you donโ€™t know js, you should ideally do one of those short guides, although Iโ€™d recommend options 2 or 3

shrewd violet
#

Ok

#

Iโ€™m doing nodeschool

opaque eagle
#

Option 1 doesnโ€™t teach you shit, Option 4 is made for people who already know JS, and Option 5 is well Google

#

So Options 2 and 3 r the best

shrewd violet
#

K

valid frigate
#

when i try sending an embed with some links such as this:

{embed: {description: `[Promise](https://google.com)<[Array](https://google.com)<*>>`}}

the result ends up being: https://ss.vysion.cc/19r2gftojz6ltd4n.png, can anyone explain why?

inner jewel
#

because discord's parser is garbage

valid frigate
#

i assume it's a bug

#

bc it's parsing <> lmao

#

i would have assumed \< and \> are workarounds

shrewd violet
valid frigate
#

the package doesnt exist on npm

shrewd violet
#

?

valid frigate
#

read the 2nd line from the npm error

#

"Not Found"

shrewd violet
#

I

#

O*

valid frigate
#

take time to read the errors npm gives you

shrewd violet
#

You know what Iโ€™m gonna do this tomorrow Iโ€™m so tired

valid frigate
#

wait a minute the package exists

#

never mind

shrewd violet
#

Too late thank

lusty dew
#

How does highestRole work?

#

D,js master

dusky geode
#

Idk

lusty dew
#

Then why respond?

dusky geode
#

Returns the highest rank

#

Role*

#

Object

lusty dew
#

Itโ€™s returning undefined

#

Which I donโ€™t see how

dusky geode
#

Show me the code

lusty dew
#

I have everything correct

#

Iโ€™m using eval to test it

dusky geode
#

Ok

lusty dew
#

But I, doing:

#

message.guild.members.get('479603748382179329').highestRole

#

It works with .roles

dusky geode
#

Let me test it

lusty dew
#

Thatโ€™s why Iโ€™m confused as to whatโ€™s undefined

cinder patio
#

that's not how you access it

#

message.guild.members.get('479603748382179329').roles.highest

lusty dew
#

Oh?

dusky geode
#

No

cinder patio
#

yes. look at the docs

dusky geode
#

You use member.highestRole

cinder patio
#

that's on stable

#

you are using master

tawny oar
#

are you using dev version?

lusty dew
#

Dev version and google feud is correct

tawny oar
#

or master

lusty dew
#

Iirc

#

Let ,e check

#

Me

dusky geode
lusty dew
#

Yea Iโ€™m using master

#

Bruhhh

dusky geode
#

Its member.highestRole

cinder patio
#

that is stable, not master

lusty dew
#

I was on the wrong docs

#

๐Ÿ˜‚

#

I was hella confused

cinder patio
#

dw I'm guilty of that as well lol

tawny oar
lusty dew
#

Thank you I was wondering why other stuff wasnโ€™t adding up

#

Lol

cinder patio
#

np!

lusty dew
#

Also when did stable get clientStatus

#

I thought master only had that

#

Last time I checked master did only have that

cinder patio
#

11.5? shrugthink

lusty dew
#

Dang okay

#

Honestly I switched to master cause of clientStatus and the other cool features lol

#

Okay ima go have fun with moment GWsetmyxPeepoCry

#

Would I be able to assign a variable a new value inside an if statement and use it out of the scope of the if statement?

cinder patio
#

yes

lusty dew
#

Iโ€™m trying to check if the users account age is over a year and if so then itโ€™d format it a certain way

#

And if it is younger then a year itโ€™d format it a different way

cinder patio
#
let variable;

if (something) {
  variable = 4;
}```
lusty dew
#

Okay

#

My question is could I do something like:

#
let time;

if(Date.now() - member.createdAt > yearinms){
time = moment(member.createdAt).format('YY')
//Format: Example. Account age: 3 years
}else{
time = moment(member.createdAt).format('MM/D/YY HH:mm:ss')
//Format: Example. Account age: 05/09/18
}
#

God that took forever to write lmao

#

Then do

#
.addField('Account age: ', time)
cinder patio
#

yeah that works

lusty dew
#

Okay thanks!

#

I almost messed up my logic lmao

cinder patio
#

you can also do it with the ternary operator

lusty dew
#

Oh?

cinder patio
#

.addField('Account age: ', (Date.now() - member.createdAt > yearinms) ? moment(member.createdAt).format('YY'):moment(member.createdAt).format('MM/D/YY HH:mm:ss'));

#

kinda ugly

lusty dew
#

Smh why did I not think of that

#

I was thinking of using that for something else lol

#

Honest though

#

The if statement looks better to me

#

A lot more clean and easy to read imo

#

Will js support 3.154e+10

#

That time format

#

I think it will

#

Really?

#

No way

dusky geode
#

Ok

lusty dew
#
2|clap  |     at Object.run (/home/panda/Clap Bot/commands/uInfo.js:34:48)
2|clap  |     at Client.client.on (/home/panda/Clap Bot/clap.js:50:88)
2|clap  |     at Client.emit (events.js:198:13)
2|clap  |     at MessageCreateAction.handle (/home/panda/Clap Bot/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
2|clap  |     at Object.module.exports [as MESSAGE_CREATE] (/home/panda/Clap Bot/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
2|clap  |     at WebSocketManager.handlePacket (/home/panda/Clap Bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:391:31)
2|clap  |     at WebSocketShard.onPacket (/home/panda/Clap Bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:418:22)
2|clap  |     at WebSocketShard.onMessage (/home/panda/Clap Bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:274:10)
2|clap  |     at WebSocket.onMessage (/home/panda/Clap Bot/node_modules/ws/lib/event-target.js:120:16)
2|clap  |     at WebSocket.emit (events.js:198:13)
2|clap  |     at Receiver.receiverOnMessage (/home/panda/Clap Bot/node_modules/ws/lib/websocket.js:789:20)
#

I keep getting this error I logged member to make sure it isnโ€™t member

#

Hereโ€™s the code:

dusky geode
#

Ok

lusty dew
cinder patio
#

let member = message.mentions.members.first() || message.author;

member can be a GuildMember OR a User. message.author is an instance of the User object. Either do
let member = message.mentions.members.first() || message.member or let member = message.mentions.users.first() || message.author; so member is always the same type

lusty dew
#

Okay thanks

cinder patio
#

You are trying to access member.user.bot, Users do not have a user property, only GuildMembers do

lusty dew
#

Ahh okay

#

Thanks

#

So message.member what is that again?

cinder patio
#

GuildMember

lusty dew
#

Okay thanks

cinder patio
#

np EmeraldOkHand

lusty dew
#

Forgot the mixture between the two donโ€™t work well yikes

lusty dew
#

How can I get the bots cpu usage?

winged thorn
#

what language?

#

@lusty dew

lusty dew
#

D.js master

winged thorn
#

what operating system

lusty dew
#

My friends hosting service is Ubuntu iirc

winged thorn
#

you can use the os module

#

or a package called os-utils

lusty dew
#

That only gets the cpu time doesnโ€™t it?

winged thorn
#
var os = require('os');

console.log(os.cpus());
console.log(os.totalmem());
console.log(os.freemem())```
lusty dew
#

Or whatever

winged thorn
#

thats with os

#

with os-utils

#
var os = require('os-utils');

os.cpuUsage(function(v){
    console.log( 'CPU Usage (%): ' + v );
});```
broken shale
#

yep

lusty dew
#

Ah mk

tight heath
#

the os-utils package looks very poorly made though.

winged thorn
#

ยฏ_(ใƒ„)_/ยฏ

lusty dew
#

How do you convert bytes in to MB and GB

tight heath
#

/ 1024

lusty dew
#

For both of em?

#

MB and GB

tight heath
#

1024B = 1MB

#

1024MB = 1GB

#

:)

#

so
B => MB / 1024
B => GB / 1024 * 1024 = 1048576

lusty dew
#

Ah mk so like

let bytes = 1024;

let mb = bytes / 1024

let gb = mb / 1024

*i suck at math btw so Iโ€™m probably wrong

winged thorn
#

no

#

the bytes -> mb is right

tight heath
#

let gb = mb / 1024

winged thorn
#

but to get to gb you need to divide mb by 1024

tight heath
#

or

#

let gb = bytes / (1024 * 1024)

winged thorn
#

that works too

lusty dew
#

Ah mk

#

Now to see how to implement this

wide ruin
#

whats the easiest way to store levels in js?

lusty dew
#

Cause it can spike from mb to gb one day

tight heath
#

@wide ruin levels as in experience?

wide ruin
#

yeah

tight heath
#

@lusty dew if (mb > 1024) display gb

#

else mb

#

ยฏ_(ใƒ„)_/ยฏ

#

use a database like mongodb

wide ruin
#

is a json easy?

tight heath
#

json is prone to corruption and super slow

winged thorn
#

but yes it is easy

#

ยฏ_(ใƒ„)_/ยฏ

wide ruin
#

so how do i set up a db?

tight heath
#

atomic json is not easy lmao

#

this seems quite good

#

but tbh

winged thorn
#

sql gang

tight heath
#

should do the trick

lusty dew
#

This doesn't look right

#

The mem usage and cpu usage I mean

#

I know why nodejs isn't working I fixed it already

#
       let memUsage

            if(process.memoryUsage()['heapUsed'] > 1024){
                memUsage = process.memoryUsage()['heapUsed'] / (1024 * 1024) + ' gb'
            }else{
                memUsage = process.memoryUsage()['heapUsed'] / 1024  + ' mb'
            }
#

Oh wait

#

I see what I did wrong

#

Cpu usage though idk what I did wrong

#

@winged thorn

#

Os-utils is being weird

winged thorn
#

how so

#

wait 51GB

#

that doesn't sound plausible

lusty dew
#

No that isn't correct

#

Idk whats going on there either

#

I thought I fixed it but Ig not

#

I'm using process.memoryUsage for the mem usgae

winged thorn
#

The cpu usage I guess is plausible if you're only running a bot

lusty dew
#

But in the pm2 console it says 4.6%

winged thorn
#

hm

lusty dew
#

Not all that wonky shit

winged thorn
#

Well idrk how that package works, maybe some googling would solve your problem

lusty dew
#

Oof

pale marsh
#

So I got a conundrum here. I wanna differentiate between kicks and normal leaves, so I was using the audit logs and checking the last kick entry. Works well so far

#

The thing is, if a user got kicked, joined, and then left again it would still think it got kicked, since in a short time no new kick entries would've been added to the audit logs

#

But then I decided to check the time the entry was created and compare it with the time at which the leave event got triggered and that always varies, and my bot sometimes lags

#

I have no idea how to do this properly

#

The fact that the kick and leave events are the same is a pain

slender thistle
#

I usually see if the difference between last audit log entry and the time of event being fired is >= 500 milliseconds

pale marsh
#

Is half a second enough?

slender thistle
#

Works well so far for me, at least HYPERLUL

pale marsh
#

It always varies

#

Imma give it like 1 sec difference lol

slender thistle
#

2 ftw

pale marsh
#

Yeah sounds about right lol

winged thorn
#

Its a bit janky but oh well

pale marsh
#

I have no idea what else to do instead honestly

winged thorn
#

I just bit the bullet and decided to only log kicks made through my bot

pale marsh
#

Lmao sounds easier. Can't do that unfortunately

winged thorn
#

rip

lusty dew
#

Okay I got CPU usage working

#

But mem usage isn't working

#

Still

#

@tight heath 1024Bytes = 1MB?

winged thorn
#

yes

lusty dew
#

You sure?

#

Cause the math isn't adding up prolerly or I'm doing something wrong