#development

1 messages · Page 1638 of 1

river panther
#
const Discord = require('discord.js');


module.exports.run = async (bot, message, args) => {
    if(!message.member.hasPermission("KICK_MEMBERS")) return 
message.channel.send( "**Üyeleri At** yetkisine sahip değilsin!");
    let kUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
    if(!kUser) return message.channel.send('Kullanıcı giriniz.')
    if(kUser.id === bot.user.id) return message.channel.send('Botu **Atamazsın!**');
    let kReason = args.join(" ").slice(22);
    if(!kReason) return message.channel.send('Sebep giriniz...')
    if(kUser.hasPermission("BAN_MEMBERS")) return message.channel.send("Atmak istediğin kişi **Üyeleri At** yetkisine sahip **Atamam...**");

    let kickEmbed = new Discord.RichEmbed()
    .setDescription("Atma")
    .setColor("#bc0000")
    .addField("Atılan Kişi", `${kUser} ID'si ${kUser.id}`)
    .addField("Yetkili", `<@${message.author.id}> ID'si ${message.author.id}`)
    .addField("Sebep", kReason);
    let incidentchannel = message.guild.channels.find(`name`, "mod-log");
    if(!incidentchannel) return message.channel.send("`mod-log` kanalını bulamıyorum.");

    message.guild.member(kUser).kick(kReason);
    incidentchannel.send(kickEmbed);
};

exports.conf = {
  enabled: true,
  guildOnly: true,
  aliases: [],
  permLevel: 0
};

exports.help = {
  name: 'kick',
  description: 'İstediğiniz kişiyi atar.',
  usage: 'kick [kullanıcı] [sebep]'
};

now paste this and try

quartz kindle
#

Wat

river panther
#

i removed the message.delete()

zenith terrace
#

discord v11 moment

river panther
#

oh wait, RichEmbed()

#

exdeeeeeee

opal plank
#

does v11 still even work?

river panther
#

idts

quartz kindle
#

Yes

opal plank
#

yikes

zenith terrace
#

clearly copied code as well

river panther
#

breh

opal plank
#

welp, good luck

#

imma go back to reading whats basically written hentie

river panther
#

tf

#

its such a cute emoji

zenith terrace
#

mine now

river panther
#

what lib are you using?

zenith terrace
#

submitData is not defined

quartz kindle
#

What are the contents of guildSettings

#

Open the page source

#

And show how that part was rendered as

#

The full page source

#

Right click view source

#

Missing quotes

#

Likely because its an object

#

It will be converted to [object Object]

#

You need to stringify it

#

You cant

sterile hawk
quartz kindle
#

ejs is a templating engine

#

It uses variables to build page

#

Then sends the page

ripe prairie
#

@sterile hawk your long description needs 300 characters

quartz kindle
#

After the page is sent you cant access it anymore from the server side

sterile hawk
quartz kindle
#

You need to make a new request from the client side

#

Using forms

ripe prairie
#

like, add your bot features + commands, etc.

quartz kindle
#

And/or xhr/ajax requests

#

You can also use the browser fetch api

sterile hawk
ripe prairie
#

"detailed description" = long description

sterile hawk
quartz kindle
#

Its not 300 letters long

#

Minimum 300 letters

#

Like a school homework

opal plank
#

just put some lasagna recipe there to fill it ||(im clearly joking)||

sterile hawk
#

Ja

quartz kindle
#

My bot was approved with a base64 image instead of description

opal plank
#

wait a second

#

does css count?

quartz kindle
#

I think so?

opal plank
sterile hawk
#

Hab ich ja

opal plank
sterile hawk
#

Geht trzd nd

quartz kindle
#

Its fine to use other langs here if its to explain something related to the problem

opal plank
#

im not a mod tho

#

¯_(ツ)_/¯

sterile hawk
#

Wie nicht genug Zeichen?

quartz kindle
#

But should transition to english soon, or parties should agree to move channels

sterile hawk
#

Was soll ich noch schreiben xD

quartz kindle
#

But im not a mod either ll

sterile hawk
#

Hab eigentlich schon alles für bot

#

Hab uch ja schon

#

Jetzt endlich

quartz kindle
#

What is he going on about

#

I understand a bit of german but cant follow this

ripe prairie
#

"i have desc"

#

-repeat

quartz kindle
#

Is that accepted?

#

Lmao

ripe prairie
#

i dont speak german so cant tell ya

#

🙃

sterile hawk
ripe prairie
#

well looks like it worked

#

so

grizzled sonnet
#

@sterile hawk was gehen

sterile hawk
quartz kindle
#

Lol

grizzled sonnet
#

Endlich jemand der deutsch kan haha

opal plank
#

i speak dutch very gud

#

ich sprechen kein deutch

grizzled sonnet
#

@earnest phoenix ik ixh schreib das so

ripe prairie
#

anyways let's keep this channel on-topic

grizzled sonnet
#

@opal plank ich auch

ripe prairie
#

if ya need more help with bot submission, please head over to #support

opal plank
#

i wonder tho

quartz kindle
#

i wonder how

#

I wonder why

opal plank
#

what would be better to use, IPC or TCP

quartz kindle
#

Depends lol

river panther
#

why are you?

quartz kindle
#

Use whatever is best for the job

opal plank
#

i mean, granted you can use both of course, IPC supports TCP, but i mean more like, which should be usecase for this

#

hmmm

#

TCP does have its perks tho

#

but at the same time avoiding it would probably make it more scalable

river panther
quartz kindle
opal plank
#

usually thats not the kind of popularity you look for

#

👀

river panther
#

is it bad?

river panther
#

ngl, why are you? its a very philosophical question

quartz kindle
opal plank
#

there might be a point in the future where it might be split into different machines

#

but i dont think that'll come anytime soon

quartz kindle
#

Unix sockets and tcp use the same api

opal plank
#

so i was thinking of pre-amptively adapt for multi machines

quartz kindle
#

So you can go with that

opal plank
#

though i heard TCP is a lot slower than ipc

quartz kindle
#

Yes

earnest phoenix
#

is it possible to get channels in a guild without client login and only with 0Auth

opal plank
#

thats why im pondering

#

use TPC for futureproofing
use IPC for speed

#

thats the dillema im in

quartz kindle
#

Its the same api so its easy to switch from sockets to tcp

opal plank
#

hmmm fair

tranquil ferry
#

Quick question barging in here: What is needed for a bot to display the amount of servers it's on on top gg? I assume there needs to be some kind of analytics implemented into the bot?

opal plank
#

i might go ipc rn since it'll take quite a while for it to need to be using other machines

quartz kindle
#

Check out some ipc libs, most of them support both with a single setting change

#

Even i made one

opal plank
#

but bloat thoo

#

more deps

tranquil ferry
#

thx

earnest phoenix
opal plank
#

supposedly yeah

quartz kindle
#

My lib good tho :^)

opal plank
#

dont think with oauth

#

but you cna always send a raw request to discord's api with a token

opal plank
quartz kindle
#

Surprise

opal plank
#

would, i just dont wanna add any more deps than needed

quartz kindle
#

It is ads

opal plank
#

and i doubt it'd take any less than a whole year before it needs to be scaled further

earnest phoenix
quartz kindle
#

yes

earnest phoenix
#

really lol

quartz kindle
#

Yes

opal plank
#

whats funny is that im the one who suggested

#

but he pinged tim

earnest phoenix
#

will it cache?

quartz kindle
#

Xd

opal plank
#

@quartz kindle

quartz kindle
#

I think it will yes

earnest phoenix
opal plank
#

tim have u edited every file?

quartz kindle
#

Well not every file

#

Lmao

earnest phoenix
#

but a part

opal plank
#

lies and deceit

#

tim modified d.js to make d.js-light, while he's very knowledgeable i doubt he would know everything from the back of his head about d.js

#

i dont even remember half of my own bot

#

and im the one who coded that

quartz kindle
#

xD

#

The classic "who coded this crap? Oh right, it was me"

earnest phoenix
#

oha xD

quartz kindle
#

xD

earnest phoenix
#

can you send message without client login?

quartz kindle
#

yes

earnest phoenix
#

lol that is cool

opal plank
#

client.login simply handshakes with the gateway

#

well, technically theres a lot more

#

but thats the idea, it just creates a websocket connection with discord

#

you can still use the api without it

quartz kindle
#

its for receiving events

opal plank
#

^^

quartz kindle
#

for sending you dont need it

opal plank
#

most of the stuff you need is POST/GET requests

#

which can be done without a webscoket connection

earnest phoenix
#

is there enyway of getting a bot with a /give points command

opal plank
#

you..... code it?

earnest phoenix
#

well how

river panther
#

sm0rt

opal plank
#

do you have a database already?

river panther
earnest phoenix
#

no

#

dont think so

opal plank
#

i assume you want something like points system n stuff

river panther
#

what library are you using?

earnest phoenix
#

ye i want a roulette bot for fun

opal plank
#

then you'll need a database to store all that data

earnest phoenix
river panther
#

oh man, yes, fml

opal plank
#

otherwise its lost when your bot goes offline

#

your best bet rn would be SQLite

earnest phoenix
#

but there has to be a /give points command so i can like give points

opal plank
#

since its a small database

#

you code it

#

but you need a framework first

earnest phoenix
#

i am dead

opal plank
#

which language you using/planning to use?

earnest phoenix
#

english

opal plank
earnest phoenix
#

or danish doesnt really matter

opal plank
#

programming language

earnest phoenix
#

idk

opal plank
#

then start there

earnest phoenix
#

i am kind of new

opal plank
#

you need to know how to code, to, well, code

#

i would recommend javascript or python

earnest phoenix
#

ill ask my friend

#

he is a coder

#

he knows it

opal plank
#

@earnest phoenix Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:

  • proper syntax
  • debuging code
  • basic features (vars, arrays, objects, functions)
  • read and understand docs
  • nodejs module system

As much as we d like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.

Here are good resources to learn both Javascript and NodeJS:

Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie s Accelerated JS: https://js.evie.dev/

Please take a couple of weeks/months to get acquainted with the language before trying to make bots!

earnest phoenix
#

i think

#

because i am dead here

opal plank
#

you have 3 options

#

learn how to code it and make yourself
copy some bot from somewhere
pay someone to make it for you

#

thats basically what you can do

ripe prairie
#

pls no do #2

opal plank
#

lel

earnest phoenix
#

haha

opal plank
#

theres a ton of open source bots out there for easy deployment

earnest phoenix
#

i know a frind

#

TIK

#

TIM

opal plank
#

tim

#

we found ur frne

#

fren*

quartz kindle
#

option 4: find a bot that does what you want and use it

opal plank
#

or that

earnest phoenix
#

i dont really know how to do that

opal plank
#

i've given you the options

#

im not gonna pick it for you

#

you're the one who decides

quartz kindle
#

you dont know how to find a bot?

earnest phoenix
#

nop

#

i am new like i said

quartz kindle
opal plank
#

is on a server thats literally for searching bots

earnest phoenix
#

lol

opal plank
earnest phoenix
#

so i just search roulette bot /give points command

ripe prairie
#

shh..

opal plank
#

hehehe

river panther
#

tbh, i hate people who use botghosts

#

and then say their bot from botghost is better than mine

river panther
#

yes

marble juniper
#

copy pasting code doesn't make ur bot better mmLol

earnest phoenix
#

tim i can not acess client.user ?

opal plank
earnest phoenix
#

is double login bad on token?

opal plank
#

this sums bot development in a nutshell

wary pollen
#

Copy paste at its finest

tired panther
river panther
viscid gale
earnest phoenix
viscid gale
#

as someone who wrote their bot without asking others for help(technically reading the docs counts but uk what i mean) i feel offended uwu

#

{0\_/0}

river sedge
#

When I am creating a channel with given codes inside a categoryjs msg.guild.channels.create(`${winner.username}-${winner.discriminator}`, { type: 'text', permissionOverwrites: [ { id: msg.guild.id, deny: ['VIEW_CHANNEL'], }, { id: winner.id, allow: ['VIEW_CHANNEL'], } ], }).then(async x => { x.setParent(category.id) });
it's creating channel with category role permissions instead of the specified ones. How to fix that?

wispy holly
#

im working on bitcoin mining bot

#

should ı open the folder and add start.bat and add commands?

#

discord bots uses developer's computer or a discord's main computer?

ripe prairie
#

are you really trying to use other people's computers to mine crypto using a discord bot?

#

what the hell lol

wispy holly
#

yis

river panther
#

how?

wispy holly
river sedge
#

lol

rugged haven
#

Hello helpme

onyx hare
#

im getting client.channels.get(channel_id) > get is not a function as an error

#

its worked for me before

unreal estuary
#

u need to do client.channels.cache.get in discord.js v12

onyx hare
#

now im having another error :||

client.channels.cache.get(channel_id).fetchMessage(message_id).then(m => {
  console.log("reaction message found.");
})

err
Cannot read property 'fetchMessage' of undefined

channel and message id bit

let channel_id = "800870237883858964"; 
let message_id = "818449664076546099";
olive spear
#

ку

#

ебать

#

русские

#

есть?

unreal estuary
#

?

olive spear
#

боты?

#

english?

unreal estuary
#

yeah english

onyx hare
unreal estuary
#

is the channel id correct

quartz kindle
#

also fetchMessage is not a thing

sharp ledge
#
client.on('ready', async() => {
    client.destroy();
    await wait(1000);
    await client.login(token);
});

btw after relogin, client is not firing event anymore, how to make it work?

client.on('ready', async() => {
    client.destroy();
    await wait(1000);
    client.on('ready', async() => {
        console.log('test')
    });
    await client.login(token);
});

try to make new event, still not fired

quartz kindle
sharp ledge
#

dunno, just want to make it work i think ~~

umbral zealot
#

make what work?

sharp ledge
#

i have no purpose

umbral zealot
#

this just loops your bot in a reboot state eternally

sharp ledge
#

i can use delay

river panther
#

bruh, just do

process.on('unhandledException', () => {})

this code will automatically solve all the errors

quartz kindle
#

client.destroy leaves client in a broken and unusable state

#

you need to create a new client

sharp ledge
umbral zealot
quartz kindle
#

client.destroy doesnt even clean caches lol

river panther
#

hey tim, any suggestions for slash commands?

quartz kindle
#

no idea, i dont even use them

river panther
#

ngl, slash commands are overrated

sharp ledge
quartz kindle
#

im not sure how good discord.js is at cleanin up,

#

you can try

sharp ledge
#

after client.destroy(); i can just client = null; right?

quartz kindle
#

yes

#

or just skip that

#

client = new Discord.Client()

sharp ledge
umbral zealot
#

discord.js isn't an API though. It's a library.

sharp ledge
#

i see

#

just because its interract with discord API~~

umbral zealot
#

Yes, that's one thing that libraries do.

#

But since this is top.gg there wouldn't be a reason to think that any channel here is related to a specific programming language or library, since bots can be in any language.

drifting wedge
#

how do i make 2 elements be alligned in a column

#

but stay where they are

#

just move the second one down

quartz kindle
#

display:block

drifting wedge
#

wait wdym

#

@quartz kindle

#

TIMMM

#

oh okay

quartz kindle
#

block elements cant be in the same line

drifting wedge
#

oh make the container block?

#

make the elements block?

quartz kindle
#

yes

drifting wedge
#

didnt work

quartz kindle
#

show code

drifting wedge
#
    <div class="botbarS">

      <h2 class="bbsTm" style="display: block;">Arch</h2>
      <h3 class="bbsTm" style="color: #c0c0c0; display: block;">Discord's favorite <span class="typer" id="none2" data-words="quest,game,music,meme,social,currency,logging,image generation,moderation,leveling,welcoming,ticketing" data-delay="100" data-deleteDelay="1000" data-colors="#7289DA" style="font-family: 'Rubik', sans-serif;"></span><span class="cursor" data-owner="none3" style="color: #7289DA; font-family: 'Rubik', sans-serif;"></span> bot</h3>

    </div>```
quartz kindle
#

whats tbe css for bbsTm abd botbarS?

drifting wedge
#

1 sec

#
.botbarS {
  display: flex;
  justify-content: left;
  text-align: left;
  padding: 20px;
  font-weight: 400;
  font-size: 14px;
  font-family: "Open Sans", sans-serif, Helvetica, arial, sans-serif;
}

.bbsTm {
  color: #fff;
  text-align: center;
}```
quartz kindle
#

you cant have blocks inside flex

drifting wedge
#

ah

quartz kindle
#

flex is a special display mode that defines both parent and children

#

so children of flex cant use display, they are locked as flex children

drifting wedge
#

there we go

#

i got it

quartz kindle
#

alternatively you can set flex direction to column

drifting wedge
#

mhm

#

alr ty

quartz kindle
#

or flex wrap to true with flex grow

slender thistle
#

Flexboxes ❤️

primal mountain
#

I'm using Node.js setting up a Music bot, what do I do so that If I vote bot, I can use the use the command need vote.

crimson vapor
#

setup a webhook

#

listen for votes

#

add the vote to the db with the timestamp

#

check on the command if the db has a vote for the user within the last 12 hours

quartz kindle
#

use mongoose on the server side then put tbe result in a client side variable

dark crest
#

help pls

slim heart
#

displayAvatarUrl()

umbral zealot
#

Why do you call it user but yo'ure getting a member ?

slim heart
#

use an actual code editor so u get code sense pls

umbral zealot
#

Would it not be more appropriate to just... get a user?

slim heart
#

oh

slim heart
#

nvrm

umbral zealot
#

yeah you really should just download Visual Studio Code

slim heart
#

its URL idk why djs has that naming scheme

#

but what eevie said

dark crest
umbral zealot
#

Alright. well anyways, get a user, not a member

dark crest
#

like that?

umbral zealot
#

members don't have avatars, users do.

umbral zealot
#

messages.mentions.users instead of members, and client.users instead of guild.members.

dark crest
#

like that?

umbral zealot
#

the first part sure

#

not the second one though, that's still getting a member

dark crest
#

ok

umbral zealot
#

get from client.users.cache

dark crest
umbral zealot
#

Ah so you no longer want to support getting a user by ID?

dark crest
umbral zealot
dark crest
#

now its should work?

umbral zealot
#

Try it.

dark crest
umbral zealot
#

it's still displayAvatarURL

#

and I don't know why you're calling it twice

#

I have a feeling you don't know javascript and you're just expecting us to give you the full real answer

dark crest
#

what i call twice?

umbral zealot
#

function()()

#

You just copied what Berry gave you, without actually understanding what he was telling you

dark crest
#

yeah its kinda show me that now i dident noticed

#

ok its work thank u 🙂

river panther
dark crest
#

got it

#

lol

#

thx

earnest phoenix
#

this is poggers. I'm working on getting data right now as well.

misty sigil
#

holy shit

#

the data

earnest phoenix
#

I've opted to go with clickhouse do to its massive throughput

misty sigil
#

its beautiful

earnest phoenix
#

Yes it is

opal plank
#

i feel lonely here with my graphs

earnest phoenix
#

I will join your shortly

opal plank
earnest phoenix
#

my old shitty graphs

opal plank
#

cant wait to see the new ones

earnest phoenix
#

neither can I lol

#

very EXCITE

misty sigil
#

i wanna have the extensive amount of data

#

how

opal plank
#

let me show off again

#

1 sec

misty sigil
#

oHhh come oooooon

earnest phoenix
#

nobody can contest, erwin is just the best

#

you literally have to go on the grafana reddit to find better ones

opal plank
#

i shall be working on it soon too

#

i wanna add a shitton of stuff

#

actually, thats one thing you could help me with if you can figure out zoro

#

dynamic tables for shards

misty sigil
#

i wanna have something that fucking cool

opal plank
#

without the use of postgres preferrably

#

ive been struggling to be able to get a full prom output on it

earnest phoenix
#

the start of data

opal plank
#

dynamicising prom is quite something

earnest phoenix
#

prom is yucky

#

check out clickhouse

#

its sql. its made for this stuff. and its FAST

fluid basin
#

is it webscale™️ though

opal plank
#

i have postgres for it, i CAN do it, but prom would be the PROPER way of doing it

earnest phoenix
#

Cloudflare uses it for their analytics

tired panther
opal plank
#

rather than using the database as a medium, its best to feed the data directly into the API

earnest phoenix
#

clickhouse is even more proper

#

trust

opal plank
#

i could very well simply have a loop for each shard with an index, then its a simple querry

#

so its not like i CANT do it

#

i just wanna do it with prom

earnest phoenix
#

ah yes

fluid basin
#

✕ Key-value requests with a high rate
wait what

opal plank
#

insert into postgres with index being the shard number, and then update every couple seconds

earnest phoenix
#

thing I don't like about prom is many things, mainly surrounding the scrape configs. and it isn't truly real time

opal plank
#

then query all from postgres

median moss
opal plank
#

prom can be set to query every second

#

which is what i think ours is at

#

but grafana is only pulling every 10 seconds

#

its overkill

#

by a LOT

earnest phoenix
opal plank
#

theres very few webscale projects that use this much data

earnest phoenix
#

yeah

#

its fun to go overkill in certain aspects though

#

this is one of them I feel

static sinew
#

hi i need help in showing leaderboards using quick.db latest verswion as startsWith method is removed now
i am also unable to install older version of quick.db as my node.js just collides and crashes so yeah

opal plank
#

indeed

#

let me get one thing i found recently

#

1 sec

earnest phoenix
#

its much more of a pain but it works

static sinew
opal plank
#

i actually did something similar, but its hardcoded

#

so if there are more shards, i would need to add some extra

#

i wanna get beyond of this level of query building

#

its some insane graphs

#

this is full view

#

i plan on using uptime on the bars

#

and map status on with grafanas built in logs

misty sigil
#

what the fuck how

earnest phoenix
#

that will be nice

#

I might try to do something similar but that will stretch my knowledge

misty sigil
#

i swear y'all are data wizards

opal plank
#

i already use grafanas logs, check how guild remove is labeled as red, while joins are green

earnest phoenix
#

very nice

opal plank
#

i can apply this to tables

#

and map them by status

misty sigil
#

i so wanna make something similar

tired panther
#

Whats so interesting in the Graphs....?

misty sigil
#

but can i be arsed?

opal plank
#

so OFFLINE/RECONNECTING/LOADING/READY

misty sigil
tired panther
opal plank
#

imagine that last bit

#

they are only using 2 color shcemes

earnest phoenix
opal plank
#

i plan on using that last colum based on the status of each shard

#

and color code it

#

with text ontop

misty sigil
opal plank
#

it'll be some highly complicated queries , im aware, but holy shit i want it

#

aaaaah i need to finish my job before i can focus on this

#

but i wanna pour every last bit of data into it

fluid basin
#

work > some_epic_database_for_my_own_eyes

opal plank
#

real time graphs and dataphilia

misty sigil
#

i would pour every bit of data i had into it

#

and i've got A LOT of data

#

but i dunno where to start and what to do

opal plank
#

actually

small holly
#

hey @bold dock , thanks a lot! do you mean on adding unit testing?

opal plank
#

now that you mention it @earnest phoenix

tired panther
#

Eat Data

opal plank
#

i wonder if its enough to be posted on reddit

fluid basin
#

dataisbeautiful?

opal plank
#

i feel like the dunning kruger effect might play here

earnest phoenix
#

Yeah it is

opal plank
#

where i boast about it and someone with 15+ years of experience just swoops in and reality slap me in the face with ha, nice try kid, but its nothing

misty sigil
#

idk man thats a cool dashboard

fluid basin
#

(damn that will still be cool if there was someone with 15 years of data analytics experience)

opal plank
#

well yeah, but i feel like this is somewhat begginer/intermediate level

earnest phoenix
opal plank
#

i dont think theres anyone here with more than a month of two of grafana query building

#

so it might be too soon to be boasting about it

#

boasting here is fine, the graphs ARE cool

#

but i'd be joining a place where theres tons of people who are way more experienced

#

might feel like some new dev coming flexing on their new kick command

earnest phoenix
#

I've been using grafana on and off for years. I just never got into it cause queries are difficult lol

misty sigil
#

i wanna get into it

#

i have data and i want to display it

opal plank
#

simple queries are easy enough, grafana isnt a hard tool to use it all

#

but the more complex and manipulation you need to do, it gets exponentially hard

earnest phoenix
#

grafana makes it easy

opal plank
earnest phoenix
#

yeah it is

opal plank
#

but then you need queries that actually manupulate data before being shown

wide wharf
#
(node:50) UnhandledPromiseRejectionWarning: ReferenceError: client is not defined
    at Object.module.exports.run (/home/container/commands/help.js:8:13)
    at Client.<anonymous> (/home/container/index.js:32:20)
    at Client.emit (events.js:314:20)
    at MessageCreateAction.handle (/home/container/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
    at Object.module.exports [as MESSAGE_CREATE] (/home/container/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/home/container/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/home/container/node_modules/ws/lib/event-target.js:132:16)
    at WebSocket.emit (events.js:314:20)
(node:50) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:50) [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.
```/help command not working
earnest phoenix
#

when it had data in it it was nice

opal plank
#

THEN you get into the oh shit zone

misty sigil
#

just to start

opal plank
#

dont be afraid

#

grafana isnt hard

#

your main issue is feeding data into it

earnest phoenix
#

like. grafana makes it this easy to make something like this $rate(countIf(Type = 200) AS good, countIf(Type != 200) AS bad) FROM requests
and in SQL form it = this sql SELECT t, good / runningDifference(t / 1000) AS goodRate, bad / runningDifference(t / 1000) AS badRate FROM ( SELECT (intDiv(toUInt32(EventTime), 60)) * 1000 AS t, countIf(Type = 200) AS good, countIf(Type != 200) AS bad FROM requests WHERE ((EventDate >= toDate(1482796747)) AND (EventDate <= toDate(1482853383))) AND ((EventTime >= toDateTime(1482796747)) AND (EventTime <= toDateTime(1482853383))) GROUP BY t ORDER BY t )

opal plank
#

here are some of my gauges

misty sigil
#

so where do i start

opal plank
#
export default {
  genshin_discord_users: {
    name: 'genshin_discord_users',
    help: 'Accurate users count',
  },
  genshin_discord_cached_users: {
    name: 'genshin_discord_cached_users',
    help: 'Cached users count',
  },
  genshin_discord_estimate_users: {
    name: 'genshin_discord_estimate_users',
    help: 'Estimate users count',
  },
  genshin_discord_ram_usage: {
    name: 'genshin_discord_ram_usage',
    help: 'Ram usage',
  },
  genshin_discord_guild_count: {
    name: 'genshin_discord_guild_count',
    help: 'Guild count',
  },
  genshin_discord_channels_count: {
    name: 'genshin_discord_channels_count',
    help: 'Channels count',
  },
  genshin_discord_message_count: {
    name: 'genshin_discord_message_count',
    help: 'Message amount in last 10 seconds',
  },
  genshin_discord_guild_member_joins: {
    name: 'genshin_discord_guild_member_joins',
    help: 'Guild member joins globally per 10 seconds',
  },
  genshin_discord_guild_member_leave: {
    name: 'genshin_discord_guild_member_leave',
    help: 'Guild members left globally per 10 seconds',
  },
  genshin_discord_commands_used: {
    name: 'genshin_discord_commands_used',
    help: 'Commands used per 10 seconds',
  },
  genshin_discord_commands_total_used: {
    name: 'genshin_discord_commands_total_used',
    help: 'Total commands used during this session',
  },
  genshin_discord_error_count: {
    name: 'genshin_discord_error_count',
    help: 'Error count',
  },
  genshin_discord_uptime: {
    name: 'genshin_discord_uptime',
    help: 'Uptime in miliseconds',
  },

fluid basin
#

yikes

#

"uptime in miliseconds"

opal plank
#
  genshin_discord_ws_message: {
    name: 'genshin_discord_ws_message',
    help: 'Websocket message',
  },
  genshin_discord_ws_message_reaction_add: {
    name: 'genshin_discord_ws_message_reaction_add',
    help: 'Websocket meessageReactionAdd',
  },
  genshin_discord_ws_voice_state_update: {
    name: 'genshin_discord_ws_voice_state_update',
    help: 'Websocket voiceStateUpdate',
  },
  genshin_discord_ws_message_delete: {
    name: 'genshin_discord_ws_message_delete',
    help: 'Websocket messageDelete',
  },
  genshin_discord_cpu_usage: {
    name: 'genshin_discord_cpu_usage',
    help: 'Cpu Usage',
  },
  genshin_discord_db_size: {
    name: 'genshin_discord_db_size',
    help: 'Database Size',
  },
  genshin_discord_dbl_votes: {
    name: 'genshin_discord_dbl_votes',
    help: 'Current votes',
  },
};

misty sigil
#

yholygod

fluid basin
#

typo no?

opal plank
#

thats not all of them

#

theres another file with more metric gauges

misty sigil
#

how do you get db size

opal plank
#

postgres

fluid basin
#

also is this per session or

opal plank
#

let me get query

#

1 sec

#

this is per session yes

fluid basin
#

thonk

misty sigil
fluid basin
#

wheres the total stats

fluid basin
misty sigil
#

you think i'm rich enough for that

#

lmao

fluid basin
#

thonk

#

no idea then

opal plank
#
 try {
      let db_size: any;
      if (client.config?.branchType === 'genshin_main')
        db_size = await client.pg.query(`SELECT pg_database_size('erwin');`)!;
      else if (client.config?.branchType === 'genshin_beta')
        db_size = await client.pg.query(`SELECT pg_database_size('distch');`)!;
      else return;
      client.stats.get('genshin_discord_db_size')?.gauge.set(parseInt(db_size.rows[0].pg_database_size));
    } catch (err) {
      genshin.errorHandler(err, 'GAUGE_UPDATE_DB_SIZE_FUNC');
    }
#

this is my gauge metric for DB size

fluid basin
#

hrm hrm

#

have you explored cloud solutions yet

#

for data analytics

earnest phoenix
#

thats a lot of data

fluid basin
#

they're sometimes pretty handy too

opal plank
#

dont need, its all local

#

and i have access directly to the bot

#

both grafana and the bot

misty sigil
#

size in bytes i assume?

opal plank
#

yes

misty sigil
#

damn i have an 8mb db

opal plank
#

the host is using nebula, so its technically in closed network

#

thats how from the host i can query even my local bot running on my pc

#

let me get the metrics

#

1 sec

misty sigil
#

we don't have context

earnest phoenix
#

Define client

#

client isn't defined mate. thats all it says, give us some code related to that and maybe we can help. but from that you need to define client

#

Async run client, message, args what you need

misty sigil
#

ok so

#

grafana

opal plank
#

notice how everything is doubled

#

left side is my local pc

#

right side is the host

#

no ssh

earnest phoenix
#

dude thats so fuckin awesome

opal plank
earnest phoenix
#

Ah yes.

#

message.client

misty sigil
#

try message.client

#

zoro too fast 😔

wide wharf
#

where?

misty sigil
#

in place of client

opal plank
#

instad of client

earnest phoenix
#

where you're doing client.user.whatever

#

message.client.user.whatever

wide wharf
#

ok

bold dock
wide wharf
#

yup fixed ty

river panther
#

wot is pagination

#

can you show an example of that this command sends

earnest phoenix
#

I'm slacking. I must code so I can collect all the data

#

that isn't his issue @river panther

#

we fixed the issue they had

river panther
#

i want to see what is pagination

earnest phoenix
#

pagination is = embeds with pages

#

however it isn't used in that command so you can ignore it

river panther
#

oh, that dude declared discord.js-pagination

earnest phoenix
#

ik

#

have a look at that

#

it shows some examples

opal plank
#

pls dont

#

nono

#

pagination is so easy

#

dont

#

just dont

earnest phoenix
#

^^

river panther
#

i want to see what it does, idk what it does

opal plank
#

dont use a package for something thats legit 7 lines

river panther
#

breh

#

ah, so this is pagination

#

nice

tired panther
misty sigil
#

ok i'm gonna make a data dashboard thing

opal plank
#
let currentpage = 0;
let filter = function();
let embeds = [ embedshere, emebed2]
let _m = await message.send(embeds[currentpage]);
const collector = reactionCollector(filter, options);
let handler = function(user, reaction) => {
  if(user.id !== message.author.id) return;
  switch(reaction.name) {
  case '>' {
     currentpage++
    _m.edit(embeds[currentpage])
    }
  case '<' {
    currentpage--;
    _m.edit(embeds[currentpage]);
    }
}
collector.on('collect', handler).on('dispose', handler)
```@river panther  this is it
#

pagination right there almost spoonfeed to you

river panther
#

i don't want to eat this shit

opal plank
#

yikes

#

arrogant lil shit

river panther
#

jk jk

#

if i want it i will make it on my own

opal plank
river panther
#

thank you tho

lyric mountain
river panther
#

but i don't need pagination for this sm0l bot o'mine

opal plank
river panther
#

this your server?

opal plank
#

no, its detritus's support server

#

which is 100x better than d.js

#

its a pure ts library

river panther
#

oh

opal plank
#

another user was asking about it today iirc

river panther
#

why only 56 people use it?

opal plank
#

just click on the last link i posted

heady gazelle
#

eris >

opal plank
#

eris is trash compared to detritus

river panther
#

wot is wris?

#

eris*

opal plank
#

another js api wrapper for discord

heady gazelle
#

I’ve never heard of detritus

opal plank
#

then check it

#

[you'll be surprised

heady gazelle
#

is it newer?

opal plank
#

the quality is way above the other libs

#

i see you're on dapi

#

dunno if you noticed

#

its been an official lib for a while

river panther
#

is it similar to discord.js?

heady gazelle
#

oh I haven’t noticed

opal plank
#

similar? its a LOT better

river panther
opal plank
#

its very rare for me to praise something so much

#

not quite

#

its quite easy to port from discord.js

#

you know the whole command system you are forced to do with discord.js?

#

like, reading folders

#

mapping them

#

functions

#

checking

#

all that bs

#

well, check this out

river panther
#

hmm, lets see, i will make a private bot, so will use det stuff for that

river panther
opal plank
#

this is how you load all commands in detritus

#

one line

#

it scans subfolders

heady gazelle
#

that’s a lot more than eris’s options

opal plank
#

thats why i praise detritus so much

#

it has everything you want and more

heady gazelle
#

I don’t even like eris’s commandhandler

#

yeah

opal plank
#

and its all optional too

#

so you nitpick what you want

river panther
#

nitpick?

opal plank
#

wait until people realise RPC has been deprecated

#

yeah, you pick what you want

river panther
#

oh, ok o

river panther
opal plank
#

https://discord.com/developers/docs/rich-presence/how-to
The SDK that this documentation references, Discord-RPC, has been deprecated in favor of our new Discord GameSDK. Replacement functionality for the Rich Presence SDK can be found in the Activity Manager of that SDK. This documentation can be referenced for education but does not entirely reflect the new SDK.

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.

#

@river panther

river panther
#

oh

opal plank
#

the proper way is using SDK

olive spear
#

м

#

@Администратор @Модератор Кто хочет обмен скинами, ПИШИ В ЛС СКОРЕЕ!!!!!!!

opal plank
river panther
opal plank
#

VSC should be using SDK iirc

river panther
#

oh, ok ok, fine then

opal plank
#

they just didnt change the name

river panther
#

hmm

#

where can i get the docs for detritus?

opal plank
#

or

#

this is the author's bot

#

its full of good examples of what you should do

river panther
#

ngl, i hate the slash commands

opal plank
#

good for practices

river panther
#

they are too overrated

opal plank
#

slash commands are available for detritus but its never mentioned in the docs

river panther
#

breh, i use slash in djs

opal plank
#

since you have to implement them yourself

river panther
#

oh

opal plank
#

detritus exposes the api for user

#

so its basically the same you'd do in d.js

river panther
#

hmm

#

what all languages do you know?

opal plank
#

d.js does not support slash commands btw

#

coding or irl langs?

river panther
#

stable doesn't

#

coding

#

ofc

opal plank
#

bit of py, full js, full ts, a bit of c, and a bit of cpp since i used to work on ue4 quite a lot

river panther
#

ts

#

eee

#

isn't ts shit?

opal plank
#

ts is glorious

river panther
#

oh

#

=|

opal plank
#

let me get you the 100 seconds guide

lyric mountain
opal plank
opal plank
river panther
#

exdi

heady gazelle
#

typescript is also >

earnest phoenix
#

is this to much color?

opal plank
#

its an underrecognized lib that excells all others, i dont see a reason not to support them after they accomplished something this big

#

in almost every sense, its better than the other libs

river panther
#

why are there so many libraries?

opal plank
#

and im not jesting

opal plank
#

turns out shit 90% of the time

river panther
#

hmm

opal plank
#

barely functioning

#

for js theres only 3 you should use

#

discord.js, eris.js or detritus.js

#

i would recommend the latter by a whole mile

river panther
#

ok ok, i shall make my next bot in detritus

slender wagon
#

Why tho

river panther
#

this one is running good in djs

opal plank
#

and its not a d.js clusterfuck, so if you ask anything in their server they'll help you

#

the devs themselves are really active

river panther
river panther
opal plank
#

ram usage, clustering, command handling, command options, reloading, organized types, no lil shitty patches, no partials

#

its a good written lib

#

optional caching

#

tim legit had to go out of his way to make optional caching with d.js-light

#

cuz they dont provide support for custom caching

#

imagine forcing users to cache EVERYTHING

slender wagon
#

Oof

opal plank
#

those fucks have presences cached

#

and message edits

#

ALL OF THEM

river panther
#

yes

opal plank
#

every message you edit gets cached

#

EVERY

#

MESSAGE

#

EDIT

river panther
#

ik

opal plank
#

let that sink for a second

#

d.js is aimed for new devs

#

it wipes your ass for you

#

and poorly at that

earnest phoenix
#

is @river panther toxic?

tired panther
river panther
opal plank
#

in d.js?

#

its by defauklt

#

fuck they let messages limit at -1 by default

tired panther
opal plank
#

even though in the docs they say to not do it

#

you can check yourself

earnest phoenix
opal plank
#

look at this shit

river panther
opal plank
#

this is default

#

DEFAULT

tired panther
opal plank
#

they say DONT DO IT

#

and they DEFAULT TO IT

#

does that make any sense whatsoever?

river panther
#

just go in the node module and delete the piece of code which caches it

opal plank
#

imagine having to edit a lib's code

#

thats how idiotic it is

tired panther
opal plank
#

tim had to make d.js-light to allow custom caching

earnest phoenix
#

then it a module

opal plank
#

check ram usagve

#

SAME bot

#

no changes whatsoever

river panther
cinder patio
#

How many times are we going to have this conversation okeh

opal plank
#

djs-light allows you to customise the caching behaviour

earnest phoenix
river panther
opal plank
opal plank
tired panther
#

lol

sterile lantern
#

i changed the way i save stuff so now it saves like this

{"money":0,"fishing_pole":true,"thief_outfit":true,"premium":false,"laptop":false,"bank":11647}```

but im unsure on how to make this
```js
 let money = db.all().filter(data => data.ID.startsWith(`bank`)).sort((a, b) => b.data - a.data)```
it takes their `bank` value and sorts it from highest to lowest and makes a leaderboard
tired panther
sterile lantern
#

yes

#

it takes their bank value and sorts it from highest to lowest and makes a leaderboard

cinder patio
#

You need to use the money value in your sort function

#

you are trying to subtract an object from object rn

sterile lantern
#

this was from before

#

data.ID.startsWith

#

should i remove that

#

because data is just the user ID

#

unsure how to filter the money value though

wide wharf
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sterile lantern
#

?

#

i think ik what to do

#

db.all().filter(object => object.data.bank)

#

something like that

earnest phoenix
#

@opal plank I'm fighting with the basic setup of this. it uses transactions and idk shit about transactions lol

#

I'm thinking I commit the transaction every 5 seconds with whatever data its accumulated

opal plank
opal plank
#

transactions is just a pool basically

#

you queue queries

#

and once you finish, it does all of them at once

earnest phoenix
#

Yeah I know

#

I'm gonna go over it again cause I know where I messed up at

#

Yeah this is what using a prepared statement gets me.

#

or any statement for that matter.

misty sigil
#

ok

#

i'm gonna start on mine rn

earnest phoenix
#

yeah, clickhouse doens't support inserts outside of a transaction. kinda poopy

#

but we will cope

misty sigil
#

how often should i update my data

#

and how much data do i store

lyric mountain
#

1 - very often
2 - all of it

sterile lantern
#

um

#

so i did

#

db.fetch(${user.id}

#

and it returns object Object

#

nvm

#

ik what i did wrong

feral aspen
#

there is something() we use that adds commas in numbers like (1,000) instead of (1000)

#

What was it again?

#

like money.something()

misty sigil
#

update every ms

#

send all of my data

#

got it

sterile lantern
#
{
  money: 96,
  fishing_pole: true,
  thief_outfit: true,
  premium: false,
  laptop: true,
  bank: 8891,
  recentlyrobbed: 1615220083453,
  robcooldown: 1615220083505,
  daily: 1615220301676,
  job: 'Programmer',
  work: 1615220413978
}```

if i do console.log(all) that happens
#

but

#

i want it to send to a channel

#

i did message.channel.send(all)

tired panther
sterile lantern
#

ah

#

figured

pale vessel
#

your naming convention scares me

sterile lantern
#

y

#

whats wrong with it xd

pale vessel
#

why isn't it consistent wtf

tired panther
#

message.channel.send(all.toString())

feral aspen
#

fishing_pole: fishingPole

pale vessel
#

thief_outfit
recentlyrobbed

#

wtf

sterile lantern
#

item, cooldown

#

lmao

misty sigil
#

you've got fishing_pole and recentlyrobbed

#

wtf

#

no

#

i dont like

sterile lantern
#

?

#

wym

#

whats wrong with recentlyrobbed / fishing_pole

tired panther
pale vessel
#

why not fishing_pole and recently_robbed or fishingpole and recentlyrobbed (bad)

sterile lantern
#

oh

#

honestly

pale vessel
sterile lantern
#

idk why

#

but i could care less its just for friends

feral aspen
tired panther
#

Learn Basic Js blobfacepalm

onyx hare
#

.catch(error, console.log(error)) would this work to catch when a message doesnt send?

pale vessel
#

no

unreal estuary
#

no

pale vessel
#

.catch(error => console.log(error)) or catch(console.log)

tired panther
unreal estuary
#

^

pale vessel
#

or console.error

onyx hare
#

ah

slender wagon
#

is there a way i could fetch twitter posts with a certain word?

lyric mountain
#

that'd be finding a needle in the haystack

slender wagon
#

oh fr?

tired panther
slender wagon
#

so there is no way through that or something similar?

slender wagon
#

if i let the bot check a few communities and once there is a post there is a event that checks if the post contains a certain word

tired panther
slender wagon
#

oh aight

#

ty

slender wagon
#

is there a way i could improve the embed pic?

#
 .setThumbnail(message.guild.iconURL({ dynamic: true, size: 256}))
#

i tried resizing but it doesn't help

umbral zealot
#

You can't change the size and style of embeds

slender wagon
#

so it is going to look crappy like that?

umbral zealot
#

Well... yes.

slender wagon
#

f

tired panther
umbral zealot
#

I used to have the power to change it. I lost it.

unreal estuary
#

custom nicknames?

#

ohh the server nickname lol

tired panther
tired panther
solemn latch
#

was a bot reviewer

river panther
#

how do i put the link below the fields?

#

i put them as descriptions

solemn latch
#

description always goes on top

#

if you want, add a field at the bottom and put them there

river panther
#

ok, thank you

umbral zealot
tired panther
umbral zealot
#

I'm not going to keep answering that question forever. Use search.

tired panther
umbral zealot
#

It was a meme

slate laurel
#

Who has a bot that can change a server picture?

earnest phoenix
tired panther
slate laurel
earnest phoenix
slate laurel
#

Ez Pz

#

Ping with response

earnest phoenix
#

then dm me

bronze vault
#

anyone know by chnage why Codacy will not let me add this repo but it will let me add all my others?

uncut swallow
#

hello

#

lol

slate laurel
#

Who has a bot that can change a server picture?

smoky herald
#

any clues why might this be happening? X_kanekiThink

crimson vapor
#

caching

lyric mountain
#

clear the cache

lyric mountain
#

dot dot dot