#development

1 messages · Page 799 of 1

smoky quartz
#

it has the token in it

#

go to ur dev portal and reset

static trench
#

i regened

smoky quartz
#

ah ok then

static trench
#

i have new token

earnest phoenix
#

Good

#

See my code doesn't have my token

static trench
#

ok! i got less errors from the quickstart site

earnest phoenix
#

I load it in from environment

smoky quartz
#

my token is in another file

#

it loads it in on boot

#

saves me being an idiot and sharing it

earnest phoenix
#

Ye

#

I use like 5 diff api keys for my bot

static trench
smoky quartz
#

i still need to work out webhooks so i can set up voting and some donation rewards

static trench
#

thats whats happening?

earnest phoenix
#

Invalid syntax.

static trench
#

crap... i leaked my token

earnest phoenix
#

Read the error.

smoky quartz
#

and ur gonna need to reset token again

static trench
#

how do i fix the syntax?

smoky quartz
#

they shouldnt be on the same line

static trench
#

huh?

earnest phoenix
#

Start with en empty code before you stick in a tutorial bot. Btw

smoky quartz
#

should be python client.run import

#

with the other shit that i cba writing

static trench
#

there is half a million errors

earnest phoenix
#

@static trench do you have any python experience at all?

static trench
#

a little

smoky quartz
#

how much

static trench
#

i did python in school before new years

earnest phoenix
#

Also. Delete al of it. Then paste in a starter bot.

static trench
#

what?

#

where can find starter bot?

#

github?

earnest phoenix
#

You have 2 bots in that file.

smoky quartz
#

because you should be able to fix syntax errors

static trench
#

@smoky quartz yes

#

i should . but i cant

earnest phoenix
#

I'd highly recommend a python tutorial

static trench
#

😉

#

ok

#

one se

earnest phoenix
#

Before you get into bot making

#

You can't do much if you don't know how to use your tools

static trench
#

where can i get a bot to throw into pycharm jsut to feel good about myself?

smoky quartz
#

fr if you cant fix syntax you wont be able to get a bot done in a reasonable amount of time

static trench
#

i remmeber seeing one on github

smoky quartz
#

smh script kiddie

earnest phoenix
#

@static trench that quickstart bot I sent

static trench
#

huh?

earnest phoenix
#

As long as it's the only thing in the file

smoky quartz
#

delete everything in there

#

paste that code

#

run

static trench
#

from discord.ext import commands
import logging
import discord

logging.basicConfig(level=logging.WARN)

def get_prefix(bot, message):
prefixes = ['%','>']
if not message.guild:
return '%'
return commands.when_mentioned_or(*prefixes)(bot,message)

bot = commands.Bot(command_prefix=get_prefix)

@bot.event
async def on_ready():
print("Bot ready!")

@bot.event
async def on_message(message: discord.Message):
if message.author.bot:
return

if message.content == "hello":
    await message.channel.send("hi")
await bot.process_commands(message)

bot.run("token")

#

that?

earnest phoenix
#

That should work yes.

static trench
#

ok

#

it didnt work

smoky quartz
#

how didnt it

static trench
#

there was a ton of errors!

smoky quartz
#

like

static trench
#

its still offline

earnest phoenix
#

It's probs one error and a stack trace btw

smoky quartz
#

did you put a token in

#

or leave it as 'token'

static trench
#

i put in the token

earnest phoenix
#

Imma hop on my laptop. This is wiwrd.

static trench
#

ok

earnest phoenix
#

I see zero reason why that doesn't work

static trench
#

it brings up another file called "connector/py"

#

what do i do?

earnest phoenix
#

The heck wym

smoky quartz
#

inb4 he hasnt even downloaded the lib or something

earnest phoenix
#

2 secs

static trench
#

i have to go . thanks 4 ur help! @earnest phoenix i will learn python and try again .

#

if you get it to work . feel free to DM me

earnest phoenix
#

i mean

#

and it works fine

static trench
#

ok

earnest phoenix
#

so i am very confused, unless @smoky quartz you have any idea?

smoky quartz
#

only error i get is yelling at me cos i dont have pynacl

static trench
#

i cant put my token in the one from github

earnest phoenix
#

wym, ben

#

which one from github

static trench
#

yes

smoky quartz
#

otherwise its fine

#

just ran it then and it worked

static trench
#

i cant imput my token antwhere

earnest phoenix
#

if you're talking about the one i sent, it goes there

#

or just change os.env(wqerthjgkh) to yours

static trench
#

i probably havnt installed python right . i have to go . i will try to figure it out! thanks for your help

earnest phoenix
#

trying is good ^.^

#

cya

static trench
#

thx

pine bear
#

Ahem, sorry for repeating myself but . . .
It says error for some reason

(node:2712) UnhandledPromiseRejectionWarning: Error: An invalid token was provided.

When I put the token in the config.json file that happened, it also said this along with the warn code.

(node:2712) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 3)
(node:2712) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

here is the code again

const Discord = require('discord.js');
const { prefix, token } = ('./config.json');
const client = new Discord.Client();

client.once('ready', () => {
    console.log('Bot is now online!');
})

client.login(token);
hoary elm
#

Reset your token and add it again

low wasp
#

@pine bear try regenerating the token, if you are also uploading to GitHub don't upload the token as it will get auto regenerated

hoary elm
#

Well could use a .gitignore to ignore the file with the token in it on upload but yeah that too

pine bear
#

so I have to regenerate the token and replace the token but the token works

#

it's from the config file also if I replace the "token" in client.login(token) with the original token the bot comes online.

hoary elm
#

@pine bear so then it's having a problem reading it from the config try something like this

const config = require('./pathToFile');
const Prefix = config.prefix;
const token = config.token
earnest phoenix
#

do console.log(token) once

hoary elm
#

Should allow you to call it VIA token

pine bear
#

That's the exact thing I did

hoary elm
#

Nah you have them together

#

{ prefix, token }

#

It's obviously not liking that

sudden geyser
#

I mean, you never actually called the require function.

pine bear
#

Damn,

hoary elm
#

^^ that to

earnest phoenix
#

oh

#

lmao

low wasp
#

We dumb

earnest phoenix
#

that would explain it

pine bear
#

I'll separate them thank you

pine bear
#

uhh?

low wasp
#

const { prefix, token } = require('./config.json')

#

Not

#

const { prefix, token } = ('./config.json')

sudden geyser
#

you're trying to get the properties from a string, which obviously does not exist

hoary elm
#

@pine bearalso make sure when you do the path to the file you do const name = require('path') you forgot the require

pine bear
#

Ok thank you for the help

hoary elm
#

np

lavish seal
#

or maybe i didnt define error

#

hmmmm

earnest phoenix
#

above you're using err

#

just below it you use error

#

they need to be the same

lavish seal
#

ill uh

#

ill just delete that

#

xD Thanks

hoary elm
#

Lol

neat ingot
#

What do yall do for showing the uptime of your bot?
I have a boottime variable that gets set when everything is initialized, but discord.js client also has an 'uptime' variable thats based on when the bot client entered the 'ready' state in ms. Which one would you show? or both?

amber fractal
#

the uptime is probably more accurate

#

well

#

It probably wouldnt matter

#

I'd just use uptime because it's already there

#

I dont know a whole lot about python

#

try player != "rock" or player != "paper" or etc

#

or you could player not in ["rock", "paper", "scissors"] as well

neat ingot
#

uptime really isnt accurate though

#

it shows my server rebooted 24 minutes ago

#

but it didnt, there was no issue whatsoever

#

not even a lagg

amber fractal
#

then use and if it's not equal to any

#

so that was mb

#

player != "rock" and player != "paper" and player != "scissors"

bitter lark
#

my bot wont show its status, whats the correct code?

#

lemme send

#

i cant even find it now

#

i didnt save it

#

whats the correct code? and btw im using discord.js

balmy lantern
#

How do you grow servers better?

stable horizon
#

Have a good bot?

pine bear
#

Lmao, I started to add commands into the bot

earnest phoenix
#

would this be right?

server.member_count
#

or should there be:

len(server.member_count)
#

or:

len(server.members)
#

can someone help?

stable horizon
#

Lang?

hoary elm
#

May help if you provide what language

earnest phoenix
#

Python

stable horizon
#

Looks like py

#

Dpy?

earnest phoenix
stable horizon
#

len(guild.members)

earnest phoenix
#

ok thank you

stable horizon
#

Err sorry, that wouldn't work for very large guilds

#

Use guild.member_count yeah

earnest phoenix
#

and guild would be:

guild = discord.guild
#

am i right?

stable horizon
#

No

earnest phoenix
#

oh?

stable horizon
#

I have a tag for this

#

Python is an OOP (Object Oriented Programming) language...it uses the concepts of objects to house information about things. The most important thing to understand is the difference between a Class and an instance .

A Class defines what an instance of said class will look like, and an instance is an object created based on that class. An example would be a Class of Fruit....an instance of this class could be apple.

An example seen in discord.py is this:
discord.Guild.id

This id attribute is an attribute of the class Guild....This means to use it you must have an instance of the discord.Guild class. This can be obtained in a number of ways, through a message: message.guild through searching by id client.get_guild(id) etc.

TL;DR: OOP is a very base concept of python, if you do not understand OOP then learn this first before creating a bot.
(Yes, static methods and classmethods exist....this is only detailing the basic class/instance interaction)

balmy lantern
earnest phoenix
#

you dont

#

iirc

#
TypeError: object of type 'property' has no len()
#

whats the line of code

#

that is an error

#

ik

#

send code

#
server = discord.Guild

embed.add_field(name='No. of server members: ', value=f"`{(len(server.member_count))}`", inline=False)
#

guild.member_count

#

no len

amber fractal
#

an int doesnt have a length

earnest phoenix
#

oh?

#

ye

#
value=f"`{guild.member_count}`"
#

wouldnt it be server though?

#

nope

#

since: server = discord.Guild

#

no

#

discord.Guild is a CLASS

#

right

amber fractal
#

you'll want to get the current guild (if it's a command, prob ctx.guild)

earnest phoenix
#

ye

#
embed.add_field(name='No. of server members: ', value=f"`{ctx.guild.member_count}`", inline=False)
#

ooo

#

i never thought of that

#

also in python, to say a var is a type, you do this:

a: int = 4
b: discord.Guild = ctx.guild
#

etc

#

but ye follow @stable horizon's advice and learn how OOP works before you get into that

stable horizon
earnest phoenix
#

um

stable horizon
#

lol

earnest phoenix
#

literally the message above you xD

#

what if: TypeError: 'property' object is not iterable

slender thistle
#

Type annotations don't do anything in Python though?

stable horizon
#

not normally

#

dpy they do

slender thistle
#

Yeaeh

copper cradle
#

didn't know you could declare static type vars in python

slender thistle
#

So tecnically s: Guild = message.guild is redundant

stable horizon
#

its for those people

slender thistle
#

Ah yes

#

🤣

stable horizon
#

or the people who have stupid partners in a collab

#

"hey ffs this isnt supposed to be a bool"

earnest phoenix
#

but @slender thistle is helps with autocomplete

stable horizon
#

tis true

earnest phoenix
#
g: discord.Guild
for g in bot.guilds:
 adsfghjk,m
stable horizon
#

and gives pycharm an aneurism when i pass a "wrong" value

earnest phoenix
#

^

slender thistle
#

Understandable

earnest phoenix
#

its handy in dpy too

slender thistle
#

Yep

earnest phoenix
#
@commands.command()
async def yeet(self, a: int, b: int):
 print(a+b)
stable horizon
#

ngl ive started implementing converter-esque stuff into other user-input-required stuff

#

just cause its so nice

slender thistle
#

Explicit over implicit

earnest phoenix
#

i use vs code

#

lol

#

dead chat as soon as i speak

stable horizon
slender thistle
earnest phoenix
#

Alright, so I'm using a node.js library named sharp by lovell, and I'm trying to create a donation "goal" thing.
So I want there to be my input of how much I've raised, and I want the green bar to go to that value on the thermometer, here's my current code:

        var raised = parseInt(args[0])
        sharp("./data/greenbar.png")
        .extract({top:0, left:0, width:20, height:Math.floor((55000-raised)/100)+100})
        .resize(367,733)
        .composite([{
            input:"./data/goal.png",
        }])
        .toFile("./data/flush_GOAL.png").then(() =>{
            msg.channel.send({
                files: ["./data/flush_GOAL.png"]
            });
        })
earnest phoenix
#

how do you remove a single complex array object?

#

for example my array is like this:

[{
name: "Fiqstro",
age: 14,
nationality: "Vietnam"
},
{
name: "Eshi",
age: 14,
nationality: "Vietnam"
}]
#

how do i remove the first one using enmap

neat ingot
#

my bot got approved sooner than i was anticipating. what should i do now? just setup the api and stuff to update guild and player counters? setup voting and such?

lethal stratus
#

set it up so it does what you want it to do!

#

It's not like it being accepted means you are not allowed to test and edit it!

earnest phoenix
#

Or maybe they were looking for ideas..?

lethal stratus
#

Ah

#

Well, in that case, im going to be asking a similar question. What are any thoughts on what to add to my bot?
( @tawdry glen )

neat ingot
#

it already did what i wanted before i applied 😄

lethal stratus
#

ah

neat ingot
#

I was going to change the markdown description for an iframe to show my bot information from my site. but the preview thing isnt showing the iframe content. Should i test publish the edit and keep all markdown and make sure that the iframe shows before i remove the markdown? or should the preview page show the iframe?

lethal stratus
#

maybe do it locally

#

I have my bot's description written specifically for the top.gg site

#

(if you look here)

#

-botinfo @tawdry glen

gilded plankBOT
#
h37
Bot info
ID

656626994251038727

Username

h37

Discriminator

1674

Short Description

A bot that allows many simple but fun commands to spice up your discord server experience.

Library

discord.js

Prefix

-=

Total Upvotes

1

Monthly Upvotes

0

Server Count

No server count

Owner(s)

@lethal stratus

Links
lethal stratus
#

Oh there is no link to the site

hoary elm
#

The Bot page link? Click the name 😏

neat ingot
#

do it locally? how can i test that topgg will show my iframe properly locally? 😄

quartz kindle
#

just publish and then edit

#

save a backup of your current setup so you can always go back to it if it doesnt work

#

but the iframe should work, check your console log to see if there is any error in the iframe

#

its possible that is being blocked by cors

neat ingot
#

yea i was checking my sites log, it showed that the page was being contacted fine. i'll just backup the markdown and test the edit i guess 😄

quartz kindle
#

check the browser console.log when you load the page that has the iframe

flat pelican
#

Firstly, wrong channel

hollow sequoia
#

Sorry

flat pelican
#

Secondly, you can resubmit your bot if you removed your command

hollow sequoia
#

How?

flat pelican
hollow sequoia
#

I dont want to wait 2 weeks ;(

#

Sad

#

/top10 isn't a server list command it shows levels

flat pelican
#

It still lists all servers

hollow sequoia
#

Ah

#

Okey

#

I understand

earnest phoenix
#

php I can edit json file?

#

that I could resolve this request js con.query(`SELECT * FROM prefix WHERE id = '${message.guild.id}' `, (err, rows) => { if(err) throw err; let prefix = rows[0].prefix;

#

in this code

#

what

quartz kindle
#

php? that is not php lol

earnest phoenix
#

i want to ask the prefix to run the music bot but it does not work await problem write what to do please help

#

await problem

quartz kindle
#

you want a custom prefix?

earnest phoenix
#

yes

#

SQL

quartz kindle
#

where do you have that code?

#

con.query

earnest phoenix
#

sql store is good too but for musicbot please download but i get error code await

quartz kindle
#

what

earnest phoenix
#

I store the prefix in mysql

quartz kindle
#

yes, and where is your sql code?

earnest phoenix
#

when i get it with conn.query, then the bot writes an error await

quartz kindle
#

show the con.query code

earnest phoenix
#

con.query(`SELECT * FROM prefix WHERE id = '${message.guild.id}' `, (err, rows) => { if(err) throw err; let prefix = rows[0].prefix;

quartz kindle
#

the full code

#

which file is this code in?

earnest phoenix
#

1 sec

#

o shit 1 rows

quartz kindle
earnest phoenix
#

oeky

#

okey

#

Thanks Working

lethal stratus
#

Any ideas on how to reduce loading times when I reboot the bot, or do I have to live with the slowness of my old pi?

earnest phoenix
#

what do you exactly do when rebooting?

#

create a new process and kill the old one?

quartz kindle
#

what part of the loading takes the most time?

#

from process start until the ready event?

lethal stratus
#

Sorry didn't see this

#

I am using systemd to do the rebooting

#

But even just running the program alone from node takes a long time

quartz kindle
#

when a bot logs in, it does the following:
connect to discord
receive list of guild ids
confirm reception
begin downloading all guilds one by one <-- this is what takes the longest time
when finished, fire the ready event

lethal stratus
#

Ah

quartz kindle
#

if your bot is sharded, add 5 seconds delay between each connection

lethal stratus
#

I feel it's dependent on my internet speed, which is very slow.

#

Also I won't be needing shards, as the bot won't ever be in 2.5k servers

quartz kindle
#

there is one easy thing you can do to improve start up time, which is reduce the large_threshold value

lethal stratus
#

where is this?

#

and what does it do?

quartz kindle
#

by default, Discord considers a guild large when it has over 250 members

#

a large guild will not contain a full member list when downloaded

#

making it a much smaller download

#

the minimum value this setting can have is 50

lethal stratus
#

large_threshold -1

quartz kindle
#

so if you set it to 50, all guilds with more than 50 members will not have their entire member list downloaded by default

#

which will reduce the time it takes to download all guilds

lethal stratus
#

Thanks!

#

But I still ask, where is this setting

quartz kindle
#

this is a websocket option when connecting to discord, depends where your library put this setting

lethal stratus
#

I use discord.js

quartz kindle
#
new Client({
  ws: {
    large_threshold: 50
  }
})```
lethal stratus
#

Thanks

quartz kindle
#

it is also possible to hack the library into firing the ready event before downloading all guilds, but this is a very advanced thing and will possibly break things lol

lethal stratus
#

K

#

I asked this becuase I see people using webhosts and stuff retarding their bots in seconds

#

Then I'm waiting out 5m+ for me to be able to see if my changes worked

#

Lol

quartz kindle
#

5m????

#

that is very not normal lmao

#

do this

lethal stratus
#

It's a pi 1

#

And my internet is very slow

quartz kindle
#

client.on("raw",console.log) and check your console when you fire the bot

#

you will see the guilds being downloaded

lethal stratus
#

K

quartz kindle
#

if they really take a long time to come

#

then yeah its your internet

lethal stratus
#

If this is a clue, I have a startup sequence in console that does stuff as it's booting

quartz kindle
#

but if it takes a long time before the guilds start coming, then the problem is elsewhere

lethal stratus
#

And it takes ages before it's even triggered

quartz kindle
#

also

#

change that to this instead

lethal stratus
#

Also the bot maxes out the CPU and memory.

quartz kindle
#

client.on("raw",r => console.log(r.t))

#

to log only the packet type, not the full object

lethal stratus
#

I use bot instead of client becuase tbh it makes more sense

quartz kindle
#

sure

lethal stratus
#

time to ssh again on my phone then use nano

quartz kindle
#

lmao

lethal stratus
#

I think I'm getting used to this sad way of editing

quartz kindle
#

very sad indeed

lethal stratus
#

Because I honestly am too lazy to get up to my computer and open visual studio code

quartz kindle
#

jesus christ

#

using ssh and nano on your phone will take 5x longer than booting your pc and opening vsc

lethal stratus
#

Ehhhhhh

#

It requires less motor skill use

quartz kindle
#

lmfao

lethal stratus
#

Less movement

#

Lol

neat ingot
#

just spent the past hour making a nice page to embed as my long description iframe. Totally took inspiration from pokecords iframe 😄

quartz kindle
#

the entire internet is built on people stealing ideas from each other

neat ingot
#

world*

#

😛

quartz kindle
#

true lul

neat ingot
#

btw yea it was x-frame permissions from my nginx that was stopping the iframe earlier ~ i nub with nginx 😄

quartz kindle
#

ah yes theres also that

earnest phoenix
#
 for (let i = 0; i < Math.min(message.guild['player'].queue.length, 10); i++) {

        const embed = new MessageEmbed()
        .setColor('#ff003c')
        .setTitle(`${message.guild.name} Music Queue (First 10)`)
        .setAuthor(message.client.user.username, message.client.user.displayAvatarURL())
        .setDescription(`Title: ${message.guild['player'].queue[i].title}`)
        .setTimestamp();
      return message.sendEmbed(embed).catch(err => this.client.emit('log', err, 'error'));
``` My queue command is not working there is 3 songs in songs and it shows only 1
neat ingot
#

i had set it all to SAMEORIGIN for basic security and totally forgot about it 😄

#

1 - you should remove that math.min from the for loop and set a variable before the for

#

as during each iteration its doing the math min calc

#

and you dont seem to be reducing the length any during the loop

earnest phoenix
#

for (let i = 0; i < message.guild['player'].queue.length + 10; i++) {

neat ingot
#
const max_length = Math.min(message.guild['player'].queue.length, 10);
for (let i = 0; i < max_length; i++) {
}```
something like that 🙂
#

but i guess thats just imo 😄

earnest phoenix
#

hmm

quartz kindle
#

microoptimizations

earnest phoenix
#

Thanks

neat ingot
#

yea, but also better for readabilities

quartz kindle
#

@earnest phoenix it shows only one because you are returning

neat ingot
#

oohh i hadnt even noticed the question lmao

earnest phoenix
#

hmm

quartz kindle
#

also, you cant send 10 messages at once

#

the limit is 5 per 5 seconds

#

you should not be sending one message per song

neat ingot
#

you could do some kind of await wait(timems) in between each msg sending

earnest phoenix
#

I'm not sending 10 messagre

#

messages

quartz kindle
#

you are trying to

neat ingot
#

assuming you have a promize wait func

earnest phoenix
quartz kindle
#

you're building a loop that loops at most 10 times, and for each time, it sends one message with one embed. if you have 10 songs it will send 10 messages

earnest phoenix
#

Oh! But I don't want to send 10 messages I just want to print 10 songs in one embed

quartz kindle
#

then you need to define the embed outside of the loop, then build it, then send after the loop finishes

#

like this

#
let embed = new Embed()
.setTitle()
.setFooter()
.etc()
for(...) {
  embed.addField(song)
}
send(embed)```
#

or if you want to use description instead of fields:

let description = ""
for(...) {
  description += "something"
}
embed.setDescription(description)```
earnest phoenix
#

ok I understood that but the loop?

quartz kindle
#

the loop you are doing is correct, you just need to create the embed before you start the loop, and send the message after the loop block

#

you only use the loop to build the embed parts

earnest phoenix
#

ok

neat ingot
#
const cuser = message.client.user;
const queue = message.guild['player'].queue;
const limit = Math.min(queue.length, 10);
const embed = new MessageEmbed();
embed.setColor('#ff003c');
embed.setTitle(`${message.guild.name} Music Queue (First 10)`);
embed.setAuthor(cuser.username, cuser.displayAvatarURL());

const tracks = [];
for (let i = 0; i < limit; i++) {
    tracks.push(`Title: ${queue[i].title}`);
}

embed.setDescription(tracks.join('\n'));
embed.setTimestamp();
message.sendEmbed(embed).catch(err => {
    this.client.emit('log', err, 'error')
});```
#

i'd go with soemthing like that

earnest phoenix
#

okay let me try this

neat ingot
#

obviously thats untested 😛

#

but something like that 😄

earnest phoenix
#

lol

neat ingot
#

also, idk there was a 'sendEmbed' function on the message object

#

i normally just do like, message.channel.send()

quartz kindle
#

all sendSomething functions are deprecated

#

you should only use .send()

earnest phoenix
#

No, I use Klasa

neat ingot
#

ahhh ok, fair enough 😄

earnest phoenix
#

The code is working but one problem it plays current playing song but no problem I'll fix that

#

Thanks

neat ingot
#

np dude 🙂

earnest phoenix
#

ok dude

earnest phoenix
#

How can i make a custom background at my DBL bot page?

neat ingot
#

how can i remove the white iframe border on my bots dbl page? 😛

sudden geyser
#

css in long description

earnest phoenix
#

Ok

lethal stratus
#

would anyone here pls help me figure out what to make a bot about?

#

I'm making a second bot because my first one is.... Something

#

And I want to make a more specialised and useful one

quartz kindle
#

usually you'd go the idea -> bot way, not the bot -> idea way lol

spare goblet
#

@lethal stratus don't make a bot just to make a bot lmao
yes - idea -> plan -> create botum
no i wanna create botum -> steal idea -> create botum

lethal stratus
#

I haven't made the bot yet

spare goblet
#

oh lmao

#

well then find a problem and create a solution to it

lethal stratus
#

I don't have a problem tho

quartz kindle
#

problem: discord needs more foot balls
solution: make bot that posts images of beautiful foot balls

lethal stratus
#

I made the first one for the sake of existing

spare goblet
#

then maybe don't create a bot till you have an idea or freelance or something

lethal stratus
#

:/

#

What you talking about freelance?

quartz kindle
#

count how many times people say all variations of "lol"

neat ingot
#

freelance: get paid to make a bot for nub

quartz kindle
#

we already have owo/uwu bots, do we have lol bots?

spare goblet
#

basically what dekita says lul

earnest phoenix
#

create an EA like economy system

lethal stratus
#

Ok but I'm 14 XD

spare goblet
#

if you can't spend your time constructively, earn money from it

earnest phoenix
#

pay for help command

spare goblet
#

you don't have to be a specific age to freelance

lethal stratus
#

pay for help command
This is the next step

#

XD

#

you don't have to be a specific age to freelance
Hmm.... But where would I find people who need bots?

spare goblet
#

errr the first time i created a custom bot for someone was just from a random server i was interacting in

earnest phoenix
#

i can make free main purpose bots

lethal stratus
#

I mean, I made a bot for a friend that managed and sorted art requests since they did art

#

I didn't charge or something tho

spare goblet
#

i mean if you dont wanna charge then don't

quartz kindle
#

the problem is, you will find people willing to pay a few bucks to get a bot made for them, but as you get better, you increase your prices, and you stop getting work

#

people nobody wants to pay

#

lmao

lethal stratus
#

I don't wanna charge lots of money

#

I mean maybe I'd charge 1$

#

Lol

neat ingot
#

could check some sites like fiver or something for freelancing 🙂

#

and charge more than a buck ffs lol

spare goblet
#

fiverr sucks for that btw, do not recommend

lethal stratus
#

1$ for like 3 10h days seems about right

quartz kindle
#

isnt fiver oversold?

#

theres like thousands of people doing the same thing there

spare goblet
#

^

neat ingot
#

same everywhere tho

#

gotta make your 'store' or w.e stand out

spare goblet
#

And a lot of people looking for custom bots don't really care about quality code

#

it just needs to work

lethal stratus
#

But would they be hosting it tho

spare goblet
#

so they'd rather hire a kid who can't code for crap for 3 dollars ig

#

usually there's a prerequisite letting them know and helping them set it up on a server or sumn

quartz kindle
#

hello, i bought a bot, how do i turn it on?

lethal stratus
#

Haha

spare goblet
#

k3llyteehee lmao

quartz kindle
#

how to make bot 24/7

lethal stratus
#

I mean if it was my bot the answer would be node and systemd

#

I think web tutorials have done a good job in failing to give the information to everyone that they need

#

By that I mean they all tell you how to make a bot respond to like "hello"

#

And nothing else

quartz kindle
#

tutorials succeeded in giving people misleading information and teaching them bad practices and opinionated coding

lethal stratus
#

It's like the opposite of unity, rather than everyone having easy access, therefore a lot of crap, it's more filtered to the people who persevere and actually know what they are doing to a degree

spare goblet
#

I think it gives you enough information to weed out the lazy people who just don't wanna spend effort in learning
Because in the end a lot of people do learn from the internet just from googling, even if the resources could be misleading

quartz kindle
#

the discord coding community expects people to have a basic knowledge of programming

lethal stratus
#

yep

quartz kindle
#

and as such, fails to teach them basic programming

lethal stratus
#

Know what's funny

quartz kindle
#

but its understandable, they cant be arsed with it

lethal stratus
#

Originally when I was getting started on my bot

quartz kindle
#

many people do lmao

lethal stratus
#

And it was very far in when it was all outdated and nothing worked

#

That I realised I had to recode large chunks

spare goblet
#

I don't blame them ? it's hard to explain over and over again on a daily basis what a string is when the person just wants to learn how to turn bot on

lethal stratus
#

And persevere through it

quartz kindle
#

yeah i dont blame them either

lethal stratus
#

I have to wonder

#

Why is it even possible to download discord.io anymore

#

Is it for the super old bots that people cant be bothered to recode?

quartz kindle
#

the author hasnt bothered to mark the project as deprecated

lethal stratus
#

Oof

#

Another layer of the antilaziness wall

spare goblet
#

not any old bots, let alone new

lethal stratus
#

I accidentally

#

Because a crappy tutorial when I was still learning what the heck I was doing

neat ingot
#

i got annoyed at mee6, google for a node js discord bot api, and discord.js was top of everything, so i went with that 😄

lethal stratus
#

I mean

#

It's really good

spare goblet
#

mee6 is really good or

lethal stratus
#

Discord.js

spare goblet
#

discord.js has slight memory leaks all over it and caching issues

#

other than that it's fine

lethal stratus
#

It's the only one I know how to use

glass crag
#

@spare goblet ive noticed those leaks... quite irritating

spare goblet
#

Ideally if you know js, you should be able to work with other libs, like Eris
but Eris is a bit strange

neat ingot
#

where does it leak from?

spare goblet
#

many different things

#

You have to basically cut open the lib, break everything, disable everything, just to have a normal sized ram

lethal stratus
#

could this be why memory use is always 100% with it open, or is that just cos I have the world's slowest raspberry pi

spare goblet
#

It's cuz of discord js

#

lmaoo

lethal stratus
#

Also CPU 100%

#

lol

spare goblet
#

cpu is probably not discord js issue

#

I've never had cpu issues other than me frickin around too much and doin inefficient functions :^)

glass crag
#

@spare goblet is there a topgg dummy-api so that my discord dev token bot doesnt report server counts to topgg?

spare goblet
#

No

#

I have the same issue (I'm assuming you're having autopost issues?)

glass crag
#

My bot just got approved and I was thinking of integrating the server install counts etc

#

ye probably autopost

spare goblet
#

if you're using master it doesn't work

#

if you're using discord js stable it'll be fine

neat ingot
#

wtf at 100%?

#

im usinga 1 core vps and it doesnt even break 200mb ram or 30% cpu

spare goblet
#

And if you don't attach the client to the constructor it'll be fine even on master ig kittyLOL

quartz kindle
#

its not memory leaks, its their aggressive caching nature

#

they cache EVERYTHING, in order to avoid hitting the api as much as possible

spare goblet
#

well ye

quartz kindle
#

the problem is that the caching is too tightly coupled with the core of the library

#

they have discussed this in the past, but decided it would be unfeasable to rewrite it

#

but yeah, we have to hack it open ourselves to fix it

#

i made a library for that lol

#

ideally, there should be a core library for discord api, something that only processes gateway packets and handles rest requests, and nothing else

#

discord.js does have cpu issues, but not caused by the library itself, they are caused by the discord api flooding your machine with presence updates

#

the new intents system fixes that

neat ingot
#

yea, i broke my bot cause of presences

#

but that was cause i was iterating over 40k users per second and trying to store presence data...

#

that feature was imemdiately removed

#

lol

#

sad thing was, my bots initial purpose was to track my own activity each day, to see what apps i was in the most etc

quartz kindle
#

lol interesting

glass crag
#

im getting a 400 Bad Request when trying to use the dblapi.js-lib? Using the topgg-provided token..

quartz kindle
#

are you on discord.js v12?

glass crag
#

ye

quartz kindle
#

@lethal stratus btw, if you google "how to make a discord bot", the first link, from digital trends, uses discord.io

#

@glass crag dblapi.js was not updated for the latest v12 changes

glass crag
#

Ah alright

quartz kindle
#

you have to remove the client from the constructor to disable autoposting

#

then you can do dbl.postStats(client.guilds.cache.size)

glass crag
#

thanks man

quartz kindle
#

v12 moved all caches to a .cache property

glass crag
#

ye

#

how often do you post ish? @quartz kindle

quartz kindle
#

i post once per day

glass crag
#

Sounds reasonable

quartz kindle
#

i dont care how accurate the count is in the website

#

dblapi's default is 30 minutes i think

#

some people do it on every guildCreate/guildDelete event lol

glass crag
#

hahah thats a bit hardcore

quartz kindle
#

yeah, its mostly small bots lul, "oh hey we have a new guild, we must update immediately"

earnest phoenix
#

everyone must know!!

glass crag
#

😄

#

the bots should post to every guild installed at to let them know the new guild count!!

quartz kindle
#

lmao

earnest phoenix
#

Need help

#
const current = message.guild['player'].current;     
const cuser = message.client.user;
const queue = message.guild['player'].queue;
const limit = Math.min(queue.length, 10);
const embed = new MessageEmbed();
embed.setColor('#ff003c');
embed.setTitle(`${message.guild.name}: Music Queue`);
embed.setAuthor(cuser.username, cuser.displayAvatarURL());

const tracks = [];
for (let i = 1; i < limit; i++) {
    tracks.push(`**${i}:**  [${queue[i].title}](${queue[i].url})`);
}
if (queue.length <= 1) {
embed.setDescription(`Now Playing: [${current.title}](${current.url})`)
} else {
embed.setDescription(`**Title:** \n${tracks.join('\n')}`);
embed.setTimestamp();
message.sendEmbed(embed).catch(err => {
    this.client.emit('log', err, 'error')
});
}```
#

Not working

#

what isn't working

#

My queue command is not working

scenic kelp
#

Bruh

earnest phoenix
#

lol

#

when I used that if part

scenic kelp
#

that's pretty obvious

#

what's the error

#

show us the stack trace

earnest phoenix
#

it's not working

pseudo mesa
#

what's the error

scenic kelp
#

we can't help you if we don't know where to start

earnest phoenix
#

It throws no error in my consoke

scenic kelp
#

then start console.logging values and seeing what's wrong

earnest phoenix
#
if (queue.length <= 1) {
embed.setDescription(`Now Playing: [${current.title}](${current.url})`)
} else {
embed.setDescription(`**Title:** \n${tracks.join('\n')}`);```
#

this part isn't working

scenic kelp
#

What is the intended output of your queue command and what is the actual output

earnest phoenix
#

There is no output

scenic kelp
#

i'm assuming you want to send an embed

earnest phoenix
#

it doesn't return anything

#

yeah

late hill
#

if the condition in there is true

scenic kelp
#

you use message.sendEmbed

late hill
#

you'll have no output because all you do is set the description

#

so that's likely the issue

scenic kelp
#

I'm pretty sure you want message.channel.send(embed)

broken jay
#

Which is better for discord.py bot + django api hosting: Kubernetes or Docker?

scenic kelp
#

send embed is deprecated too

late hill
#

and message.guild['player'] is weird

#

why aren't you using .player

scenic kelp
#

@broken jay what

earnest phoenix
#

Fixed

scenic kelp
#

you use k8s to manage docker

#

if you are hosting a bot

#

you can run it without docker or k8s

broken jay
#

What?

scenic kelp
#

k8s is container orchestration

earnest phoenix
#

I putted } in wrong place

broken jay
#

I don't want standard VPS

scenic kelp
#

you still need a VPS to run docker + k8s

#

or a PC

#

they aren't hosting services

broken jay
#

I want docker/kubernetes + managed DB

#

DigitalOcean have Kubernetes service, AWS have Docker service

scenic kelp
#

amazon also has kubernetes

broken jay
#

I need to decide which one to use

#

Yeah

scenic kelp
#

if you're deciding which one to use there's probably not many people here that are gonna be able to answer that for you

earnest phoenix
#

need help

#

@coral trellis

coral trellis
#

?

earnest phoenix
#

help regarding that authorization thing !

#

@coral trellis

mossy vine
#

read what it says

#

authorization can be literally anything

earnest phoenix
#

i want to do that

#

so how can i do it ??

quartz kindle
#

you want to setup top.gg webhooks?

earnest phoenix
#

yep

grim aspen
quartz kindle
#

are you using a library like dblapi.js?

earnest phoenix
#

nope

quartz kindle
#

how are you using it then?

earnest phoenix
#

djs

quartz kindle
#

are you running a webserver?

earnest phoenix
#

nope

quartz kindle
#

then you need a webserver, or dblapi.js

earnest phoenix
#

^

quartz kindle
earnest phoenix
#

There are many examples on GitHub, you can check that also

quartz kindle
#

follow the example on the link i posted

#

github examples might be outdated (if its not from the official github)

earnest phoenix
#

@earnest phoenix, are you from official Fntatic clan?

mossy vine
#

not the channel for that

earnest phoenix
#

Just asking one question

earnest phoenix
#

Anyone know how to make a captcha?

quartz kindle
#

i made one

#

so yes

earnest phoenix
#

I’ve been thinking of making one

#

Would it be possible with python?

quartz kindle
#

for when people join a guild?

earnest phoenix
#

Yes

quartz kindle
#

should be possible yes

earnest phoenix
#

Anti raid

quartz kindle
#

mine is made with javascript

earnest phoenix
#

Ok

#

I see

quartz kindle
#

you should be able to do it with whatever graphic drawing library there is for python

#

some sort of canvas for example

slender thistle
#

Pillow, PIL

quartz kindle
#

you'll create a random string, save somewhere and draw it on an image, then check if the user's messages match the saved string

#

you'll probably need a database to keep track of things

earnest phoenix
#

Lol that is not what I meant

quartz kindle
#

then what do you mean?

earnest phoenix
quartz kindle
#

cant a bot just read that?

slender thistle
#

Easily possible

quartz kindle
#

well, it might be able to stop generic spam bots, but anyone could easily make their spam bots copy and paste the captcha

#

using an image will make it harder for them to do it, they'd need OCR, and even then it might often fail

lone night
#

could i add a html file to my bot that displays the sqlite database it has

modest maple
#

wut

modest maple
#

Opinions wanted:

#

Postgresql

#

or Mongo

#

or Datomic

#

which DB would you choose to manage a LARGE Database

slender thistle
#

PostgreSQL I heard for good performance

modest maple
#

yh

#

dont know what has better performance SQL or Nosql

late hill
#

what do you use to generate those @quartz kindle nyapeak

quartz kindle
#

canvas

late hill
#

with the colors and locations of the characters randomized each time?

quartz kindle
#

yup

late hill
#

how do you draw the lines

#

just picking 2 random points?

quartz kindle
#

yeah

#

just run a few corrections and constraints to prevent drawing outside

late hill
#

would it be possible that the lines somehow get in a position where it's rly difficult even for a human to see the characters

#

i just wanna make sure people don't get screwed over

#

lol

quartz kindle
#

yes, its possible

#

but the lines are thinner than the characters

#

so unlikely to happen

late hill
#

alright

#

i'll keep them thin

quartz kindle
#

you can also use dots or circles instead

late hill
#

🤣

quartz kindle
#

xd

#

i mean, the chances that someone decides to make their spambots run OCR to break into your server are probably lower than the chances of winning the lottery

#

but oh well

late hill
#

well this is for game bot

quartz kindle
#

i also made mine optionally case sensitive, for some extra fuckery lmao

late hill
#

works well this way

quartz kindle
#

and up to 10 chars

late hill
#

but i'd guess there's probably at least one person that has at least tried ocr

#

I originally had regular text that was case sensitive and people fucked it up all the time because the font discord uses can be confusing

#

lol

quartz kindle
#

most of my problems were from characters being too similar to each other, like lower care L and upper case i

late hill
#

yeh that

quartz kindle
#

i had to remove those characters from ever being used

#

also 0 and O

#

i use these characters now 123456789abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ@#$%&?

late hill
quartz kindle
#

hahahah

earnest phoenix
#

random thought. is there a way to use decorators in d.py for command help? right now on the cog setup, i just register a command like that.

def setup(bot):
    bot.add_cog(Minecraft(bot))
    HE.HelpEntries.register("jping", ["%jping server","%jping server:port"], "Pings a java server")
    HE.HelpEntries.register("bping", "%bping server port", "Pings a bedrock server")
class HelpEntries:
    cmds = []

    @classmethod
    def register(cls, command, usage, helpmsg, notes="N/A"):
        cls.cmds.append(core.help.HelpEntry(command, usage, helpmsg, notes))
    
    #etc
#

like it'd be nice to keep the help stuff near each command

#

loaded on cog load

#

class decorators maybe?

slim heart
#

So i've been wanting to add the ability to log changes that people make on a servers dashboard. I was wondering what would be the best way to do so? How should i store it and should there be a limit on the amount of logs etc.

delicate zephyr
#

kinda like audit logs?

#

i mean

#

you could always just make it simple

#

store the action, the person who did it, and the time

late hill
#

and the server

slim heart
#

the issue would be though that people make changes to multiple things at once and save. So like it'd be multiple actions, if it was one by one i'd take a similar approach to discord but it's not.
i would be hoping to find the difference between it and store the changes and then it would list those changes in one "log" thing on the dashboard so i know that much. but don't know how to store it / best way

unique nimbus
#

sql?

late hill
#

If the only purpose is that people can read it, then the "action" could just be a combination of actions

#

where's it's all just a string

#

if you plan to use it for other things such as reversing actions

#

you'd need to properly set up each action

quartz kindle
#

maybe also the ability to sort the log by change type

#

so for example, a table with timestamp, type of change, string describing the changes

#

and maybe also the author of the changes

#

if you're using an sql database, you could have all logs from all guilds in a single table, and have them indexed by guild id as well

late hill
#

As for the limit, I doubt it would become an issue on your end to store it all. You'd probably just want to limit the output, but while doing that you could always have something deleting very old logs

pine bear
hushed berry
#

?

amber fractal
#

you define prefix then use config.prefix still

#

also what's up with that if statement

#

that wont do anything

pine bear
#

Mmm

#

Uhh, that's just a test command its not suppose to do anything

amber fractal
#

yeah but the if statement wont do anything at all anyways

#

it will evaluate to something then do nothing then it will send ping regardless

#

The one above it is fine

molten pewter
#

finally this garbage package was deprecated

#

maybe we can get actual good bots out of this

unique nimbus
#

It is still usable at the moment

#

¯_(ツ)_/¯

#

idk tho

amber fractal
#

how does request have anything to do with the quality of a bot

#

all it does is make requests

molten pewter
#

it's extremely slow

#

many bots use it

amber fractal
#

and that's their choice and they will probably use it regardless

molten pewter
#

many people who make bots with it do not know how to use it properly

#

as the package is basically noob bait

unique nimbus
#

It is still a choice

molten pewter
#

like just use the http/https modules or node-fetch

wicked pivot
#

how can we make progress graphs, in discord.js?

earnest phoenix
#

using canvas

amber fractal
#

chart.js is pretty good

#

canvas's api is just annoying to work with imo

earnest phoenix
#

no

#

that's why most bots use canvas-constructor

amber fractal
#

And that's an opinion

#

in my opinion canvas is annoying to work with

#

in my opinion

earnest phoenix
#

easy = boring

amber fractal
#

easy = less time wasted trying to figure out how to draw a line with points

earnest phoenix
#

simple math

unique nimbus
#

or

#

its an opinion

molten pewter
#

I use gm mostly but am looking for an alternative that still uses imagemagick

quartz kindle
#

if node.js, look into sharp

solemn mica
#

please my bot verify patent please

amber fractal
#

Not how that works

#

just wait

pseudo mesa
#

what

pine bear
#

Oh that's why the bot sends ping when the prefix in mentioned.

amber fractal
#

yes

molten pewter
#

I would like to move to sharp/libvips but the lack of features compared to *magick kinda sets me off

#

also no animated gif support

#

which is why I can’t use canvas either

quartz kindle
#

it does support gif, no?

#

well, vips supports writing gifs by importing magick or something apparently, but sharp didnt implement this yet

#

requires imagemagick installed

storm bluff
quartz kindle
#

with any graphics generation library

#

such as canvas

storm bluff
#

canvas ?

quartz kindle
#

what language are you using?

storm bluff
#

js

quartz kindle
open cedar
#

Does anyone know of a bot that can automatically whitelist players into my dayZ server?

quartz kindle
#

sounds oddly specific, it probably doesnt exist

amber fractal
#

does dayz even have an api endpoint for that

hoary elm
#

Yeah you can script for it

open cedar
#

I’ve seen it on only one server before

#

@earnest phoenix you have any idea on how to do that?

hoary elm
#

What you're asking I've seen it but have no idea how to do it sorry. I'm just familiar with scripting

earnest phoenix
#

?

hoary elm
#

@earnest phoenix think they meant to tag me lol

open cedar
#

i did lol

quartz kindle
#

is it like a private server hosted in your vps?

open cedar
#

Yes

earnest phoenix
#

Ah Ok 😂

open cedar
#

@quartz kindle

quartz kindle
#

how does the whitelist work, do you have a file that you edit?

amber fractal
#

That'd be really difficult for someone else to do, you'd probably be better off making it yourself

hoary elm
#

Run a private server, when people join it grabs their steam hex or something and uses that for whitelist @quartz kindle

quartz kindle
#

but where is this whitelist stored and how is it accessed?

amber fractal
#

unless you open your vps to requests and a bot lets makes a request to your server to do that

hoary elm
#

Usually via a database like SQL

quartz kindle
#

then a bot could connect to it

#

could be a bot running on the same machine and access the local db

open cedar
#

You whitelist then they nitrado app

#

thru*

quartz kindle
#

well idk what that is, never played dayz either

#

the point is, you need to know how the internals of the white listing process works

hoary elm
#

It's an app they have to manage your servers (start, stop ect)

quartz kindle
#

and program a bot that can access/modify the white list

hoary elm
#

Yeah I'm sure a whitelist bot is possible I don't see why it's not

#

I mean I made one for FiveM that can connect to the server, ban players ect from my discord channel but I had to connect it to their API and usually if they allow scripting they will have Docs

slender thistle
#

In HTML, should I put paragraphs directly under a div that contains all necessary buttons or is it preferred I use separate divs for each one?

earnest phoenix
#

for each paragraph element?

slender thistle
#

Yeah

open cedar
#

What would be the best way to approach trying to set up a “whitelist bot”?

earnest phoenix
#

Maybe make a single div for all paragraph elements

hoary elm
#

@open cedar honestly find their docs and their API first

#

Make sure they allow that and see how it's possible

earnest phoenix
#

Or at least group paragraphs into certain divs based on where you plan to position them

slender thistle
#

Well technically it's only buttons and one paragraph inside a div

#

🤔

earnest phoenix
#

If it's only a single paragraph I wouldn't bother with having an extra div just for that

slender thistle
#

Also should I worry/bother about paragraph elements with width equal to the window width

open cedar
#

Nitrado allows for ftp and sql connections and so has direct connect query ports. I'll do some digging and see if I can find what handles the whitelist and how to connect to it.

hoary elm
#

@open cedar that would be your best bet 😁

earnest phoenix
#

If you mean the paragraph is taking up the entire width of the visible screen, I'd probably change it up a bit

slender thistle
#

It's just that I'm not sure if it'll bite me later when the buttons are there

earnest phoenix
#

why my bot's top.gg page doesn't show my bot's avatar, even though it has been verified

slender thistle
#

Edit the page and save

earnest phoenix
#

what i have to edit?

slender thistle
#

Try to just re-save

earnest phoenix
#

okey, it works

wicked glade
#

I'm trying to implement play command on my bot through lavalink, is there any online host for me to connect to or am I supposed to run the service from my own computer?

#

It's a python function, here is a "placeholder" for it

#

lavalink.add_node("host", 2333, "youshallnotpass", "eu", "default-node") # host, port, password, region, node

lyric mountain
#

Doesn't lavalink work with youtube?

#

Ah, I got what you're saying

#

You can load a local file on it

#

You could make a list containing the name of the files, then compare the input name with your list and load it on lavalink

wicked glade
#

What do you mean by files?

#

nvm just read the docs

vague kite
#

Hey I need some help with the new discord.js version 12 for embeds. I looked at the docs and everything but I keep getting the same errors when ever I try to add fields to embeds

topaz fjord
#

it would be great if you show the errors

vague kite
#

TypeError: fields.flat is not a function

#

Yeah sorry I sent the wrong picture

topaz fjord
#

what is fields

#

I need to see some code to actually help

copper cradle
#

console.log(fields);

#

then send the output

#

btw fields.flat() isn't a method of fields

vague kite
copper cradle
#

that's not what I said

#

i said console.log(fields)

vague kite
#

ReferenceError: fields is not defined

earnest phoenix
#

@vague kite you're really in djs v12?

amber fractal
#

Most people are

topaz fjord
#

master branch is d.js 12

earnest phoenix
#

@vague kite i think you can't add multiple fields with addFields addFields doesn't exist no??

earnest phoenix
#

I don't find addFields lol

#

Oh okay

topaz fjord
#

have you tried passing it in as an array of objects @vague kite

amber fractal
#

addField seems to have been removed

topaz fjord
#

e.g., [{}, {}, ...]

earnest phoenix
#

@vague kite delete the last ,

amber fractal
#

which doesnt make sense but

topaz fjord
#

that's not needed @earnest phoenix

#

js doesn't give syntax errors for that

earnest phoenix
#

Oh hea have to replace the () with []

topaz fjord
#

no

#

.addFields([{}, {}, ...])

#

also eslint recommends you add the comma after the last element

earnest phoenix
#

Okay i don't know this i'm on 11.5.1(stable)

topaz fjord
#

it's not a d.js, it's a node thing

earnest phoenix
#

Yeah but i use only js for node js

#

(I use only with bots discord)

copper cradle
#

@vague kite well then there's ur answer

#

fields isn't defined

#

wait

#

show where u define 'fields'

#

like the entire code

vague kite
#

Ahh okay so it's a node thing kl

#

Also just tested it using Embed object and it works fine

sudden geyser
#

@vague kite by the way, your C:\Users\name is in the top of the console screenshot.

vague kite
#

It's fine

sudden geyser
#

alright, I was just wondering since you censored the other ones

vague kite
#

Yeah I failed ngl

#

But at the same time idrc

#

It's not my full first name

earnest phoenix
#

TypeError: Cannot read property 'likes' of undefined

#

i'm trying to make a leaderboard command

quartz kindle
#

show code

earnest phoenix
#

All i had was this for now (I'm using enmap);

let lb = client.db.fetchEverything().array().sort((a, b) => b.yt.likes = a.yt.likes);  
     console.log(lb)
quartz kindle
#

you might have entries in your database that do not have a yt property

earnest phoenix
#

hmh

quartz kindle
#

you can do .array().filter(t => t.yt).sort(...)

#

you can also do .array().forEach(t => { if(!t.yt) { console.log(t) } })

#

to see which ones dont have it

earnest phoenix
#

lemme try that

flat quiver
#

Help

#

Dis bot is not online

#

?

#

End Here is online

amber fractal
#

It isnt in this server

flat quiver
#

How do you access a server?

hoary elm
#

there shoudld be a Join Support Server button on the bot page

#

if not then they dont have it listed

#

and i believe to get the bot back in this server the owner/dev of the bot would have to Fix the problem that got it kicked (Messages on join)

flat quiver
#

Thanks for the help

hoary elm
#

Np

grizzled raven
#

@earnest phoenix change the b.yt.likes = a.yt.likes to b.yt.likes - a.yt.likes if you want to sort them from highest to lowest

floral bloom
#

Discord.js
I've been trying to get a JSON file for like the past 30 minutes to no avail. Would someone be so kind as to tell me how? It's for server settings, so I've tried these:

let settings = require(`./guilds/${message.guild.id}/settings.json`);
``` and
```js
let $ = require("jquery");
$.getJSON(`guilds/${message.guild.id}/settings.json`, function(json) {
  settings = json;
});
```Ping with response, please!
hoary elm
#

@floral bloom you are trying to access the contents of a JSON file?

quartz kindle
#

jquery has nothing to do with json, its a waste to use it

#

jquery is for navigating the DOM, in browsers

#

and html operations

hoary elm
#

Yeah I usually use FS

#

fs.readFileSync()

quartz kindle
#

your first attempt should work, provided the file path is correct

floral bloom
#

you are trying to access the contents of a JSON file?
Yes, I am.

your first attempt should work, provided the file path is correct
It is, though it's weird because I was getting an error (I'll try it again after trying fs.readFileSync. Thanks, ToxicDev.).

quartz kindle
#

well, if you're getting an error, you should post the error, else we cant know whats going on

hoary elm
#

If it works the way you have it you could just show the error

#

Prior to making changes

floral bloom
#

This is the most recent error: $.getJSON() is not a function

quartz kindle
#

thats because you tried to use jquery lol, remove everything related to jquery

hoary elm
#

I would go with the first method let settings = and if it errors shows us the error

#

As Tim said jquery is unrelated to what you are attempting to do

dull terrace
#

Hi, done when it comes to creating a salon or joining one I can't do it, here is my code but I think there is no error

@client.command()
async def p_channel(ctx):
    channel = await discord.Guild.create_text_channel('test')
    await ctx.message.delete()
slender thistle
#

I am curious

#

Do you know the difference between instances and classes

hoary elm
#

Lol

dull terrace
#

why ?

slender thistle
#

Why do I feel like we've gone through this already

#

I wonder why

#

Probably because in order to properly work with OOP you should get the hang of the OOP concept first

dull terrace
#

maybe

slender thistle
#

No it's not "maybe"

earnest phoenix
#

@dull terrace

#

like shivaco said, its not a maybe

dull terrace
earnest phoenix
#

i mean either way, point is, you need to know how oop works before you can do much