#development

1 messages ยท Page 995 of 1

warm marsh
golden condor
#

^

paper phoenix
#

new Date(Date.now()).getTime() will return a unix timestamp @lusty quest (also how will a document be made after you peform the action)
@golden condor That's literally the same thing as just doing Date.now()

warm marsh
#

Although I don't know if that's what you need.

#

You don't need to pass Date.now() into new Date, It's kinda pointless.

long yew
#

@warm marsh ty so much it works now

golden condor
#

He said Date.now() returns milleseconds

lusty quest
#

sounds like a unix timestamp with extra steps

paper phoenix
#

So does getTime

earnest phoenix
#

@warm marsh that does not return the correct time

warm marsh
#

What are you trying to do?

tight plinth
#

Date.now() returns the milliseconds between January 1st,1970 and today

lusty quest
#

if you want to format time look into moment

#

makes it easyer

golden condor
#

I just read a couple stack forums and it said .getTime returned unix

earnest phoenix
#

My time => 17:11 => your function i tested => 12:18 @warm marsh

warm marsh
#

You have to change the locale

golden condor
#

^

warm marsh
#

But your image time won't be updated like embeds.

earnest phoenix
#

Changing locale Thonk Thonk

warm marsh
#

Inside the toLocaleString('localehere')

golden condor
#

try use moment

paper phoenix
#
const seconds = Date.now( ) / 1000 >> 0;

console.log( `Current UNIX time is ${ seconds }.` );
delicate shore
#

Purge command not working

#

log says nothing

lusty quest
#

@golden condor i dont need the Unix Timestamp. i want that MongoDB gives me a Document where the timestamp < Date.now()

pure lion
#

does anyone have a tutorial for mongodb currency system?

golden condor
#

Well that's weird

#

It should give it to yo

lusty quest
#

well thats my database call function : client.getEndedAuctions = async time => { const data = await Data.findOne({ timestamp: {"$gt": time} }); if (data) return data; else return; };

#

and here i call it const time = new Date(Date.now()); const fauction = await client.getEndedAuctions(time);

#

maybe i need to use $gte

#

and the time value is at 2020-06-26T12:58:22.895Z

still merlin
paper phoenix
#

You're doing timestamp is greater than the current time?

still merlin
#

the eval command is

  const args = message.content.split(" ").slice(1);

  if (message.content.startsWith(prefix + "eval")) {
    if (message.author.id !== "529770099285032980")
      return message.channel.send(
        "**error** Only the bot owner can execute this command!"
      );
    try {
      const code = args.join(" ");
      let evaled = eval(code);

      if (typeof evaled !== "string") evaled = require("util").inspect(evaled);

      message.channel.send(clean(evaled), { code: "xl" });
    } catch (err) {
      message.channel.send(
        "`:x: Error preforming eval command`" + "(" + err + ")"
      );
    }
  }
});```
paper phoenix
#

Shouldn't it be less than?

hasty sparrow
#

What is "clean"?

lusty quest
#

the timestamp in the database is always in the future. and i want to return only the timestamp that is in the past

hasty sparrow
#

Clearly you didn't define it, which is exactly what the error is telling you

paper phoenix
#

So if they're in the past, they'll be lt

still merlin
#

Saw it on a github turtorial

lusty quest
#

i think i know what bot framework he uses. there is a way to clean out the Client Keys etc

hasty sparrow
#

Don't just copy-paste

still merlin
#

but when I removed it I get 921937284684676 errors (11 errors)

strange trout
#

Make your own eval command

#

Use that as reference

lusty quest
#

so it will not return any sort of important stuff in a error

pale vessel
#

just use eval and inspect

#

no need for complicated functions

lusty quest
#
        if (typeof(text) === "string") {
            return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203));
        } else {
            return text;
        }
    };````he misses this
still merlin
#

Nvm I fixed it

long yew
#

can someone help me?

pure lion
#

can someone help me?
h

lyric mountain
#

only if you ask something in first place

paper phoenix
#

@lusty quest - Old dates will be lt the current.

lusty quest
#

thx

pure lion
#

does anyone have a tutorial for mongodb currency system?

lusty quest
#

one sec

digital ibex
#

hi, with css or bulma, does anyone know how i can make it show a word and add somethign to show they're different things, so i've got rn:

#

how can i make it be soemthng like word 1 | word 2 | word 3 etc ?

paper phoenix
#

@digital ibex - Are they individual elements?

digital ibex
#

yeah, its just: html <table class="table"> <thead> <th>Custom Commands</th> </thead> <tbody class="table-body"> <% commands.forEach((command) => { %> <tr class="row"> <th><%= command.name %> </th> </tr> <% }) %> </tbody> </table>

wary basin
#

You could use borders and just use css nth child

digital ibex
#

on th, i done border-color: red; but nothing changed

wary basin
#

Have you tried border: 1px solid red;

digital ibex
#

hm, lemme try

#

nothing changed

wary basin
#

hmmm

paper phoenix
#

Tables may require that you change the border styles of the actual table, not just the cells

digital ibex
#

ah ha

paper phoenix
#

Like border-collapse and such

digital ibex
#

i used that but on row

#

thank

wary basin
#

Now just remove top and bottom

#

And you can use something like last child and first child to remove the left and right borders for them

paper phoenix
#

Why are you using a table for that anyhow?

digital ibex
#

i kinda like it, i think if i changes the colour and the background colour, change the font it wouldnt look bad

#

because

#

its going to go down, and after every like 10 commands, its going to go to a new page, and on that line, you can edit the command

#

if that makes sense

earnest phoenix
#
let lois = 0;
for(ise of this.split(/ +/)){
if(ise.includes(string.toString())){
lois+=
}
}
return lois;
}

"EEE".howMany("E");```
`Syntax error: Unexpected token '}'`
![facepalm](https://cdn.discordapp.com/emojis/592992459450220544.webp?size=128 "facepalm")
#

Lol

leaden rover
#

Is there a way to make a currency system, Like dank memer? Where its global

wary basin
#

Use a DB

lusty quest
#

use a Database

leaden rover
#

DB?

#

ok

paper phoenix
#

But what's confusing me is that you're adding rows with tr... But it's actually adding columns according to your images

lusty quest
#

(dont use a file database)

wary basin
#

^^^

leaden rover
#

Is there something for like, Node.js or Python?

#

As in a link

wary basin
#

You can use a mysql database. Thats fairly easy to setup for NodeJS

leaden rover
#

ok

lusty quest
#

or MongoDB

#

you can get a Free Hosted instance

earnest phoenix
#

Can somebody tell me how does this have an Unexpected token of '}'?

let lois = 0;
for(ise of this.split(/ +/)){
if(ise.includes(string.toString())){
lois+=
}
}
return lois;
}

"EEE EEE".howMany("E");```
wary basin
#

True that as well

#

postgresql as well if you're going to make a complicated db

earnest phoenix
#

@earnest phoenix did u tried it without eval?

lusty quest
#

if you cant afford a database server. SQlite style databases like quickdb or Enmap are good in the beginning

earnest phoenix
#

No @earnest phoenix

#

Then try :d

#

Doesn't matter where you use it

#

are you sure

#

This works but turning that into that function gives that error

for(es of args.join(" ").split(/ +/)){
if(es.includes("es")){
lvs++
}
}

lvs```
leaden rover
#

Ok, is there an NPM package?

lusty quest
#

depends on what database you want to use (yes)

leaden rover
#

ok

long yew
#

can someone help me?

lusty quest
#

what is your issue?

long yew
#

ok

#

i wanna make

#

a command

#

to catch the pokemon that spawn

delicate shore
#

Hey

#

So

#

I have a query

lusty quest
#

store the pokemon that should spawn into a DB. then get the command and check if the pokemon is spawned

long yew
#

how?

#

also what db should i use?

lusty quest
#

depends on the database

long yew
#

i'm using json

#

atm

#

so how would i do that on there?

lusty quest
#

the usually 3 used are Mysql, postgres and MongoDB

#

then there are SQLite databases like enmap and quick.db

long yew
#

ok

lusty quest
#

(sqlite is local on the machine)

long yew
#

ok

#

so how would i do the catch and spawn thing on json databases??

lusty quest
#

idk. never used a json database

limber swan
#

I have a json db
And my problem is that when I run cmd that changes data in the json file, it change sthe data but the bot doesnt read it after it restarts, how can I fix it

#

(Small server)

lusty quest
#

did you load the file after a restart?

lyric mountain
#

"catch and spawn thing"
"on a json database"

#

dude

#

you wanna kill ur bot?

lusty quest
#

(also i dont recommend json databases)

#

they can corrupt easly

#

and are slow AF

lyric mountain
#

not to say the horrible IO speed

lusty quest
#

and can DDos your own bot if you store a stupid amount of data

limber swan
#

Its 20 users wont use mongo or any other db. I know json isnt recommended

lusty quest
#

use enmap

#

its still local but uses Sqlite

lyric mountain
#

it's 20 users NOW

#

what about later on in the future?

lusty quest
#

also you can get a free MongoDB instance

lyric mountain
#

also, the amount of stored data per user will be unbearable for a json db

lusty quest
#

you can store about 500MB of data in there (a efficent bot with 14k users can use about 200MB of data)

digital ibex
#

hello everyone

limber swan
#

alright alright,................................................. I will use mongo, god

lusty quest
#

its nothing against you. just json dbs are extremely fragile and inefficent

lyric mountain
#

you can store about 500MB of data in there (a efficent bot with 14k users can use about 200MB of data)
@lusty quest my bot with 100k+ users barely reached 100MB lol

lusty quest
#

gg

digital ibex
#

does anyone know why my text isn't going into the middle of the table? my code is: html <thead style="text-align: center;"> <th style="color: tomato; display: inline-block;">Custom Commands</th> </thead>

lusty quest
#

then it depends on how much you store per user

digital ibex
#

i've got the text align to center on parent, and the child has display: inline-block

lyric mountain
#

@lusty quest this is the size of my database backup files, since they're compressed let's double the size, it's still 18M at most

lusty quest
#

cool

#

i just started with a small Cluster

#

where i currently store whopping 72kb

lyric mountain
#

I store a "spawn and catch" data, credits system, customization/profile data, xp system, badges, tamagotchi data and most used commands/log about each user, and that's ONLY the member stuff

#

all that data would easily reach 1GB if I used a json db

lusty quest
#

wow and then only 100MB in the DB nice

#

i currently make a Auction Bot. that will store "only" a per Server Config and some data for the auctions

lyric mountain
delicate shore
#

Guys

lusty quest
#

efficent

delicate shore
#

Why is this happening?

#

Same with kick

#

Command

lusty quest
#

what is your issue?

delicate shore
#

See

#

It says reason

#

The I'd of user

lusty quest
#

bcs you dont remove the tagged user from the reason

delicate shore
#

What

#

How

#

See my code

honest perch
#

you need to remove the first word from the argument

delicate shore
#
    if (!msg.member.hasPermission("BAN_MEMBERS"))
      return msg.reply("Sorry, you don't have permissions to use this!");

    let member = msg.mentions.members.first();
    if (!member)
      return msg.reply("Please mention a valid member of this server");
    if (!member.bannable)
      return msg.reply(
        "I cannot ban this user! Do they have a higher role? Do I have ban permissions?"
      );

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

    await member
      .ban(reason)
      .catch(error =>
        msg.reply(`Sorry ${msg.author} I couldn't ban because of : ${error}`)
      );
    msg.reply(
      `${member.user.tag} has been banned by ${msg.author.tag} because: ${reason}`
    );
  }```
lyric mountain
#

the args include the mention

wary basin
#

Have you tried let reason = args.slice(2).join(" ");?

#

If that doesnt work try console logging the args to see where exactly it is

digital ibex
#

h_i

#

anyone have any ideas with my css issue?

wary basin
#

Whats the issue?

delicate shore
#

@lyric mountain THanks ๐Ÿ™‚

digital ibex
#
        <thead style="text-align: center;">
           <th style="color: tomato; display: inline-block;">Custom Commands</th>
        </thead>``` isn't making it go to the middle
#

its the table thing

lyric mountain
#

hm

wary basin
#

Have you checked the width of the parent / child

lyric mountain
#

yeah, looks like the table itself isn't 100% the width

digital ibex
#

u mean in inspect?

#

wym?

wary basin
#

Is the <table> width 100% or what ever you want it to be?

#

Or even the thead?

delicate shore
#

@lyric mountain what i have to change

#

sorry am getting confised

#

confused

digital ibex
#

yeah, tables width is 100%

lyric mountain
digital ibex
#

oh wait

#

its 50%

#

mb

wary basin
#

Change either thead or the child to width 100%

delicate shore
#

pls help

#
    if (!msg.member.hasPermission("BAN_MEMBERS"))
      return msg.reply("Sorry, you don't have permissions to use this!");

    let member = msg.mentions.members.first();
    if (!member)
      return msg.reply("Please mention a valid member of this server");
    if (!member.bannable)
      return msg.reply(
        "I cannot ban this user! Do they have a higher role? Do I have ban permissions?"
      );

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

    await member
      .ban(reason)
      .catch(error =>
        msg.reply(`Sorry ${msg.author} I couldn't ban because of : ${error}`)
      );
    msg.reply(
      `${member.user.tag} has been banned by ${msg.author.tag} because: ${reason}`
    );
  }
digital ibex
#

change thead to?

delicate shore
#

so here?

wary basin
#

Have you checked whats outputted via args?

#

Just do quick console.log

delicate shore
#

ok wait

lusty quest
#

let reason = args.slice(2).join(" ");try this

wary basin
#

^^ that too

#

Most definitely the solution

lusty quest
#

or do ```javascript
let reason = args.slice(member.name.lenth).join(" ");

tulip ledge
#

So someone told me you should always use let instead of var but now I'm wondering why is that exactly?

digital ibex
#

ziggy, im confused wym me to do?

#

var is useless chickendev

#

const and let do exactly what var does

lusty quest
#

var is deprecated

digital ibex
#

not exactly but

wary basin
#
        <thead style="text-align: center; width: 100%;">
           <th style="color: tomato; display: inline-block; width: 100%;">Custom Commands</th>
        </thead>``` isn't making it go to the middle

@digital ibex try that

lusty quest
#

its still there bcs of compablility

tulip ledge
#

My friend told me it was cuz var was function scope but that seemed weird

digital ibex
#

kk

#

nope, nothing changes

wary basin
#

Have you tried putting text-align center on the th?

hardy vector
#

pls help me i asked 5 times yesterday and no one helped i get this error

#

https://hasteb.in/adisutem.js
it does the role menu but then it crashes and gives me this error at Function.Module._load (internal/modules/cjs/loader.js:879:14)
(node:1704) UnhandledPromiseRejectionWarning: OverwriteModelError: Cannot overwrite ReactionRole model

fossil aspen
#

will my boat be approved?

tulip ledge
#

wait 2-3 weeks

lyric mountain
#

2-3 weeks or after it floats

tulip ledge
#

lol

knotty sigil
#

does someone know how can i do the custom status of a user when i do userinfo? (discord.js)

digital ibex
#

yeah

opal plank
#

not sure i understand your question

#

what do you mean DO the custom status?

#

you want to access user presence?

lusty quest
#

@hardy vector ```
const newData = {
Guild: message.guild.id,
Reaction: args[2],
MessageID: msg.id,
Role: args[1],
};

hardy vector
#

where do i put that

opal plank
#

well, im assuming thats it, so here we go

hardy vector
#

in ReactionRole.js?

opal plank
#

@knotty sigil

hardy vector
#

nvm

lusty quest
#

also you need to do Model.save()

hardy vector
#

why not newData.save()?

#

im supposed to save that data right?

knotty sigil
#

@opal plank ye user presence like if he playing something it will show it

opal plank
#

thats what i sent above

lusty quest
#

how did you then tell MongoDB that you want to save the dataset into a DB?

pure lion
lusty quest
#

@hardy vector nvm you are right

hardy vector
#

lol

#

and isnt newdata supposed to start like this const newData = new ReactionModel({

#

bc i imported the reactionrole model

#

?

lusty quest
#

forget a part of the stuff. i have running the database stuff in a different file.

#

need to sort it out to post it here

opal plank
#

hmmmm

hardy vector
#

wait so what u told me to fix

#

is wrong

lusty quest
#

not entirely

hardy vector
#

the first thing u said is right?

lusty quest
#
 client.createData = async data => {
        const merged = Object.assign({ _id: mongoose.Types.ObjectId() }, data);

        const newData = await new Data(merged);
        return newData.save();
            
    };
``` this function creates a database
hardy vector
#
const mongoose = require("mongoose");
module.exports = mongoose.model(
  "ReactionRole",
  new mongoose.Schema({
    Guild: String,
    MessageID: String,
    Reaction: String,
    Role: String,
  })
);```
#

i have that

#

for my reactionrole model

lusty quest
#
  const newData = {
                    timestamp: expireHuman,
                    auctionid: auctionid,
                    authorid: authorid,
                    highestbider: "",
                    currentbid: settings.startingbid,
                    item: item,
                    messageid: messageid,
                    channelid: config.tradechannelid,
                    url: url,
                    Platform: platformformated,
                };
                try {
                    await client.createData(newData);
                } catch (error) {
                    console.error(error);
                }
``` this sends the data to the function
opal plank
#

anyone here been using the dbl-api js module?

lusty quest
#
 const newSetting = {
        Guild: message.guild.id,
        Reaction: args[2],
        MessageID: msg.id,
        Role: args[1],
      };

  const newData = await new Data(newSetting);
newData.save()
#

change new Data to your model

#

@opal plank yes

opal plank
#

perfect

#

lemme ask you this then

#
const DiscordBotListAPI = require('dbl-api');
const dbl = new DiscordBotListAPI(config.botID, config.ggtoken, client);

requirement, now. If you look at the Client base dbl-api is, you'll see this

#

that forces a crash after a short period of time

lusty quest
#

you dont send the Authorisation Header

hardy vector
opal plank
#

does it not expect an auth header on the Client?

slender thistle
#

That doesn't look like an official library

lusty quest
#

you make a simple HTTP request i think. i use the Client but only for the Webhook

opal plank
#

using this

#

it might be for the webhook

#

though thats what im trying to hook into

#

since it already handles eventListeners, was hooking into it to trigger some commands

pale vessel
opal plank
#

did not even know there was an official one, i'll port the code to use that one

#

ty flazepe

long yew
#

can someone help me?

knotty sigil
#

someone knows how can i display gif in userinfo?

earnest phoenix
#

Use imageURLOptions @knotty sigil

knotty sigil
#

its ok

earnest phoenix
#

Or you mean like a normal gif or

knotty sigil
#

i already did it

#

dynamic: true

long yew
#

how do i get the most recently called pokemon ID (the number from the array)(log it to a DB)
then when the person writes .catch, the pokemon name that was most recently called is logged into the mons.json

lyric mountain
#

don't use json for pokemon-related stuff

#

regarding the question, you gotta store the called ID in a global var

long yew
#

ok

#

how do i make it so it stores the latest one in a spawns .json file?

lyric mountain
#

dot dot dot

#

dude

#

first of all, why don't u use a switch-case?

#

also, you do know that there are HUNDREDS of pokemons, right?

solemn latch
#

Like 700 or 800

#

It would probably be good to have a pokemon handler, like a command handler

lyric mountain
long yew
#

ik

#

i'm only doing galar region

#

and that is route 1

lyric mountain
#

still

long yew
#

those pokemon

lyric mountain
#

hardcoding it is extremely bad optimized and time-wasting

#

you should make a loop handle that for u

long yew
#

what do u reccomend me doing?

lyric mountain
#

1 - Creating a generic pokemon embed
2 - Using a rng to get a pokemon from the list and saving it to a variable
3 - Showing the pokemon info on the generic embed

opal plank
#

a json contaning properties of each pokemon would work on your case. Say, name, region, rarity, image

#

load it all on memory and access when needed

misty sigil
#

did someone say JSON

opal plank
#

do NOT do database calls for something you'll be accesing constantly

#

yes, i DID say json

solemn latch
#

Lol

misty sigil
#

nice

lyric mountain
#

you could actually get the amount of files inside pokemon folder and get a random json from it

solemn latch
#

^

lyric mountain
#

this way you'd not need to load all jsons in memory

opal plank
#

that'd be using fs quite a bit, no?

misty sigil
#

making it less intensive on the random access memory

solemn latch
#

Tbh, 800 text objects wouldnt take much ram anyway.

#

Its the images

opal plank
#

you arent loading the images

#

you loading the url's

lyric mountain
#

according to stackoverflow:

const fs = require('fs');
const dir = './directory';

fs.readdir(dir, (err, files) => {
  console.log(files.length);
});
opal plank
#

imgur or something would work great for that

solemn latch
#

I'm moving off imgur to my own cdn provider

#

I found imgur to be slow

opal plank
#

list them all, keep it on memory

#

im thinking about buying a domain

lyric mountain
#

better yet:

opal plank
#

but my shitty isp prevents me from port fowardingh

lyric mountain
#
[
  {
    "name":"Pikachu", "region":"Unova","rarity":"1","image":"someurl.com/pika"
  },
  {
    "name":"Raichu", "region":"Unova","rarity":"1","image":"someurl.com/rika"
  }
]
#

instead of 800 files in this case

opal plank
#

thats what i meant

#

obj containing the info of each pokemon out there

#

all i can say is good luck building that

#

850+ pokemons will take a while

long yew
#

i am doing galar

opal plank
#

could be automated to some extent

solemn latch
#

Could grab it from the wiki

long yew
#

regoin only

lyric mountain
#

he could probably use bulbapedia API

solemn latch
#

^

long yew
#

300 pokemon i think

opal plank
#

that'd work really well actually

opal plank
#

300 pokemon made by hand is still quite a bit

#

could at least get a premade array of all the pokemon and loop a forEach to help you at least build it

long yew
#

idk how to do that stuff

opal plank
#

unless you really eager on doing it all by hand

solemn latch
#

Its a great way to lean

#

learn

opal plank
#

^^

long yew
#

i

opal plank
#

.....

long yew
#

how do i make it so it lists the latest one spawned

#

and then i can do a .catch command

opal plank
#

you completely ignored both our switch case and json ideas, didnt you?

long yew
#

no

#

i don't understand either

#

;c

long yew
#

ok ty i'll get busy looking

#

well trying to learn

#

wow that is so hard

lyric mountain
#

if that's hard you should give up on pokecord-esque features

opal plank
#

what part of it is hard?

lyric mountain
#

they ain't easy to make

paper phoenix
#

@long yew - regarding your image, there's a chance that none of those execute.

opal plank
#

forEach loop

#

its quite simple actually

long yew
#

all of it is hard

#

@long yew - regarding your image, there's a chance that none of those execute.
@paper phoenix how?

#

if that's hard you should give up on pokecord-esque features
@lyric mountain it isn't gonna be like pokecord that much

opal plank
#

you are trying to chew more than you can bite currently

paper phoenix
#

It's picking a new random each time. So that second if, it could roll a 1.

opal plank
#

your options are to learn how to properly do it, or give up on it if you arent motivated

#

we are here to help, but you'll likely not be spoonfed

long yew
#

kk i am motivated

#

It's picking a new random each time. So that second if, it could roll a 1.
@paper phoenix how?

opal plank
#

try first doing what Kuu sugested, make a generic embed

lusty quest
#

to do the 300 db entries once i would get a proper DB first. makes handling it way easyer

opal plank
#

that'll get rid of the spaguetti code you did

#

just load it on memoery

paper phoenix
#

@long yew - Each time you can random_pokemom, it ois a new number. It could pick a number you've previously checked for.

long yew
opal plank
#

depending on how often its being called its better to have it easilly accessible rather than doing DB calls every request

solemn latch
#

One embed

#

Not one for each

long yew
#

@long yew - Each time you can random_pokemom, it ois a new number. It could pick a number you've previously checked for.
oh

opal plank
#

or make a global variable that can be accesed for the function

#

even though i dislike globals

long yew
#

this bot is gonna take me like 5 years

opal plank
#

learning a language isnt suppose to be quick

#

from the looks of it, you jumping head on something completely unknown

solemn latch
#

You have to want to learn the language tho

long yew
#

i doooooooo

paper phoenix
#

@long yew - Think about it like I had a function to flip a coin. If you have:

if( flip( ) === 'heads' )
  doStuff( );
else if( flip( ) === 'tails' )
  otherStuff( );
#

That second if flips again. And that second flip could be heads.

long yew
#

hmmm

opal plank
#

there are so many wrong things in that code, we usually just point you towards a better direction to accomplish what you want

#

like Stev said, you want to generate a number once

#

if you REALLY want to follow your way of thinking, start by doing something like

let n = randomGenerator()```
then access N
#

also switch cases

paper phoenix
#

So, if taking your approach, it should be changed to:

const pokemon = random_pokemon( arr );

if( pokemon === 1 )
  stuff( );
else if( pokemon === 2 )
...

But, as others have pointed out, switch.

opal plank
#

though for what i said, you wouldnt need any of that if you use a json to keep the object loaded in memory for being quickly accesible

#

generate the number and then match it with the object size

earnest phoenix
#

@paper phoenix use switch() or the code will be as inefficient as yandere sim

opal plank
#

index it

#

lets say the pokemon.json contains all 300 pokemon, what you can do is check for size if you put it on a map or something, then access is by number on index

#

instead of having a case for each pokemon

#

its a much better approach, nowhere near perfect though

earnest phoenix
#

@earnest phoenix what

opal plank
#

what 2

#

google translate

earnest phoenix
#

Say it in your native language

opal plank
#

bot use LANGUAGE, not OPERATIONAL SYSTEM

pure lion
#

i-

solemn latch
#

imagine a discord bot operating system

pure lion
#

ikr

opal plank
#

language = java, javascript, python
Operational system = linux, windows, mac

#

i got discord.js out fo that

#

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

earnest phoenix
#

oh u mean what you need for making a bot

#

like what processor

solemn latch
#

i got i5

earnest phoenix
#

or specs

pure lion
#

me need help w/ quick.db
i wanna implement a per-guild command disable thing, but i am unsure as to how i:
write the guild ID to the table
delete it later

#

(it says target is not an array and im retarded too)

earnest phoenix
#

do smthing like guildID.disabled.<command> and set it to true

#

then check if thats true when the command is ran and tada @pure lion

#

@summer torrent get ur ass in here ma boi

pure lion
#

i have that system in place, and it works, but idk how to delete the value

earnest phoenix
#

set it to false

pure lion
#

:D

#

if only i knew how to read docs

earnest phoenix
opal plank
#

or set it to either be there or not

pure lion
earnest phoenix
#

@earnest phoenix variable["0"]

opal plank
#

2 secs too late

#

fuck

earnest phoenix
#

Oh lemme try

#

sir can you explain the existence of a facebook account on your profile?

opal plank
#

you mean boomerbook?

earnest phoenix
#

yes

opal plank
#

i'd also like to know that

pure lion
#

my pc runs on gasoline and facebook.isis

misty sigil
#

how do i make a user info command

earnest phoenix
#

brhh

still merlin
#

I have a question, (Don't judge me), Do I put my commands like this (In a index.js file)?
if (command === 'balance') { 'Your balance.' + message.author.balance } else if (command === 'duel) { if(message.author.bot) return; **code here** } else if (command === 'leaderboard') { if(message.author.bot) return; if(!args[2]) **my code** } });

pure lion
#

uh

earnest phoenix
#

You can, or you can make an actual command handler @still merlin

pure lion
#

@still merlin use switch case uwu

still merlin
#

Okay thanks!

earnest phoenix
#

which will be useful if you have more than 20 commands

opal plank
earnest phoenix
#

since every command has its own file

misty sigil
#

constantin i cannot say how much i agree

opal plank
#

its literally highlighting the stuff thats wrong

misty sigil
#

ikr

opal plank
#

no

#

bad

#

shoo

#

dont tell people to copy paste

#

go read the docs

honest perch
#

no

opal plank
#

bad, copy paste = bad

#

im guessing you new to bot development

#

then whats that link for?

honest perch
#

it pretty bad ngl

regal raven
#

Can anyone suggest me some commands to make for my bot just to learn how to make them?

#

Hmm

opal plank
#

@still merlin remove the } before else if

still merlin
#

ok

honest perch
#

you could make a ban command idk

regal raven
#

I did

opal plank
#

actually

#

wtf

#

the best tutorial is: read the docs

#

people will copy paste that and instantly come here saying "how do i do this?"

regal raven
#

Lol

misty sigil
#

how do i make a user info command

opal plank
#

making guides is fine, but please dont provide pre-made code

#

snippets are fine like in the docs

still merlin
#

Does anyone know why this is happening? I saw it on the guide while I was trying to learn more discord.js

opal plank
#

dude

#

paste the code here

still merlin
#

if (command === 'balance') {
   message.channel.send('Your balance.' + message.author.balance)
else if (command === 'duel) {
    if(message.author.bot) return;
     //finish soon
else if (command === 'leaderboard') {
    if(message.author.bot) return;
  if(!args[2]) //finish soon
}
});```
misty sigil
#

duel doesnt have an ending quote

#

thats why its red

still merlin
#

still getting errors tho

#

and the code is


if (command === 'balance') {
   message.channel.send('Your balance.' + message.author.balance)
else if (command === 'duel') {
    if(message.author.bot) return;
     //finish soon
else if (command === 'leaderboard') {
    if(message.author.bot) return;
  if(!args[2]) //finish soon
}}}```
opal plank
#
if (command === 'balance') message.channel.send('Your balance.' + message.author.balance);
else if (command === 'duel') {
      if (message.author.bot) return;
      //finish soon
      else if (command === 'leaderboard') {
          if(message.author.bot) return;
          if(!args[2]) {} //finish soon
    };
  }``` @still merlin
#

you cant leave an if statement open

still merlin
#

o

misty sigil
#

lol i was gonna say that

opal plank
#

If(something) do (what?)

misty sigil
#

but half the time i give help it doesnt work lol

opal plank
#

though even what i sent is wrong

#

i was waiting for him to notice

quartz kindle
#

also, you're confusing single line ifs with multi line ifs

topaz fjord
#

that code just gave me an aneurysm

misty sigil
#

same turtle, same

topaz fjord
#

time to leave Tim to this because he specializes in this

quartz kindle
#

in the code above you're doing ```js
if(message.author.bot) {
return
} else if(command === "leaderboard") {

}

#

which is likely not what you want

still merlin
#

;-;

opal plank
#
if (command === 'balance') {
   message.channel.send('Your balance.' + message.author.balance)
}
else if (command === 'duel') {
    if(message.author.bot) return;
}
else if (command === 'leaderboard') {
    if(message.author.bot) return;
  if(!args[2]) {/* stuff */}
}```
#

i was hoping you'd notice

topaz fjord
#

question: have you learned js

opal plank
#

likely not

topaz fjord
#

also no @opal plank

still merlin
#

question: have you learned js
I know the basic's-

topaz fjord
#

there's no need to put if(message.author.bot) return in every single command

haughty mirage
#

@prime storm

opal plank
#

make it global

topaz fjord
#

just put it at the beginning of the message event

opal plank
#

^^

still merlin
#

ok

#

Do i put it out of the command to make it global?

opal plank
#

you know scopes?

still merlin
#

no .-.

opal plank
#

let a = 1
if(something) {
let b = 2
}
console.log(a)
console.log(b)

#

what would happen here?

#

dont run this code, its just logic

#

trying to teach you a quick lesson on scopes

still merlin
#

A is 1 B is 2 and the if something is (Havent learnt yet) and your logging a b

opal plank
#

b would return undefined

still merlin
#

ok

opal plank
#

b is inside this scope

#

if i moved console.log(b) right after let b = 2 it would work fine

#

cuz it can access that scope

#

same way for the commands you are doing

still merlin
#

ok

hardy vector
#

throw new _mongoose.Error.OverwriteModelError(name);
^

OverwriteModelError: Cannot overwrite ReactionRole model once compiled.
im tryna make a reaction role cmd but i get this error
https://hasteb.in/adisutem.js

it does the role menu but then it crashes and gives me this error

#

pls help

#

my 6th time asking

opal plank
#

make the author prevetion outside of the scopes
if(command = a) {
stuff
}
if(command = b) {
more stuff
}

still merlin
#

But I thought I should mention this is all I know (plus the doc's and guides out there for discord.js)

lusty quest
#

@hardy vector i think you somehow try to overwrite it wrong

opal plank
#

trying to read this gave me cancer, but anyway

#

hows that relateD?

hardy vector
#

im not tho

#

am i overwriting anywhere here?

still merlin
#

.-. Its not related I just wanted to mention I'm still learning like basic stuff

lusty quest
#

did you create it or update it?

opal plank
#

ah, i see

lusty quest
#

@hardy vector thats the wrong syntax for retriving data

hardy vector
#

wait so what do i do

misty sigil
#

how do i get avatarURL of a message author

opal plank
#

author has the url property

lusty quest
#

did you want to Create, Update or get the data?

misty sigil
#

does message.author return the user or member object?

lusty quest
#

message.member @misty sigil

opal plank
#

you can use author

#

it has avatar property too

lusty quest
#

@hardy vector i guess you want to update the data. then replace findOne with updateOne

pale vessel
#

does message.author return the user or member object?
@misty sigil message.author returns user and message.member returns member

misty sigil
#

so message.author.avatarURL?

opal plank
#

displayAvatarURL

pale vessel
#

yeah

#

author and member works

#

avatarURL() works too

#

you should use displayAvatarURL since it returns default avatars if the user didn't set one

opal plank
#

oh yeah i forgot that works too

pale vessel
earnest phoenix
#

xD

opal plank
#

hmmmm

#

auto dm

winter basalt
#

sounds illegal to me

opal plank
#

sounds like unsolicited marketing

solemn latch
misty sigil
misty sigil
misty sigil
#

user.bot is undefined

opal plank
#

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

lusty quest
#

is your user defined?

misty sigil
#

yea

lusty quest
#

where did you get your user from?

#

message.author.bot

#

should also work

misty sigil
#

wait a sec

lusty quest
#

iirc will return a boolean

misty sigil
#
let member = message.mentions.members.first() || message.member,
    user = member.user```
lusty quest
#

both return the user object so member = user

summer torrent
#

pong

lusty quest
#

wait? why did you want to get the user object of a member?

summer torrent
#

@summer torrent get ur ass in here ma boi
@earnest phoenix AngryEyes

lusty quest
#

it would be easyer to get message.author and message.mentions.users.first()

earnest phoenix
#

lol

misty sigil
#

user object of member, im making a user info command

opal plank
#

technically bots can only be used in testing right? not sure if doing an eval here would be fine, since it likely doesnt have perm to post here regardless

misty sigil
#

yea

opal plank
#

much easier to show it here right away than going and showing an example in testing

misty sigil
#

which testing channel?

opal plank
#

either works

misty sigil
#

2

marble geode
#

you need lockdown and unlockdown command ?? see my channel :)

earnest phoenix
#

no

#

coding on mobile and hosting on glitch smh @marble geode

#

also ads

lusty quest
#

if i wanted i could make a lock and unlock command myself

earnest phoenix
#

^

opal plank
#

not like its hard

lusty quest
#

cant be more annoying than switching the code from Mysql to MongoDB

opal plank
#

i'd recommend postgres, but mongo is fine too

lusty quest
#

took me 3 days to learn the backend stuff for getting the mongoDB server running and then getting 3 of them Running in a Cluster

#

i dont switch again

#

after i changed one bot already

hardy vector
#

@hardy vector i guess you want to update the data. then replace findOne with updateOne
@lusty quest wait but they told me i was overwriting it somewhere

lusty quest
#

its all i can say bcs there was the wrong syntax for getting the data i guess. or did you got somewhere a save down there?

earnest phoenix
#

I can send embed with webhooks?

pure lion
#

idk, do you wanna?

earnest phoenix
#

the bot say

2020-06-26T16:28:35.522037+00:00 app[worker.1]: (node:4) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send an empty message```
pure lion
#

send code

#

what is anti?

#

also use a timeout function

#

oh

#

do you have ms npm?

earnest phoenix
#

help anyone

#
const bots = await Bots.find({ 
  state: "verified"}, { _id: false, auth: false })
#

i want sort it by desnding

opal plank
#

need more info

#

lib? lang?

#

what is Bots

#

looks like a DB call

earnest phoenix
#

const bots = require("@models/bots.js")

misty sigil
#

why is my member.bot returning true for bots and undefined for users

opal plank
#

i told you

#

member.user.bot

#

member doesnt have a bot property accesible in it

#

you need to access user for that

surreal notch
#
Print(abc)```
earnest phoenix
#
const Bots = require("@models/bots");
const bots = await Bots.find({}, { _id: false, auth: false })
 return bots.filter(bot => bot.state != "deleted")
#

help me

#

i want make it sorted by descending

#

thats Mongoose or MongoDB

summer torrent
#

where is your .sort()

misty sigil
#

how do i use id as a ui command arg?

earnest phoenix
#

Where i can find yt api?

#

can you help me with making a discord.js bot because i try making one and it never gets online

misty sigil
#

alex

#

whats ur code

#

@earnest phoenix

earnest phoenix
#

wait

misty sigil
#

k

earnest phoenix
#

bruh

#

i think my code is outdated

#

shit

misty sigil
#

what is it

earnest phoenix
#

its old

misty sigil
#

where did you copy paste it from

earnest phoenix
#

the problem is im still learning javascript and i still havent found a way to get it online

still merlin
#

Each time a user executes a command and its has one of a pokemon on it or buys a pokemon how do I display the pokemon they have-

misty sigil
#

DB

#

@earnest phoenix Show us the code and any errors

still merlin
#

Alright thanks

earnest phoenix
#

const discord = require ('discord.js');

var client = new discord.Client();

const token = "token";

client.on("ready", ()=> {
console.log("Ready!");

client.user.setActivity ("sw! help " (type: "GAMING"))
});

newFunction();

function newFunction() {
cost;
prefifx = "sw!";
}

client.on ("message". (message)) => {

};

#

that

misty sigil
#

const token isnt actually your token

earnest phoenix
#

oh

misty sigil
#

but you censored im a dummy

earnest phoenix
#

then what

misty sigil
#

you don't have client.login(token)

#

and token should be replaced with your bot token

earnest phoenix
#

i know that

#

i censored it

misty sigil
#

then put client.login

earnest phoenix
#

k

#

then whats client token

#

const

misty sigil
#

const token = "your token"

earnest phoenix
#

yes

#

i added my bots token there

misty sigil
#

then just type token in client.login

#

client.login(token)

earnest phoenix
#

k

#

also i havent checked that out but is the discord.js tutorial from the website accurate and does it work

misty sigil
#

yes

#

obviously

solemn latch
#

extremly good guide pikathink

hardy vector
#

throw new _mongoose.Error.OverwriteModelError(name);
^

OverwriteModelError: Cannot overwrite ReactionRole model once compiled.
im tryna make a reaction role cmd but i get this error
https://hasteb.in/adisutem.js

it does the role menu but then it crashes and gives me this error

#

someone else said its cos im defining schema twice but im not

earnest phoenix
#

Is it possible to extend the GuildMemberManager structure from discord.js?

still merlin
#

Is Math.floor(Math.random() * 6 + 1) a random number between 6 and 1?

hardy vector
#

yes

still merlin
#

ok thanks

digital ibex
#

@earnest phoenix yeah, with classes

#

does anyone know if its possible to check if a message is an image? im using eris btw

#

i cant find anything in the docs about it

earnest phoenix
#

I mean... That's what I'm trying to do...
RangeError: "GuildMemberManager" is not a valid extensible structure.

solemn latch
#

didnt tim explain extensions

digital ibex
#

what does ur code look like?

solemn latch
#

^

#

example of extentions

earnest phoenix
#
return class GuildMemberManager extends GMM.BaseManager{
Newest(Amount){
return this.cache.map(m => m).sort((a, b) => a.joinedTimestamp - b.joinedTimestamp).map(m => m.user.tag).reverse().slice(0, parseInt(Amount));
}
}
});

message.guild.members.Newest(1);```
digital ibex
#

yeah

#

oh wait, ur not using classes?

earnest phoenix
#

class... You see it

digital ibex
#

oh woops

#

u can just do something as simple as: ```js
const { GuildMemberManager } = require('discord.js'); // or however u get GuildMemberManage from d.js
class E extends GuildMemberManager {

someting() {
return // cde
}
}```

earnest phoenix
#

Umm

digital ibex
#

im not sure about the Discord.Structure.extend bit and what its really needed for

#

im not sure

earnest phoenix
#

Umm, i don't think that's how it's but imma try

lusty quest
#

does someone know if you can switch Booleans in a mongoose query? want to invert the boolean

final summit
#
@bot.command()
async def giveaway(ctx, channel, duration, winners, item):
    embed = discord.Embed(
        title = "**Giveaway**",
        description = item + "\n **React with ๐ŸŽ‰ to enter!** \n **Number of winners: **" + winners + "\n **Ends: **"
    )
    msg = await ctx.send(embed=embed)
    await msg.add_reaction('๐ŸŽ‰')

Whenever i use the command
it doesnt specify a time
even tho i said 2m
lol

slender thistle
#

surely it's because you're not adding duration to the string

earnest phoenix
#

How To Make A Bot Unlimited Host Time?

misty sigil
#

host it on a vps

earnest phoenix
#

What Is VPS?

still merlin
#

Virtual private server

earnest phoenix
#

But How?

still merlin
#

First buy one

#

and put your bot on it

earnest phoenix
#

Are They Are Any Way To Get It for Free?

still merlin
#

or you could host a bot on a rasbery PI

topaz fjord
#

no

amber fractal
#

no free hosting is 24/7

still merlin
#

Free option - rasbery PI hosting. (Ideal for small bots)
Expensive or cheap option - vps. (Ideal for big bots)

misty sigil
#

how do i get user object from ID

earnest phoenix
#

If I Hosting It From Rasbery Or VPS Are My Bot Still Work?With The Commands I Set In

#

Using Discord Bot Designer App?

misty sigil
#

aslong as you upload all the code

#

so, how do i get the user object from a member object?

amber fractal
#

in d.js?

misty sigil
#

yes

amber fractal
#

member.user

still merlin
#

If I Hosting It From Rasbery Or VPS Are My Bot Still Work?With The Commands I Set In
@earnest phoenix If you upload your code to them it should work

amber fractal
misty sigil
#

ty for the docs btw

pure lion
#

can i set a per-guild custom prefix with quick.db?

lusty quest
#

yes

misty sigil
#

member.joinedAt is displaying BST, which it was when I joined
user.createdAt is returning a GMT time, which was when I made my account
how could I convert this into GMT

still merlin
#

I haven't toutched this file and I get a error- could someone please help (My main file is client.js and the first line is requering fs)

 C:\Users\Jon\Desktop\Pokedex\node_modules\uuid\dist\esm-browser\index.js:1
export { default as v1 } from './v1.js';
^^^^^^

SyntaxError: Unexpected token 'export'
    at wrapSafe (internal/modules/cjs/loader.js:1050:16)```
lusty quest
#

it cant handle the export

amber fractal
#

what's your node version

still merlin
#

I havent exported anything though

opal plank
#

usualyl you use module.export

#

not exports

amber fractal
#

well depends

opal plank
#

export is ES6 syntax

amber fractal
#

that's an es6 export

still merlin
#

I haven't even written in index.js

amber fractal
#

Do node -v

#

tell me the output

still merlin
#

and I don't even know how to work modules export .-.

#

v13.3.0

amber fractal
#

es6 works in node 14

opal plank
#

14 is the newest iirc

amber fractal
#

you'll need to update

still merlin
#

How do I do that without it braking my bot

opal plank
#

nothing should break

amber fractal
#

you can try to run it in harmony mode instead, but updating node shouldnt break your bot

still merlin
#

Okay

opal plank
#

change the package data to match the proper node version

still merlin
#

How do I update node? is it like a command prompt or terminal thing or a pc installing prosess?

misty sigil
#

member.joinedAt is displaying BST, which it was when I joined
user.createdAt is returning a GMT time, which was when I made my account
how could I convert this into GMT

amber fractal
#

are you on windows or linux?

still merlin
#

windows

amber fractal
#

should be a simple download

still lily
#

so im making a bot in python that reads one line off a document then deltes it but my code deletes everything on the document, can anyone help?

amber fractal
#

@misty sigil that just returns a date, which defaults to the OS's timezone you can use <Date>.toUTCString() to get the gmt string (gmt and utc are basically the same)

#

gmt is just utc+0 anyways

digital ibex
#

HI, i have this code: js switch (message) { case message.content.length: embed.fields.push({ name: 'Content', value: message.content.slice(0, 350), inline: true }); embed.fields.push({ name: 'Deleted By', value: `<@!${us}>`, inline: true }); break; case message.attachments.length: embed.image = { url: message.attachments[0].url }; embed.fields.push({ name: 'Content', value: message.content.slice(0, 350), inline: true }); embed.fields.push({ name: 'Deleted By', value: `<@!${us}>`, inline: true }); break; } and when a message gets deleted, its just saying a messgae has been deleted with no fields, i have this switch statement to add the fields.

#

any ideas what im doing wrong?

amber fractal
#

can you show more the the surrounding code?

digital ibex
#

kk

pure lion
#

trying to set new prefix

  let GuildPrefix = await commandBLdb.get(`GuildPrefix.${msg.guild.id}`)

  let prefix;

  if (GuildPrefix == null) {
    prefix = PREFIX
  } else {
    prefix = GuildPrefix
  }

  if (msg.author.bot) return;

  let args = msg.content.substring(PREFIX.length).split(" ");
  let _command = msg.content.toLowerCase()
  if (!_command.startsWith(prefix)) return;

ive set a new prefix but its not working at all, even with the new prefix

digital ibex
amber fractal
#

One sec

misty sigil
#

yeesh

#

.avatarURL doesn't appear to be returning a url

digital ibex
#

o ok

#

and wym jeremy?

misty sigil
#

i mean it's not showing up on my embed

amber fractal
digital ibex
#

steven, theres no way i can use- yeah

amber fractal
#

@misty sigil are you on d.js v12?

digital ibex
#

im just trying to optimise my code

#

lol

misty sigil
#

yes

amber fractal
#

then it's a function

digital ibex
#

oki, i'll just use if else

amber fractal
#

.avatarURL()

digital ibex
#

thank

amber fractal
#

yep

misty sigil
#

now just to get BOT emoji working lmao

quick copper
misty sigil
#

reqEvent isn't a function

#

you'd need to make it a function

digital ibex
#

hi, im kinda confused how to explain this. when i delete an image, it logs js [ { width: 910, url: 'https://cdn.discordapp.com/attachments/702241622926295092/726153425804591164/unknown.png', size: 29349, proxy_url: 'https://media.discordapp.net/attachments/702241622926295092/726153425804591164/unknown.png', id: '726153425804591164', height: 514, filename: 'unknown.png' } ] so i do message.attachments[0].url and it gets the image, but doesn't embed..

quick copper
#

Jeremy how i do it?

#

im pretty noob

digital ibex
#

you can try learning javascript

quick copper
#

into this

bold sundial
#

do something like let ImageEmbed = message.attachments[0].url then create a normal embed message.channel.send(ImageEmbed)

#

@digital ibex ^

quick copper
#

yea

#

help me pls

digital ibex
#

im confused what thats gonna do...

quick copper
#

CalumT Can you help me

digital ibex
#

my issue, is that it doesn't embed. no idea why, it was embedding before, and now its not

bold sundial
#

CalumT Can you help me
@quick copper using => is for a function which reqEvent isn't a function

quick copper
#

amd what should i changed for?

pale vessel
#

try proxyURL @digital ibex

digital ibex
#

i tried that too, still doesn't embed for some reason

#

wait, proxy_url or proxyURL ?

pale vessel
#

proxy_url, my bad

digital ibex
#

yeah, that one doesn't embed either

pale vessel
#

what do you mean by "doesn't embed" by the way

#

it doesn't show up on discord or it doesn't show up in an embed?

quick copper
#

anyone help me trought dm?

limber swan
#

Im trying to use mongodb but when I try to create the new db with the settings in the ready events it throws me this error:
TypeError: client.guilds.keyArray is not a function

pale vessel
#

that's because it's access denied

#

it probably works on an actual embed where you set the image as

digital ibex
#

and doesn't show up in the discord embed, i replace it w my avatar and does

pale vessel
#

that's weird

#

have you tried fetching it first?

#

from the machine

quartz kindle
#

@digital ibex both images are deleted from discord when a message is deleted

#

the urls you get might still work for a few seconds but they will eventually be gone

digital ibex
#

oh

quartz kindle
#

so both the embed and the url will stop working

pure lion
#

GUYS

digital ibex
#

oof

pure lion
#

GUYSHSJSJSJSJSJ

#

I think my bot is stable-

#

:D

quartz kindle
#

if you want to preserve the image, you need to download it and resend it as a new image (if there is enough time to download it)

limber swan
#

Im trying to use mongodb but when I try to create the new db with the settings in the ready events it throws me this error:
TypeError: client.guilds.keyArray is not a function

quartz kindle
#

discord.js? v12?

limber swan
#

mhm

digital ibex
#

that makes sense, it was working perfectly fine the whole time lol

quartz kindle
#

client.guilds.cache

limber swan
#

client.guild.cache.key..?

digital ibex
#

thanks for the clarification :)

quartz kindle
#

yes

limber swan
#

thanks

earnest phoenix
#

(process:76276): Pango-WARNING **: 20:43:55.846: couldn't load font "Helvetica Not-Rotated 30px", falling back to "Sans Not-Rotated 30px", expect ugly output. anyone know how to get around this in canvas?

quartz kindle
#

did you use registerFont()?

earnest phoenix
#

I have to use that?

#

I thought it can access through the system's fonts

quartz kindle
#

its good practice to preload the fonts you use, even if they are system fonts, to prevent possible issues

earnest phoenix
#

since Helvetica is a sans-serif font

#

ok

quartz kindle
#

on some systems for some reason it doesnt find system fonts some times

pure lion
#

Can someone run me through what I'd need to make a bot dashboard

quartz kindle
#

knowledge of full stack development

pure lion
#

Shit

#

*proceeds to become the youngest full stack dev on earth*

quartz kindle
#

full stack includes webserver, network configuration, domain names and dns, databases, client side html css and js

#

possibly more things

pure lion
#

F unck

warm marsh
#

domain names and dns?

quartz kindle
#

there's always a chinese kid thats better than you btw

pure lion
#

Idc

#

:(

#

Also I can just use my Pi as a webserver

quartz kindle
#

@warm marsh if you want to buy a domain name for your website/dashboard

pure lion
warm marsh
#

Would it not come under knowledge of "dns" though?

earnest phoenix
#

running a website on your home network isn't the smartest idea

pure lion
#

I may or may not have kickass internet

quartz kindle
#

you could put them together i guess, but buying a domain is kinda different than configuring it (i did put them together under a single comma separator)

pure lion
#

I really wanna be verified okay

steel dirge
#

.

warm marsh
#

Fair enough.

earnest phoenix
#

I may or may not have kickass internet
it doesn't matter, you're actively exposing your home network to ddos attacks and exposing your ip to anyone lol

pure lion
#

Okay true

#

I'll use a proxy! :$

quartz kindle
#

use cloudflare

earnest phoenix
#

did you use registerFont()?
@quartz kindle registerFont('Helvetica.ttf', { family: 'Helvetica' }); same error

#

i've probably done something wrong

pure lion
#

use cloudflare
Noted

quartz kindle
#

did you copy helvetica.ttf to the same folder?

earnest phoenix
#

yes

ivory pebble
#

Are webhook tests working for anyone?

quartz kindle
#

what about Not-Rotated, whats that?

ivory pebble
#

Nothing happens when I click the test button

earnest phoenix
#

idk that just comes up randomly

quartz kindle
earnest phoenix
#

yep

quartz kindle
#

not sure how canvas uses pango behind the scenes, but its possible that the issue has to do with concurrency

#

are you doing concurrent drawing of some sort?

earnest phoenix
#

yes

#

i just draw a background image

quartz kindle
#

can you show code?

earnest phoenix
#

yh ill sourcebin

ivory pebble
earnest phoenix
#

I have roundRect as a function

amber fractal
#

It isnt meant to show anything

#

you'd get a request to your webserver

#

not the best for accessibility reasons though, I agree.

#

unless it said that it sent a request, which I actually forget if it's meant to

#

I havent have a bot on dbl in a while

ivory pebble
#

@amber fractal It shows a pop up

#

Its not even sending any requests

#

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

#

And I try to vote for any bot it says there is an error

quartz kindle
#

@earnest phoenix 2 thoughts: i'd move the registerfont to before the canvas is created, just to make sure, ie right after canvas is required. also, i'd probably do the same for all async functions such as loadImage. Im pretty sure canvas should be well protected for this, but its quite possible that the context switching here could lead to unforeseen issues

#

for example, you start drawing, you stop drawing to load an image, while the image is loading another command starts drawing on another canvas before the previous is finished

#

in theory this shouldnt cause any issues, but who knows, its better to be safe

limber swan
#

someone uses mongodb?

quartz kindle
#

also im not sure what adding "not-rotated" to the font does, you can try removing it to see if there's any changes

earnest phoenix
#

na I didn't have it there before

#

I added it to see if it does anything different

quartz kindle
#

ah

#

better remove it then

#

are you on windows?

earnest phoenix
#

yep

#

yes

quartz kindle
#

the issue with pango font loading on windows is quite recent, about 1 month old, while the last node-canvas release is almost a year old

earnest phoenix
#

yh saw it on github

quartz kindle
#

some possible suggested fixes is using registerFont with the full font url from the windows fonts folder

calm goblet
#

And I try to vote for any bot it says there is an error
@ivory pebble I had that issue a few days ago. Is your internet good?

earnest phoenix
#

some possible suggested fixes is using registerFont with the full font url from the windows fonts folder
@quartz kindle the font registered

ivory pebble
#

Its been shit the past few days

earnest phoenix
#

issue is fixed

ivory pebble
#

I'm actually replacing my modem right now lmao

earnest phoenix
#

ty for the help

quartz kindle
#

ah cool

#

what fixed it?

calm goblet
#

Ok my internet was slow and that is why I could vote for anything so maybe that is the problem for you @ivory pebble

ivory pebble
#

ok

#

I'll try it after I fix my internet

earnest phoenix
#

what fixed it?
@quartz kindle just putting it under the params

#

I'll try it after I fix my internet
@ivory pebble damn technician out here

ivory pebble
misty sigil
#

How do I

  1. Use ID for ui command
  2. Use the format param for .avatarURL
quartz kindle
#

avatarURL({format:bla})

earnest phoenix
#

client.users.cache.get(args[0]) @misty sigil this is how I get the user's id

misty sigil
#

can i remove cache?

earnest phoenix
#

if you're on v11

#

then yh

misty sigil
#

im on v12

earnest phoenix
#

then you have to keep it

quartz kindle
#

you can use fetch to get uncached members