#development

1 messages ยท Page 5 of 1

quartz kindle
#

you need to await it or .then() it

last tapir
#

i .find() how exactly that has the object?

#
bot.shard.broadcastEval(client => client.guilds.cache.get("737011108954505267")).then(x => x.find());
quartz kindle
#

array.find(condition) gets the first item in the array that satisfies the condition

#

Boolean or x => x are basically shortcuts for item => if item exists, return true, else return false

last tapir
#

i have 3 shards and still returns [ null, null, [Object] ]

#

oh qwait

quartz kindle
#

for example array.find(Boolean) or array.find(item => item) will return the first item in the array that is not null/undefined/""/0/nan

last tapir
#

OHH

last tapir
#

it returns that

quartz kindle
#

yes

last tapir
#

wait, array.find(Boolean) how?

#

.find(true)?

lyric mountain
#

any boolean condition

last tapir
#

.find(false).

lyric mountain
#

item => item is a boolean condition

last tapir
#

.. or like .find(Boolean) like that.

quartz kindle
#

no, Boolean is a built in function

last tapir
quartz kindle
#

for example Boolean("a") === true

lyric mountain
quartz kindle
#

so if you do array.find(Boolean) its the same as array.find(item => Boolean(item))

last tapir
#

ohhh

#

so right now, with shards, to get a server, i have to do this

let guild = bot.shard.broadcastEval(client => client.guilds.cache.get("737011108954505267")).then(x => x.find(x => x));
quartz kindle
#

yes that should be fine

last tapir
#
bot.shard.broadcastEval(client => client.guilds.cache.get("737011108954505267")).then(x => x.find(x => x)).members;
``` returned undefined
#

is it because i should add await?

quartz kindle
#

yes

last tapir
#

oh, damn, so

(await bot.shard.broadcastEval(client => client.guilds.cache.get("737011108954505267")).then(x => x.find(x => x))).members;
quartz kindle
#

you need to await either the broadcastEval itself, or await the .then(), or put .members inside the .then

last tapir
#

fair, but i want to treat the code above as if im like doing message.guild.members, if you got what i mean

quartz kindle
#

for example ```js
const guild = await bot.shard.broadcastEval(client => client.guilds.cache.get("737011108954505267")).then(x => x.find(x => x)));
guild.members

or

const ev = await bot.shard.broadcastEval(client => client.guilds.cache.get("737011108954505267"));
ev.find(x => x).members

or

bot.shard.broadcastEval(client => client.guilds.cache.get("737011108954505267")).then(x => x.find(x => x)).members);

#

you will likely face a bigger issue tho

last tapir
#

oh, go ahead

#

whats that?

quartz kindle
#

broadcastEval does not support complex data like GuildMember objects or Guild objects

#

the data you receive will be converted to plain simple object

last tapir
#

example? what do you mean

#

i understood the compelx data part

#

but plain simple object like what

quartz kindle
#

like its just an object: { name: "xyz", description: "zzz", etc }, it does not have any functions like .setName()

#

and not sure if it does include members at all

last tapir
#

oh, so it will return an object with no merthods

quartz kindle
#

console.log it and see for yourself

#

yes

#

anything that is not serializable will be stripped from it

last tapir
quartz kindle
#

guild or guild.members

#

after using .find() on it

last tapir
#

2nd option returned an array

quartz kindle
#

what exaclty do you want to do with those members?

last tapir
#

oh, no .cache?

#

oh, woooot

#

.members is supposed to return the GuildMemberManager class

#

but it returned an array instead ๐Ÿคท

quartz kindle
#

exactly

last tapir
#

oh, so what now

#

what would i do in this case?

quartz kindle
#

depends what exactly you want to do with those members

last tapir
#

for now, ill not be able to treat it like im treating a normal bot without shards due to it not supporting complex data

last tapir
quartz kindle
#

then do it inside the broadcastEval and return only the names

last tapir
#

using this code:

bot.shard.broadcastEval(client => client.guilds.cache.get("737011108954505267")).then(x => x.find(x => x).members);
last tapir
#

i need to call themethod again?

quartz kindle
#
const memberNames = await bot.shard.broadcastEval(client => {
  const guild = client.guilds.cache.get("737011108954505267");
  if(guild) {
    return guild.members.cache.map(member => member.displayName);
  }
}).then(x => x.find(x => x));
last tapir
#

oh damn

#

everyone faces this issue when it comes to sharding?

quartz kindle
#

yes

last tapir
#

oh, so that's the only solution, correct?

quartz kindle
#

because transferring data between shards is like transferring data between apis, it needs to be serialized into something like a json string and sent as raw bytes

quartz kindle
#

so if you need to access any complex data you have to do it while still inside the shard, and then only return the final data once you know what you need

quartz kindle
#

else memberNames is just a Promise

last tapir
#

now i understood for the sharding part, many thanks, not switching to promises question

last tapir
quartz kindle
#

broadcastEval returns a Promise

last tapir
#

we can handle with await or .then(), we chose .then()

quartz kindle
#

awaiting a Promise lets you return its value as normal

#

using .then() on a promise lets you access its value inside the .then() and return a new Promise

#

basically .then() allows you to access and change what the promise will return

last tapir
#

ohh ok

quartz kindle
#

but it always returns another Promise

last tapir
#

alrighty, fair

last tapir
quartz kindle
#

yes, thats how it is

last tapir
#

unfortunate

quartz kindle
#

working with shards requires you to change your mind set

last tapir
#

true

quartz kindle
#

and see how your cache is split between different processes

last tapir
#

challenging and worth it

quartz kindle
#

like if you had part of your cache in one website, and part in another website

#

and you need to make api requests to each other to access it

last tapir
#

now, question, you're in my place, isnt it better to have .member return the GuildMemberManager object, somehow?

quartz kindle
#

not possible to transfer that data

#

however it is possible to construct a new GuildMemberManager

last tapir
#

oh, how about so:

const ok = await bot.shard.broadcastEval(client => {
  const guild = client.guilds.cache.get("737011108954505267");
  if (guild) return guild.members;
}).then(x => x.find(x => x));
#

ok is the new class

#

that's a great idea, no?

lyric mountain
#

ok will still be a generic object

last tapir
#

then I can continue like ok.cache.map(x => x.displayName);

last tapir
lyric mountain
#

ok is just the name of the variable

#

broadcastEval will always return a generic object regardless of what's to the left

quartz kindle
#

if you want to reconstruct the class, you can try something like const members = new Discord.GuildMemberManager(guild, arrayOfMemberObjects)

#

but that is not recommended

#

because you will be interfering with the discord.js cache system, and probably end up with duplicated caches across shards

last tapir
quartz kindle
#

yes

last tapir
#

well thats amazing, looks like illl need to stick with plan a now

#

now, at least i figured out what ill be doing for now

quartz kindle
#

the recommended way is to use all the classes you need inside the broadcastEval and only return when you have something simple

lyric mountain
#

also reduces the payload size

last tapir
# quartz kindle the recommended way is to use all the classes you need inside the broadcastEval ...

alright, thats sounds good, now that i got lost a bit; when should i use this or the other?

bot.shard.broadcastEval(client => client.guilds.cache.get("737011108954505267")).then(x => x.find(x => x).members);
const x = bot.shard.broadcastEval(client => {
  const guild = client.guilds.cache.get("737011108954505267");
  if(guild) {
    return guild.members.cache.map(member => member.displayName);
  }
}).then(x => x.find(x => x));
quartz kindle
last tapir
#

๐Ÿ‘ ๐Ÿ‘ ๐Ÿ‘

quartz kindle
#

and always try to reduce the data you are transfering as much as possible

last tapir
#

by meaning... ?

lyric mountain
#

instead of sending the entire cow send just the beef

quartz kindle
#

like if you only need names and ids, return an object with only those

#

dont return everything

#

return guild.members.cache.map(member => ({ name: member.displayName, id: member.id }));

last tapir
#

now this helps in what, particularly? less memorage usage?

last tapir
quartz kindle
#

less stuff to transfer across shards, which does reduce cpu usage

last tapir
#

excellent

#

i believe im all set

quartz kindle
#

๐Ÿ‘

last tapir
#

thanks, as well!

quartz kindle
#

np

feral aspen
#

Hey, Tim. Isn't he getting values from one shard to another? Can't he just like do what he needs to do in the method itself as it is?

#

Like supposedly, he wants to use .send(), what would he do?

last tapir
#

oh, yeah, what do i do when it comes to like sending messages or something ๐Ÿ‘€ good question

ancient nova
#

anyone got some cool effects for a website?

near stratus
#

(s)he's a few centuries ahead of us in terms of animations and stuff

stuck dawn
#

anyone knows why using the property outline with border-radius makes a square in CSS?

#

i want to make a circle with an outline

earnest phoenix
#

I believe you've got to use the box shadow?

stuck dawn
#

im so dumb

earnest phoenix
#

does somebody know how I could make anything outside the square transparent?

ancient nova
#
<!DOCTYPE html>
<html lang="en-us" class="sr">
    <style>
        body { background-color: #000000; }
        header { font-size: 15px; color: #ffffff; }
    </style>
    <title>
        Anonymous Hater
    </title>
    <meta name="description" content="Work in Progress Web for Anonymous Hater Discord Bot."/>
    <a href="http://hater.only-fans.club/terms">
        Terms of Service
    </a>
    <br>
    <a href="http://hater.only-fans.club/terms">
        Privacy Policy
    </a>
    <center>
        <header style="font-size: 50px;margin-top: 250px;">
            Anonymous Hater
        </header>
    </center>
    <center>
        <header>
            WEBSITE IS WORK-IN-PROGRESS!
        </header>
    </center>
 </html>
``` not that good at css, but how do I make the terms of service and privacy policy text align at the top left of the screen?
#

top right*

#

how do I get a font again?

ancient nova
#

lmfao I just stole dyno's CSS I hope that's okay since it's literally publicly available

wheat mesa
#

Just because something is publicly available doesnโ€™t mean itโ€™s not their intellectual property

#

Probably not the greatest idea to steal somebody elseโ€™s work and pass it off as your own :p

near stratus
earnest phoenix
#

just modify it to remove all traces and ur good to go, and maybe learn something from the css/html

near stratus
#

Okay How do I check if a value is actually null
I'm using

const a = something
if(a){}

But if the value is 0 it'll also return false
And I don't want that

#

Edit: Now I'm using

if(low === false || low === null || low === undefined){
}

Still looking for a better solution

civic scroll
civic scroll
#

AmiyaDefault alone in dev

wheat mesa
#

The classic case of โ€œwe need 4 falsy valuesโ€

civic scroll
pine nova
#

yeah empty strings count as false too frfr

civic scroll
#

BUT THEN

pine nova
#

copium

#

i think !{} gives true too

#

idk

#

not sure tbh

civic scroll
earnest phoenix
pine nova
#

copium

pine nova
civic scroll
#

yeah

dry abyss
#

Hiii

civic scroll
#

hiu

#

hi

#

but what was that implemented for

earnest phoenix
#
context.drawImage(loadImage, 0, 0, ctxWidth, ctxHeight);


        context.beginPath();

        if(ctxHeight > ctxWidth) {
            context.rect((ctxWidth / ctxHeight), 40, ctxWidth, ctxWidth);
        } else {
            context.rect(( ctxWidth - ctxHeight ) / 2, 0, ctxHeight, ctxHeight);
        }
        
        context.closePath();

        context.stroke();

        context.clip();```
#

still returns this

lyric mountain
#

THEN you draw the image

pine nova
#

found this weirdsip

#

o wait

#

nvm

#

๐Ÿ’€ ๐Ÿ’€

civic scroll
earnest phoenix
pine nova
earnest phoenix
#

oh

civic scroll
#

then clip

earnest phoenix
lyric mountain
#

d-d-discord guide?

earnest phoenix
#

dude that shit is hilarious

pine nova
#

kekw

earnest phoenix
#

no readability

#

I could volunteer rewriting the whole shit page once I have an understanding of it

lyric mountain
#

you should look at canvas documentation instead of some random discord guide

near stratus
#

AWS moment

lyric mountain
#

and test with codepen

earnest phoenix
#

bruh

#

I figured it out

wheat mesa
civic scroll
#

๐Ÿ’€

radiant kraken
earnest phoenix
#

I have to clip before drawing

#

like @ Glitter said

#

๐Ÿ’€ ๐Ÿ’€

civic scroll
#

sure

#

whatever suits you

earnest phoenix
#

didnt ask

civic scroll
#

didn't ask either

#

i don't have to be asked in order to respond to a statement that was previously replied to mine

earnest phoenix
#

not gonna read

civic scroll
#

you just, did

#

KekWLaugh L

earnest phoenix
#

no

#

I read

#

the emoji

#

with my own eyes

#

๐Ÿ’€ ๐Ÿ’€ ๐Ÿ’€ ๐Ÿ’€ ๐Ÿ’€

civic scroll
#

anywho how do i render a canvas as if it's a webassembly app

ancient nova
#

can you guys rate

winged temple
#

time to get ip grabbed

ancient nova
sick agate
#

-Great

winged temple
civic scroll
#

still didn't accept that man just copied a raw css file from target site

#

๐Ÿ’€

earnest phoenix
#

how do I remove the transparent parts / scale the image to be scale the image height and width?

using canvas and djs

ancient nova
#

shush ๐Ÿ˜ญ

lyric mountain
civic scroll
#

oh

#

i thought i had to make a new canvas

lyric mountain
#

like, instead of making a canvas the size of the image simply use a smaller canvas to begin with

quartz kindle
civic scroll
#

at this point just use a native photo editor app on your operating system LapSmug

winged temple
ancient nova
#

how do I add cloudflare to my website tho?

#

never acc done my own website before I always used glitch and a custom domain

winged temple
civic scroll
#

you simply add your website in cloudfare

quartz kindle
#

you login to cloudflare

#

and follow instructions

civic scroll
#

yeah that

winged temple
#

is this good stats for a bot that has been released for 7 days without any actual ads other than top.gg listing?

ancient nova
#

and will it automatically work with secure http?

quartz kindle
#

you will decide on cloudflare

ancient nova
#

yeah that's pretty good

civic scroll
quartz kindle
#

if you want https chose flexible ssl

winged temple
#

also guys

#

i have a issue

ancient nova
civic scroll
#

just say the issue

winged temple
#

with express and https

civic scroll
winged temple
#

wifi shit over here

earnest phoenix
ancient nova
winged temple
#

on a laptop outside camping

#

but ill ssh into it

#

and find the error

civic scroll
#

๐Ÿ’€

quartz kindle
#

pepsi

civic scroll
#

so at the end, no description of the issue

lyric mountain
quartz kindle
#

the issue is the campfire is too hot

ancient nova
#

@earnest phoenix joecool

winged temple
#

so im tryna use https using express with cloudflare cert

ancient nova
#

I see the website already worked

earnest phoenix
#

not so trustworthy

ancient nova
earnest phoenix
#

I added it to a dummy server

winged temple
#

but it literally just doesnt work

#

when i start the bot

#

the website also loads normally

#

but i cant connect using https

ancient nova
#

IT DOESN'T I WAS JUST TOO LAZY TO PICK OUT INDIVIDUAL PERMISSIONS

winged temple
#

but whenever i use http, it works fine

#

literally no errors

earnest phoenix
#

lmao

lyric mountain
earnest phoenix
ancient nova
#

okay okay gotcha

#

I'll do that rn

quartz kindle
wheat mesa
#

Actually taking a suggestion? ๐Ÿ˜ฎ

civic scroll
#

maybe either side is lacking https compability

lyric mountain
#

for me any bot that even mentions admin perm is a huge red flag, so red that it goes into infrared wavelength

ancient nova
winged temple
wheat mesa
winged temple
#

i dont exactly remember cus i aint got the file

civic scroll
quartz kindle
#

you want to use cloudflare's certificate as a file in your own webserver?

winged temple
#

as im on a completely new fresh laptop i bouht

quartz kindle
#

then wut

winged temple
#

that was a diff thing i tried

civic scroll
winged temple
#

hang on im tryna remember what i did

#

i tried a lot of shit

#

but nothing worked

#

literally just enabling https with express.js is what im tryna do

quartz kindle
#

you have a website that is connected to cloudflare via dns, right?

winged temple
#

yea

#

nameservers for domain

ancient nova
#

while I'm editing the html do you guys have any tips to make the website better?

winged temple
#

and dns

quartz kindle
#

do you have certbot or acme.sh on your webserver?

winged temple
#

nop

#

no

#

lazy

quartz kindle
#

then you need to use cloudflare flexible ssl

civic scroll
#

sorry

#

wrong rep

quartz kindle
#

and use normal http express

civic scroll
lyric mountain
#

and description

winged temple
lyric mountain
#

also dont be so bold

civic scroll
# winged temple lazy

laziness either encourage people to come up with creative solutions to autonomy or kill their mentals

#

most of them ended up in 2nd situation

ancient nova
quartz kindle
ancient nova
#

I'm going to use the ones on the top.gg site

civic scroll
#

bro???

winged temple
#
const express = require("express");
const app = express();

app.enable("trust proxy");
app.set("etag", false);
app.use(express.static(__dirname + "/website"));

app.listen(80, () => console.log('App on port 80'));```
#

what im doing rn

civic scroll
#

@ancient nova design concept first, coding second

civic scroll
quartz kindle
#

and it works when you do to http://yourserveripaddress right?

winged temple
#

yea

#

but whenever i try https

#

it just dies

civic scroll
quartz kindle
#

check your cloudflare settings again

civic scroll
#

try writing down on paper first

quartz kindle
#

make sure flexible ssl is enabled

winged temple
#

let me login

#

on laptop

#

there

#

still

spark flint
#

Takes time for cf cache to clear

winged temple
#

how long usually?

spark flint
#

Idk

winged temple
#

using https

#

or is that http

spark flint
#

Nah

winged temple
#

what i thought

#

i tried this same thing

#

b4 i left for holidays

#

let it sit for a few days

#

and nothing worked

lyric mountain
#

check your server logs

#

it's not erroring on cloudflare, it's erroring on the server

quartz kindle
#

check if you have any kind of firewall enabled on cloudflare

winged temple
#

literally no errors

#

sorry wifi died

#

seems to be dying still

#

there

earnest phoenix
ancient nova
#

how do I make the text not curl and just be in a straight line?

lyric mountain
#

remember the formula?

earnest phoenix
#

ahh yes

lyric mountain
#

x + (maxWidth - width) / 2

earnest phoenix
#

ye

lyric mountain
#

x would be negative

eternal osprey
#

hey guys, how do i create a vote tracker for a server (not a bot)

eternal osprey
earnest phoenix
eternal osprey
#

nah but like are there any docs out there

#

I don't know the methods

lyric mountain
#

or text-wrap: none

snow niche
#

so how do i point / on my express to the index.html file

lyric mountain
#

../ to go up one folder

ancient nova
#

does this look better?

lyric mountain
#

do I need to say?

ancient nova
lyric mountain
#

also your entire site is empty

wheat mesa
#

use react

#

React is so easy to use

ancient nova
lyric mountain
#

...

wheat mesa
#

Or just use bootstrap css

#

Bootstrap makes css really easy

ancient nova
#

I only added it because I had to have a tos and a privacy policy

winged temple
lyric mountain
#

raw html + css + js is enough

ancient nova
lyric mountain
#

just use relative units

wheat mesa
ancient nova
#

that's true, it is (by my opinion) the best

lyric mountain
#

it's a simple site

winged temple
#

thats just

wheat mesa
#

If youโ€™re not good at CSS use bootstrap, itโ€™s just a CSS library that makes your life easier

winged temple
#

pissin me off xd

ancient nova
lyric mountain
lyric mountain
#

it's a very bold statement to call something "the best"

winged temple
lyric mountain
#

it only makes u look even more generic

wheat mesa
#

Every bot says the same thing

#

โ€œBest at this, best at thatโ€

#

Starting to feel like an apple product without any quality

winged temple
#

since when was apple a quality product

ancient nova
#

does this look better?

lyric mountain
#

u really need to fix that div

ancient nova
#

I did an oopsie let me fix

lyric mountain
#

remove is-half property

earnest phoenix
wheat mesa
lyric mountain
#

use negatives for the rect

ancient nova
#

okay check new

earnest phoenix
#

oh that

wheat mesa
ancient nova
lyric mountain
#

also u can press F12 and test live changes on element inspector

ancient nova
#

yeah I know that

lyric mountain
ancient nova
#

it's better at least

earnest phoenix
#

this triggers me

ancient nova
#

I hope

winged temple
ancient nova
lyric mountain
#

why are u using background props if u dont have a background image?

ancient nova
ancient nova
lyric mountain
#

what does that have to do with background props?

ancient nova
#

Istg it actually looks kinda ok now

winged temple
wheat mesa
#

Mobile looksโ€ฆ not good but Iโ€™m assuming youโ€™re not dealing with viewport scaling atm

ancient nova
wheat mesa
earnest phoenix
wheat mesa
#

Very small and empty

ancient nova
#

lmfao...

eternal osprey
#

does topgg even have a voting method for servers?

ancient nova
lyric mountain
#

look, canvas is technically infinite, what u see is the viewport

ancient nova
#

@winged temple how exactly do you display bot statistics?

lyric mountain
#

you can move stuff to negative coordinates which will go to top/left

winged temple
#
let file = fs.readFileSync("./src/website/html/home.html", { encoding: "utf8" });

file = file.replace("$$guilds$$", guilds);
file = file.replace("$$users$$", users);
file = file.replace("$$uptime$$", duration);
ancient nova
# winged temple express.js

already using express, how do you pass them onto your website? you technically would have to run them both on one server

winged temple
#

or whatever your prefix is

ancient nova
#

huh okay

wheat mesa
#

You know from what Iโ€™ve gathered from bot development, Iโ€™m never going to release an unfinished product again

winged temple
#

inside of your

app.get("/", async(req, res) => {

}
wheat mesa
#

But my god I need discord to hurry up with the modal updates so I can achieve that

ancient nova
#

doesn't look too bad if you scale it back a little

cursive musk
#

im trying to connect my repl to a custom domain name from Namecheap, does anyone know what th DNS host name needs to be?

#

repl dosen't tell that

eternal osprey
#

Why does the topgg docs only talk about uploaded bots, and not servers?

winged temple
#

so for example:

app.get("/", async(req, res) => {
    const users = client.guilds.cache.reduce((a, g) => a + g.memberCount, 0);
    const guilds = client.guilds.cache.size;

    const duration = moment.duration(client.uptime).format(" D [days], H [hrs], m [mins], s [secs]");

    let file = fs.readFileSync("./src/website/html/home.html", { encoding: "utf8" });
    file = file.replace("$$guilds$$", guilds);
    file = file.replace("$$users$$", users);
    file = file.replace("$$uptime$$", duration);

    res.send(file);
})
winged temple
#

for the repl website

cursive musk
#

like this?

winged temple
#

thats not the url

#

is it?

cursive musk
#

ohh

#

no

winged temple
#

what do you use to connect to you website with?

cursive musk
winged temple
#

without the custom domain

ancient nova
cursive musk
winged temple
#

no

#

your repl web server

#

whats the link to that

ancient nova
winged temple
#

no

cursive musk
#

??

#

so confused lol

#

should it be www

#

?

winged temple
#

ur tryna connect a custom domain to a website url

#

but you dont know what the url is?

#

not only that but ur using cname

cursive musk
winged temple
#

no

#

dont worry about ur custom domain

cursive musk
#

alr

winged temple
#

whats the link ur tryna connect it to

cursive musk
#

https://___.ishaantek.repl.co

ancient nova
#

how do you use the <ul> <li> tags?

#

nothing shows when I use them

winged temple
cursive musk
winged temple
#

alright

#

what i recommend doing

#

is hooking it up to cloudflare

#

so sign up to cloudflare

#

change ur nameservers on namecheap

#

to cloudflares' ones

#

should look something like customname.ns.cloudflare.com

#

then after, go to your dns settings

cursive musk
#

hmm do i need to use cloudflare tho? it was working fine few months ago

winged temple
#

on cloudflare, not namecheap

cursive musk
#

but forgot what to make the host

winged temple
#

and then do something like this

winged temple
#

@ancient nova dyno

cursive musk
#

ohh the host is @?

cursive musk
lyric mountain
#

so u can understand how canvas coordinates work

#

vx, xy, vh and vw are viewport (red square) controls (x, y, height and width)

#

ox, oy, oh and ow are object controls (the black square)

ancient nova
earnest phoenix
# lyric mountain <@456226577798135808> https://www.desmos.com/calculator/l4fuwaakdm

I just literally tried moving my canvas by position after giving them 1 : 1 scale via createCanvas like u said and I literally can't move any more than I have scaled meaning that anything beyond that will either have no effect or you will cut your current canvas off if u move the canvas off the view

tldr u cant work with more than set via createCanvas because either nothing will happen or the spot will just become transparent

ancient nova
#

how do I freaking format this

lyric mountain
#

inject that html

quartz kindle
#

yes inject it into your blood stream

#

it cures cancer

ancient nova
#

yeah I know the invis chars disappear

cinder patio
#

Huh

#

what do you mean by format

ancient nova
cinder patio
#

it's poop

lyric mountain
#

why are the images still stacked like cargo containers?

ancient nova
cinder patio
#

different dimensions too

cinder patio
ancient nova
ancient nova
lyric mountain
#

also just noticed, u forgot to fix this

earnest phoenix
lyric mountain
#

bitfields are useless to common users/mods

ancient nova
#

ah I'll still keep it there cause why not shrug

lyric mountain
cinder patio
# ancient nova ah I'll still keep it there cause why not <:shrug:332268181517238272>
<div style="margin-left: 20px">
โ€Žโ€Žโ€Žโ€Žโ€Žโ€Žโ€Žโ€Ž- Moderation
โ€Žโ€Žโ€Žโ€Žโ€Žโ€Žโ€Žโ€Ž- Utility
โ€Žโ€Žโ€Žโ€Žโ€Žโ€Žโ€Žโ€Ž- Games
โ€Žโ€Žโ€Žโ€Žโ€Žโ€Žโ€Žโ€Ž- Image Manipulation
โ€Žโ€Žโ€Žโ€Žโ€Žโ€Žโ€Žโ€Ž- Customization
โ€Žโ€Žโ€Žโ€Žโ€Žโ€Žโ€Žโ€Ž- Logging
</div>

learn css pls

lyric mountain
#

the very same u want to do with the image

#

just put negative y coordinate

#

it'll crop the image to show only what's visible to the viewport

#

like the black square in my example (only what's inside red square will be visible)

earnest phoenix
#

if I do that I will have transparent stuff visible taking up space

#

I want to get rid of that

lyric mountain
#

canvas doesn't render what's outside the boundaries

earnest phoenix
#

there is transparent stuff

lyric mountain
#

I think ur misunderstanding what I mean

quartz kindle
#

what are you trying to do?

lyric mountain
#

crop I believe

lyric mountain
#

(marked by the red square)

#

then move the image to negative y

#

you'll have a cropped image

quartz kindle
#

drawImage has 3 sets of coordinates

#

draw, crop and resize

ancient nova
#

aight that looks good enough for now

quartz kindle
#

4 sets actually

lyric mountain
#

if they only want to return a cropped image I think simply moving the image up will suffice

quartz kindle
lyric mountain
#

String.format("#%6x", color) for #RRGGBB

#

no user will look at those values and say "ah, that color"

ancient nova
lyric mountain
#

now do the same for the bitfields

#

show the actual permissions that changed

ancient nova
#

yeah I do

#

bitfields are just an extra

lyric mountain
#

an useless extra

#

like one piece filler episodes

ancient nova
#

I wasn't meant to use the String global var?

quartz kindle
#

String.format is not a thing in js

lyric mountain
#

I mean, u didn't think I would give u something to simply copypaste right?

ancient nova
#

oh didn't notice cause the snippet looks like JS slightly

ancient nova
#

I think I can use .replace for this?

lyric mountain
#

nope, u need to search how to format a string in js

near stratus
earnest phoenix
# lyric mountain make the canvas the desired size

dude if I do
canvas = Canvas.createCanvas(ctxWidth, ctxWidth);

and
context.rect((ctxWidth / ctxHeight), 0, ctxWidth, ctxWidth);

on an image that has a bigger width than height, I literally always get the same crop

#

full image

#

I get this crop

#

I literally can't move it to the right no matter what I fucking do

lyric mountain
#

...you can

#

on drawImage

#

simply input negative coordinates and it'll move to the opposite direction

earnest phoenix
#

oh on drawimage

lyric mountain
earnest phoenix
#

oh I see

#

yeah that explains it

near stratus
#

If you're tim you would rather code it yourself

#

like

if (!String.prototype.format) {
  String.prototype.format = function() {
    var args = arguments;
    return this.replace(/{(\d+)}/g, function(match, number) { 
      return typeof args[number] != 'undefined'
        ? args[number]
        : match
      ;
    });
  };
}
#

(I have no idea what this thing I copied does)

quartz kindle
#

it lets you do "abc".format(...)

near stratus
#

damn didn't know that you can do it globally

lyric mountain
#

but that's for blabla {0} bla

#

printf allows actual value formatting, not only replacements

#

like Color is #%6X will print Color is #00000F (for input 255)

near stratus
#

yea c has types I understand

lyric mountain
#

I'm actually surprised js doesn't

near stratus
#

It was made to make html be able to think

ancient nova
#

I'm thinking about changing the bots name to Ratelimited, does that sound ok?

lyric mountain
#

can't u use a normal name?

near stratus
ancient nova
#

is that not normal

lyric mountain
earnest phoenix
#

not gonna like it took me over 10h today to figure out how canvas work

#

also I suck at maths

near stratus
#

JS never needed a typed format

winged temple
#

@lyric mountain ur good with web development, how would you do something like this with express.js?

#

list of servers the bot is in

sharp geyser
#

You'd just loop through the guilds attached to the client assuming you're using something like djs

#

And display the appropriate data

lyric mountain
#

iterate over servers and return html elements

winged temple
#

and what about the invites?

#

do the same im guessing?

lyric mountain
#

do it inside the loop

winged temple
#

but return with creating invites

lyric mountain
#

now now, that's a danger zone

sharp geyser
#

You'd have to make sure the bot has permission to do this though

winged temple
#

the thing is, the bot requires a permission

#

but on dynos page

lyric mountain
#

first because top.gg doesn't allow botlist/serverlist bots

winged temple
#

theres literally a join button for each server

sharp geyser
#

If you just willy nilly created invites without the owner of the servers knowing you'd face issues

winged temple
#

ive gone thru over 200 pages now

lyric mountain
#

second because that might cause privacy concern

winged temple
#

not if you write it on the bot page or something like that

#

to alert the users

sharp geyser
#

If you're going to do something like this make it an opt in feature

winged temple
#

but ion see dyno doin that

lyric mountain
#

I believe dyno has opt-in

sharp geyser
#

I'm sure not ever server wants their invite out there

lyric mountain
#

like, it comes disabled and u have to enable

ancient nova
#

so ratelimited is a bad name?

sharp geyser
#

Some just want a private server for themselves or friends

winged temple
#

free advertisement :kewk:

sharp geyser
#

Not for those who don't want their servers public

lyric mountain
#

not all advertisement is good advertisement

winged temple
#

what if it were a owner command / page only

sharp geyser
#

You'd have huge privacy violation issues

winged temple
sharp geyser
#

Make it an opt in feature

#

Disabled by default

lyric mountain
winged temple
#

alr

lyric mountain
#

that solves one of the issues

sharp geyser
#

At least that way you aren't held reliable

lyric mountain
#

the other issue is that topgg doesn't allow list bots

sharp geyser
lyric mountain
#

idk how it gets away with that

sharp geyser
#

I see no issue with it tbh

#

It's just a way of flexing their servers

lyric mountain
#

but there was a ton of bots denied because they were listing bots/servers

winged temple
cinder patio
#

maybe ask a bot reviewer

winged temple
sharp geyser
#

Yea I'd suggest doing that

#

Just ask a bot reviewer like Google said

#

They have more knowledge on this than us

lyric mountain
#

smells like backdoor

sharp geyser
#

๐Ÿ‘€

winged temple
sharp geyser
#

Yea that definitely breaks some rules on discord

winged temple
#

i really dont need invite shit

sharp geyser
#

Seeing them is fine but having invites isn't

winged temple
#

only displaying servers using it

lyric mountain
#

that's fine then

sharp geyser
#

I've already been reprimanded for experimenting with creating invites for servers

#

It's not fun

winged temple
#

i connected my bot token to botghost to list the servers bot is in temporaily until i actually implement that into the website myself

#

tiny issue, im not good with web-development

sharp geyser
#

Welcome to the club

wheat mesa
winged temple
sharp geyser
#

How good of a site do you want ;)

winged temple
#

๐Ÿ˜‚

#

another issue

sharp geyser
#

You're broke?

#

Same

winged temple
#

my paypal got locked, so i have to use my "backup" paypal

sharp geyser
#

@wheat mesa guess what bro

winged temple
#

which has like 5 bux on it

sharp geyser
#

You ain't getting shit for 5$

#

Maybe a high five

lyric mountain
#

it doesn't even pay a liter of gas

winged temple
#

ikr

lyric mountain
#

hmm, did u do shady things?

sharp geyser
#

They'd have to of

winged temple
#

no

sharp geyser
#

Paypal literally doesn't do anything for anything else

lyric mountain
winged temple
#

its literally all bc of identification

sharp geyser
#

Doubt

winged temple
#

i dont have a drivers license, passport expired, id card- never had

sharp geyser
#

I have none of that either and I can use PayPal just fine

ancient nova
#

my current bots name is Anonymous Hater, does that sound fine? I was thinking of changing it to just "Hater"

lyric mountain
#

so u registered a cc without verification?

winged temple
#

i used to be able to

#

until i added my paypal account to tebex (way to sell products ect)

wheat mesa
winged temple
#

which then required me to provide id

#

which i dont have

#

until august

winged temple
sharp geyser
wheat mesa
#

nice

sharp geyser
#

Finally getting a job

winged temple
#

and my credit card (that works online) is linked to my locked paypal acc

#

so i cant unlink it and link it to my new acc

sharp geyser
#

I had to give PayPal my SSN number to send money and accept it

#

After that it was fine

quick sand
#

nice

winged temple
#

we aint even got ssn here in norway

ancient nova
#

I need to fucking decide ๐Ÿ˜ฉ

sharp geyser
#

No

#

Decide then

#

Smh

wheat mesa
#

I can't tell what it does by the name

#

and the name does not sound good

sharp geyser
#

This server is full of programmers. They are notorious for not being able to name things

#

Take waffle for example

#

His bot is literally wafflebot

winged temple
#

and my bot is "luma"

#

how tf do we get these names

#

xd

sharp geyser
#

Mines ligma

lyric mountain
#

mine can be guessed

winged temple
#

exactly

#

shirojbot, @lyric mountain?

ancient nova
lyric mountain
#

nah u cheated, u looked at the bio

ancient nova
#

meh

winged temple
sharp pilot
#

my bots are named after minecraft mobs lol

pine nova
#

๐Ÿ’€

winged temple
#

skeleton

#

zombie

lyric mountain
#

dirtblock

sharp pilot
#

passive* mobs

winged temple
#

spider

sharp geyser
#

He said mobs

#

Dummy haku

winged temple
#

pig

#

cow

#

sheep

sharp pilot
#

sheep is correct :)

sharp geyser
sharp pilot
#

that's one of them anyway

winged temple
winged temple
#

one of em

sharp geyser
#

We make a lot of mother jokes here

lyric mountain
#

what do u have against my pet dirt block?

sharp pilot
wheat mesa
#

but...why

sharp pilot
#

only 2 are on top.gg bc i didn't feel like doing the rest

#

they all have different uses

winged temple
#

such as?

wheat mesa
#

they all sound minecraft related

sharp geyser
#

Homie never heard of multipurpose

winged temple
#

fr

earnest phoenix
#

Multi-purpose, the scariest term on all of Discord

winged temple
#

my bot luma has verification, economy, anti-raid, giveaways, tickets, music, moderation, ect

sharp pilot
# sharp geyser Homie never heard of multipurpose

actually i have thanks, my first bot was multi purpose and i decided that trying to maintain that big of a bot is more of a pain than trying to maintain smaller, more specialized ones
it still exists tho and at some point it'll also get released

winged temple
sharp geyser
pine nova
sharp geyser
#

I'd rather manage a multipurpose bot than 8 small bots

winged temple
#

pls dont tell me u sat for hours

sharp pilot
#

but anyway
sheep: role colors
form fox: forms/applications
ticket golem: support tickets
alex: heavy lifter for hub-style servers
ocelot: self roles & react roles
enderbot: starboard
tbh the minecraft thing started as a joke and then just kinda stuck

winged temple
#

changing ur name

lyric mountain
sharp geyser
#

No

lyric mountain
#

like mine which is 1 number off 1337

sharp geyser
#

Discord just never changed it after nitro expired

#

I'm not complaining

winged temple
#

does it always change? or only if someone else has the username and tag?

lament rock
#

something something if the original was taken, then you either keep or it gets rerolled

lyric mountain
winged temple
#

yea ik

sharp geyser
#

Luckily no one had the same tag as me ig

drifting cairn
digital swan
sharp geyser
#

That url in your about me is sus

winged temple
digital swan
digital swan
winged temple
#

also

digital swan
#

i didnt actually do that though i just stole it

sharp geyser
#

You don't even have an ssl cert on it

winged temple
#

why tf r u counting down to christmas????

sharp geyser
#

Imagine

digital swan
#

everyone loves christmas

digital swan
winged temple
#

ooo max has a snap

#

do we do a little bit of trolling?

digital swan
#

gosh.

winged temple
#

xdtekoh

#

lets see how many valid snap accounts i have atm

#

around 500

#

ok

#

not bad

digital swan
#

are u hoarding snap accounts or something

winged temple
#

i used to do like generators / botting ect

#

so discord tokens, insta followers, twitch followers, ect

sharp geyser
#

Why

winged temple
#

idk

#

bored

digital swan
#

funny innit

sharp geyser
#

No wonder your PayPal got terminated

winged temple
#

i never sold anything

#

just private use

earnest phoenix
#

is there a way for canvas to fade? like from left to right slowly becoming transparent, or some cool effects for canvas

winged temple
#

when trolling friends on twitch

#

like i have 500 followers on spotify

#

can be genned easily

sharp geyser
#

Cool

lyric mountain
earnest phoenix
digital swan
#

with djs (default cache settings) will all roles for guilds be cached?

drifting cairn
sharp geyser
#

I think by default arent roles cached no matter what

#

Or did they change this

digital swan
#

yeah i know theyre cached but im not sure if all of them get cached so u dont need to fetch them

drifting cairn
#

they should all be cached

sharp geyser
#

Well either way

#

Never fetch from cache

#

For anything

#

It's dumb

digital swan
#

how come

sharp geyser
#

Cause your worries may become a reality

#

At some point you'll run into the issue of it not being cached

#

So use .fetch on the appropriate manager and it will fetch from cache first and if it's not their it will fetch from the API and cache it (unless told otherwise)

drifting cairn
#

hc_duck_shrug thats always an option ig

#

i'd go with cache but its up to u

sharp geyser
#

Why

#

That's super dumb

drifting cairn
#

cuz i dont wanna spam api request when multiple users are running commands every second hc_duck_shrug

sharp geyser
#

Fetching for something that might not exist will error out your code and possibly cause it to crash

sharp geyser
drifting cairn
digital swan
#

the issue i was getting anyway was related to finding a role by name

drifting cairn
#

i said i dont use .fetch so

sharp geyser
#

.fetch looks through the cache first, if it can't find it in cache it goes to the API and then caches it

#

So the next time you use fetch guess what it'll be in cache and won't fetch from the api

#

Assuming you're fetching the same resource

drifting cairn
digital swan
#

yeah i always use fetch when i have an id

sharp geyser
digital swan
#

what about when searching for something by name

sharp geyser
#

Let me look at the docs real quick I'm certain there's more ways than just passing an id

#

I guess there isn't

#

That makes sense though as it'd end up fetching the API which only accepts snowflakes

sharp geyser
#

And then take those roles and find the role you want

digital swan
#

thats what i was doing and it wasnt finding the role

sharp geyser
#

If it doesn't exist in cache tho you'd need to fetch it either way

#

Show code

#

It's a guessing game without code

digital swan
sharp geyser
#

Use === btw

#

== would just confirm the type iirc (someone who's more knowledgeable about this please confirm)

digital swan
#

== allows type conversion

winter pasture
sharp geyser
#

== doesn't check the actual values is all I know

digital swan
#

it does

sharp geyser
#

No it doesn't

digital swan
#

but e,g "1" would be equal to 1

earnest phoenix
#
const attachment = new MessageAttachment(canvas.toBuffer('image/png'), 'profile-image.png');```

how would I attach this image into an embed without having to upload the canvas somewhere to retrieve an url

```js
image: {
                url: ...
},

I don't want to attach the image outside of the embed as an attachment itself

sharp geyser
#

Well yes that's true

#

So I'm wondering why you're not strictly checking

digital swan
#

i type == out of habit

#

and it still works

sharp geyser
#

It's not a good habit

#

For something like this you don't want the name to be compared to something like a bool or number

#

And still match true

#

A bool is a bad example here cause strings are truthy by default but my point stands

#

As for why it's not getting the role back I'm not exactly saying that you not stringy checking is the problem but it could be a cause. Another reason is the role with that name doesn't exist

wheat mesa
#

I barely ever use === because typescript momento

sharp geyser
#

There's not a whole lot of need in ts as typescript is strict like that

earnest phoenix
sharp geyser
#

But js is a diff story

sharp geyser
digital swan
#

yes

#

i actually think fetching is the issue cus it worked fine before i added that

sharp geyser
#

I doubt fetching is the issue

#

If it is than djs needs to fix it cause it's purpose is to fetch and cache from the API

drifting cairn
#

i thought fetching only works with id Thonk

digital swan
drifting cairn
#

ah

sharp geyser
#

It does work based on id

carmine magnet
#

hello, i'm having an issue when i'm trying to launch my bot. I got the error below. I'm using typescript with nodejs and ts-node. my node-fetch version is 3.2.9 so I don't know why I have this error

sharp geyser
#

But passing it nothing makes it fetch everything

#

You're using require on an esm module

#

Not allowed

carmine magnet
#

i'm not

sharp geyser
#

Ts compiles down into js

#

Therefore imports compile into require

#

So yes you are

carmine magnet
#

so how am i supposed to fix this issue?

sharp geyser
#

You can try using dynamic imports to require whatever module is esm based

#

You'll have to do something weird though

carmine magnet
#

the reason why i hate typescript

sharp geyser
#

As dynamic imports also compile down into require due to ts fucking up

carmine magnet
#

why everyone told me it was a good idea gone

sharp geyser
#

Well despite it's flaws ts offers more than enough benefits

#

I need to find the thing Tim told me about I don't remember it

solemn latch
#

node-fetch has older versions that support require if you really need.
Not sure if any security issues exist though

earnest phoenix
carmine magnet
#

isn't there a way to compile ts in es module?

sharp geyser
sharp geyser
#

But I've had issues with it so I can't assist you on that

carmine magnet
#

okay

earnest phoenix
carmine magnet
#

ty

digital swan
#

@carmine magnet try using node-fetch 2.6.7 it works for me

earnest phoenix
#

Show more of the code

royal portal
#

hi how fix code

const burbur = "me"
if (burbur == "qt") {
  console.log("omg qt");
} else {
  console.log("stinky");
}
#

it output stinky

earnest phoenix
#

Because you're stinky, very evil!

royal portal
#

wtf no

#

i blame on node.js

#

node.js issue