#development

1 messages Β· Page 1236 of 1

earnest phoenix
#

give me a sec

fast loom
#

Sometimes hardcoding is the best option

#

or making your own library, so you can know what's going on

earnest phoenix
#

hardcoding would be the fastest

#

however a small api request doesn't hurt

#

make a GET request to that endpoint on your application boot

#

then store the response somewhere

eternal osprey
#

okay

earnest phoenix
#

even gives you the actual flag image url

#

actually

#

you don't even need to make a request

#

just save the json

#

lol

eternal osprey
#

hmm thanks, but i will first try myself.

#

i actually wanna learn some new things.

pale vessel
#

if you hardcode your locations, you might as well hardcode the flags too smart ```js
const locations = [
":flag_de: Berlin",
":flag_tr: Turkey",
":flag_eg: Egypt"
];

async function get_location_by_skytext(text) {
const result = await get_data(locations.map(x => x.split(": ")[1])); // Remove flags
// Contuue your function...
}

const locations_found = await get_location_by_skytext(skytext);
const embed = new Discord.MessageEmbed()

locations_found.slice(0, 10).map(location, i) => {
const flag = locations[i].split(": ")[0];
embed.addField(${flag} ${location.current.observationpoint}, **${location.location.lat}**+**, ${location.location.long}**);
embed.addField('map:' , http://www.google.com/maps/@${location.location.lat},${location.location.long},6z, true)
});```

eternal osprey
#

i know

earnest phoenix
#

that's effort

pale vessel
#

this is a bit of spoonfeed

#

yeah

eternal osprey
#

but ffs that takes too long

pale vessel
#

too bad

earnest phoenix
#

you can just use the json from restcountries and be done with it

pale vessel
#

assuming it returns the iso code from the payload then yeah

#

true

earnest phoenix
#

it returns alpha2 and alpha3

pale vessel
#

welp

eternal osprey
#

now i am going to figure out how to use this json database.

#

one second.

fast loom
#

xD

pale vessel
#

that's not database

misty sigil
fast loom
#

naah, better make a library yourself

pale vessel
#

he meant something else jeremy

fast loom
#

CountryName : CountryAbbreviation

#

and then use a simple method:
SetCountryFlag(countryName)
{
// Get the country abbreviation by it's name
// Create a string with ":flag_{countryAbbreviation}"
// return the flag
}

#

Ez Pez

earnest phoenix
fast loom
earnest phoenix
#

Showcasing only 5, find them by the one you like

eternal osprey
#

πŸ‡¦πŸ‡·

earnest phoenix
#

for production use you're better off using the json file though

#

less expensive than an api request

eternal osprey
#

πŸ‡©πŸ‡ͺ

#

voltrex

#

i have no clue what you have done there

#

all the tips

#

i still can't figure my mess out

#

πŸ‡©πŸ‡ͺ

earnest phoenix
#

require the json file

#

treat it like an array

eternal osprey
#

i do have the all.json

earnest phoenix
#

yes, now require it in your code

eternal osprey
#

okay

earnest phoenix
#

the variable the require is in is now the json array

#

a parsed one

#

treat it like any normal array

#

to get the name of the countries, .map() by the name property

#

to get the ISOs map by the alpha2Code property

eternal osprey
#

how do i convert the name of a country to a discord emoji flag

earnest phoenix
#

:flag_isocode:

#

to get the flag emojis you can straight up map the array by that

eternal osprey
#

owh okay

earnest phoenix
#

there's multiple approaches to this

#

do whatever

pale vessel
#

it returns alpha2 and alpha3
@earnest phoenix where? can't find it in the api (the weather-js module)

eternal osprey
#

i am just going to hardcode it.

pale vessel
#

oh nm you meant the restcountries api, ohterwise he could've just used the code

#

his locations are inconsistent, sometimes he uses a country and sometimes a capital

eternal osprey
#

yeah i will give up on this concept

earnest phoenix
#

πŸ€” it's like 5 minutes of work

opal plank
#

thats not the first time they've given up upon facing a bump

misty sigil
#

πŸ€” it's like 5 minutes of work
@earnest phoenix its a whitename Thonk

#

thats not the first time they've given up upon facing a bump
@opal plank perseverance 0

opal plank
#

big shame

#

shame stare

misty sigil
#

if i were to give up upon facing a bump my bot wouldnt even have commands

opal plank
#

i remember first time i tried my bot

#

dumbass put the token inside the client login without quotation marks and got furious cuz it wasnt working

misty sigil
earnest phoenix
frozen crest
summer acorn
#

I am reading the InfluxDB docs, but I don't get what the tags property is when constructing the client and writing data. In the docs, they use host when constructing the client and put in a example url when writing. Like

tags: [
'host'
]
// ...
tags: { host: 'box1.example.com' }
#

What is the tags property for

opal plank
#

Thats what fun about coding. Its the journey that matters. I fully enjoy all the memorable moments from when i've encounted bumps and overcame them, including

The 13 broken keyboards
The $383.95 bill of headache/painkiller meds
The 2 shattered monitors
The 2 splatted mouses
The countless headaches and fist pain from punching everything

Coding is fun firefine

misty sigil
#

yes

earnest phoenix
#

sounds like you should invest into anger management

misty sigil
#

also yes

pale vessel
#

how

opal plank
#

there isnt saving grace when it comes to bugs

#

you fix one, 3 other appears

#

its like fighting a necromancer. The more you kill,the more ammo your enemy has

eternal osprey
#

erwin

#

please do not take conclusions too fast

#

i have been at thisflag problem for 2 hours now

#

and you call it a littl 'bumb'

#

maybe for you

#

but for me it is a big deal.

opal plank
#

it is a little bump, thats the whole challenge of being a dev

#

see problem? fix

eternal osprey
#

i know

#

i am trying

opal plank
#

even if you find a dead end,step back and take a different approach

eternal osprey
#

i know

#

but at some point

#

(when you have been trying to solve this fucking shit for like 2+ hours)

#

you are just tired and sick of it.

pale vessel
#

even if you find a dead end,step back and take a different approach
feelsstrongman

opal plank
#

2+ hours is nothing

cinder patio
#

take a break

opal plank
#

ive spent 5 days looking at how to do pagination when i started

eternal osprey
#

how old are you

opal plank
#

and i've known people who spent far more time looking into issues much more complicated than that

#

im 22 iirc

eternal osprey
#

oki

#

basically

#

i have tried everything by now

#

the all.json file

#

and treating it like an array

#

well it did result in nothing as i didn;t know how to proceed further

opal plank
#

what exactly are you doing? gimme a quiick tldr

eternal osprey
#

i also tried hardcoding it.

#

well i gave up as it was giving errors like hell

#

i am trying to get a country flag before a country name

#

let me get a ss

#

wait

opal plank
#

aight

pale vessel
#

im 22 iirc
@opal plank what the fuck

eternal osprey
pale vessel
#

how can you forget

opal plank
#

i stopped counting after 18

#

jan 98, do the math

pale vessel
#

no

#

i will not

opal plank
#

@eternal osprey do you know all the possible countries returned by that query?

pale vessel
#

he hardcoded them

eternal osprey
#

i do have made a list of countries, yes

opal plank
#

so he does know all of them

#

good

#

so you wont need fuse for this case

pale vessel
#

they're sometimes capitals

opal plank
#

then make a json

eternal osprey
#

or places.

opal plank
#

(which i assume you already has(

pale vessel
#

i spoonfed you the code though

eternal osprey
#

yeah but i tried doing it myself

pale vessel
#

o

#

that's good

eternal osprey
#

lets just say it didn't work, and i want to learn from it.

#

not just copy and pasting.

#
const locations = [
  ":flag_de: Berlin",
  ":flag_tr: Turkey",
  ":flag_eg: Egypt"
];

async function get_location_by_skytext(text) {
    const result = await get_data(locations.map(x => x.split(": ")[1])); // Remove flags
    // Contuue your function...
}

const locations_found =  await get_location_by_skytext(skytext);
const embed = new Discord.MessageEmbed()

locations_found.slice(0, 10).map(location, i) => {
    const flag = locations[i].split(": ")[0];
    embed.addField(`${flag} ${location.current.observationpoint}`, `**${location.location.lat}**`+`**, ${location.location.long}**`);
    embed.addField('map:' , `http://www.google.com/maps/@${location.location.lat},${location.location.long},6z`, true)
});``` this was the ciode right?
pale vessel
#

the one i gave you works assuming the promise.all does everything in order

#

which it should, it's async

opal plank
#
brazil: :flag_br: ,
united_states: :flag_us:,
//etc
}```


embed => name + flags['name']

thats literally it
pale vessel
#

yeah

eternal osprey
#

but i am using an weather-js package

opal plank
#

unrelated

eternal osprey
#

wouldn't it search on flag:br

#

as it is taking the whole line

opal plank
#

or map them by what you search

eternal osprey
#

and earching/

opal plank
#

if you searching by brazil map it brazil

#

if you searching for BR, use BR

#

use the same name on the property as what you're querrying

eternal osprey
#

should i create a new list?

pale vessel
#

nah

eternal osprey
#

or just add the flags onto my already exsting

pale vessel
#

yes

opal plank
#

instead of array use an object(json)

#

you know all the values

#

object should be better for this case

#

rather than checking with include() orsomething

#

you can simply do if(flags['country']) => run code

eternal osprey
#
{
brazil: :flag_br: ,
united_states: :flag_us:,
//etc
}``` this is already tested by me
opal plank
#

if you really need to check

eternal osprey
#

it did nothing

opal plank
#

it does

eternal osprey
#

it does not

opal plank
#

im literally doing that for mytimeout

eternal osprey
#

i have literally done it for this bot

#

but nothing happened

opal plank
#

you clearly doing something wrong

eternal osprey
#

πŸ‡¦πŸ‡«

opal plank
#

i have the same arrangement as i told you

pale vessel
#

why not just arrays

opal plank
#

and it works just fine

#

you know the size of the object

digital ibex
#

lmao

opal plank
#

unless its enum it makes it hard to get specific values in order

pale vessel
#

oh

eternal osprey
#

but i have a list of like 300 places or so

pale vessel
#

wait

eternal osprey
#

how the fuck am i going to do that

pale vessel
#

explain to me why it's an object

eternal osprey
#

that will take decades

opal plank
#

hardcode all of them then

#

though

#

you dont have that many flgas

#

flags*

earnest phoenix
#

or just

#

use the json

opal plank
#

so why not only map the ones that has flags and not add the oters

#

thats what im sugggesting cry

earnest phoenix
#

you don't have to manually map it at all

opal plank
#

if he didnt know the shape of the results i'd recommend him to use fuzzy match

earnest phoenix
#

it's all in the json from restcountries

pale vessel
#

erwin why is that countdown.json an object

opal plank
#

ive told you, i need it enum

obtuse jolt
pale vessel
#

cri

opal plank
#

objects are better for this

#

also json when imported is an object in js

#

if that was your question

split hazel
#

OFF TOPIC SMH

obtuse jolt
#

smh my head

opal plank
#

πŸ‘€

pale vessel
#

nah i meant that i would have make it an array and access it by index

opal plank
#

unless its hardcoded, like i said, it would be annoying without enum

pale vessel
#

ye

opal plank
#

and enumerating it would be more painful

#

generating this is somewhat easy

#

making the gifs on the other hand tho....

eternal osprey
#

jeej

#

i am on 1/16 of my code

opal plank
#

prob bad to be testing here dude

eternal osprey
#

i am deleteing the messages

opal plank
#

either way

eternal osprey
#

so i don't think it bothers anyone

opal plank
#

not a testing channel

#

gets notifcations unecessarily

vague wigeon
#

Is scheduling a good solution for cooldown problem?

opal plank
#

what scheduling?

vague wigeon
#

Settimeout

opal plank
#

cooldown for what exactly?

earnest phoenix
vague wigeon
#

This is the amount of time player has to wait to get command again

earnest phoenix
#

+- 10s for screenshotting

#

this is also c# which means it's typed

vague wigeon
#

Sr my bad English

opal plank
#

then map it and run with timestamps

#

if (now < timestamp) return 'cooldown active'

#

ads

misty sigil
#

Any one need vypr vpn dm me
@earnest phoenix we dont want ur bloody vpn (is this considered ads @split hazel?)

pale vessel
#

hot bot name

opal plank
#

been reading so much re:zero, i read his name as Subaru

split hazel
#

bue bue

vague wigeon
#

I read in some places, settimeout didn't affect performance

opal plank
#

optimized =/= affecting permformance

#

ish

earnest phoenix
#

every single thing you do affects performance

opal plank
#

lemme explain a bit better

earnest phoenix
#

some on a larger scale, some on a smaller scale

opal plank
#

that ^^

#

the amount of iterations you need to be doing to affect something needs to be really large

#

even though its unlikely that you can achieve that much in discord,its still good practice to optimize your code

#

take a look at this for example, me making my point that embed builders are bad

#

235 ms. thats 1 million times ran, and that was under 235 ms.You need large scale to make dents

#

doesnt necessarily excuse bad code/unoptimized code

vague wigeon
#

var embed so good, it's not fastest but it's easy for maintenance

opal plank
#

no need for var if you arent changing the embed

#

if its a constant, send it directly

pale vessel
#

πŸ‘

earnest phoenix
#

Is getting ratelimited often an issue?

pale vessel
#

yes

earnest phoenix
pure lion
#

πŸ”­

earnest phoenix
#

can you help

#

yes
@pale vessel i will be banned?

#

Because of hitting rate limit

#

A lot of times

pale vessel
#

yes, your bot will be detected by the spam detection and you'll have to appeal

earnest phoenix
#

can you help plssss

#

no one really helps

quartz kindle
#

have you tried googling the error?

still merlin
#

I'm looking at using auth2 with my bot but I'm wondering if I need a file or use a variable to store my client secret? (auth.json file) or maybe something like

 "client_id": "client id",
   "client_secret": "client secret",
   " grant_type": "authorization_code",
   "redirect_uri": "redirect uri",
  " scope": "scopes"```
misty sigil
#

if u want

#

isnt required tho

opal plank
#

@still merlin need? no.shoud? absolutely

#

hardcoding sensitive info on your bot always leads to issues

jovial nexus
#

How can i do a command for restarting all the shards of my bot?

quartz kindle
#

if you have a process manager, just kill the process

earnest phoenix
#

im pretty new to all of this but i created a music bot with discord.js and i have no idea how to add a custom status

pure lion
#

@earnest phoenix docs

#

Look under client

earnest phoenix
#

ohk

#

client.user.setStatus({activity: {name: "some status", type: "PLAYING/STREAMING/LISTENING/WATCHING", url: "someTwitchURL"},afk:false,status:"online/idle/invisible/dnd"}) @earnest phoenix

#

thank you :)

#

that is the most data you can provide to a normal presence

#

yeah im having a look right now

earnest phoenix
#

ok so im not the smartest person but like i added the code in and everything and i just added const client = new Discord.Client(); and its saying discord is not defined

misty sigil
#

you need to

earnest phoenix
#

i need to

misty sigil
#

define discord

earnest phoenix
#

wow

misty sigil
#

let me see your code

earnest phoenix
#

ok

#

how do you want me to show you?

misty sigil
#

put it in a bin

earnest phoenix
misty sigil
#

Ok, it's just Client, not Discord.Client

earnest phoenix
#

ohh

jovial nexus
#

How can i do a command for disconecting only one of my bot shards?

quartz kindle
#

how are you sharding?

#

discord.js sharding manager?

small zenith
#

How to make bot create emoji?

#

in d.js

supple oriole
small zenith
#

create not use

supple oriole
#

:0

#

Example?

small zenith
#
message.guild.createEmoji("Name", "URL")``` Like this?
#

I dont think so

tight plinth
#

is there anything like visual studio live share but less laggy?

misty sigil
#

message.guild.emojis.create("url", "name") iirc

tight plinth
#

and buggy

jolly wave
#

thr login don't bother

small zenith
#

Ok thanks

supple oriole
#

.

#

Why share ur code

#

Out loud

#

Ima use it now

jolly wave
#

oh you readed my mind and know the code so u can help me?

supple oriole
#

Ima see

tight plinth
#

-dotpost @supple oriole

supple oriole
#

Is everything installed?@jolly wave

jolly wave
#

yes

supple oriole
#

Like node etc etc

#

Um Ima see

jolly wave
#

ytdl,discord.js,opusscript

#

ffmpeg-static too

supple oriole
#

I can't solve it.

#

Sorry.

jolly wave
#

oof

supple oriole
drowsy skiff
#
var data = "token=aaaaaac";

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function() {
  if(this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://currencyapi.heppcat.cf/apiendpoint");
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

xhr.send(data);``` this only works for post when I change the method on server and in this code to get it does not work
earnest phoenix
#

saddek do you have an error you can poat

#

post

jolly wave
#

yes

digital ibex
#

@drowsy skiff what do you mean by β€œdoes not work”?

earnest phoenix
#

hmm thats aws error?..i dont know that

jolly wave
#

did u read my script?

drowsy skiff
#

@drowsy skiff what do you mean by β€œdoes not work”?
@digital ibex when I change it to get its like the token does not go through but on post it works fine

earnest phoenix
#

yea looked good...unless for some reason you need to move login to top of file?..but doubt it

#

or...discord.js wasnt installed on aws?

digital ibex
#

idk much about ajax, but its used for sending data to the backend, so why are you even trying to use the get method?

earnest phoenix
#

i really dont know..looks good

digital ibex
#

you’ll need to have a backend for that, if u dont already

drowsy skiff
#

idk much about ajax, but its used for sending data to the backend, so why are you even trying to use the get method?
@digital ibex I am making an api and I would rather use get to get the data then post

pale vessel
#

oh lord

#

why did you use xhr

#

why

digital ibex
#

thats frontend

pale vessel
#

require() works?

#

o

digital ibex
#

and ajax is sending data to the backend, which is what ur doing

#

but not rly

drowsy skiff
#

why did you use xhr
@pale vessel I use express for the server

pale vessel
#

then why use xhr

cinder patio
#

You can use the fetch function

digital ibex
#

the stuff u r doing there, do that in the backend

cinder patio
#

It's 10 times simpler

jovial nexus
#

discord.js sharding manager?
@quartz kindle yes

#

sorry i was bussy

drowsy skiff
#

the stuff u r doing there, do that in the backend
@digital ibex I need to pass a token from the req to the server

digital ibex
#

then u need to use post, not get

quartz kindle
#

@jovial nexus you can use process.exit() on that specific shard, and the manager will restart it automatically

sharp thicket
#

Hey so im trying to buy a vps for my bot but i don’t know how to configure it like uh do i need a domain?

jovial nexus
#

ok thx

quartz kindle
#

no you dont need a domain

jovial nexus
#

and if i want to choose the shard yo restart?

#

like /restart 2

quartz kindle
#

hostname is basically the machine's name

#

you can set it as whatever

sharp thicket
#

So like i could just spam

quartz kindle
#

@jovial nexus use broadcastEval to find the right shard

earnest phoenix
#

I am available for any questions in dm....node, discord.js, discord.ts

sharp thicket
#

So like i could just like spam
@sharp thicket

#

Like uh

digital ibex
#

discord.ts?

earnest phoenix
#

yup

sharp thicket
earnest phoenix
#

thats what i use maibly

sharp thicket
#

Wtf is that

digital ibex
#

thats still in beta

#

its not ready for production

sharp thicket
#

Huh

jovial nexus
#

how can i get the shartReconecting event?

earnest phoenix
#

does that mean no one would use it or have a question

quartz kindle
#

is discord.ts even a thing?

earnest phoenix
#

yes its awesome

jagged condor
#

Hey all

quartz kindle
#

link?

digital ibex
#

uh

earnest phoenix
#

i love it

quartz kindle
#

ah so its basically just discord.js

earnest phoenix
#

yes

honest perch
#

its much much lighter

digital ibex
#

oh well i was thinking of a different one

quartz kindle
#

deno lmao

quartz kindle
#

3.5gb?

honest perch
#

wait

digital ibex
#

nice lol

quartz kindle
#

ah you're showing deno using 350mb ram

quartz kindle
#

yup, classic discord.js

#

lmfao

digital ibex
#

is that 3.69gb ram?

misty sigil
#

use d.js-light if you can

digital ibex
#

but thats not using node

honest perch
#
Test Description
~2 million members were fetched and stored with 7k guilds and tons of channels. Same bot/Same token. Minimal ping command example on using both libs.

Using the most popular Node.JS lib (Discord.JS):
After 10 minutes it was at around 900+MB. SS below for exact details. https://media.discordapp.net/attachments/381870553235193857/733469128639250562/unknown.png

Using my Deno Discord Lib (Discordeno):
Fit in 150MB after 10 minutes. I showed it to some people and they could not believe that this was even possible for JS to be this small so i ran it again as per their instructions to rule out any flukes. The second attempt was at 356MB(note this was going down even more later), but the SS shows the massive difference already.

First: https://media.discordapp.net/attachments/704351191538335896/733435402207100978/unknown.png
Second: https://media.discordapp.net/attachments/381870553235193857/733473380208214057/unknown.png (It was dropping more at the time i shut the bot off it was under 250MB. I'm sure if i left it on more it would decreased further)

At first people thought I was somehow abusing Swap but as you can see in the SS the Swp on the deno lib was even lower than the Node.js lib. And tbh IDK what Swap is let alone how to abuse it.
#

ill just post it all

earnest phoenix
#

i dont know what swap is either..i used it on $5 droplet to install angularcli though and it worked

quartz kindle
#

does deno not have process.memoryUsage()?

digital ibex
#

a bot with like 11k servers and 2m+ members, storing all uses like 500mb ram

#

with eris

#

so blame that on discord.js

pale vessel
#

d.js-light can take lower than eris tho

misty sigil
#

it does (depending on cache settings)

earnest phoenix
#

at this point is there a good reason to make my own music bot...besides to learn

pale vessel
#

no

digital ibex
#

true, but yano, i dont own it or anything

drowsy skiff
misty sigil
#

discord.js-light better

quartz kindle
#

lmfao

digital ibex
#

discord.js is shit

misty sigil
#

^ it is

quartz kindle
#

its not fair to compare cache vs non-cache tho

misty sigil
#

yea

earnest phoenix
#

i think im gonna change my bot prefix...im afraid it will get denied

misty sigil
#

it wont be denied over a prefix

quartz kindle
#

is discord deno can do that with all the regular caching, its quite impressive

earnest phoenix
#

ok cool

misty sigil
#

unless its something terribly offensive

quartz kindle
#

but being able to disable caches is very important for bigger bots

earnest phoenix
#

nah just common

quartz kindle
earnest phoenix
digital ibex
#

why do people still use discord.js

#

like fr

#

its bad

earnest phoenix
#

whats a better js option

pale vessel
#

it's not bad

quartz kindle
#

because the community is huge

pale vessel
#

it's just the caching

digital ibex
#

i think eris, but

#

the code style (in my opinion) is the bad thing about it

#

you cant really change it if u want

#

ur just like

#

stuck with it

quartz kindle
#

discord.js and eris are popular because they are built for general purpose, they have to support everything and anything

#

if you want to scale, you need to start being more purpose-specific

#

which discord.js and eris dont really support, therefore they feel bloated

#

there are quite a few options to chose from, djs-light, kalsa core, detritus

digital ibex
#

if a bot i make somehow blows up, i’ll just fork eris to suit my needs

quartz kindle
#

and possibly more

earnest phoenix
#

what does eris do better than discord.js ive never used it

digital ibex
#

depends on what u need it for

quartz kindle
#

eris is a bit dumbed down, it has less features, and dont use collections everywhere

#

arrays and objects are more memory efficient than collections

earnest phoenix
#

ahh

digital ibex
#

i like to think of it as u actually do stuff urself but thats just me

quartz kindle
#

yes

#

but like djs, it lacks support for disabling caches

#

so it has most of the same problems djs has at scale

pale vessel
#

eris-light when

quartz kindle
#

xD

pale vessel
#

seriously, that doesn't sound like a bad idea

misty sigil
#

eris-light soontm

pale vessel
#

i'd use it

earnest phoenix
#

i was gonna shard but my bot is pretty niche...the site the bot is related to only has 250 users at a time on a good day...so maybe 3 of them will use it

quartz kindle
#

i just use internal sharding

earnest phoenix
#

i thought about it...but traditional sharding is only a few more lines

pale vessel
earnest phoenix
#

if i remember terms correctly

quartz kindle
#

a few more lines, an extra file, requires using ipc and broadcastEval and other complications xD

#

but its good if you have multiple cpu cores

pale vessel
#

thank you tim

#

it's even better since i edited the PresenceUpdate event under client.actions to only cache required presence (which is spotify and osu activities only)

quartz kindle
#

thats still a lot, do you cache channels?

pale vessel
#

yeah

quartz kindle
#

ah ok, pretty cool tho :3

pale vessel
#

i don't cache members though

misty sigil
#

i cache channels guilds overwrites and roles (iirc)

#

146MB rss

#

if i were to use d.js it'd be around 300 i'd bet

pale vessel
#

~135 here

misty sigil
#

d.js light is cool

pale vessel
#

indeed

quartz kindle
#

:3

#

support me on patreon pls

pale vessel
#

i would if i could πŸ˜”

cloud pebble
#

is there any quick way to allow both with '!' prefix and without to work? e.g.
b!command and bcommand should both work but of course if you set the prefix as b, it reads the command as !command

fluid basin
#

@pale vessel we just need the first 16 digits of your credit card, the expiry date and the last 3 digits at the back of your card

#

@cloud pebble use if statement?

cloud pebble
pale vessel
#

is that the april i know

fluid basin
#

I don't know how you check the prefix

still merlin
#

Is there a way to shut your bot down without manually doing it? I'm making a rateLimit event, and I'm not sure how id turn it off. here's what im using, I'd test it but if it doesn't work I don't want a ip ban-

client.on('rateLimit' () => {
client.destroy();
})
fluid basin
#

but you could just compare and see if its one of the either

cloud pebble
#

i use a function to return the prefix

pale vessel
#

nope it's not πŸ˜”

fluid basin
#

@still merlin uh why would you want to do that

#

I don't see a reason to

sudden geyser
#

@still merlin it's not uncommon to hit the rate limit.

cloud pebble
#

you've given me an idea though πŸ€”

sudden geyser
#

Using .destroy() is how you destroy the client, but for the most part it's unnecessary

fluid basin
#

@cloud pebble if you want to use a function, the function should tell whether it is a command or not by checking the prefix

#

instead of returning the prefix

still merlin
#

Alright thanks

fluid basin
#

it's not uncommon to hit the rate limit.
@sudden geyser if thats the case your bot has bigger problems

sudden geyser
#

I did not mean it like that, but the rateLimit event is not what they should be listening for to destroy the client.

still merlin
#

What should I listen for then?

misty sigil
#

is that djs?

still merlin
#

I accidently tabbed across rateLimit five minutes ago making a ready event, No clue what the rateLimit event does, I just guessed πŸ€·β€β™€οΈ

misty sigil
#

djs handles ratelimits itself generally

sudden geyser
#

Turn it off on request or something, like a command you can only run. Like Methuew said Discord.js handles rate limits for you.

cloud pebble
#

bot = commands.Bot(command_prefix=determine_prefix)

with determine_prefix being:

def determine_prefix(discord_bot, message):
    guild = message.guild
    # Only allow custom prefixes in guild
    if guild:
        guild_id = str(message.guild.id)
        try:
            prefixes = DB_GUILD_DATA.find_one({'_id': guild_id})["prefixes"]
        except TypeError:
            prefixes = default_prefixes
    else:
        return default_prefixes

    return commands.when_mentioned_or(*prefixes)(discord_bot, message)```
#

are you sure it's not returning the prefix?

#

ok it's a dirty workaround but here's how i got it to work dogekek

@bot.event
async def on_message(message):
    content = message.content
    if message.content.lower().startswith('b!'):
        message.content = content.replace('!', '', 1)
    await bot.process_commands(message)
drifting wedge
#
discord.ext.commands.errors.MissingRequiredArgument: member is a required argument that is missing.```
#

wut doesthis mean

#

i knoe member is missing

#

but basicly i want to make a thing where member id is the mentioned user, and if no user is mentioned, go to message author id

#

python

earnest phoenix
#
bot.on("ready", async () => {
    console.log(`${bot.user.username} online lett ${bot.guilds.cache.size} szerveren!`);
    var interval = setInterval (function () {
      let fasz = 0;
      if (fasz === 0) {
          bot.user.setActivity(`${bot.guilds.cache.size} szerver | ${prefix}help`, {type: "PLAYING"});
          fasz = 1;
      }
      if (fasz === 1) {
        bot.user.setActivity(`${bot.users.cache.size} felhasznΓ‘lΓ³ | ${prefix}help`);
          fasz = 0;
      }
  }, 1 * 1000);
});
#

@modern sable you can help me? Here is the code

modern sable
#

setting the interval to 5000 should be enough

small zenith
#

1*1000 6_ThinkingHyper

#

that will be 1000 means 1 sec
and thats discord API Abuse Ig

misty sigil
#

that is api abuse

quartz kindle
#

add an else

#

otherwise it will do both on every iteration

slender thistle
#

but basicly i want to make a thing where member id is the mentioned user, and if no user is mentioned, go to message author id
@drifting wedge da bo doo

#

ba do beep

#

member=None

#

in the command, do if member is None: member = ctx.author

lime gorge
#

Hey guys, its it possible to make message links work in embeds title?
EG: setting this as the embed url will open the link in a browser on desktop Discord, but not on mobile where it will work as intended

misty sigil
#

not that id think of

#

just a quirk of discord ig

drifting wedge
#

in the command, do if member is None: member = ctx.author
@slender thistle yep im getting help in the py disocrd

#

ty

lime gorge
#

Yeah, the inconsistencies in embeds between desktop and mobile are killing me lol

opaque hawk
#

How would I make my bot DM someone when they get warned?

sudden geyser
#

What is match's default value, and can you show us the un-censored part.

opaque hawk
#

and the logs are above the if statement

drifting wedge
#

and i want to be able to select the channel for the logs
how can i do that?
i have the thing that writes the channel i want to mongo db
but im having diffiulty reading it
and displaying it
ping me

opaque hawk
#

I dont fully understand

earnest phoenix
#

Anyone know how to fix "AbortError: The user aborted a request." when uploading videos?

digital ibex
#

more context?

obtuse jolt
#

When I use this is comes back as positive even if it’s got the wrong caps is there something I’m doing wrong?

#

I want it to be case sensitive

sudden geyser
#

Zerls are you sure the if condition is actually returning true.

digital ibex
#

whats the problem, zerls?

obtuse jolt
#

@quartz kindle can you help me pls

#

You are good with this stuff

digital ibex
#

r u sure its false? console.log it

#

but thats not what is wrong, i assuming

#

is the issue on line 27 or have i got that wrong?

earnest phoenix
#

what is better, function keyword or arrow functions?

earnest phoenix
#

what is better, function keyword or arrow functions?
@earnest phoenix Depends on how you want it to look

digital ibex
#

hmm

earnest phoenix
#

function keyword looks uglier than the arrow function

#
function gay() {
return "Gay";
}```
```js
let gay = () => "Gay";```
opaque hawk
#

agreed

digital ibex
quartz kindle
#

for callbacks, function arguments and anonymous/lambda functions, arrows are better

#

for classes, prototypes, inheritance and functional programming, use function

digital ibex
#

oof i use arrow functions in classes

#

well, i recently started to

pale vessel
#

you can't use this in arrow functions right?

quartz kindle
#

i mean, depends on what you're doing inside the class, and ^

digital ibex
#

idk, this is the first time i realised they were different

#

i'll have to use the normal one instead

earnest phoenix
#

tbh the differences between arrow functions and normal functions don't really apply to my code
i never use this or

// this
class

or even

// this
new smth();
#

you can't use this in arrow functions right?
@pale vessel In which part of it? As the parameters or body of the arrow function

sullen frost
#

Music Bot error when i want to play something:

[VOICE_CONNECTION_TIMEOUT]: Connection not established within 15 seconds

im very bad in codng ._.

#

joins, and leaves directly

earnest phoenix
#

will message.mentions.users return undefined if there are no pinged users? discord.js btw

hazy sparrow
#

Can random-puppy get the title of a post ?

earnest phoenix
#

Can random-puppy get the title of a post ?
@hazy sparrow why are you using a package like that anyways

hazy sparrow
#

Because why not

earnest phoenix
#

using the reddit API straight is more flexible and better

#

will message.mentions.users return undefined if there are no pinged users? discord.js btw
@earnest phoenix It just returns an empty collection

#

uhh k

hazy sparrow
#

using the reddit API straight is more flexible and better
@earnest phoenix how do i download that?

pale vessel
#

@pale vessel In which part of it? As the parameters or body of the arrow function
@earnest phoenix body

earnest phoenix
#

so message.mentions.users.first() won't rthrow an error right?

pale vessel
#

nope

earnest phoenix
#

No

#

||kthnxbai||

hazy sparrow
#

Can random-puppy get the title of a post ?

pale vessel
#

no

#

i answered you already

#

use the reddit api

#

:)

hazy sparrow
#

oof, what about get?

earnest phoenix
pale vessel
#

use it in actual class

#

it can't get stuff in this

earnest phoenix
#

The classes this or the global this

pale vessel
#

global this?

#

i meant the class's

earnest phoenix
#

Every class has this for itself yea

hazy sparrow
#

use the reddit api
@pale vessel is there a "latest version" of it? My hosting thingy doesesnt require me to download it just put it in the package.json

quartz kindle
#

an arrow function bypasses this, so it looks for the parent this, defaulting to the global scope/window if not found

earnest phoenix
#

can i add a link to an embed that would be treated as a reply to bot? like if i gave a list of options...

#

can i add a link to an embed that would be treated as a reply to bot? like if i gave a list of options...
@earnest phoenix what are you trying to say? waitWhatSpinwaitWhatSpinwaitWhatSpinwaitWhatSpinwaitWhatSpin

#

i like flexing mah nitro

hazy sparrow
#

can i add a link to an embed that would be treated as a reply to bot? like if i gave a list of options...
@xsfg5#2269 explain please

earnest phoenix
#

Nitro is a bruh moment

hazy sparrow
#

Bruh did he leave

earnest phoenix
#

Paying to use emojis spanishkek

hazy sparrow
#

wait no nvm

earnest phoenix
#

maybe

#

Paying to use emojis dogekek
@earnest phoenix only way discord can get revenue without fuckign bitches aka users complaining about ads

hazy sparrow
#

Discord themselves hate ads @earnest phoenix

earnest phoenix
#

like say a user types -search terms here....i reply with a list of options...they click an option and it triggers a command to bot

hazy sparrow
#

What do you mean "click option"? Do you mean reactions?

earnest phoenix
#

if reaction means responding to bot yes

#

grabs discord.js docs link

hazy sparrow
#

if reaction means responding to bot yes
@earnest phoenix what

sudden geyser
#

It sounds like you're looking for a message/reaction collector.

earnest phoenix
#

one sec

#

that's the wrong link

sudden geyser
#

And when we say reaction we mean reacting to a message with an emote

hazy sparrow
#

@earnest phoenix grab the guide link aswell

earnest phoenix
#

i dont understand how none of you understand what i mean

faint prism
#

@faint prism how would u go about doing it? theres just gonna be 1 ELO check and if it doesnt find someone in a certain amount of time it just picks 2 people randomly
@earnest phoenix I'd make a while loop with an int for the range that expands if no matches are found

earnest phoenix
#

Are you trying to say reactions

#

Tf

#

im a better dev than most of you im sure i dont need doc links

#

im a better dev than most of you im sure i dont need doc links
@earnest phoenix fuck off

hazy sparrow
#

Yea then why are you asking us go ask someone better than you smh

earnest phoenix
#

im a better dev than most of you im sure i dont need doc links
@earnest phoenix Then why are you asking here if you're better

#

yeah

slender thistle
#

Keep it civil y'all

earnest phoenix
#

;-;
||at least ;-; isn't a dotpost||

#

its cool my question was obviously too advanced for you hobbyist

pale vessel
quartz kindle
#

discord doesnt not have a user interface to interact with bots, nor clickable elements. the only possible interaction with bots at the moment is through message reactions

earnest phoenix
#

@slender thistle this guy thinks he's better than us

#

ty tim

sudden geyser
hazy sparrow
#

its cool my question was obviously too advanced for you hobbyist
@earnest phoenix yea dont ask us then

earnest phoenix
#

@sudden geyser stop giving him help he indirectly said no i don't need help bitches

slender thistle
#

I said keep it civil

sudden geyser
#

That's what this channel is for?

earnest phoenix
#

lol you guys are silly

quartz kindle
#

however, discord plans to implement such advanced bot features in the future

earnest phoenix
#

nice

#

however, discord plans to implement such advanced bot features in the future
@quartz kindle POGGERS

slender thistle
#

Telegram v2 inb4 πŸ˜‚

earnest phoenix
#

why don't i read news

hazy sparrow
#

@earnest phoenix you got your answer then just go why are you still bothering us

earnest phoenix
#

yeah

#

lets compare bot code @earnest phoenix

#

why are you disturbing us if we're worse than you

#

well see whos a newb

pale vessel
hazy sparrow
#

well see whos a newb
@earnest phoenix sure, lets compare tokens, you go first

slender thistle
#

If anyone keeps this shit up, I'll start handing out mutes

earnest phoenix
#

ok

#

Block and move on
quoting shivaco from the last shenanigan

hazy sparrow
#

^

earnest phoenix
#

I first knew what he was trying to say, clickable links to interact with bots, but as i knew its not a possible thing, reaction collectors come to mind

#

i ask a question and get thrown docs like im an idiot

hazy sparrow
#

Please stop now

earnest phoenix
#

yeah

pale vessel
#

you could've asked your question more thoroughly, like "i've read the docs but i don't understand how i can do x"

hazy sparrow
#

You didnt specify that you weren't an idiot the time you asked for help

earnest phoenix
#

we're not minimodding we're literally triggered

quartz kindle
#

for example, this was a proof of concept released earlier this year about the future of discord bots, however there hasnt been any news since. but it gives you an idea of what discord is possibly planning

earnest phoenix
#

ok now let's seriously stop to be safe from mutes mmLol

slender thistle
#

Honestly, custom buttons on Discord would be nice, imo. πŸ€”

earnest phoenix
#

youre the ones that keep going...

slender thistle
#

I wonder what the ratelimits will be for them

cinder patio
#

That would really make my bots so much better, I can't wait

earnest phoenix
#

but it would have lots of weird shit

hazy sparrow
#

@earnest phoenix honestly if you think about it if you'd just stop replying to us we'd stop too

cinder patio
#

The dropdown button will be of good use

slender thistle
#

How about I just

earnest phoenix
#

or you could stop replying to me

#

Can't wait to see how broken those button interaction with bots would be

#

Or just op

#

The dropdown button will be of good use
@cinder patio yeah cool

quartz kindle
#

it will make my awesome reaction menu obsolete tho lmao

earnest phoenix
#

WE NEED OPTIMIZED EMBEDS ON MOBILE MORE THAN CLICKABLE BUTTONS
REACT WITH verified IF YOU AGREE

hazy sparrow
#

^

earnest phoenix
#

i came to ask a question and got shit on

#

Mobile embeds are retarded

#

whatever

#

huge UI changes are coming soon

quartz kindle
#

how soon?

earnest phoenix
#

69 years later

#

bots will be able to hook into slash commands, create interactive elements (polls) etc.

discord gave no ETA but it's been confirmed that they're working on it

quartz kindle
#

still nothing new then

earnest phoenix
#

this may or may not be exclusive to verified bots

earnest phoenix
#

bots will be able to hook into slash commands, create interactive elements (polls) etc.

discord gave no ETA but it's been confirmed that they're working on it
@earnest phoenix you know discord is a big lie right?

acoustic veldt
#

HeyπŸ€— I don't know English so I'll just say hello πŸ€—

earnest phoenix
#

Hello!

#

yeah what tim linked, i didnt scroll up

#

Welcome to hell of devs

slender thistle
earnest phoenix
#

Do you need help with bot development? Cuz this is the channel for that

#

Casual chatting goes to #development
you edited that so fast i wanted to take a screenshot for a meme sad

#

bots will be able to hook into slash commands, create interactive elements (polls) etc.

discord gave no ETA but it's been confirmed that they're working on it
@earnest phoenix Discord says like they ever gonna implement that, man if they do that, can't wait to see how broken they will be on mobile

#

Everything is still broken in mobile LULW

#

They might just abandon discord mobile

#

lol most muted users here are on mobile and have to live with terrible embeds and they can't confess their problem because they're muted dogekek

slender thistle
#

VBA is such a pain in the ass

earnest phoenix
#

@quartz kindle can you blur an image before drawing it to canvas?

#

Tf is VBA

slender thistle
#

Visual Basic for Applications

earnest phoenix
#

Tf is VBA
@earnest phoenix vhen biscuits attac

#

ah yes

#

star if you noob (this is a strategy to tell people not to star your stuff so they intentionally star it)

#

development, more like general-3

slender thistle
#

I do love how the VBA editor straight up formats my code if the syntax is correct

sudden geyser
#

it's also a strategy at not getting on starboard

earnest phoenix
#

it's also a strategy at not getting on starboard
@sudden geyser you won't get psychology cuz ya nub
||this is a joke please don't kill me||

#

Imagine trying to get on starboard

slender thistle
#

Keep this channel on topic

earnest phoenix
#

ok

#

Then time to wait for another person to ask a question, imma move channels

#

can you blur images on the canvas? I want to add a background in my profile command but it blends with the text too much

sudden geyser
#

[Rust] I have this module: ```rust
mod tests {
use crate::search;

#[test]
fn one_result() { /* ... */ }

}```
The compiler complains I'm not using crate::search (I do use it in one_result, but excluded it here to make the code shorter). When I remove the line, it throws a compiler error (obviously). This is obviously only run in tests, so does anyone know why it wouldn't work // how to fix it.

Edit: I found my mistake: I didn't mark the module with the attribute #[cfg(test)]

earnest phoenix
#

throw the docs at me i don't care

#

You can use the shadowBlur on the 2d rendering context of canvas

#

link docs plz browser is too slow and CS_AlphabetFs up on google.com

pale vessel
#

shadowBlur is for shadows

#

you meant to say blur an image right?

earnest phoenix
#

shadowBlur is for shadows
@pale vessel lmfao wut

#

yeah

pale vessel
#

that's not possible

earnest phoenix
#

then i'll draw the image and blur the current canvas mmLol

pale vessel
#

there's ctx.filter in newer browsers but it's not supported in node-canvas

earnest phoenix
pale vessel
#

wait

#

nm

sterile lodge
#

how would i send a message with a webhook from a bot?

#

when i do hook.send("asgdiasghd") i get an error

slender thistle
#

What's the error?

sterile lodge
#

hook.send is not a function

#

anyone know how to fix this?

#

or how to send a message with a webhook?

earnest phoenix
#

What's the constructor of the webhook object?

#

@sterile lodge

#

WebhookClient?

sterile lodge
#

const hook = msg.channel.createWebhook(userToCopy.name, userToCopy.avatarURL())

#

@earnest phoenix

earnest phoenix
#

That returns a promise

#

Resolve it

#

async/await

sterile lodge
#

how

#

i have no idea how to do that lol

earnest phoenix
#
const hook = await msg.channel.createWebhook(userToCopy.name, userToCopy.avatarURL());```
#

you just got told how

#

that

sterile lodge
#

thx

#

now im getting DiscordAPIError: Invalid Form Body

#

name: this field is required

earnest phoenix
#

Can you show the entire error

#

Error message + stack trace

sterile lodge
#
Trace: unhandledRejection at: DiscordAPIError: Invalid Form Body
name: This field is required
    at RequestHandler.execute (/home/runner/Infinite-Bot/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at process.<anonymous> (/home/runner/Infinite-Bot/levelling.js:611:13)
    at process.emit (events.js:327:22)
    at process.EventEmitter.emit (domain.js:483:12)
    at processPromiseRejections (internal/process/promises.js:209:33)
    at processTicksAndRejections (internal/process/task_queues.js:98:32)```
#
async function sendWebhook(user, msg){

  const hook = await msg.channel.createWebhook(user.name, user.avatarURL())

  hook.send("a")                           
  hook.delete();
}```
digital seal
earnest phoenix
#

Lib?

sterile lodge
#

wdym

earnest phoenix
#

user.username

sterile lodge
#

now im getting this:

Trace: unhandledRejection at: DiscordAPIError: Unknown Webhook
    at RequestHandler.execute (/home/runner/Infinite-Bot/node_modules/discord.js/src/rest/RequestHandler.js:170:25)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at process.<anonymous> (/home/runner/Infinite-Bot/levelling.js:611:13)
    at process.emit (events.js:327:22)
    at process.EventEmitter.emit (domain.js:483:12)
    at processPromiseRejections (internal/process/promises.js:209:33)
    at processTicksAndRejections (internal/process/task_queues.js:98:32)```
digital seal
#

I want my bot to be in its state the number of servers it is in and the number of members Do you understand me?

earnest phoenix
#
async function sendWebhook(user, msg){

  const hook = await msg.channel.createWebhook(user.username, user.avatarURL());

  await hook.send("a");                
  hook.delete();
}```
#

@sterile lodge Here fixed it

sterile lodge
#

great thx

digital seal
#

let guilds = <Client>.guilds.cache.size

and just change the status with ${guilds}
@spare mirage Is this my response?

sterile lodge
#

works except for the avatar

earnest phoenix
#

Then

#
async function sendWebhook(user, msg){

  const hook = await msg.channel.createWebhook(user.username, user.displayAvatarURL({
size: 2048,
format: 'png'
}));

  await hook.send("a");                
  hook.delete();
}```
#

@sterile lodge Try

sterile lodge
#

you're amazing thx

digital seal
#

Anyone fluent in Arabic? To help me

sterile lodge
#

still doesn't work

dense nest
#

How would i relay how many guilds my bot is in to my website?

earnest phoenix
#

I want my bot to be in its state the number of servers it is in and the number of members Do you understand me?
@digital seal
Server count => <client>.guilds.cache.size
User count => <client>.users.cache.size

digital seal
#

Do I put them in my code? @earnest phoenix

earnest phoenix
#

How would i relay how many guilds my bot is in to my website?
@dense nest Construct an api that redirects to your website and do a post request to that api and use it

dense nest
#

Oh god

digital seal
#

I put this to what do I change it?

client.user.setActivity('-tax , -help', { type: 'PLAYING' })
})
@earnest phoenix

earnest phoenix
#

@digital seal just

<client>.user.setActivity(`Watching ${<client>.guilds.cache.size.toLocaleString()} servers with ${<client>.users.cache.size.toLocaleString()} users`, {
type: "WATCHING"
});```
#

So if it's 1000, it would be cast to 1,000

digital seal
#

lock error

#

ok 1s

worn badge
#

Hey anyone wanna help me on how to use custom emojis wobble on discord.js?

#

i thought just sending ![verified](https://cdn.discordapp.com/emojis/710970919736311942.webp?size=128 "verified") would work

#

oh can you link it please

digital seal
#

@earnest phoenix

#

@spare mirage

#

lock?

earnest phoenix
#

Just remove <>

sterile lodge
digital seal
#

I already removed it @earnest phoenix

#

oh

#

1s

earnest phoenix
#

Error says otherwise

worn badge
#

alright ty

digital seal
#

@earnest phoenix ?

#

@spare mirage lock

#

whats the error

#
client.user.setActivity(`Watching ${client.guilds.size.toLocaleString()} servers with ${client.users.size.toLocaleString()} users`, {
type: "WATCHING"
});```
pale vessel
#

lol watching watching x servers

earnest phoenix
#

@digital seal That's a syntax error, you might want to show your entire code for us to fix

#

PepeLaugh Is he gonna throw on the token

digital seal
#
client.user.setActivity(`Watching ${client.guilds.size.toLocaleString()} servers with ${client.users.size.toLocaleString()} users`, {
type: "WATCHING"
})```
@earnest phoenix
pale vessel
#

entire code moment

digital seal
#

this code

earnest phoenix
#

entire code moment
@pale vessel I'm dying

digital seal
#
client.user.setActivity(`Watching ${client.guilds.size.toLocaleString()} servers with ${client.users.size.toLocaleString()} users`, {
type: "WATCHING"
})```
@earnest phoenix

@digital seal .

earnest phoenix
#

Entire code moment

digital seal
#

Here's the code that you put in

pale vessel
#

the file mate

digital seal
#

Can you come privet what I send you? @earnest phoenix

earnest phoenix
#

I mean just send it in hastebin and show it

#

Remove the token

digital seal
#

@earnest phoenix

pale vessel
#

did he leak it?

digital seal
#

He said to me, send it all

#

Entire code moment
@earnest phoenix .

#

؟

earnest phoenix
#

Did you just send the token with it

pale vessel
#

did he? i need to know

digital seal
#

no

#

ya

worthy glacier
#

console.log returns the correct field from my mongodb doc but return doesnt. I think it has to do with async and callbacks?

pale vessel
#

ah nice

earnest phoenix
#

@digital seal I don't see whatever i told you to put in the code you sent

spice furnace
#

@digital seal

digital seal
#

I will not send the code

spice furnace
#

What is ur problem?

digital seal
#

I want my bot to be in its state the number of servers it is in and the number of members Do you understand me?

spice furnace
#

man

#

wait one m

earnest phoenix
#

Didn't i just spoon feed you the whole thing

spice furnace
#

${bot.users.cache.size}, ${bot.channels.cache.size} use it @digital seal

earnest phoenix
#

@digital seal just

<client>.user.setActivity(`Watching ${<client>.guilds.cache.size.toLocaleString()} servers with ${<client>.users.cache.size.toLocaleString()} users`, {
type: "WATCHING"
});```

Am i a joke you

worn badge
#
guild.createEmoji('IMAGEurl', 'NAME')
  .then(emoji => console.log(`Created new emoji with name ${emoji.name}`))
  .catch(console.error);

@worn badge couldnt find it so
@spare mirage oh i meant how to use already made emojis, or is that not an option?

earnest phoenix
#

@worn badge Just get them or use their identifier

digital seal
#

When the bot came lit a mistake

worn badge
#

ohhh i'm dumb, it wasn't working because the bot was trying to send an emoji from a server that he's not in facepalmz

digital seal
#

lock @spare mirage @earnest phoenix

#

no no

#

rpd

#

rpb

earnest phoenix
#

Man do you code on a notepad

digital seal
#

rdp @earnest phoenix

#

ok 1s

earnest phoenix
#

The hell is rdp

pale vessel
#

remote desktop protocol

digital seal
#

i need a package.json

pale vessel
#

like npm init -y?

digital seal
#

ok

earnest phoenix
#

Pls help, how made bots server count on website?

#

bruh my english bad

#

...

cinder patio
#

I'm working on a forum, and I'm thinking about how all the data should be stored. I'm using mongoDB as the database, and right now I am considering two options (the example is of a category object - a category contains threads.)

{
 id: "...",
 ...some other data,
 threads: []
}

In the first one all the threads in the category are stored in one array. In the second option, all threads are in a different collection and have a categoryId property, so threads can be eaily found via a category id.

The second option sounds better to me because it's more organised, BUT it means making more requests to the database. I also feel like the second option allows for better caching

dense nest
#

@earnest phoenix means how can he relay how many servers his bot is in to his website

earnest phoenix
#

yes

dense nest
#

Ukrainian?

earnest phoenix
#

Russian

dense nest
#

Ah

earnest phoenix
#

Okay how fix this

dense nest
#

Thats js

earnest phoenix
#

yes

dense nest
#

Hmmmmm

#

Im python

earnest phoenix
dense nest
#

Trying yo figure out the dame thing

earnest phoenix
dense nest
#

(len(client.users))

#

In python

#

Ect

slender thistle
#

-servercount @earnest phoenix

gilded plankBOT
#

@earnest phoenix

To have your bot's server count displayed on DBL, please read the documentation on server/shard posting. Click here to see the docs.. You may also find #312614469819826177 useful; however it is strongly discouraged as most of the examples are extremely outdated.

earnest phoenix
#

thx

dense nest
#

@slender thistle what's DBL

#

Lmao

slender thistle
#

Discord Bot List, the bots part of top.gg

dense nest
#

Oh

#

I seee

#

How do i do it on my own website

#

O.o

#

.py?

#

Orrrrr do i need a database

chilly bison
#

How get around youtube search ratelimits

#

?

#

I make 1 request and get ratelimited >:((

misty sigil
#

by scraping

chilly bison
#

by scraping
@misty sigil how doe

misty sigil
#

ytdl

chilly bison
#

I did

#

1 request

#

insta-ratelimit

earnest phoenix
#

How i can get full info about error in catch()

#

cuz i have to do error.toString()

sand condor
#

do you mean the error stack ?

earnest phoenix
#

and it display only this

consoleTypeError: message.member.presence.find is not a function
sand condor
#

error.stack

earnest phoenix
#

yes maybe

#

uhh

#

let me try

sand condor
#

uh and presence is an object not an array or collection

#

so find wouldn't work

earnest phoenix
#

can i slice error.stack

#

it is a string

#

or object ?

sand condor
final stone
#

In discord.js, how do I pass an image buffer to .setImage on a MessageEmbed? KEKW Im not the smartest of people.

#

Like, when you buffer canvas.

#

like this, ```js
const buffer = canvas.toBuffer("image/png");

#

to send it as a file I would do this ```js
await message.author.send('', { files: [buffer] })

#

Trying to find out the equlivant for .setImage()

misty sigil
#

@final stone you need to attach it iirc

final stone
#

Buffering anything in general Β―_(ツ)_/Β―

#

@final stone you need to attach it iirc
@misty sigil So it cannot be set as a image in the embed?

misty sigil
#

it can.

final stone
#

Could i get some pointers? KEKW Im stumped.

misty sigil
#

.attachFiles(new Discord.MessageAttachment(ctx.toBuffer(), "image.png"))
.setImage("attachment://image.png") iirc

final stone
#

OOOh

chilly bison
#

In general, is it a good idea to use the youtube api?

final stone
#

Thanks πŸ™‚

misty sigil
#

aye no problem!

proven lantern
#

@final stone int *pointer1; int *pointer2;

final stone
#

@final stone int *pointer1; int *pointer2;
@proven lantern what? waitWhat

sonic lodge
#

a joke, if i'm not mistaken

proven lantern
#

you're right, those are dereferenced pointers

sonic lodge
#

never mind

proven lantern
#

yeah, but i messed it up

faint prism
earnest phoenix
#

it's genuinely fun

#

ive mostly used them when fiddling with audio

slender thistle
#

x is an integer, but apparently I can't use x^(1/2) on it regardless of its type?

#

for further context if necessary, this is my code up until the compilation error (last line)

Option Explicit
Sub Êíèãà1()
Dim a As Single, x As Integer, pi As Single, i As Integer, arr(0 To 4) As Single
pi = 3.14159265358979
x = CInt(Val(Cells(5, 2)))
arr(0) = (1 + 2.5 * x) / (Sqr(x) * (1 - x))
arr(1) = (x^(1 / 2)) * (Abs(1 - x) ^ (1 / 2)) * ((Sqr(x) + 1) ^ (1 / 3)) * (Abs(Sin(x)) ^ (1 / 4))
faint prism
#

Visual basic 🀒

slender thistle
#

πŸ˜‚

#

Don't blame me. Blame my education course

brave prairie
#

What for my axo

opaque hawk
#

Why doesn't ts await message.guild!.members.kick(user); kick the GuildMember

faint prism
#

x is an integer, but apparently I can't use x^(1/2) on it regardless of its type?
@slender thistle wouldn't that just be Sqr(x)? Assuming that means square root

slender thistle
#

sqr is square

#

sqrt is square root

opaque hawk
#

Math.sqrt

slender thistle
#

and there's no sqrt

faint prism
#

ah I see why you're doing that then

#

well is it negative

slender thistle
#

I don't see what's happening, unless ^ is editing x somehow

#

it's 5

faint prism
#

because you can't get a real number from sqrt-ing a negative