#development

1 messages · Page 689 of 1

amber fractal
#

That still wont work

topaz fjord
#

also

#

format pls

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

topaz fjord
#
message.channel.send(`you rolled a ${rollDie()}`)
inner jewel
#

format your code

topaz fjord
#

^

#

why no spaces after brackets

#

*newlines

sage bobcat
#

One message removed from a suspended account.

topaz fjord
#

then get a linter

inner jewel
#

formatted ```js
const Discord = require('discord.js');
module.exports.run = async (client, message, args) => {
function rollDie(sides = 6) {
Math.floor(Math.random() * sides) + 1;
}
message.channel.send(you rolled a ${rollDie}!)
}

module.exports.help = {
name: 'roll'
}```

vs unformatted```js
const Discord = require('discord.js');
module.exports.run = async(client, message, args) => {

function rollDie(sides = 6) {
Math.floor(Math.random() * sides) + 1;
}
message.channel.send(you rolled a ${rollDie}!)
}
module.exports.help = {
name: "roll"
}```

#

formatted code is way easier to read

#

if people can't read your code your chances of getting help are lower

#

also most editors have formatting built into them

topaz fjord
#
const Discord = require('discord.js');

module.exports.run = async (client, message, args) => {
  message.channel.send(`you rolled a ${rollDie}!`)
}

function rollDie(sides = 6) {
    return Math.floor(Math.random() * sides) + 1;
}

module.exports.help = {
  name: 'roll'
}
``` *fixed
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

inner jewel
#

missing return

sage bobcat
#

One message removed from a suspended account.

earnest phoenix
#

you don't call the function

bitter sundial
#

looks like the redesign changed code formatting colors?

topaz fjord
#

@bitter sundial it changed lots

#

most of it i hate

bitter sundial
#

ah, a blind change hater

topaz fjord
#

```Kotlin
``` works tho

#

so im happy about that

bitter sundial
#

I like most of the new design

#

some things will take some getting used to

earnest phoenix
#

everything is perfect except font width

topaz fjord
#

what with the font tho

#

before it was huge

#

now its small

earnest phoenix
#

too thicc

topaz fjord
#

after a client restart it fixed itself

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

topaz fjord
#

no

#

im blind

earnest phoenix
#

what you had before was fine
you just werent calling the function

sage bobcat
#

One message removed from a suspended account.

topaz fjord
#

log rollDie() and see the output

earnest phoenix
#

>>> what you had before was fine
you just werent calling the function

topaz fjord
#

it wasn't

#

because before the function wasn't returning anything

earnest phoenix
#

oh i was reading your code bloblul

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

topaz fjord
#

where did you put the console.log

sage bobcat
#

One message removed from a suspended account.

topaz fjord
#

move the function outside of the module.exports.run and try again

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

amber fractal
#

No, just move the function

#

To the bottom of the file

#

Or top

#

Or wherever, just not in the .run

#

Or .help mmulu

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

topaz fjord
#

well ofc

#

you moves the console.log out of the .run

amber fractal
#

You have the console.log out of run

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

topaz fjord
#

is run even getting called

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.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

topaz fjord
#

what

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

topaz fjord
#

its generally not a good idea to keep the function inside .run

#

since it'll create a new one each time .run is called

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.

topaz fjord
#

when you run the command does it send anything

sage bobcat
#

One message removed from a suspended account.

topaz fjord
#

so

sage bobcat
#

One message removed from a suspended account.

topaz fjord
#

my question is

#

is .run even getting called

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

topaz fjord
#

because if its not executing anything the run function isn't getting called

#

did you load the command into the bot

sage bobcat
#

One message removed from a suspended account.

broken shale
#
const Discord = require('discord.js');

module.exports.run = async(client, message, args) => {
    const rand = Math.floor(Math.random() * 6) + 1;
      message.channel.send(`you rolled a ${rand}`)
}

module.exports.help = {
  name: "roll"
}```
sage bobcat
#

One message removed from a suspended account.

broken shale
#

tbh don't use a function for that

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

topaz fjord
#

can someone else take over

#

i need to go do some work

broken shale
#

sure

#

Can you try what I sent @sage bobcat

sage bobcat
#

One message removed from a suspended account.

broken shale
#

I doubt it's gonna make a difference though since I just got rid of the function

sage bobcat
#

One message removed from a suspended account.

broken shale
#

change message.channel.send() to console.log()

#

then run it and check console

#

Anything? @sage bobcat

sage bobcat
#

One message removed from a suspended account.

broken shale
#

np, so did anything show in the console?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

broken shale
#

hm

#

Can I see your command handler

#

@sage bobcat

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

broken shale
#

kill the bot

#

I have a strong feeling it's in the main file, theres something wrong with the command handler

#

go to your roll file then console.log(message)

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

broken shale
#

return message.channel.send()

inner jewel
#

it responds to any messages in a dm

#

including it's own

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

broken shale
#
if (message.channel.type == 'dm' || message.author.bot) return;```
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

broken shale
#

what's strange is the command handler looks fine but no clue why it's not sending the roll message

#

go to the roll file and console.log(message)

#

and tell me what you get

sage bobcat
#

One message removed from a suspended account.

broken shale
#

so it does work

sage bobcat
#

One message removed from a suspended account.

broken shale
#

Why is it not working then MegaThonk

#

Also in your roll file, client is bot

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

broken shale
#
const Discord = require('discord.js');

module.exports.run = async(client, message, args) => { // client is supposed to be bot
    const rand = Math.floor(Math.random() * 6) + 1;
      message.channel.send(`you rolled a ${rand}`)
}

module.exports.help = {
  name: "roll"
}```
sage bobcat
#

One message removed from a suspended account.

broken shale
#

since in your command handler you defined it as bot

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

amber fractal
#

It doesnt matter what it's called when you pass it

sage bobcat
#

One message removed from a suspended account.

amber fractal
#

As long as he passes it as bot it can be whatever

broken shale
amber fractal
#

Yes

broken shale
#

he passed it as client in the file

amber fractal
#

Doesnt matter

#

Oh

#

Wait what

sage bobcat
#

One message removed from a suspended account.

amber fractal
#

He defined it as bot in the main file

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

broken shale
#

async (client, message, args)
should be async (bot, message, args)

amber fractal
#

It doesnt matter.

#

Like you can call it whatever after you pass it

sage bobcat
#

One message removed from a suspended account.

broken shale
#

Still doesn't answer why it doesn't send the message

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

amber fractal
#

Because it doesnt matter what it's called after you pass it. It's just a variable name

#

But

#

Is it just not sending?

broken shale
#

Still doesn't explain why it's not sending

sage bobcat
#

One message removed from a suspended account.

broken shale
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

amber fractal
#

What's the current code

sage bobcat
#

One message removed from a suspended account.

candid sedge
fiery birch
#

you got pranked

#

this is support for development of bots

#

rather than adding them

candid sedge
amber fractal
#

Try to add .catch(e => console.error(e)) after the .send

#

And you're sure the command is running right?

west raptor
#

@sage bobcat is the command even running

#

oh

#

they just asked that

#

im blind

broken shale
#

it logged it to console to yes

west raptor
#

that never confirmed if the command is running

broken shale
#

logged in the actual command

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

#

One message removed from a suspended account.

abstract crow
#

https://vinniehat.is-inside.me/N9GdPevb.png What do you guys think? Any suggestions?

I am not the best but I am proud lul
I went with this font called Manjari instead of the usual for me called Montseratt or something like tha

dusky geode
#

Both look blue

earnest phoenix
#

second better, ultimate bit kinda cringe ngl

#

i'd make the gradient diagonal or remove it

abstract crow
#

I will try a gradient diagonal

earnest phoenix
#

make ultimate blue, like the logo

#

agreed

hushed berry
#

hey yall

earnest phoenix
#

also it's kinda ironic there's no blue square anywhere there :P

#

hiya

hushed berry
#

oh hey i use a diagonal gradient on my website

#

at vinnie

abstract crow
#

at nikki

hushed berry
#

henlo

#

why hath you pingeth meth

earnest phoenix
#

library developer :o

#

what library did you develop

hushed berry
#

the library of alexandria

abstract crow
#

the library of noob help

earnest phoenix
#

that's pretty neat

#

shame about the whole burning thing

hushed berry
#

common misconception

earnest phoenix
#

!

hushed berry
#

it wasnt actually burned down

abstract crow
#

i was just about to do something and then stopped so that way I didn't get in trouble

earnest phoenix
#

oh interesting

abstract crow
#

ikr

lusty dew
#

Lol

abstract crow
#

a lot of people care about what I think

earnest phoenix
#

kek

lusty dew
#

Really who?

earnest phoenix
#

apparently the library was only said to have burned down, but in reality the most likely occurrence was that only a place that housed some scrolls burned down

#

ok sorry off topic

lusty dew
#

Lol

abstract crow
#

memeas

copper cradle
#

ok

earnest phoenix
#

what's the map function to view guild emojis

amber fractal
#

We dont spoonfeed

copper cradle
#

@earnest phoenixik

#
earnest phoenix
#
lusty dew
#

Who uses bing....

earnest phoenix
#

cultured people ofc

west spoke
#

"Google" is the #1 most searched thing on there

amber fractal
#

Rather use ie than bing mmulu

west spoke
#

^

earnest phoenix
#

fine use https://yahoo.com for all of your searching needs

west spoke
#

Even worse

lusty dew
#

Yahoo is so old

#

Forgot it existed

earnest phoenix
#
lusty dew
#

Didn’t know that existed

earnest phoenix
#

it apparently does

lusty dew
#

Looks like a rip-off of google

copper cradle
#

lmao

earnest phoenix
copper cradle
#

why

earnest phoenix
#

best search engine

copper cradle
#

why is that a thing

lusty dew
#

It is the worst

#

Won’t let me search up dogs ;(

#

Safari is the best search engine mmLol

earnest phoenix
#

the what

#

nvm got it

#

thanks for the "help"

amber fractal
#

We weren't going to give you the code anyways.

earnest phoenix
#

i didn't really ask for a code tho :\ was i?

#

well yes but actually yes

amber fractal
#

^

#

"what's the map function to view guild emojis" you asked for the map function

#

i.e. what to put in your .map()

earnest phoenix
#

he asked for a string of characters that makes up a word or multiple words

#

mehhhh true

#

lol

#

you could've sent me the collections guide for me to read though 🤷

#

well yeah, but actually,

#

yeah

amber fractal
#

Which would tell you the method used to turn an emoji object into a string that discord will turn into an emoji

#

Or used the pattern yourself

earnest phoenix
#

or just use 100% of your brain ofc

amber fractal
#

So <:name:id>

earnest phoenix
#

👌

coarse patrol
#

I have coded this bot in java. It is still getting features and these are the first 2.

#

I have coded mostly everything.

coarse patrol
lusty dew
#

Okay

#

What’s your issue?

#

@coarse patrol

#

What’s your issue here

coarse patrol
#

This channel is about talking about development?

lusty dew
#

No

#

Asking for help on development

coarse patrol
#

Oh.

lusty dew
#

How could I go about sweeping my db monthly and deleting user data if a user left a guild

scarlet bane
#

@lusty dew this channel for talking about development

#

not just asking

#

read title

slim heart
#

@lusty dew really depends on what db you use but what I’d do is get the entire db, then filter by if the client has that guild id, then update the entire db with that filtered data

edgy orchid
#

I have question, how do I make a command which reads a text document and sends something random from that text file?

#

in node.js

earnest phoenix
#

you already got told

edgy orchid
#

ik but after that i need define callback "fs..reafFile(path, callback)"

earnest phoenix
#

a function

slim heart
#

Use readFileSync

#

Much easier to manage

#

It just synchronously returns the content

earnest phoenix
onyx summit
#

readFileSync is the worst you can do to your performance, but if that doesn't matter it's fine

edgy orchid
#

cuz the only thing i want is my bot should read a text file and copy one of the texts

slim heart
#

If performance is an issue why’re your reading from a file in the first place

edgy orchid
#

and i started with try to code discord bot yesterday so im pretty bad

earnest phoenix
onyx summit
#

@slim heart reading from a file isn't a performance issue, blocking the whole thread while reading it, is one

slim heart
#

No that’s an issue but ok

earnest phoenix
#

it is

#

it will block for a longer time if the file is longer

onyx summit
#

Hm k then I wonder why my fucking bot doesn't has problems with performance, because most of the time it's just reading files (with streams)

earnest phoenix
#
    let money = db.startsWith(`money_${message.guild.id}`, { sort: '.data'})
  
  let content = ""
  
    for (let i = 0; i < money.length; i++) {
        let user = client.users.get(money[i].ID.split('_')[1]).username     
        content += `${i+1}. ${user} ~ ${money[i].data}\n`
    }

    const embed = new Discord.RichEmbed()
    .setAuthor(`Leaderboard`)
    .setDescription(content)
    console.log(content)
#

it didn't change the content var somehow when i added the += thing

quartz kindle
#

log money

onyx summit
#

Can anyone recommend me a course (udemy or sum shit) to learn the proper way for building a rest API with express, typescript and request validation

earnest phoenix
#

Promise { <pending> }

#

@quartz kindle

quartz kindle
#

thats your problem

#

since a promise has no length, the for loop will never run

#

you have to await the promise

earnest phoenix
#

Oh yea i forgot lol

#

There’s nothing in the db tho

#

The log says []

quartz kindle
#

then something's wrong with your db

wheat jolt
#

is there an event that triggers when the bot disconnects from a voice channel?

earnest phoenix
#

i n
w h i c h
l i b r a r y

wheat jolt
#

node lib

earnest phoenix
#

which one

wheat jolt
#

discord.js

earnest phoenix
#

you can't expect someone to read your mind and know which lib you're using

amber fractal
#

This is basic in the docs...

warm marsh
#

Although that event does all voiceStateUpdates so you will have to check the user that leaves and joins the voice channel.

amber fractal
#

Yeah

#

It emits old member and new member

#

Check if they had a voice channel before and if they have one now

coarse patrol
earnest phoenix
#

add more text?

coarse patrol
#

I want text under text.

#

Like
this

earnest phoenix
#

use the newline character, \n

coarse patrol
#

And where do I add that?

unique nimbus
#

or if you are in python you can do """ """

earnest phoenix
#

anywhere you want a newline

unique nimbus
#

yes

coarse patrol
#

I'm doing js

unique nimbus
#

yes then it wont work

#

I think I tried it already on js

earnest phoenix
#

hay

#

guys

warm marsh
#

Using `` in js should have the same effect as """
""" from python.

coarse patrol
#

.addField("Information", "Test")
Can you tell me where to put it?

#

I don't really know.

warm marsh
#

Where do you want a new line?

earnest phoenix
#

'' help ''

warm marsh
#

"Test\nMoreText"

earnest phoenix
#

" " "

coarse patrol
#

Like that?

warm marsh
#

Yeah if that's how you want it.

unique nimbus
#

isnt this spoonfeeding

warm marsh
#

Is it?

coarse patrol
earnest phoenix
#

backslash, not frontslash

warm marsh
#

Backslash

coarse patrol
#

Wait

#

I noticed

#

Ok. Works, thank you guys.

warm marsh
#

But there is a max on how much text per field value so watch out.

earnest phoenix
#
db.set(`money_${message.guild.id}`, { sort: '.data'})
let money = await db.startsWith(`money_${message.guild.id}`, { sort: '.data'})
  
  let content = ""
  
    for (let i = 0; i < money.length; i++) {
        let user = client.users.get(money[i].ID.split('_')[2]).username     
        content += `${i+1}. ${user} ~ ${money[i].data}\n`
    }

(money[i].ID.split('_')[2]) is undefined

quartz kindle
#

you are not saving anything in the db?

warm marsh
#

console.log what you get from money.

earnest phoenix
#

(node:2296) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'username' of undefined

quartz kindle
#

yes, but what does money contain?

#

thats what we need

earnest phoenix
#

The etror

#

the error prevents me from viewing it

scarlet bane
#

Print money on its own without split or anything

earnest phoenix
#

money[i].id only?

thorn yoke
#

hai

quartz kindle
#

@earnest phoenix js let money = await db.startsWith(`money_${message.guild.id}`, { sort: '.data'}) console.log(money)

earnest phoenix
#

I got it fixed

#

client.users.get(resp[i].ID.split('_')[2]) Is undefined though

#

resp[i].data is [Object object]

#

do i need to map it?

quartz kindle
#

again, show the contents of the object you're working on

#

if you changed money to resp, do console.log(resp) right after you define it

warm marsh
#

[object Object] Means it's an object which has more properties just console.log it and you'll see what you need to get from the object.

earnest phoenix
#

@quartz kindle [ { ID: 'money_601331300925702144', data: { sort: '.data' } } ]

polar sentinel
#

I need your opinion

#

I got this

Your bot @BF1 Server Browser was declined. Reason: Your bot spams each BF1 servers info in a row on a channel for every querry which meets with a server's name. For example, it spammed 20 embeds in a row for "DICE" and this is considered as an API abuse. Consider limiting the max messages amount sent to a reasonable amount or add every information a single embed when any occurence is found from your BF1 API.
earnest phoenix
#

read

polar sentinel
#

I have a command +search that sends some results as embeds (1 embed per result)

#

I am thinking of making a command +more

#

and making +search send only the first 5

#

and +more sends 5 more

#

@earnest phoenix I know how to read

#

🙂

#

I just ask if 5 messages at a time is reasonable ammount

mossy vine
#

the ratelimit is 5 messages per 5 seconds iirc

quartz kindle
#

@earnest phoenix split returns a 0-indexed array, meaning [0] becomes money and [1] becomes the id

#

[2] doesnt exist

west spoke
#

@polar sentinel
Psuedocode:
for amount of (result):
add field to embed with result (without images)

polar sentinel
#

@west spoke the problem is the fields suck. The allignment is horrible. And I can only have up to 25 fields.

west spoke
#

inline=true

polar sentinel
#

Maybe I can use 1 embed for every 5 results using 5 fields and use the triple backticks trick

#

yes i know

#

it is horrible

#

i want everything alligned

west spoke
#

you can split each result with \n if you want

polar sentinel
#

it makes the embed larger still

west spoke
#

or you can just use one field and append the results to that

warm marsh
#

It's only one message instead of 5 though.

west spoke
#

^

#

it ratelimits your entire bot for 5s

polar sentinel
#

anyway thanks for recommending that i use the fields

west spoke
#

if you send 5

polar sentinel
#

but discord fields suck dick really. there is no correct alignment if you use many fields with different string size

quartz kindle
#

@polar sentinel how do your search results look like?

polar sentinel
#

wait i send you screenshot

west spoke
#

then you can split the string itself with \n

#

each time the characters go over a certian limit

torn folio
#

This is a really random question but does a developer in here know a way to change the nickname of all the users within a server or even a channel and it show in real time without it being janky or glitchy

polar sentinel
#

like this

quartz kindle
#

thats api abuse @torn folio

torn folio
#

Yeah that's what I figured. But it really isnt' a question of fair use

#

More so possibility

#

For my sanity

west spoke
#

Actually

polar sentinel
#

for my sanity i better not use discordbots at all

#

my bot is doing what it is supposed to do

west spoke
#

that's fine to just join the embeds, or use a pager/embed

hybrid orchid
#

hmm, does mass role assigns count as api abuse?

west spoke
#

eg like some bots' help command

#

Yes @hybrid orchid

hybrid orchid
#

i see

torn folio
#

Anything that applies mass anything to numerous users is api abuse

#

Kind of lame

hybrid orchid
#

i wonder why Dyno gets away with it

torn folio
#

But that is how it is

polar sentinel
#

how can i join the embeds?

west spoke
#

@hybrid orchid it does it over time, not instantly

polar sentinel
#

i am using discord.js

hybrid orchid
#

oh i see

west spoke
#

Like 1 role /2s

#

I never liked it. It was faster for me just to assign them myself

polar sentinel
#

So ... what discordbots tells me

#

is that i make my bot shit in order to comply

#

lmao

hybrid orchid
polar sentinel
#

how the fuck is this allowed and not mine?

hybrid orchid
#

theres heroes that go up to 7 abilities, each skill with their own embed

polar sentinel
#

wtf

earnest phoenix
#

@quartz kindle i changed it to 1 same thing

torn folio
#

Pretty cool concept. Reminds me of the super hero mod project from cs 1.6

polar sentinel
#

@hybrid orchid i like your design

hybrid orchid
#

@polar sentinel thanks! thought of a single embed but this looks more sensible for mobas

polar sentinel
#

in my case i also needed to make every embed box size the same

torn folio
#

You running a UI/Inventory embed with that design, @hybrid orchid ?

polar sentinel
#

so i had to use the code snipet thing

late hill
#

Implement reaction scrolling

#

ez fix

west spoke
#

^

polar sentinel
#

ok anyway fuck discordbots

late hill
#

lmao

polar sentinel
#

i ll just send links to invite my bot

late hill
#

They are simply telling you that the method you're using

polar sentinel
#

not gonna comply

late hill
#

Is a lil stupid

#

And you can easily fix it

west spoke
#

just make it a single embed, or make it scroll

polar sentinel
#

thats ok i agree

#

but ... ffs

torn folio
#

Scroll is definitely pref IMO

west spoke
#

it's honestly not that hard, since most langs have one

polar sentinel
#

man wtf if i make it a single embed i cant do that same result

#

i cant have the images

late hill
#

You can

torn folio
#

simple button scroll would be awesome

late hill
#

With scrolling

west spoke
#

With scrolling you can

#

but in a single embed you can use that

late hill
#

If you only display one result per page you can still use a thumbnail image

west spoke
#

^

torn folio
#

^

late hill
#

Reaction scrolling isn't extremely difficult

#

good coding practise

west spoke
#

^

polar sentinel
#

oh shit

west spoke
#

Users cannot do it

#

but bots in the embed description can

polar sentinel
#

ok

#

so you say i use that instead

west spoke
#

If you are going to use a single embed, yes

polar sentinel
#

:/

west spoke
#

If its going to be a pager, then do what you already did

torn folio
#

Also this is outside development, but you should be humble; my guy

west spoke
#

なに?

torn folio
#

Not really cool to blast moderators who try to uphold quality

west spoke
#

^

polar sentinel
#

it is going to be a pain but i will try it next week. maybe i will just have a buffer to put the info and grab 5 servers to fill 5 fields with the images and then another embed for every 5 more

#

ok

torn folio
#

You should really be driven by denial.

polar sentinel
#

thanks everyone!

torn folio
#

Failure is the greatest achievement

polar sentinel
#

++

torn folio
#

If you don't fail, you aren't innovating.

polar sentinel
#

++++

#

lmao joseph stalin typing

#

i lost it

coarse patrol
#

Uh

#

Hi

polar sentinel
#

hitler

#

jk dont ban me

warm marsh
#

Stalin is the Russian not German.

coarse patrol
#

I have added 7 commands to my bot already.

polar sentinel
#

i know man

warm marsh
#

nvm

#

I need to relearn history lmao.

polar sentinel
#

i know a perfect place to start

hybrid orchid
#

im thinking of migrating my bot from glitch to there

coarse patrol
#

Glitch?

torn folio
#

I haven't used anything out of digitalocean

#

Can't say

coarse patrol
#

I'm using glitch to code my bot on

torn folio
#

outside of*

quartz kindle
#

@polar sentinel if you have webhook permissions, you can do this

hybrid orchid
#

hmm yeah digitalocean, might look around

quartz kindle
#

webhooks can send multiple embeds

west spoke
#

DO isnt worth it

hybrid orchid
polar sentinel
#

@quartz kindle Yeah I just found out yesterday

hybrid orchid
torn folio
#

Looks like it has a cute dashboard

#

But how do the servers run

#

LMK when you do some testing

hybrid orchid
#

aight sure

#

i doubt it tho, might be weeks before i can shift full focus on this

west spoke
#

I can toy around with it

hybrid orchid
west spoke
#

I'll let u know what I find. It's free right?

#

Also @hybrid orchid name reveal

torn folio
#

If it is just load test it and you'll know pretty quick lol

hybrid orchid
#

name reveal?

#

havent actually signed up on it yet lol

#

will find out

west spoke
#

oh

#

ok

hybrid orchid
#

oh thats not me lol

#

thats their featured image on homepage

wheat jolt
#

What's that

hybrid orchid
unique nimbus
#

the storage is quite low tbh

#

well for me

hybrid orchid
#

disregard this, will be looking around for better services

torn folio
#

Can't really speak for that service but I don't know what you mean by cash-centric. Any good host is going to require denote for their service

#

$$$ talks

hybrid orchid
#

nah, its just me and their dashboard design lol

#

true ^^^

#

site is quite reasonable for the integrations they are giving you

west spoke
quartz kindle
#

lul

west spoke
#

Eek

#

that's so SMALL

unique nimbus
#

I mean if you know html and css you can make your own server dashboard

west spoke
#

sheesh

unique nimbus
#

and js

west spoke
#

like actually

quartz kindle
#

why pay 3 euros for that when i can pay 3 dollars for 1gb ram and 15gb ssd?

west spoke
#

that's tiny

#

^^

unique nimbus
#

I pay 3 euros for 2gb ram and 20gb ssd

torn folio
#

hahahahahah

#

i can't

quartz kindle
#

oh wait its 3 euros quarterly

#

so 1 euro a month

torn folio
#

i need to take a nap before school

hybrid orchid
#

wait wtf i havent seen that part yet LMAO

torn folio
#

that is the most ridiculous shit i've ever seen tho

quartz kindle
#

i guess they run a master node.js server and put each bot in a worker process, so the bot doesnt need to use a dedicated process

hybrid orchid
#

im shook

quartz kindle
#

else node.js by itself already uses all that ram lul

#

discord.js will still make it oom pretty quick lul

torn folio
#

key word

#

.js

#

X')

quartz kindle
#

they support node.js and java

onyx summit
#

I was actually thinking of creating some sort of bot hosting provider (free tho) but I don't know enough shit about virtualization

quartz kindle
#

so maybe if you bot is in java, you might get more milleage

torn folio
#

not on 64mb mem m8

#

we're talking javascript here

quartz kindle
#

i said java

unique nimbus
#

I seen bots with 100 servers using 30mb

#

python is retarded and sucks up ram by keeping stuff in ram

onyx summit
#

javascript too, its not a good idea to run a bot with 64 MB ram

#

you have zero buffer, you cant really cache anything

quartz kindle
#

my test library uses ~70mb ram on 1500 guilds

#

including the node process

torn folio
#

what is in the library

quartz kindle
#

a bunch of shit

torn folio
#

databases?

unique nimbus
#

I mean my bot caches discord memes and images also songs

quartz kindle
#

you cache songs? rip

unique nimbus
#

It downloads

#

but I think python caches it

#

because it doesnt like me

torn folio
#

i get songs but why cache memes?

unique nimbus
#

my fun cog has a 13mb cache on its own

#

because its python it likes to cache everything

torn folio
#

I'd have to consult my java boy on that so I'll just trust there

#

I'm just the guy that writes the docs

#

anyways gl to all the developers joining with questions, @quartz kindle outside of API abuse I'd be keen to know if it is even possible to do the mass nickname change if you got anything

#

Be easy guys. Good morning and good day!

hybrid orchid
quartz kindle
#

@torn folio the only way would be to make a queue and execute it over time

torn folio
#

Discord api just naturally deny mass changes like that naturally? @quartz kindle

quartz kindle
#

it will deny them, and possibly ban you if you get too many denies lol

#

most libraries have queuing to avoid being denied by the api

#

i believe the current rate limit for changing nicknames is 1/1s per guild

torn folio
#

That makes a lot of sense. When we tried testing it the only nick change was on the bot.

small prairie
#

Question: Is there a way to "get" How many users(and bots) in a voice channel
discord.js

twilit rapids
#

Library?

small prairie
#

Oops edited

#

@twilit rapids

warm marsh
#

<VoiceChannel>.members

twilit rapids
#

Yeah

#

Then you can filter for bots or users

warm marsh
#

Returns a Collection of all the users within the channel.

rugged bramble
#

it's possible i push another cmd variable in js?

grim aspen
#

Not available

#

N/A

#

Because your bot is not here

quartz kindle
#

your bot needs to be approved first, which may take several days. you will receive a message when its done

rugged bramble
#

it's possible i push another cmd variable in js??

quartz kindle
#

explain @rugged bramble

rugged bramble
#

can i dm you?

quartz kindle
#

i'd rather you write here

rugged bramble
quartz kindle
#

explain what you need?

rugged bramble
#

i need to get the 2 users

#

to 1 cmd

#

its possible?

paper cypress
#

How do I claim

quartz kindle
#

@rugged bramble you mean, a match making system?

rugged bramble
#

exactly

#

i searched on google but i don't get anything

quartz kindle
#

you need to add both the requester and the requested to the database

rugged bramble
#

can you give me an example??

quartz kindle
#

with the way you're using your database, it would be something like db.set("request_queue_IDFROM_IDTO")

#

and on the other function, you need to get from the database an item that contains "request_queue" and the user's id

#

this would be simpler if you used objects instead of strings

rugged bramble
#

hmm

#

i go test

warm marsh
#

Is it possible to use my VPS's mysql server on my current machine?

quartz kindle
#

as a remote database?

warm marsh
#

Yeah, I'm currently rewriting my bot but using Java and was planning on implementing a database instead of doing that on localhost I was hoping could use the VPS so when upload don't have to recreate everything.

quartz kindle
#

yes its certainly possible

warm marsh
#

Alright.

#

I take it just requires creating a using with host being my IP.

#

Public IP*

quartz kindle
#

yup, ip port username password

warm marsh
#

Thanks.

quartz kindle
#

if your db is not secured yet, you should secure it before opening it for connections

onyx summit
#

I should do that too

#

but meh

#

I only use the connection while testing stuff

warm marsh
#

So I know this sounds dumb but secure?

amber fractal
#

Secure your db from outside connections that arent you

#

e.g. a firewall

onyx summit
#

or if you really need connections from the outside, you have to use ssl or you have a smoll problem

quartz kindle
#

secure it with a password lul

onyx summit
#

and if you dont have ssl, and connect from outside the server, everyone can read that password mm

quartz kindle
#

they'd still need to tap into your connection

#

more effort than those bruteforcing plagues that run 24/7 all over the internet

#

probing unsecured ips

onyx summit
#

I had like 80 IPS banned that tried to login over ssh

#

till I switched port to 209

inner jewel
#

i'd recommend leaving the db to only be accessible from the server (aka only localhost connections) and using a ssh tunnel to connect to it

quartz kindle
#

yeah but he wants to use it remotely from another machine

inner jewel
#

yes

#

that's what ssh tunnel is for

warm marsh
#

It would be temporary and would be removed once rewrite was done.

#

SSH tunnel from a project?

quartz kindle
#

oh yeah, ssh tunnel, forgot that was a thing for a sec

onyx summit
#

Am I getting something wrong (don't know much about ssh tunnels), or does the library that connects to the db has to support them?

warm marsh
#

Ngl, My knowledge in this area is very very basic so I guess will just leave it for now.

quartz kindle
#

my only experience with ssh tunnel is with using chrome's dev tools to inspect a remote node process

onyx summit
#

last time I tried to save a 500MB heapdump my process crashed

quartz kindle
#

same

inner jewel
#

which is safer than exposing the db to the internet

#

(in my case, the db port is blocked from even reaching the server)

onyx summit
#

I have it blocked except from my home ip

#

damn, my bot needs 27 seconds from start until being connected to everything

inner jewel
#

i do stuff with ssh because then i can access it from anywhere safely

small prairie
#

discord.js
If i force disconnect a bot (voice channel) is there a function that would be called something like client.on , guildMember.add like these

warm marsh
#

Currently there isn't an event for force disconnect.

#

afaik

small prairie
#

;_;

#

@warm marsh is there if it disconnects aut?

#

auto*

peak quail
#

how can i get a log like

main bla bla | <here the console.log()>
warm marsh
#

If the bot leaves it's self?

small prairie
#

Yeah

mossy vine
#

@peak quail custom logging

warm marsh
#

Idk. I don't think so.

small prairie
#

lmao

#

well thanks for quick reply

warm marsh
#

Np.

small prairie
#

wont have to search google

warm marsh
#

Could always check https://discord.js.org/

small prairie
#

eyah ust checking the docs

#

yeah just*

inner jewel
#

i'm pretty sure you get a voice state update for all joins/leaves

warm marsh
#

There could be a property within one of the parameters passed from voiceStatusUpdate. But highly doubt it.

#

State*

small prairie
#

it could be implemented tho

#

i'll try and let you know

warm marsh
#

Ok!

#

For some reason I can't get a bigint to store in Java.

#

I've got a big int within my database just for testing but it doesn't do anything, It doesn't log at all but the numbers that are the size of an int do. Any idea?

small prairie
#

never used java for discord bots so am crap

#

wait i can go the hard way

#

for my problem

west spoke
#

I wanna start on a bot in java (lol)

late hill
#

show code

polar sentinel
#

one more question

west spoke
polar sentinel
#

in the bot i am making i only read a command from user and it prints some message

#

do i need only these?

loud salmon
#

@west spoke comfiestLanguageofJAVA

west spoke
#

No

polar sentinel
#

oh ...

#

what do i need?

west spoke
#

Unless the bot has a role saying it cant read messages

loud salmon
#

@polar sentinel if its just text then yea

west spoke
#

Its fine

polar sentinel
#

ah ok

#

i just read a command with one param and just output a message or more

earnest phoenix
#

hey im trying to fetch all embed messages that the bot sent
this is my code

#

what am i doing wrong?

small prairie
#

@earnest phoenix error?

earnest phoenix
#

its just returning me a map with nothing in it

small prairie
#

i dont think there is a msg.type collection

#

is there?

#

@earnest phoenix

earnest phoenix
#

idk

small prairie
#

there is ebed.lenth

#

embed.length

#

pardon me ;_;

slim heart
#

Msg.type also doesn’t have embeds

small prairie
#

message.embeds.length

#

this is i think the code

#

you can check for

#

if(message.embeds.length>0)

#

@earnest phoenix

earnest phoenix
#

ok

#

thx

#

worked

small prairie
#

anytime mate

warm marsh
#
 public static HashMap<String, String> getUserProfile(String userID) throws SQLException {
        HashMap<String, String> toReturn = new HashMap<String, String>();
        checkUser(userID);

        Statement statement = con.createStatement();
        ResultSet results = statement.executeQuery(BaseCommand.format("SELECT * FROM userprofile WHERE uid=\"{0}\";", new Object[] {
                userID
        }));

        NumberFormat Money = NumberFormat.getCurrencyInstance(new Locale("en", "GB"));
        String cash;

        int defaultMoney = 2500;

        System.out.println(results.getInt("cash")); // Doesn't display when the number is larger than an Integer.

        if (!results.next()) {
            cash = Money.format(defaultMoney);
            checkUser(userID);
            toReturn.putIfAbsent("cash", cash);
            toReturn.putIfAbsent("job", "None");
            return toReturn;
        } else {
            cash = Money.format(results.getInt("cash"));
            toReturn.putIfAbsent("cash", cash);
            toReturn.putIfAbsent("job", results.getString("job"));
            return toReturn;
        }
    }```
#

I know it's terrible. It just doesn't display a number that is bigger than 2147483647

small prairie
#

wow java hard af

warm marsh
#

Nah.

small prairie
#

for making bots

warm marsh
#

That's not for bots.

earnest phoenix
#

store as long instead of int

small prairie
#

oh af

warm marsh
#

I tried and it still didn't log.

earnest phoenix
#

long can store 8 bytes unlike int which can store 4

#

there's probably an exception occuring somewhere then

#

try catch

#

and see

#

nevermind

#

i'm blind

#

ignore what i just said

#

long should work

warm marsh
#

I will try again.

earnest phoenix
#

make sure you're using long everywhere

warm marsh
#

That worked, I tried that before but nothing happened lmao. I must of done something wrong.

autumn rain
#

Welp

#

I get disconnect code 1011

#

On a single shard, what does that mean?

turbid gale
#

Also instead of the NumberFormat you're using you could just do String.format("£%,.2f", money)

#

You might have to cast money to a float though

small prairie
#

kudos

#

Question:

#

can bots go live

#

it might be available in future libraries i think

#

then they can live streams etc

onyx summit
#

I doubt that the endpoint for that is accessible for bots

small prairie
#

it may be

#

in future

#

<client>.goLive xD

stray garnet
#

lel

onyx summit
#

doubt, would just cause even more load and traffic for Discord because some people would let their bots stream 24/7

small prairie
#

there can be limit

#

in API

onyx summit
#

we will see, I highly doubt it

small prairie
#

yeah whatever lmao

mossy vine
#

it would allow some really cool things, but can also end horribly in so many ways

small prairie
#

Yeah

#

Live wtach streams using discord

#

it will be pretty heavy bot

inner jewel
#

@warm marsh

  1. Don't specify HashMap as the return, prefer Map
  2. Don't return a map there, creating an object to represent the data is safer
  3. You have an sql injection vulnerability there. Use prepared statements instead of statement.executeQuery
warm marsh
#

Ok.

#

I've got no clue how object works in Java unless it's Object[]

inner jewel
#

you also never close the result set

#

so you leak resources

#

Object means "anything"

#

Object[] is an array of anything

#

creating an object would be creating a class to represent that data

#
public class MyUserData {
    private X x;
    private Y y;
    //...

    public MyUserData(X x, Y y, ...) {
        this.x = x;
        this.y = y;
        //...
    }

    getters and setters
}```
warm marsh
#

So I should make classes for each thing I use, e.g. UserProfile class and GuildSettings?

inner jewel
#

you should prefer a class over a map

#

if it'll always have the same keys, prefer making it a class

warm marsh
#

Probably would be better.

#

But prepared statements is there a way of doing such?

inner jewel
warm marsh
#

Isn't that just the same ?

inner jewel
#

no

gray geyser
#

why?

inner jewel
#

because your lib didn't properly set the username

earnest phoenix
#

yo

#

im trying to make a giveaway command

warm marsh
#

.user.username

earnest phoenix
#

and i need to get the array of the people reacted

#

thats the code

#

and its return null

mossy vine
#

reactions arent mapped like that

#

read the docs

gray geyser
#

hm

earnest phoenix
#

i didnt got it

#

lol

#

i need to do like

warm marsh
#

.find() ?

earnest phoenix
#

message.reactions.array().foreach(re=>{
if(re.emoji.name == "🎉){
something?
}
})

#

tried to do get

#

isnt working

#

oh

#

i got it i think

#

thats how to do it?

#

no you would search for \🎉, not 🎉

unique nimbus
#

I mean in python its both

slender thistle
#
from werkzeug.utils import secure_filename

filename = secure_filename(file.filename)
``` is there any way to ensure that cyrillic will be supported?
west spoke
#

Anyways

#

Could someone help me make a http request to a .txt file (on my url) and return the text in java

#

Ping if u can/dm

topaz sphinx
#

i need someone seriously big brains

#

PostgreSQL jsonb type: {key : {key1 : str, key2 : list}}

#

i want to iterate trough every value in key

warm marsh
#

Language?

topaz sphinx
#

python3, doesnt matter, it's SQL i have problems with

amber fractal
#

Uh

#

You want to iterate it

#

So python does matter

topaz sphinx
#

no it doesnt matter, sql is the one to handle the iteration ASfacepalmmio

#

if it was one value i'd easily use concatenate as i am using currently

#
INSERT INTO
        user_bookmarks(user_id, {0}_image_id_list)
        VALUES ($1, $2::jsonb)
        
        ON CONFLICT (user_id) DO
            UPDATE SET {0}_image_id_list = user_bookmarks.{0}_image_id_list || excluded.{0}_image_id_list

        RETURNING *, (xmax = 0) AS inserted;
#

this is the way to insert values to it

#

but from {key : {key1 : str, key2 : list}}, i'd want to extract all keys matching all values in a list input

topaz sphinx
#
SELECT *
FROM user_bookmarks
WHERE sfw_image_id_list->>ANY->'image_type' = 'SFW'
#

is there a posibility to replace ANY with every key in sfw_image_id_list

trim swallow
#

@west spoke wait what

west spoke
#

get text from a url (I know how to do that) but how do I return it, eg say I called the class GetNekos()

#

It would return 107 (currently)

#

@trim swallow

trim swallow
#

I assume you're using aiohttp?

west spoke
#

this is java

#

Httpurlconnection

topaz fjord
#

Does the endpoint return json or text

#

@west spoke

west spoke
#

plaintext

#

drawing the text from that url

topaz fjord
#

What code do you have now

#

And what http client are u using

west spoke
#

httpurlconnection

#

and atm its edited code from stack, but I have been working with this same thing for my app.

#

But my app worked, since I was able to route it through oncreate

#

and edit the text

#

but I'm trying to return result;

#

I cant provide code, atm

#

since it's at school

topaz fjord
#

You can

br = new BufferedReader(new InputStreamReader((conn.getInputStream())));
 sb = new StringBuilder(); 
String output; while ((output = br.readLine()) != null) { sb.append(output); } 
return sb.toString();
#

well fuck

#

That formatting failed

#

But yeah

west spoke
#

I'll reformat it, but ty!

topaz fjord
#

You can use that to get the input stream and stringbuilder to turn it into a string

modern elm
west spoke
#

Oke

topaz fjord
#

conn is HttpConnectionURL

modern elm
#

Can anyone help me with my alias handling problem?

#

plis

#

xd

topaz fjord
#

Do you have any code

modern elm
#

Yeah

#

lemme copy-paste rq

#
fs.readdir('./commands/', (err, files) => {
  if(err) console.log(err);
  let jsfile = files.filter(f => f.split(".").pop() === "js");

  if(jsfile.length <= 0) {
    return console.log(`[ERROR] Couldn't find commands.`);
  }
  
  jsfile.forEach((f, i) => {
    let pull = require(`./commands/${f}`);
    bot.commands.set(pull.config.name, pull);
    pull.config.alias.forEach(alias => {
      if(alias !== "") {
      bot.aliases.set(pull, pull.config.alias);
      }
    });
  });
});


...


try {

 delete require.cache[require.resolve(`./commands/${cmd}.js`)];

        let ops = {
            ownerID: ownerID,
            active: breep
        }
        let messageArray = message.content.split(" "); //args but whatever it works easier this way
        let cm = messageArray[0];
        let commandFile = bot.commands.get(cm.slice(prefix.length)) || bot.commands.get(bot.aliases.get(cm.slice(prefix.length)));
        if(commandFile) commandFile.run(bot, message, args, ops, tools);
    } catch (e) {
        console.log(e.stack);
    }
#

sorry its so long but hastebin isnt working

earnest phoenix
#

I need help

modern sable
#

]]faq 10 -c

west spoke
#

AAAAAAA

frail ocean
#

Please don’t ping all of our, especially for no reason.

earnest phoenix
#

Can a mod dm me please

#

Yes

#

I saw a dm ad bot

#

@frail ocean

#

Is that bad?

west spoke
#

oh my god

#

mentioning all mods over a dm

#

yes that's bad

earnest phoenix
#

Kk

west spoke
#

But not so bad that mods have to be pinged

earnest phoenix
#

So who I ping?

west spoke
#

a single mod, not the role.

modern elm
#

ok im back

earnest phoenix
#

<@&265158261945270273> I saw a dm ad bot. Is that a problem? Sorry for ping.

modern elm
#

omfl

modern sable
#

oh my god

modern elm
#

he did it again

#

w0w

#

big brain time

modern sable
loud salmon
#

@earnest phoenix dude. You were told to fucking ping ONE PERSON

modern elm
earnest phoenix
#

But I didn’t ping you

modern elm
#

LOL

modern sable
#

well you did earlier

torn folio
#

hahaha I love this chat rn

earnest phoenix
#

Ye

modern elm
#

"bUt i dIdNt piNg u"

#

im laughing so hard

earnest phoenix
#

Before I did by accident

modern elm
#

i almost fucking choked on my cookie

earnest phoenix
#

Now to owner

west spoke
#

BY ACCIDENT

earnest phoenix
#

I NEED HELP

west spoke
#

YOU JUST PINGED OLIY YOU FOOL

loud salmon
#

-m @earnest phoenix clearly doesnt follow instructions and pinged roles for non-emergencies after being told not to | 6h

modern elm
#

oh btw mods

gilded plankBOT
#

🤐 Muted Pro Gamer YT#0001 (@shut mango)

modern elm
#

can u change my nickname

#

to Daddy

west spoke
#

Uh

#

what

modern elm
#

lol

loud salmon
#

no @modern elm

modern elm
#

ok

west spoke
#

oof

modern elm
#

can i get something less boring?

loud salmon
#

no

west spoke
#

If u boost the server then yeah

modern elm
#

ok

loud salmon
#

you can change your name

modern elm
#

lol

west spoke
#

U have nitro

modern elm
#

i have $5 nitro on a gift

west spoke
#

so use it lol

sage bobcat
#

One message removed from a suspended account.

modern elm
#

@west spoke can u help me with my code pls

earnest phoenix
#

sa