#development

1 messages · Page 1694 of 1

copper cradle
#

show that function

#

brb

earnest phoenix
#
async def get_economy_data():
  with open("economy.json","r") as f:
    users = json.load(f)

    return users










async def update_economy(user, change = 0,mode ="wallet"):
  users = await get_economy_data()

  users[str(user.id)][mode] += change

  with open("economy.json","w") as f:
    json.dump(users,f)

  bal = [users[str(user.id)]["wallet"],users[str(user.id)]["bank"]]
  return bal




earnest phoenix
copper cradle
#

what's inside economy.json

#

what u want is to stop the loop once the fields you want have been added

#

but if you don't actually need to store the data then just remove it once you buy a new level

umbral zealot
#

You might have been told this before but .json is not an appropriate database format. It will corrupt and you'll lose the entire thing.

#

Use a database.

copper cradle
#

if you buy a new level remove the old one

umbral zealot
#

If you want something simple to save data, python has shelves which look pretty damn awesome tbh

copper cradle
#

shelves?

#

never heard of those lemme check

umbral zealot
#

I don't code python so I haven't used this, but it seemed pretty fucking convenient to store key/value pairs 😄

earnest phoenix
copper cradle
#

yeah

earnest phoenix
earnest phoenix
umbral zealot
#

If you're new to this, take it from the people with more experience than you have: you're doing it Wrong

#

don't continue down this erroneous path. Take a step back, and move to a better method, because right now you are straight-up just putting red shells in a shotgun aimed straight at your foot. Don't do it.

earnest phoenix
#

I appoligize

#

I'll just delete it all

#

Ty for you help

umbral zealot
#

It's fine, I'm just trying to help you here. Helping means telling you that you need to change what you're doing right now ^_^

earnest phoenix
#

I'm sorry for wasting your time

umbral zealot
#

Don't delete it just... fix it 😦

earnest phoenix
umbral zealot
#

Maybe just take a break then. Go sleep. Try again with shelve in the morning.

earnest phoenix
#

It is morning

#

15hrs total

#

This is attempt 2

umbral zealot
#

Alright well, the JSON attempt failed, try again 😊

earnest phoenix
#

You mean me saying make a new json?

umbral zealot
#

No I mean stop using JSON

earnest phoenix
#

I would like to

umbral zealot
#

You should not be using JSON for data storage.

#

It's bad.

#

It's wrong.

earnest phoenix
#

I have been told

#

Alot

#

I've only been doing this for 3 days

umbral zealot
#

Whoever told you JSON is appropriate for this is a moron.

earnest phoenix
#

I get jt...I dint belong...but this is the end...once thus is fixed im done

umbral zealot
#

Use a database or shelve

knotty zodiac
#

Mongo db is the best

earnest phoenix
#

Ya I've heard.. I use the God awful repl

#

I looked into Mongo but I didn't understand it

#

@earnest phoenix what is the benefits of economics on a bot?

umbral zealot
#

Great if you're on repl.it you literally have a database available to you, built in, provided by repl itself!

#

Click the Database tab and have a look at the examples.

earnest phoenix
#

I have %work.. it gives you money...then you can %levelshop and %buy levels then display them with %level

umbral zealot
#

It's exceedingly simple to use too!

earnest phoenix
#

Ya..well I'm a Neanderthal in this group

#

But im trying

#

Is there anyway to fix this with my json before I convert it all to a db

#

I just want it work

umbral zealot
#

No, don't. Stop.

#

Just because you've put a lot of time in a mistake, you shouldn't hang on to it. Quit while you're still ahead.

earnest phoenix
#

I just need this last thing fixed then I'll stop

#

I can't give up just yet

umbral zealot
#

But it's not going ot be fixed

earnest phoenix
#

The answers out there itnworksnin the video

#

I have to have an error

umbral zealot
#

you can't put deodorant on a pile of shit and expect it to smell appealing

lyric mountain
#

let's say regular software have multiplicative bug amount

earnest phoenix
lyric mountain
#

software that use JSON db have exponential bug amount

umbral zealot
#

You can't clean this up. You should delete it.

#

Stop trying to fix bad code, it's not worth it.

earnest phoenix
#

O.o

lyric mountain
#

also, json db has the thanos issue

umbral zealot
#

Snap. Data gone. Lol.

earnest phoenix
#

Yes but I'll deal with that later

#

I just need it working now

umbral zealot
#

No you don't. Delete it and deal with it later

earnest phoenix
#

O.o

#

Its been 3 very confusing very passion filled days. I'll never delete it

umbral zealot
#

It's 100% ridiculous and pointless to hang on to code you should not be using.

earnest phoenix
#

But I will start over

lyric mountain
#

look, let's say you finish your json-db thing

umbral zealot
#

You've still learned things. The experience is not lost. But the code is.

lyric mountain
#

you'll start storing data, right?

#

what then? to convert to regular databases later on will be harder than if you do it now

earnest phoenix
#

Yes I want to learn cogs and db next

lyric mountain
#

why? because you'll have data

earnest phoenix
#

I just want this last thing to be finished

lyric mountain
#

that means a whole downtime for data migration

#

while fighting thanos

earnest phoenix
#

No I was just gonna make a new bot

#

Start from scratch after I learn cogs and db

lyric mountain
#

after you learn cogs

#

you ain't learning db

earnest phoenix
#

O.o

lyric mountain
#

json is json, db is db

earnest phoenix
#

Well I mean I'm willing to learn whatever it takes

#

I'm sorry I appoligize for my novice

lyric mountain
#

json-db is that chimera from FMA

earnest phoenix
#

Lol

#

She had a name

earnest phoenix
#

hi guys

#

how could i get embed avatar from a user with oauth

#

i mean

#

if a user that doesn t have an avatar

#

is trying to login to a website with discord

#

how could i know what color is his default avatar

#

?

#

if im trying to log profile.avatar

#

i get null

earnest phoenix
#

what s the formula

#

cuz i don t get it

slender thistle
#

it quite literally says it there

#

See the modulo operator

#

Get the remainder of 3078 divided by 5

#

what do you get

earnest phoenix
#

oh

#

i got it

#

thanks :))

#

I think I have an error here in this line.. but im new to this and not sure. Anyone could maybe point me in the right direction?

slender thistle
#

Can you print level?

#

Also I don't get what's the issue here

simple zodiac
#

Hey does anyone know how to make my bot stay in a VC 24/7? I wasn't able to find much online or in guides. I want it to be like how groovy (and other bots) will just stay in as long as you pay a premium, but instead of paying premium, I want it just in one server ( my own). I'm using Discord JS, thanks. Any tutorials or anything would be appreciated.

smoky herald
#

Hi, I think I was already trying to solve this issue here but didn't really manage to resolve it. All of the sudden I started getting those "user aborted request" error from I don't know where, which keep happening until the app crashes with "possible memory leaks" issue. Any ideas about it's origin?

sterile lantern
simple zodiac
#

Can i do something like join vc (channel ID)? Simplified cause I dont know exact code but something like that?

sterile lantern
#

you will be able to do it

simple zodiac
#

i'm using a repl

sterile lantern
#

i'm saying if you don't have a vps, you will need to make it join everytime

#

yes so,

#

on your client.on ready function

#

make it so the bot joins your designated channel

#

and for your commands

#

dont have it disconnect or join a channel

#

and they bot will stay in it

simple zodiac
#

ah ok so maybe it wont work

#

I'll prolly find a way

#

thanks

sterile lantern
#

wym it wont work

#

it will work

#

you just need to include it into your function lol

lost wadi
#
let user = message.mentions.users.first() || client.users.cache.get(args[0]) || message.author

    const canvas = createCanvas(867, 892);
    const ctx = canvas.getContext("2d");
    const background = await loadImage(
      "https://cdn.discordapp.com/attachments/822225367372660806/829396711255965726/amogus_rap_editado.png"
    );
    ctx.drawImage(background, 0, 0, canvas.width, canvas.height);

    const avatar = await loadImage(
      user.displayAvatarURL({ format: "png" })
    );
    ctx.drawImage(avatar, 300, 120, 230, 230);
    const attachment = new Discord.MessageAttachment(
      canvas.toBuffer(),
      `${user.username}_amogus.jpg`
    );
cinder patio
#

bezier curves

#

Can you draw images with those? IDk

lyric mountain
#

in java I just use setClip with drawImage

#

although bezier aint that hard

cinder patio
#

Yea that's what the stackoverflow answers suggest

#

but you have to draw a rectangle the image will "clip" in

#

so you have to use curves

lyric mountain
#

drawRoundRect KEKW

cinder patio
#

it's not really a rectangle

lyric mountain
#

like

cinder patio
#

I don't think that's a thing in the canvas api

lyric mountain
#

what is it then?

cinder patio
#

it's not fully round

#

the bottom corners aren't round

lyric mountain
#

oh

#

then you gotta bezier it

earnest phoenix
#

Why I'm getting this error [TypeError: Cannot read property 's' of undefined] when I try to connect with mongodb?

cinder patio
#

Can you show the full error

blazing portal
#

and the code

earnest phoenix
lyric mountain
#

book about sus fungus

cinder patio
earnest phoenix
#
 TypeError: Cannot read property 's' of undefined
    at C:\Users\MI PC\Desktop\Mis Cosas\...\Programacion\Java Script\Archivos\node_modules\mongodb\lib\mongo_client.js:222:37
    at maybePromise (C:\Users\MI PC\Desktop\Mis Cosas\...\Programacion\Java Script\Archivos\node_modules\mongodb\lib\utils.js:685:3)
    at MongoClient.connect (C:\Users\MI PC\Desktop\Mis Cosas\...\Programacion\Java Script\Archivos\node_modules\mongodb\lib\mongo_client.js:221:10)
    at node:internal/util:325:7
    at new Promise (<anonymous>)
    at node:internal/util:311:12
    at Object.<anonymous> (C:\Users\MI PC\Desktop\Mis Cosas\...\Programacion\Java Script\Archivos\testing.js:8:42)
    at Module._compile (node:internal/modules/cjs/loader:1091:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1120:10)
    at Module.load (node:internal/modules/cjs/loader:971:32)
lost wadi
#

hmmm

cinder patio
#

looks like an internal error

#

or you're not using it correctly

earnest phoenix
#

My code literally is:

const { MongoClient } = require('mongodb');

const client = new MongoClient(`........`);
require('util').promisify(client.connect)()
    .then(console.log)
    .catch((e) => console.error(e))
cinder patio
#

client.connect already returns a promise I'm pretty sure

earnest phoenix
#

hm

#

a

lyric mountain
#

yah it does

lyric mountain
#

the hypocrisy

toxic jolt
#

i how to fix this pls help

lyric mountain
toxic jolt
cinder patio
#

Are you talking about the formatting?

toxic jolt
#

i catching shard.js

#

error

cinder patio
#

what do you want to fix?

#

I don't see an error there

toxic jolt
#

my bot dont connecting

umbral zealot
#

can you actually show us the errror

lyric mountain
#

I wonder how you even read that

toxic jolt
#
const { ShardingManager } = require('discord.js');
const settings = require('./ayarlar.json');
const manager = new ShardingManager('./bot.js', { token: settings.token, totalShards: "auto", spawnTimeout: "-1"});
(async () => {
    await manager.spawn().catch(e => console.log(e))
})();

manager.on('shardCreate', shard => {
console.log(`Launched shard ${shard.id}`)
});

    manager.on('death', (a, b) => {
        console.log('Shard öldü, tekrar bağlanılıyor.')
        client.destroy()
        client.login(settings.token)
        console.log(a)
        console.log(b)
    })
    
manager.on("disconnect", async (eventd, id) => {
    console.log('Sharda tekrar bağlanılıyor!')
    manager.respawn(30000, 30000)
})
#

my shard.js

#

here

umbral zealot
#

ok what is the error

toxic jolt
#

here pls wait

umbral zealot
#

Also your terminal looks like a bastard child of Windows XP and baby puke. I don't know how you can not dig your eyes out looking at that

lyric mountain
#

looks like a map from the great flood using dwarf fortress graphics

toxic jolt
umbral zealot
#

god how are you even reading this

#

too many requests is basically you spamming the API

umbral zealot
#

You've been rate limited

#

something's sending a lot of requests to the API

toxic jolt
#

can you give a sample code

#

Server setup system is available. Could it be from him? It creates channels and roles.

umbral zealot
#

May I ask you a question first? How many guilds is your bot on?

lyric mountain
toxic jolt
lyric mountain
#

adjusted brightness and contrast

#

now it's readable

umbral zealot
#

how the hell did you reach 35,000 guilds without sharding correctly? ia_think_thonk

toxic jolt
#

WHAT IS THIS OMG :D

earnest phoenix
#

client.on('message', msg => {
if (msg.content === 'kyazıyor aç') {
message.channel.startTyping()
msg.channel.send("a few moment later");
}
});
Why doesn't it work? what should I do?

umbral zealot
#

Well clearly there's something in your code that spams the API but there's not much we can tell without examining the entire bot code

toxic jolt
#

i buyed 2 VDS :D

earnest phoenix
umbral zealot
#

no I mean, what does it do

#

does it not respond at all?

toxic jolt
#

i changed message to msg

umbral zealot
#

ok and?

toxic jolt
#
client.on('message', msg => {
  if (msg.content === 'kyazıyor aç') {
    msg.channel.startTyping()
msg.channel.send("a few moment later");
  }
});```
#

here

earnest phoenix
#

not responding at all

#

thanks 😄

umbral zealot
#

And you're sending exactly kyazıyor aç in chat? noithing before or after? no uppercase letters?

toxic jolt
#

all channels?

twilit geode
#

how does a bot choose what custom emote to use if there are multiple of the same name

#

so like I may have a really complex emote name

#

but what stops someone from just maliciously copying it.

cinder patio
#

get the emote via it's id

twilit geode
#

im making a card & deck class for my bot and there is no good way that I see to assign each card an emote without doing every card manually

#

nevermind, the way javacord handles emotes, I should be able to check what server the emote is from

strong sail
formal trail
#

does anyone have an eval to leave all servers with less than 100 members for dbd.js?

twilit geode
#

why would you want to leave servers @formal trail

formal trail
#

I want my bot to leave servers with less than 100 members in order not to accumulate unusable servers

sterile lantern
#

wouldnt that be tos violation-ish

#

forcing the bot to leave the server

#

ig not

#

just run a script

#

that fetches all the guilds

#

if guild's member count is < 100

#

guild.leave

#

or whatever that function is

formal trail
#

can you do this script for me? never script to leave servers

#

@sterile lantern

sterile lantern
#

how many servers is your bot in?

formal trail
#

my bot is in dbd.js

sterile lantern
#

what..?

#

im asking u how many gulds is the bot in

formal trail
#

59

sterile lantern
#

i dont do dbd.js

#

but if your bot is in 59 servers

#

you should know how to do that

formal trail
#

I don't move because I'm new to dbd.js and I'm starting at the discord library now

sterile lantern
#

look at the docs

#

and fetch the guilds

#

after just use the guild leave function

#

or just go to their support sever and ask there

formal trail
#

thanks

sage bobcat
#

One message removed from a suspended account.

crimson vapor
#

wuts this

sage bobcat
#

One message removed from a suspended account.

inland quail
crimson vapor
#

oh

sage bobcat
#

One message removed from a suspended account.

crimson vapor
#

thats pog

sage bobcat
#

One message removed from a suspended account.

placid meadow
#

@sage bobcat im trying something new, with equation generator 😉

sage bobcat
#

One message removed from a suspended account.

placid meadow
#

what ya think

#

it plots equations , next part i have to make an interpreter for the equation from string

crimson vapor
#

what did you use?

#

to make the image

#

@placid meadow

placid meadow
#

manually, GDI

crimson vapor
#

GDI?

placid meadow
#

yeah dotnet's own 2d drawing routines

crimson vapor
#

o

#

it takes formulas as strings? or did you have to plot the points yourself?

placid meadow
#

thats the next step im gonna make ye

#

prolly need a small tokenizer

#

i thougt it be cool to have that as feature

crimson vapor
#

yea

#

@opal plank teach me postgresql

median moss
#

does anyone knows how can I apply toLowerCase here?

if (args[0] == 'dust2') {

        let EmbedDust = new Discord.MessageEmbed()
        .setColor("#1eb346")
        .setTitle("Dust 2 Map")
        .setImage("https://totalcsgo.com/image/callouts/dust2/overview.png")
        .setFooter("pb!help for support")
        message.channel.send(EmbedDust)```
crimson vapor
#

args[0].toLowerCase() == 'dust2'

median moss
#

@crimson vapor it says cannot read .toLowerCase of undefined

crimson vapor
#

you could do args[0]?.toLowerCase() but that doesn't really fix the issue that you aren't making sure that args[0] is given

median moss
#

if it doesn't have the arg it don't send the error message

crimson vapor
#

args[0]?.toLowerCase() will return a lowercase string or undefined

#

if its undefined then you aren't defining args correctly

median moss
crimson vapor
#

ah

ripe shadow
#

if (args) ?

median moss
crimson vapor
#

you could do (args[0] || '') but thats dumb

median moss
#

@crimson vapor so I can maybe make if(args[0])

#

or won't work?

cinder patio
#

Check if args[0] is undefined beforehand and if it is send an error message or something

#

then start comparing it

median moss
#

but when I use correctly the command it works normally

cinder patio
#

and I just told you what to do

shy turret
#

with pm2, how do you view the logs combined with the errors?

median moss
shy turret
#

--merge-logs doesn't seem to work

summer jolt
#

Alright so i am trying to set up (This person has voted) but
UnhandledPromiseRejectionWarning: Error [TOKEN_MISSING]: Request to use token, but token was unavailable to the client.

#

and i know for sure its right

echo granite
#

hallo

#

i am new in server

earnest phoenix
#

nice

earnest phoenix
summer jolt
#

oh

#

how can i fix this?

earnest phoenix
#

By calling the method after the client is logged in

summer jolt
#

...

earnest phoenix
#

Show us the code at least

median moss
#
const Discord = require('discord.js');
var request = require('request');
var cheerio = require('cheerio');

function getStatData(location , $){
    var selector = $('.segment-stats .value').eq(location).text();
    var stat_array = $.parseHTML(selector);
    var stat = 0;

    if(stat_array == null || stat_array.lengh == 0){
        return -1;
    }else{
        stat = stat_array[0].data;
    }

    return stat;
}  

exports.run = async (client, message, args) => {
    var UR_L = "http://csgobackpack.net/api/GetInventoryValue/?id=" + args[0];

    if(!args[0]){
        return message.channel.send("Please Enter a valid STEAMID64");
    }

    request(UR_L, function(err, resp, body){
        $ = cheerio.load(body);

        var success = getStatData(0, $);
        if(success == false){
            return message.channel.send("Invalid, make sure you wrote the STEAMID64, and that the user account is not private.");
        }

        var value = getStatData(1, $);
        var items = getStatData(2, $);
        var currency = getStatData(3, $);

        var embed = new Discord.MessageEmbed()
            .setTitle("__***CSGO Inventory***__")
            .setURL(UR_L)
            .addField("Current inventory",
            "Number of Items: " + "__**" + items + "**__" + "\n" +
            "Total Inventory Value: " + "__**" + currency + value + "**__", true)
            .setTimestamp()
            .setColor("#1eb346")
            .setFooter("pb!help for support");

        message.channel.send(embed);
    })
}```

idk why but all the datas are -1, when they should be different. Does anyone know what my error is?

API Link: https://csgobackpack.net/api/
pale vessel
#

oof why you using a deprecated lib, request

crimson vapor
#

fetch is pog, just use fetch

#

node-fetch

median moss
#

ok, and how to use it?

#

like

#

how does it works

pale vessel
#

read their readme

median moss
#

can you send me the link pls?

opal plank
crimson vapor
#

teach me SQL

lyric mountain
#

I'm gonna do what I call a pro gamer move

#

erwin, tell me about detritus

pale vessel
#

ok thx

crimson vapor
#

no

#

oh

#

erwin or another thing?

#

oh yea ads

pale vessel
#

both you mean

quartz kindle
#

because erwin is famous for his ads

#

xD

crimson vapor
#

he is a salesman

#

@quartz kindle

pale vessel
#

accurate

quartz kindle
#

XDDD

blissful coral
#

Editing djs to have stage channels for v12 go brrr

median moss
#

@pale vessel

const Discord = require('discord.js');
var fetch = require('node-fetch');
var cheerio = require('cheerio');

function getStatData(location , $){
    var selector = $('.segment-stats .value').eq(location).text();
    var stat_array = $.parseHTML(selector);
    var stat = 0;

    if(stat_array == null || stat_array.lengh == 0){
        return -1;
    }else{
        stat = stat_array[0].data;
    }

    return stat;
}  

exports.run = async (client, message, args) => {
    var UR_L = "http://csgobackpack.net/api/GetInventoryValue/?id=" + args[0];

    if(!args[0]){
        return message.channel.send("Please Enter a valid STEAMID64");
    }

    fetch(UR_L, function(err, resp, body){
        $ = cheerio.load(body);

        var success = getStatData(0, $);
        if(success == false){
            return message.channel.send("Invalid, make sure you wrote the STEAMID64, and that the user account is not private.");
        }

        var value = getStatData(1, $);
        var items = getStatData(2, $);
        var currency = getStatData(3, $);

        var embed = new Discord.MessageEmbed()
            .setTitle("__***CSGO Inventory***__")
            .setURL(UR_L)
            .addField("Current inventory",
            "Number of Items: " + "__**" + items + "**__" + "\n" +
            "Total Inventory Value: " + "__**" + currency + value + "**__", true)
            .setTimestamp()
            .setColor("#1eb346")
            .setFooter("pb!help for support");

        message.channel.send(embed);
    })
}```

still not working
pale vessel
#

you don't just change request to fetch

#

use it the proper way too, examples are in their docs

blissful coral
median moss
blissful coral
#

Read the docs

pale vessel
#

i don't even know if fetch supports callback

blissful coral
#

uhhhh don't think so...

pale vessel
#

but it shouldn't

blissful coral
#

from my knowledge it does not

median moss
#

;-;

#

then I'll keep using request

pale vessel
#

even IF it supports it they still need to use the res.text function

median moss
#

I use it request on other commands and work perfectly

pale vessel
#

right

#

revert then, if it's easier for you

median moss
#

but do you know why the command is sending the incorrect informations?

pale vessel
#

but it really isn't hard to use, if you read the readme js const body = await fetch(url).then(res => res.text()); const $ = cheerio.load(body);

#

you don't even need those fetch(UR_L, function(err, resp, body){ ... }anymore

blissful coral
#

this

pale vessel
#

log all your variables and see where it went wrong

#

if you wrote all that code yourself then you might get the idea already

opal plank
median moss
opal plank
#

unironically or just playing around? cuz im legit short on time

pale vessel
#

a weeb is short on time? impossible

midnight blaze
#

I need help with express js. What is wrong with my script?

Error: cannot read "password" of undefined.

express js:

const express = require('express');
const app = express();

app.use(express.json());
app.use(express.static("public"))

app.get("/login", (req,res)=>{
    res.sendFile(__dirname+"/public/login.html")
});

app.post("/login", (req,res) => {
    console.log(res.body.password)
    console.log(res.body.name)
    
})


app.listen(3000)

--
html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Login</title>
</head>
<body>
    <label>Login</label>
    <form method="POST" action="/login">
        <input name="login"/>
        <input name="password"/>
        <button type="submit">send</button>
    </form>

    
</body>
</html>
opal plank
#

though, legit, i got errands to run

earnest phoenix
midnight blaze
#

yes

pale vessel
#

you mean req?

#

res is response

#

body is included in request

earnest phoenix
#

yea, use req

pale vessel
#

i barely used express though

earnest phoenix
#

Ok

umbral zealot
#

or it could be req, lol

midnight blaze
#

req is better

#

but

#

it aint the solution

earnest phoenix
#

Have you tried logging req.body and see what it returns

midnight blaze
#

yes, just did

#

empty

earnest phoenix
#

Then yea, look at what hindsight said

midnight blaze
#

@umbral zealot in the form tag

#

what does value mean

#

value=" "

#

do I have to add that?

umbral zealot
#

oh I think I know what the problem is. heh

#

missing id in the form imput fields

midnight blaze
#

really?

umbral zealot
#

name isn't usually enough

midnight blaze
#

id and name have to be the same?

umbral zealot
#

I always do both just for sure, and yes, try both being the same

midnight blaze
#

yes

#

that crap was it

cosmic forum
#

Anyone know if it's possible to send data from a nodejs server to another nodejs server and have the other nodejs server parse the data sent?

cosmic forum
opal plank
#

if they are in the same process, use IPC

#

otherwise, use http/api

#

search IPC

#

you'll see what i mean

#

aight, time to head out

cosmic forum
#

Ok

fierce ether
#

message.guild.members.cache.filter(m => !m.user.bot).size how do i account for members not inside of the cache

pale vessel
#

fetch all members first

#
await message.guild.members.fetch();
message.guild.members.cache.filter(m => !m.user.bot).size```
#

just add that first line, assuming you have the intent

rough current
#

Is there a way for discord bots you can do something like client.uptime ect I can not find anything in the docs I use discord.py

sudden geyser
#

I don't see many mention of it in the documentation. One way would be to save the timestamp when the ready event is called (which may be triggered multiple times).

dusk scarab
#

hello so I am trying to use canvacord to make the rank card, and the rank is always 1...

#

and when I do user.rank it gives me an error

#

does anyone here know what is wrong and what I have to do to fetch their rank

#

btw im using discord-xp

#

please ping me if you know what is going on

placid meadow
#

ahhyiiss ...

#

plotter finished

#

@slender thistle

tulip ledge
#
User@DESKTOP-4N2JIA7 MINGW64 ~/Documents/Projects/Main Projects
$ git remote add origin https://github.com/Vigintillionn/repo
fatal: not a git repository (or any of the parent directories): .git

User@DESKTOP-4N2JIA7 MINGW64 ~/Documents/Projects/Main Projects
$ git remote -v
fatal: not a git repository (or any of the parent directories): .git
#

anyone knows why I keep getting this error?

#

ok nvm I was in wrong folder lol

placid meadow
#

mingw havnt seen that for a while 😛

somber nimbus
#

I'm looking for a bot that watches roles and automatically applies higher roles according to the roles people have. For example: to receive role A in a server, you must first acquire roles 1, 2, and 3. Normally, I'd have to manually check everyone's roles and manually tag the people with those 3 roles with the 'A' role but with hundreds of users, this is way too much. What I'm using this for is my gaming guild. As people achieve clears in game, they get tagged for that achievement automatically with another bot I use. I want a ranking system based on those clears in order to lock less experienced people out of harder content.

YAGPDB has this function in "Role commands" but it's not automated. My users would have to manually enter commands for the bot to tag them. It's already way too much to ask them to read anything, so we can forget hoping they can figure out how to copypasta commands.

blissful coral
#

Am I the only one who thought djs v13 was released when they pinged

crimson vapor
#

probably

earnest phoenix
#

i saw a few of the new changes tho, like the timeout getting removed from <Message>.delete()

#

not a lot of major changes so far

quartz kindle
blissful coral
#

lmao

lament rock
#

Nooooo. They removed disableMentions which I made D:

grizzled raven
#

use allowedMentions instead

lament rock
#

I don't even use discord.js lol

quartz kindle
#

use D++ :^)

lament rock
#

Also, Tim. It took me a month or two, but I finally migrated to postgres and things perform so much better than on maria and/or redis

#

So nice to not have to worry about performance being an issue for a while

crimson vapor
#

@pale vessel do you know the intents site thing that has the easy generator?

blissful coral
#

Ok for some random reason

#

When I move my main dashboard page from / to /server/:serverID it decides to not load any of my static files

#

any reason it would do this?

tacit sequoia
blissful coral
#

When was that said?

tacit sequoia
#

Saw some notes of Discord.js dev's scolding some person who was fetching all menbers

opal plank
#

Havent heard anything of the sort

#

Most bots DO fetch all members

#

But that scaled poorly

#

Cuz too many members might cause u to skip a heartbeat

quartz kindle
#

not guild.members.fetch()

tacit sequoia
#

Ah, thats what I meant. Sorry

blissful coral
quartz kindle
#

exdee

smoky herald
#

Help pleeeeease zz_aquasob Once I launch my bot it takes like 10 minutes for this to appear the first time, since then it keeps popping multiplied in intervals until it reaches point where the whole app crashes on "MaxListenersExceededWarning: Possible EventEmitter memory leak detected..." SakuSigh

distant cloak
#

support

lament rock
smoky herald
#

cuz I only got client.on and client.on ready - each once - inside my DB connection

misty sigil
#

why would you do that

vivid fulcrum
#

smells like bad design

slender thistle
smoky herald
#

what is the correct design then?

misty sigil
#

separate them?

smoky herald
#

and do you think the abort requests were caused by that? I'll figure out soon ig tho 😆

outer ridge
#

[

soft glade
#

im trying to use an anime quote api and this is the code

def get_anime():
  response = requests.get("https://animechan.vercel.app/api/random")
  json_data = json.loads(response.text)
  quote = "**" + json_data[0]['q'] + "** *-" + json_data[0]['a'] + "*"
  return(quote)

and im getting this error message for some reason

slender thistle
#

json_data[0] is wrong

earnest phoenix
#

Blocking blobweary

onyx hare
#

so i have a report command, i wanna make it so the Bot grabs the message link of the report so the staff can review where the timestamp of the report came from, how would i grab the message link of the origins of the report?

quartz kindle
#

your library should provide a message url in the message object

queen kettle
#

!hellp

#

!help

#

#help

earnest phoenix
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

crimson vapor
#

what happens when you zip your desktop or something

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

unreal estuary
#

is anyone familiar with fastify here

still umbra
scarlet furnace
#

how do I update my bot information on the site? javascript

crimson vapor
#

post to the api

earnest phoenix
#

Anyone?

#
@client.command()
async def buy(ctx,item,amount = 1):
  await open_account(ctx.author)

  res = await buy_this(ctx.author,item,amount)

  if not res[0]:
     if res[1]==1:
       await ctx.send("That object isn't there!")
       return
     if res[1]==2:
       await ctx.send(f"You don't have enough money in your wallet to buy that! {amount}")
       return
      
      
  await ctx.send(f"You just bought {amount} {item} level.")





async def buy_this(user,item_name,amount):
  item_name = item_name.lower()
  name_ = None
  for item in lvlshop:
    name = item["name"].lower()
    if name == item_name:
      name_ = name
      price = item["price"]
      break

  if name_ == None:
    return [False,1]

  cost = price*amount

  users = await get_economy_data()

  bal = await update_economy(user)

  if bal[0]<cost:
    return [False,2]


  try:
    index = 0
    t = None
    for thing in users[str(user.id)]["level"]:
      n = thing["item"]
      if n == item_name:
        old_amt = thing["amount"]
        new_amt = old_amt + amount
        users[str(user.id)]["level"][index]["amount"] = new_amt
        t = 1
        break
      index+=1  
    if t == None:
        obj = {"item":item_name , "amount" : amount}
        users[str(user.id)]["level"].append(obj)
    
  except:
    obj = {"item":item_name , "amount" : amount}
    users[str(user.id)]["level"] = [obj]

  with open("economy.json","w") as f:
    json.dump(users,f)

  await update_economy(user,cost*-1,"wallet")

  return[True,"Worked"]



#
@client.command()
async def gbuy(ctx,item,amount = 1):
  await open_account(ctx.author)

  res = await gbuy_this(ctx.author,item,amount)

  if not res[0]:
     if res[1]==1:
       await ctx.send("That object isn't there!")
       return
     if res[1]==2:
       await ctx.send(f"You don't have enough money in your wallet to buy that! {amount}")
       return
      
      
  await ctx.send(f"You just bought {amount} {item}.")





async def gbuy_this(user,item_name,amount):
  item_name = item_name.lower()
  name_ = None
  for item in gstore:
    name = item["name"].lower()
    if name == item_name:
      name_ = name
      price = item["price"]
      break

  if name_ == None:
    return [False,1]

  cost = price*amount

  users = await get_economy_data()

  bal = await update_economy(user)

  if bal[0]<cost:
    return [False,2]


  try:
    index = 0
    t = None
    for thing in users[str(user.id)]["inv"]:
      n = thing["item"]
      if n == item_name:
        old_amt = thing["amount"]
        new_amt = old_amt + amount
        users[str(user.id)]["inv"][index]["amount"] = new_amt
        t = 1
        break
      index+=1  
    if t == None:
        obj = {"item":item_name , "amount" : amount}
        users[str(user.id)]["inv"].append(obj)
    
  except:
    obj = {"item":item_name , "amount" : amount}
    users[str(user.id)]["inv"] = [obj]

  with open("economy.json","w") as f:
    json.dump(users,f)

  await update_economy(user,cost*-1,"likes")

  return[True,"Worked"]


#

They are identical except for the currency

#

One allows a negative balance

#

How to fix?

#

One allows a negative balance

unreal estuary
#

is that a json database

earnest phoenix
#

Yes

#

I know I knwo

unreal estuary
earnest phoenix
#

But being the case what do I do?

unreal estuary
#

hmmmmmmmmm

earnest phoenix
unreal estuary
#

which one allows a negative balance

earnest phoenix
#

Gbuy

#

Buy works successfully

unreal estuary
#

what

earnest phoenix
#

Its 2 diff stores... buy works.. if a user dosent have enough money it returns false 2.. but gbuy dosnet it just makes the balance negative

#

Each store uses a different currency

old cliff
#

does djs 12 support stage channels?

earnest phoenix
#

Is this the issue?

unreal estuary
#

im not rlly sure what im lookg at

#

ur pointing at the function name

earnest phoenix
#

Line 1016 "wallet"

#

D9 I need to add ,"likes"

unreal estuary
#

tbh idk lol

earnest phoenix
#

Lol

#

Nope that broke the bot

#

Unless "wallet","likes" is not how you do it?

unreal estuary
#

idk

#

also are u coding on mobile

#

cuz thats tough stuff

earnest phoenix
#

Ues

#

Yes

#

And I know

#

But the bot works well

#

Its just this lil issue

unreal estuary
#

1 sec

#

ill actually look at the code lol

earnest phoenix
#

Omg ty

earnest phoenix
unreal estuary
#

what is "cost" defined as

#

oh wait lol

earnest phoenix
#

Lol

unreal estuary
#

found it

earnest phoenix
#
@client.command()
async def gbuy(ctx,item,amount = 1):
  await open_account(ctx.author)

  res = await gbuy_this(ctx.author,item,amount)

  if not res[0]:
     if res[1]==1:
       await ctx.send("That object isn't there!")
       return
     if res[1]==2:
       await ctx.send(f"You don't have enough money in your wallet to buy that! {amount}")
       return
      
      
  await ctx.send(f"You just bought {amount} {item}.")





async def gbuy_this(user,item_name,amount):
  item_name = item_name.lower()
  name_ = None
  for item in gstore:
    name = item["name"].lower()
    if name == item_name:
      name_ = name
      price = item["price"]
      break

  if name_ == None:
    return [False,1]

  cost = price*amount

  users = await get_economy_data()

  bal = await update_economy(user)

  if bal[0]<cost:
    return [False,2]


  try:
    index = 0
    t = None
    for thing in users[str(user.id)]["inv"]:
      n = thing["item"]
      if n == item_name:
        old_amt = thing["amount"]
        new_amt = old_amt + amount
        users[str(user.id)]["inv"][index]["amount"] = new_amt
        t = 1
        break
      index+=1  
    if t == None:
        obj = {"item":item_name , "amount" : amount}
        users[str(user.id)]["inv"].append(obj)
    
  except:
    obj = {"item":item_name , "amount" : amount}
    users[str(user.id)]["inv"] = [obj]

  with open("economy.json","w") as f:
    json.dump(users,f)

  await update_economy(user,cost*-1,"likes")

  return[True,"Worked"]


unreal estuary
#

thats the one that dont work?

earnest phoenix
#

Yes

unreal estuary
#

res = await buy_this(ctx.author,item,amount)

#

res = await gbuy_this(ctx.author,item,amount)

#

waoot

earnest phoenix
#

O.o

unreal estuary
#

sorry im like braindead rn

#

idont think i can help lol

earnest phoenix
#

Ok

unreal estuary
earnest phoenix
#

Ty anyhow

unreal estuary
#

im a dissappointment

#

maybe smart boy jesus can assist you

earnest phoenix
#

O.o maybe my savior is coming

unreal estuary
#

lmao

earnest phoenix
#

You saw that too lol

unreal estuary
#

nah jesus abondoned us

earnest phoenix
#

Typical

fickle magnet
river panther
#

why does it reply with winner is undefined

#

?

#

wait

#

foind it

#

i shall use a collector

earnest phoenix
river panther
#

no u

earnest phoenix
#

no u

cedar crow
river panther
#

-.-

cedar crow
#

did u define user

#

f my eyes

#

hold on

river panther
#

reaction.users

#

breh

cedar crow
#

sorry my eyes

river panther
#

mhm

#

ik reading other dev's code is a pain xD

cedar crow
#

very

#

lol

river panther
#

ye

cedar crow
#

just a question

#

did u finish ur setTimeout function?

river panther
#

yes

cedar crow
#

k

river panther
#

this is the only error

cedar crow
#

i havent worked a lot with reactions

river panther
#

ah, ok

old cliff
#

Try logging the winner

#

Also try logging the reaction object

raw pawn
#

hey guys how do u add prefixes to bots that ur making?

waxen bough
#

we add an if condition where if a message starts with a certain word or symbol then it's a command

raw pawn
#

?

#

sorry i didnt get that

waxen bough
#

for example... if you want the prefix to be "--" then this code

client.on('message',(message)=>{
  if ( message.content.startsWith("--") ) { // This is what i'm talking about
    //do some actions 
  } ;
});
raw pawn
#

uh hehe sorry where do u find that?

waxen bough
raw pawn
#

ooh ok

#

wait how?

#
  if ( message.content.startsWith("~") ) { // This is what i'm talking about
    //do some actions 
  } ;
});
#

?

#

oop

#

im so bad at bot amking TvT

waxen bough
#

do you know how to code in javascript

#

or python?

raw pawn
#

nop TvT first timer

waxen bough
waxen bough
#

mainly Javascript or Python

raw pawn
#

hehe idek how to do that TvT

waxen bough
raw pawn
#

ooh ok

waxen bough
#

...if you prefer javascript

restive furnace
#

you can use other languages for developing bots too tho.

raw pawn
#

oh mk

waxen bough
#

yes

#

i even saw a github repository of discord client written in PHP

restive furnace
#

PHP is not even weird to write discord bots in ¯\_(ツ)_/¯

waxen bough
#

yes

restive furnace
#

I saw a bash script which connects into Discord and acts as an bot.

waxen bough
#

if it's well maintained then why not

raw pawn
#

hey guys what if the website is like this?

waxen bough
#

there's a dot in the end. remove it

raw pawn
#

ooh ok

#

is this it?

waxen bough
raw pawn
#

oh ok

#

this one?

waxen bough
#

yes

raw pawn
#

mkey

#

uhhh how do i do this again? hehe sorry

waxen bough
#

not really

#

wait wait

#

there's actually separate tutorial for node.js

raw pawn
#

oooh okie

waxen bough
raw pawn
#

is it this one?

#

what how?

fickle magnet
#
import time
import threading
import time

q = []

class QueueManager:
    def __init__(self,num):
        self.q = []
        self.Node = None
        self.num = num
    def insert(self, val):
        self.q.append(val)
    def update(self):
        while True:
            #the time delay is there to test the queue system
            time.sleep(1)
            if len(self.q) > 10:
                if self.Node == None:
                    self.Node = QueueManager(self.num + 1)


                    #this is splits the array and puts it in the Node within itself simular to a binary search tree
                    self.Node.q = [self.q[i] for i in range(len(self.q)) if i >= len(self.q) / 2]
                    self.q = [self.q[i] for i in range(len(self.q)) if i <= len(self.q) / 2]

                    #for each node it makes a thread this just activates it
                    th = threading.Thread(target=self.Node.update)
                    th.start()
                else:
                    self.Node.q = [self.q[i] for i in range(len(self.q)) if i >= len(self.q) / 2]
                    self.q = [self.q[i] for i in range(len(self.q)) if i <= len(self.q) / 2]
            if self.q != []:
                self.q.pop()
            print(f'{self.num} has {self.q} \n')
        

test = QueueManager(1)

t = threading.Thread(target=test.update)

t.start()

while True:
    test.insert(input())
    print(test.q)

this is a queue system algorithm I been working on to test a certain concept not sure if the increase in threads is a good idea however does improve the speed at which it handles the increase of data

#

yea I just had an idea of a queue system that splits itself into two threads to handle data but the problem is having more threads might not be a good thing

lusty quest
#

if i get more requests to the AI i spawn new Worker threads on different threads

#

if the requests are done the worker threads despawn

fickle magnet
#

oh

#

yea I am trying to see if I can add some sort of decontructor to it

lusty quest
#

like i say i want up to 5 workers, i can just configure it, if i get 500 requests each worker will handle 100 of them

#

gives better performance on the AI Classification

fickle magnet
#

@lusty quest also I was wondering when a bot crashes due to spam which part crashes the program the is receives the information and sends it to the server or the server where the source code is running at

lusty quest
fickle magnet
#

yea bot spams are usually rare

pale vessel
#

not really

fickle magnet
#

I mean depends on the spam usually

#

something like one guy spamming it can happen often but spams where you just have a bunch of people all spamming at once is rare

lusty quest
#

one guy spamming you probably wont notice if you dont run the bot on a toaster

fickle magnet
#

I might make a discord bot that handles multiple messages at once without crashing

lusty quest
#

lol my smaller bot handles a few million messages a day and without even noticing

#

and almost all of them are send to my AI for classification

fickle magnet
#

I ment like thousands of messages all being sent like super fast

lusty quest
#

depending on what you do with the messages they usually only take a few ms to get resolved

frail moth
#

how can i save some info in a bot like if i need to save. Like if i do !warzone ...#..battle and i want the next time the user does !warzone then he gets the info of the user after it

lusty quest
#

use a database, not json. json is fine for static stuff not dynamic stuff

hazy sparrow
#

database

frail moth
#

lol only for the 2 info strings?

#

can it not be done in a map or array?

lusty quest
#

you could, but its not persistant

#

if your process restarts for what ever reason its gone

frail moth
#

true but a db for only the name of the stats is to small to use a db right?

lusty quest
#

lol no

frail moth
#

its only like ....#2312 battle thats it

lusty quest
#

and for how many things did you want to do this? like if you only want to do it for one thing you could hardcode it into a json file, but if you want to make it for mutiple servers and more entries use a DB

#

or use a key store database

frail moth
#

well i did read the user has also a TAG item in discord.js maybee i can add it in there?

lusty quest
#

you could

frail moth
#

so i can read it from there so the i dont need to save it in a db

#

also the .env is that for every server different or 1 for all the servers?

lusty quest
#

the .env stores enviroment variables for the entire process

frail moth
#

oke its the same with that for let the admin select a channel 😄

lusty quest
#

but if you want to make the entire thing dynamic i still suggest some sort of proper database

#

if you want to make per guild configs, i can already suggest using a database

#

even if you only store 3 things

frail moth
#

its only to get this

lusty quest
#

so you want to get stats from a user?

#

isnt there a API for this?

frail moth
#

and they now have to use like !warzoneweekly ....#21312 battle

lusty quest
#

then you dont have to store anything

frail moth
#

yea i have that but i want the user only use that once and then do like !warzoneweekly

lusty quest
#

why?

frail moth
#

easy`r for the user

lusty quest
#

why? just call the API instead of your local storage

#

doesnt change anything for the user

#

and will be dynamic

gleaming hemlock
frail moth
#

yea they dont have to type every time the ...#23213 battle

lusty quest
frail moth
#

they have to use it once and then do like !warzone weekly and can do like more commands like solo, duo, trio, or quads

lusty quest
frail moth
#

so they dont have to enter the whole sting

#

no its weekly but i want so have like this first time its like !warzoneweekly .....#213123 battle and when they do it again they only have to do like !warzoneweekly. then they get the information

lusty quest
#

you could make it a bit more fancy then.
Create a database where you store the Warzone Username of the Discord users.
if a user uses the Warzone command you just look up the stats for the Discord user that ran the command using the Stored username
-> Will give you the ability to use the solo,duo, etc stuff

#

and the thing you want to do probably will cause issues. but if you want to do it, its your bot.

#

and it sounds like you want to store the stuff for mutiple users, so i would suggest to use a Database

frail moth
#

lol i dont have any access to a server db like i dont want to use a db on my pc to run it day and night

lusty quest
#

they are not that hard to use, but there are a few things to keep in mind, if you use "Free" Hosters like repl.it they delete the entire project and pull it again from github -> makes using SQlite based databases a pain in the asss

lusty quest
#

you get a Small Database for free, sure wont work if your bot blows up and gets millions of users, but to get started its good

frail moth
#

ill look in that may its something thx for the help.

stuck crag
#

is tracking number of commands used a part of storing user data?

earnest phoenix
#

Is there any downloadable version of the discord developer docs? Won't take the risk of having Opera open while I'm coding on Atom

lusty quest
stuck crag
#

yep

lusty quest
#

then yes

earnest phoenix
stuck crag
#

oki

earnest phoenix
#

which cannot be viewed even on public repls

lusty quest
earnest phoenix
#

i agree but who else cares ¯_(ツ)_/¯

stuck crag
#

and what should i upload in my id? (im a student so what id)

lusty quest
#

then i rather suggest using MongoDB atlas who uses services with decent rep for hosting the DBs

earnest phoenix
#

i did and i got a plain html page with no css

lusty quest
#

they run the Databases on AWS or Google or Azure

lusty quest
#

or drivers license

earnest phoenix
#

cant you use their hosting provider directly

stuck crag
#

alright

earnest phoenix
#

google firebase is free if you dont cross the quota limit

lusty quest
earnest phoenix
#

?

#

wos that

lusty quest
#

if one server catches fire you dont loose data

earnest phoenix
#

catches fire more like causes fire

lusty quest
#

you have 3 Servers, 1 Main server and 2 Replica sets, the main server sends the data it stores to the 2 other Servers so you have reduntand Storage and high Aviability

earnest phoenix
#

aviability

#

anyways imma go add my weebsocket shit to my lib

#

Why doesn't the reactionAdd event in discord.js detect reactions on messages sent before the bot was online?

regal saddle
#

probably because you cache messages, and the cache gets cleared everytime you restart your bot.

summer acorn
#

@summer torrent help

#

this issue is back

summer torrent
#

what did you do before

regal saddle
summer acorn
#

I still do that

earnest phoenix
#

not my knowledge at least

regal saddle
#

nvm messages get automatically cached.

#

still means everytime you restart your bot the cache gets cleared and the older messages don’t get cached again.

rose warren
#

Is there a limit to how many OAuth2 redirects you can set on your Discord developer dash? I'm at 13 redirects and can't seem to add a 14th

earnest phoenix
#

Hello

#

who can help me

#

with a code

#

im trying to get a guild by a specified id, but it cant find

cinder patio
#

what the

#

use fetch

#

And also... why are you putting the response in a custom header

earnest phoenix
#

the request it's fine

#

but

#

when itry to get the guild by the id

#

it cant find

#

when i try manually

#

it works

rose warren
earnest phoenix
#

why u need so many

cinder patio
#

Are you sure there isn't an empty space or something in the guild id you receive

rose warren
#

They redirect back to a link on my site with a parameter for Google Analytics tracking

woeful pike
#

lol putting the response in a header

rose warren
#

So I can see where the invite came from

earnest phoenix
woeful pike
#

why are you sending an html response to an xhr request

earnest phoenix
#

oh wait

#

nvm

#

fixed my error

#

i used fetch

#

thanks GoogleFeud

lusty quest
earnest phoenix
#

what is the problem ?

#

This is another bot's fault

long crow
#

Probably you do alot of client.on('message',

earnest phoenix
long crow
#

Tackle the issue 1 by 1. Firstly only use 1 listener

#

Also the ready event

cinder patio
#

React SSR with Nest.js sounds like pain

#

but I wanna use next.js so muccch

raw pawn
#

hOW YOU KEEP BOT ONLINE?

#

Help

pale vessel
#

rent a VPS

raw pawn
#

rent?

dusky sundial
#

You need a machine that runs your bot's code 24/7. So either your own computer, or a VPS

raw pawn
#

uh how?

dusky sundial
#

Wdym how?

raw pawn
#

my computer is on but my bot is offline

dusky sundial
#

is your computer running the code of your bot?

raw pawn
#

also this was my first time having made my own bot

dusky sundial
#

do you know how a bot works?

raw pawn
raw pawn
dusky sundial
raw pawn
raw pawn
#

its mah first time making my own bot sooo yea lol

dusky sundial
#

Okay so first of all, I'm not sure how repl.it works so I couldn't tell you. Also, I'm pretty sure you're only supposed to have one message listener.

raw pawn
#

message listener? whats that?

dusky sundial
#

client.on("message"...

raw pawn
#

ooohhh

#

i still dont know sorry-

dusky sundial
#

Well, I would recommend you to learn some basic programming concepts and a little JavaScript before getting into making a bot. But it's up to you

raw pawn
#

OH

#

woops

#

hehe

dusky sundial
#

Some people learn programming by making a bot. But it's usually not the best way to go about it

raw pawn
#

Oops

timber fractal
#

so i have this code to try and run the command and if there is an error it will send a message but why if there is an error it does console.log() it but it doesnt send a message?

try {
            command.run(client, message, args);
        } catch (error){
            console.error(error);
            message.channel.send(`OOPS, an error occured. ${error}`);
        }```
raw pawn
#

wut-

dusky sundial
#

Mmhm

marble juniper
#

its good to start off with something more normal

raw pawn
#

im sorry TvT

pale vessel
#

nop

marble juniper
#

like learning how the language works in the first place

#

learning the basics

#

maybe making a web server using express in js

#

something that doesn't require much knowledge you know

dusky sundial
#

It's like trying to learn the piano by trying to play a really hard song. It's gonna take a shit load of time and you won't be a good piano player nonetheless

earnest phoenix
#

Why is this giving error? token is working

marble juniper
#

its not that ideal to jump straight into something advanced without prior knowledge

timber fractal
raw pawn
#

uhh does watching yt tutorials help?

timber fractal
marble juniper
#

learn the basics and stuff and if you think you have learned good enough try doing something more advanced and work your way up

timber fractal
#

i jumoed straight inot making bots

marble juniper
#

study hard, work hard

#

lol

timber fractal
#

jumped*

#

but maybe learning js is good with yt tutorials

marble juniper
#

not rly

#

text guides are better

marble juniper
#

you can read faster than you can hear

#

lol

#

a human can read 250 words in a minute

#

for a video you only hear 150 in a minute

#

lol

#

also text guides are usually better

earnest phoenix
marble juniper
#

as text guides can easily be updated

#

unlike a youtube video

#

which is why most youtube tutorials are also old and outdated

raw pawn
timber fractal
#

so i have this code to try and run the command and if there is an error it will send a message but why if there is an error it does console.log() it but it doesnt send a message?

try {
            command.run(client, message, args);
        } catch (error){
            console.error(error);
            message.channel.send(`OOPS, an error occured. ${error}`);
        }```
#

?

lusty quest
raw pawn
#

ok yep im doomed : D

timber fractal
#

if i dont try to make an error it just sends the message

#

from the command

timber fractal
raw pawn
#

I just need my bot to stay online and thats it TvT

vivid fulcrum
#

don't log errors to discord

#

in fact

marble juniper
#

just say an error occure and don't show it

#

lol

vivid fulcrum
#

^

marble juniper
#

99% who use ur bot are not bot devs and wont give a shit about it

timber fractal
#

no only like embed fields may not be empty

#

i just want it to do

#

i dont care if others dont care

vivid fulcrum
#

what is your user going to do with that information

timber fractal
#

i want it to work

lusty quest
#

if you want to have a quick debug message, make a channel on your support discord where you send the errors in. but console is mostly more than enough

vivid fulcrum
#

do not

#

stop logging to discord

timber fractal
vivid fulcrum
#

🙄

timber fractal
#

i just want this to work if you cant help be quit

lusty quest
#

did you get errors in the console?

timber fractal
#

i just want it i dont care abt ur opinion

lusty quest
#

why it doesnt work

timber fractal
lusty quest
#

would be ironic if the error trys to send the function to send the error as a error

timber fractal
#

do u need index.js?

lusty quest
#

i need the error

timber fractal
#

there is only the error i created by myself nothing more

raw pawn
#

can someone help pls? maybe like a command or message line? or whatever?

timber fractal
#

it just doesnt send the message

#

if i try to run the command it says this

waxen bough
vivid fulcrum
#

the error is more than likely too long to send

timber fractal
#

okay

vivid fulcrum
#

which is why you should 👏stop👏logging👏messages👏to👏discord👏

tacit sequoia
#

Oop

vivid fulcrum
#

you're a moron

waxen bough
pale vessel
#

error.stack gang

tacit sequoia
#

Err is an object, no?

pale vessel
#

if you want to send it, send it as file

timber fractal
pale vessel
#

take advantage of the new discord feature
\

vivid fulcrum
#

an error has a toString override, no?

pale vessel
#

just send it as attachment

#

way easier

waxen bough
waxen bough
timber fractal
timber fractal
waxen bough
waxen bough
pale vessel
#

they did the same

#

`${error}` toString()'s it

timber fractal
raw pawn
#

im surrounded by pros and im crying cuz ive made the biggest mistake i couldve ever made TvT

timber fractal
#

do u need index.js maybe?

raw pawn
#

#CryingIntheClub

raw pawn
tacit sequoia
timber fractal
tacit sequoia
timber fractal
#

yes

#

exaactly

raw pawn
tacit sequoia
#

So that he can get his "debug channel" cat_reee

vivid fulcrum
#

are you sure that the error is logged in the catch clause

timber fractal
vivid fulcrum
#

im on a phone so it would be a nightmare

#

but to confirm it

timber fractal
#

here is it

#

u can just read it right?

pale vessel
#

first time you're not invisible

vivid fulcrum
#

console.log("a") in the catch clause

timber fractal
#

i need to

#

go

#

sorry

#

i will continue later