#development

1 messages · Page 577 of 1

ruby dust
clear moth
#

Thanks m8

earnest phoenix
#

how do I put the amount of my bot server on the site?

indigo current
#

Look at the docs

earnest phoenix
#

@indigo current could you send me

ruby dust
#

you already asked that question AND got the link in #general Thonk

empty dune
#

hey

#

i made a bot

#

but im trying to upload him to the site

#

but i dont know witch lib to choose

#

any sugestions?

ruby dust
#

if you don't know which lib to choose, then I don't think you made a bot

topaz fjord
#

what lib did you use

empty dune
#

i just used javascript

topaz fjord
#

eris or discord.js

empty dune
#

tnx

topaz fjord
#

that wasn't and answer

#

that was a question

empty dune
#

oh

topaz fjord
#

if you don't know what lib then there's something wrong

ruby dust
#

how can you create a bot without a lib

topaz fjord
#

you write all the gateway connections yourself

ruby dust
#

I mean, you still had to install one to code one, which will be your choice

empty dune
#

node.js

#

?

#

that was the only thing that i had to install

topaz fjord
#

that's a runtime enviroment

#

did you do anything with npm

empty dune
#

yes

topaz fjord
#

what did you install with npm

empty dune
topaz fjord
#

oh no

empty dune
#

uashauhauhua

ruby dust
#

isn't that the outdated one?

topaz fjord
#

probably won't even work at all

empty dune
#

damn

#

tnx btw

ruby dust
#

I wonder if listing the lib on the bot page even helps anyone, cause I can't think of any reasons why it's still an option in bot lists

topaz fjord
#

but I also suggest:

  1. Learning a programming language of your choice
  2. Code a bot with your new skills
earnest phoenix
#

Does anyone know how to get my db token?

ruby dust
#

dbl token?

earnest phoenix
#

yes

empty dune
#

i know how to code

ruby dust
earnest phoenix
empty dune
#

its just js thats new to me

earnest phoenix
#

tanks

#

@ruby dust

ruby dust
#

js is a programming language, discord.js/eris are discord wrappers that are made to program discord bots without much hassle

topaz fjord
#

that's why i said learn the programming language

#

node.js also isn't the lang it's a runtime enviroment

ocean vale
ruby dust
#

I'm more concerned about why you have so many on_message events

earnest phoenix
#

lol

#

After every command add return; @ocean vale

#

if you are using d.js

ocean vale
#

im using python

ruby dust
earnest phoenix
#

idk i did not saw the eic

#

vid

ruby dust
#

and also your python syntaxes makes me think you are using python 2

#

both are outdated

ocean vale
#

im using python 3.6.4

ruby dust
#

I've never seen python 3 using % like that

#

only in 2

ocean vale
#

well it does use that

ruby dust
#

well either way, it still seems like you are using discord.py async?

ocean vale
#

yep

ruby dust
#

yeah, that version is so outdated that I think they will soon stop maintaining docs for it

#

and also not many people use it anymore, so you won't really get help from anyone, most likely

ocean vale
#

ok

ruby dust
#

that's the currently maintained version, and is considered the latest version

ocean vale
#

ok

earnest phoenix
knotty steeple
#

dont use powershell

#

ok thanks

#

but actually

#

help with what

#

ur not giving much detail

earnest phoenix
#

I'm trying to put the amount of server pro to my bot on the site more when I send the error files

knotty steeple
#

huh

#

the module isnt called dbl

earnest phoenix
#

how then?

knotty steeple
#

dblpy

earnest phoenix
#

it's called dbl on the site

#

aaa

knotty steeple
#

w h e r e

#

the module is outdated and broken anyways

#

post with aiohttp yourself

earnest phoenix
#

The problem is this kk I do not even know

#

even though I changing the error remains

pale marsh
#

What even is the error

earnest phoenix
pale marsh
#

When you run your code do any errors pop up?

undone hearth
#

does anyone know how to use the guildBanAdd feature to get a full report on the ban like the user who got banned and the reason why they were banned? (im using discord.js btw)

earnest phoenix
#

@pale marsh just a moment

#

@pale marsh no

pale marsh
#

Why mention twice GWcfcThonk

earnest phoenix
#

do not mistake no more when I try to send heroku to that mistake

#

sorry

#

it's custom kk

gilded blaze
#

The Guild Ban Add event supplies you with the user who got banned. If you want more information query the audit log.

pale marsh
#

I think you have to add a requirements.txt file in your project's root directory that contains names of pypi packages for heroku to install. I might be wrong

earnest phoenix
undone hearth
#

@gilded blaze how do you query the audit log? all i need from it is the reason for the ban

earnest phoenix
#

@pale marsh

pale marsh
earnest phoenix
#

Is this a problem?

gilded blaze
pale marsh
#

Well yeah lol

#

I don't use heroku and idk how to help honestly. Sorry

earnest phoenix
#

okay 😦

undone hearth
#

@gilded blaze i still dont understand

#

i dont know how to use aduit logs

#

like what would my code look like for getting the reason a use was banned when sending a ban report using the guildBanAdd event?

earnest phoenix
#

don't use heroku for hosting

gilded blaze
#

Use the filtering methods. Set the user to the banned user and the type to ban add

earnest phoenix
#

I use because I'm poor.

#

😂

gilded blaze
#

if something gets returned in the array validate it then send the log

earnest phoenix
#

i am too but i still don't use free hosting ¯_(ツ)_/¯

#

free hosting is shady and unreliable

undone hearth
#

@gilded blaze can you send out what this would look like or just dm it to me

earnest phoenix
#

if you can't afford to spend $3/mo on a vps you probably shouldn't be starting a public bot yet

amber fractal
#

Why not just on ban fetch the latest audit log that is a ban Thonk

undone hearth
#

@amber fractal what do you mean?

amber fractal
#

On guildBanAdd, fetch the latest audit log

earnest phoenix
#

My problem is not knowing how to use vps

undone hearth
#

@amber fractal how do you do you fetch the latest audit log when the event triggers?

amber fractal
#

guildBanAdd passes guild and user

undone hearth
#

yes

#

and then i want reason

amber fractal
#

yes

#

audit logs

#

have a reaso n

earnest phoenix
#

but yet again we're limited by discord and their very bad implementation, audit logs have strict criteria for an action to be logged and it has a slight to giant delay, depending on how discord feels, on the entry

amber fractal
#

Hasnt messed up on me yet

undone hearth
#

but how do i get the reason from the audit log into a variable that i can then add into a message

earnest phoenix
#

use the docs

undone hearth
#

im trying

#

they are kinda hard to understand

amber fractal
earnest phoenix
#

d.js has one of the most detalied library docs

#

your argument is invalid lol

amber fractal
#

it's literally .reason

undone hearth
#

well 😆 idk

#

would it look something like this

guild.fetchAuditLogs() .then(audit => console.log(audit.entries.first())) let reason = (idk here).reason

amber fractal
#

if you want to get the latest log

#

You'd put the reason inside the then

#

Well, I do everything inside the then

undone hearth
#

where in the .then

earnest phoenix
#

Can someone help me?

#

i told you, get a proper vps

amber fractal
#

you change the .then from just being console.log to a function

earnest phoenix
#

heroku or any other free hosting is a no go

undone hearth
#

like .then(audit => .reason)?

amber fractal
#

Have you used a .then before?

earnest phoenix
#

private bots? fine, use free hosting, it's not going to be used by a lot of people outside of your scope, but for a public bot free hosting does not come as an option

undone hearth
#

no

bright spear
#

lol how is heroku shady, its owned by fricking salesforce

#

and free hosting is an option for bots that aren't very resource intensive

#

any form of hosting has its benefits and limitations

earnest phoenix
#

i didn't say heroku is, i said free hosting, as in general

#

you're right

amber fractal
#
//function body
})```
bright spear
#

well i can also say bots in general are shady

#

just because some are doesn't mean all are

earnest phoenix
#

invalid

amber fractal
#

Advaith is shady asf

#

lets be honest

undone hearth
#

@amber fractal what would you put in the function

earnest phoenix
#

hosting and bots are two completely different things, you cannot compare them

amber fractal
#

I cant give you all the code

undone hearth
#

would it be like let reason = .reason

inner jewel
#

no

#

learn js

#

writing a closure is basic knowledge

bright spear
#

my point is that anything can have some shady instances

earnest phoenix
#

not to mention, if you have an edu email, many services are willing to fund you with a proper vps with some limitations, e.g github edu pack offers you 50 bucks on DO and a year free on AWS with no credit card required

bright spear
#

that doesn't invalidate the entire idea

earnest phoenix
#

Do you think 1GB of RAM is already good for the bot?

#

@earnest phoenix

#

yeah

bright spear
#

well yeah but ofc they'll try to suck you into paying after that's over

earnest phoenix
#

my bot held pretty good with 1.9k guilds on 1 gb so you should be good

amber fractal
#

They dont use that much ram, unless you did something wrong, or you get a lot of guilds

#

Or you're like me and cache everything because you're an idiot

#

but that's me

earnest phoenix
#

cache the entire channel message history

#

:wesmart:

amber fractal
#

I just cache my user data, and release it if it needs memory, or they don't use it

#

got that 5ms faster response, u kno?

earnest phoenix
#

yeah, i cache user data for 24 hours, if it hasn't been touched for more than that it gets dumped

amber fractal
#

and other processes

earnest phoenix
#

also i found a nifty little hack recently, if you want to get the first ever message in a channel you can use GET/channels/{channel.id}/messages, set after to 0 and limit to 1

amber fractal
#

wait

earnest phoenix
amber fractal
#

that woulda been so helpful to know

#

I can now make a program to get the queue size

earnest phoenix
amber fractal
#

Wait, it gave me the most recent one Thonk

earnest phoenix
#

thonk

#

be sure to set to after 0, not before 0

amber fractal
#

Yeah, I did, does using d.js fetchMessages not return the same thing?

undone hearth
#

@amber fractal i got it to work so thanks!

amber fractal
#

:+1:

earnest phoenix
#

dunno why it doesn't work

amber fractal
#

it should be the same thing, shouldnt it?

earnest phoenix
#

yeah

#

maybe it pulls from cache?

amber fractal
#

it's just an api wrapper

#

weird

earnest phoenix
#

nope it doesn't

#

makes a rest request

amber fractal
#

Yeah, Im on it

#

it says whether it's cached or not

#

Really weird then

#

Wait

#

thats fetchMessage

#

Whatever

#

I have a really bad migrane rn, Imma go have some tea and lie down

earnest phoenix
#

I just realized that my bot grew from 3 commands to 51 within 2 weeks.

amber fractal
#

migraine*

earnest phoenix
#
  • a working money system
#

Take care man, you dont wanna get a too big headache

#

14 days for 48 commands is a lot

#

Yeah, i didnt even realize it lol

#

@amber fractal What you mean with "queue size"? And you use discord.js?

amber fractal
#

What?

#

I didnt ask a question

#

did I?

#

idk terible migraine rn preparing some tea before I take a nap

undone hearth
#

is there any way to fetch the amount of unbans like how guild.fetchBans() .then(bans => { let bannum = bans.size })
gives you the number of bans, can you do that with unbans or what?(discord.js)

earnest phoenix
#

no

undone hearth
#

😢

earnest phoenix
#

because unbans don't exist as an entity

undone hearth
#

ok

amber fractal
#

Wait

#

What?

#

MEMBER_BAN_REMOVE

undone hearth
#

??

earnest phoenix
#

thats an event

#

not an entity

amber fractal
#

its a guild audit log type

earnest phoenix
#

ah

undone hearth
#

im trying to make it so it will count the number of unbans

amber fractal
#

The event is guildBanRemove, for d.js

earnest phoenix
#

you will have to manually track unbans

#

they don't exist as an api entity

undone hearth
#

so like if i unban a person i want the unban count to be 1

earnest phoenix
#

yes

undone hearth
#

could I do that

earnest phoenix
#

you're most likely going to need a database to keep that data persistent

amber fractal
#

you can if you save the number of times the unban even was triggered

undone hearth
#

ok nvm then

amber fractal
#

but you can fetch unbans tho

inner jewel
#

no

#

audit logs are deleted after 90d

amber fractal
#

Are they? rip

undone hearth
#

how would i track unbans then?

inner jewel
#

and fetching all of them evey time will be slow and spam

earnest phoenix
#
TarpergonToday at 11:17 PM
The event is guildBanRemove, for d.js
inner jewel
#

easy way of getting ip banned

undone hearth
#

what would i put in the guildBanRemove event though to make it track the unbans for that server

amber fractal
#

I learn something new every day

earnest phoenix
#

learn js, for the third time now, we aren't going to spoonfeed you code

#

it's basic number incrementation

earnest phoenix
#

@undone hearth for bans you can save every time to your json file when someone gets unbanned

#

just an easy filesysyem

#

using json as a database 🙅

amber fractal
#

Well, if it's just something like bans, does it matter?

earnest phoenix
#

yes

amber fractal
#

I keep non important stats in json, user data in a DB

earnest phoenix
#

one of two unbans logged to a json file at the same time will fail

#

which is why you don't use text or json files as a database

#

you use a database as a database

#

beats me ¯_(ツ)_/¯

#

it's bad practice to use json as a database for persistent data

amber fractal
#

thats just stats I like to look at

#

it doesnt matter if they become corrupt to me, but they are just cool little things I like

#

and I just realized that was an accidental ad

earnest phoenix
#

now, i'm not saying "oh don't use json for anything it's bad", json is fine for app settings or settings on software startup, however don't use it for persistent data, it wasn't made for that

earnest phoenix
fiery birch
#

cool, what about a VPS now

open olive
earnest phoenix
#

i put my bot on vps and nom when i do my b!stats

#

i have this error

amber fractal
#

moment-d isnt installed

#

Or delete

#

Lol

earnest phoenix
#

how can i install that pleaz ? 😂

#

cause i do npm install moment

#

and nothing change

amber fractal
#

I dont even know what moment-d is

#

I know what moment is

earnest phoenix
#

there is

#

i need to

#

npm install moment-duration-format ?

amber fractal
earnest phoenix
#

@amber fractal ♥ ♥ ♥ ♥ ♥ ♥ ♥ ♥

#

love u so much

amber fractal
#

:+1:

earnest phoenix
#

i just have a question

#

when i am connected to my vps

#

do i need to go to the files node_modules

#

for do npm i

sick cloud
#

no

amber fractal
#

^

sick cloud
#

you run it in the root of your bots folder

earnest phoenix
#

Hum okay

#

ty

umbral trench
amber fractal
#

You're trying to delete the same message twice

#

msg.delete() then a check then delete again

#

Remove the one before the check.

umbral trench
#

and

#

It deletes the .purge 1 message aswell

#

and doesnt purge the one before

amber fractal
#

msg.delete() runs then another msg.delete() runs when msg doesnt exist

#

Thats the error

#

Google search is quite nice too

umbral trench
#

How do I make it delete the message before the purge?

amber fractal
#

Just dont have two msg.delete()s

umbral trench
#

now its not deleting

#

that 3 didnt delete

amber fractal
#

Well what did you change?

umbral trench
amber fractal
#

And you did a purge?

#

Try a console.log after the purge

umbral trench
#

It did not delete though

amber fractal
#

Well mine is different, only accepts 2-100 and doesnt delete the command message beforehand, and does it in the bulk delete

umbral trench
#

ok

sinful lotus
#

@umbral trench you dont "await" msg.delete()

#

it means it wont wait for msg.delete() to finish before bulk deleting hence throwing Unknown Message

umbral trench
#

k

lucid yacht
#

so I've got this node.js HTTP server running, tested it locally and externally and it's working on both, but when I hit "test" on the webhook I'm not getting anything, anyone have any suggestions?

#

would it be because I'm using HTTP and not HTTPS?

#

nevermind

undone hearth
#

im trying to show the difference in roles before a role is added and after, my code looks like this
bot.on('guildMemberUpdate', (oldMember, newMember) => { let log = oldMember.guild.channels.find(name`, "log");
if(!log) return;

oldMember.guild.fetchAuditLogs()
    .then(audit => {
        let user = audit.entries.first().executor
        let logembed = new Discord.RichEmbed()
            .setAuthor(`User Update Case`, user.avatarURL)
            .setThumbnail(user.avatarURL)
            .setColor("8c0066")
            .setDescription("User Updated!")
            .addField("Updated By", user, true)
            .addField("Updated Deleted By ID", user.id, true)
            .addField("Roles Before", oldMember.roles, true)
            .addField("Roles After", newMember.roles, true)
            .setTimestamp()

        log.send(logembed)
    })

})`

#

what am i doing wrong?

#

when it runs, it just says [object map] where it should show the roles after and before

brittle nova
#

what version of d.js?

undone hearth
brittle nova
#

yeah, roles is a collection of the member's roles

undone hearth
#

version of d,js one sec

brittle nova
#

are you trying to get names/

#

?

undone hearth
#

yes

brittle nova
#

.roles.map(r => r.name) iirc I haven't done js in a long time

undone hearth
#

ok

#

btw d.js version ^11.3.0

brittle nova
#

okay

undone hearth
#

that worked @brittle nova thanks!

brittle nova
#

welcome

clever wave
#
/opt/watcher/app-types/node/start.sh: line 49: null: command not found
#

Whats the problem?

earnest phoenix
#

d.js? @clever wave

clever wave
#

yes

#

Git Hub also found a music boat I wanted to set up ver I got such an error @earnest phoenix

earnest phoenix
#

So

#

you use file system?

clever wave
#

glitch

earnest phoenix
#

and send all error

sinful lotus
#

I think

#

its his package.json scripts start

clever wave
#

I'm using the glitch

earnest phoenix
#

yes

#

I know

#

but send all the error

sinful lotus
#

I host testing bots in glitch

#

try to fix that

earnest phoenix
#

I host all my bots there ^

clever wave
sinful lotus
#

glitch isnt really for hosting public bots. that is designed for testing only either ways

earnest phoenix
clever wave
#

what should I do

earnest phoenix
#

Projects require a start command in package.json, so try:
"scripts": { "start": "sh ./etc/app-types/node/start.sh" },

sinful lotus
#

make sure

  "scripts": {
    "start": "node --max-old-space-size=128 --trace-gc --always-compact coreyamato.js"
  },

this is pointing into right file

#

dont copy my tags because its for testing

#

just node <file.js>

lament meteor
#

tbh glitch is good for websites

#

not for bots

clever wave
#

would you mind if I gave you my glitch address?

#

@sinful lotus

sinful lotus
#

you can solve it yourself

#

Im tired

#

I even gave you the piece of code

earnest phoenix
#

what's your starting file name @clever wave

sinful lotus
#

thats enough spoonfeed

clever wave
lament meteor
#

remove Procfile...

clever wave
#

I think Procfile

#

just got this

lament meteor
#

... this is not heroku

earnest phoenix
#

node bot.js

clever wave
#

this is glitch @lament meteor

earnest phoenix
#

I can make glitch 24 hours

#

So you can do something like what I’ve put above if you’re using a sh file. But if you don’t, then you can just do "start": "node server.js", replacing server.js with the name of your server start file.

#

@earnest phoenix same

lament meteor
#

this is hopeless

earnest phoenix
#

Very simple using glitch

#

remove Procfile and set node bot.js

#

@clever wave

clever wave
#

1 minute @earnest phoenix

earnest phoenix
#

k

#

My friend code a bot using notepad XD

#

Gg

#

LOL xd

#

It's hard using notepad

#

Yea

clever wave
#

@earnest phoenix I remove Procfile

earnest phoenix
#

But he says its easy

clever wave
earnest phoenix
#

@clever wave now go package.json and send me the code

clever wave
#

@earnest phoenix send me here?

restive bough
#

sup everyone

#

is there an way to listen for multiple events

#

with discord.js

#

in the same block

sinful lotus
#

client.on(eventname )

#

or clarify what you want

lament meteor
#

u can do 2 message events

#

but not suggestable

restive bough
#

i want to listen for multiple events in the same code block

earnest phoenix
#

I think he wanna that the bot will listen to 2 things

restive bough
#

like client.on('event1 event2')

earnest phoenix
#

yes you can

restive bough
#

is that possible?

sinful lotus
#

I never heard of someone did that

earnest phoenix
#

Maybe

sinful lotus
#

but if you want read node.js docs

earnest phoenix
#

make INTERVAL

sinful lotus
#

you probably can find your answer in node.js docs

earnest phoenix
#

interval, read in docs

restive bough
#

i want to have this in one block

client.on('guildCreate', updatePresence) client.on('guildDelete', updatePresence)

#

okay

#

i'll read the docs

earnest phoenix
#

Can i make 2 bot on 1 project ?

#

Is that posible ?

#

=> { //what you wanna };

restive bough
#

?

sinful lotus
#

if you run it on interval

restive bough
#

updatePresence is an function

#

to callback to

sinful lotus
#

make sure you remove that listener

earnest phoenix
#

``

client.on('guildCreate', updatePresence) => {
//here

}
``

restive bough
#

i know what i'm doing

sinful lotus
#

or else you will have a leak in your listeners

restive bough
#

i just want to listen for 2 discord.js events like this client.on('guildCreate guildRemove')

earnest phoenix
#

var interval = setInterval (function () { //here ) }, 1 * 1000);

restive bough
#

why would i need an interval?

sinful lotus
#

read there

#

thats basically event emitter which d.js use

#

but in my opinion as you can see in the docs, .on() only listens into one event
so if you want them to use the same function

sick cloud
#
const event = (guild) => {
    // code
}

client.on('event', event);
client.on('event', event);
restive bough
#

bruh

#

ok

sinful lotus
#
function doSomething() {
  // code here
}
emitter.on(event, doSomething)
emitter.on(event, doSomething)
sick cloud
#

thats the only way

restive bough
#

i'll try to explain it again

sick cloud
#

@sinful lotus the () isnt needed angery

sinful lotus
#

oh yas my bad lmao

restive bough
#

so i want to listen for 2 events in one listener like this client.on('event1 event2', myFunction)

marble needle
#

.on only listens to one single event. you cant throw 90 events into a single listener and handle it in a single block

sinful lotus
#

I already answered you you cant do that instead you can do what we sent

sick cloud
#

no

sinful lotus
#

You cant do it like that instead you can make them invoke the same function

#

there bold

restive bough
#

i already do

#

but in in different event listeners

sinful lotus
#

sighs

restive bough
#

the only question i have

#

is

#

is it possible to put 2 events in one listener

#

yes or no

marble needle
#

jesus christ

#

you've been told

#

4 times

#

no

#

you cannot

restive bough
#

okay

sinful lotus
#

Did you read what we've told you?

restive bough
#

thank you

#

finally

sinful lotus
#

its even in bold

marble needle
#

losing braincells by the minute

sinful lotus
#

Comprehension level 100

#

I need to rest in offtopic for now

sick cloud
restive bough
#

this server is the worst

#

lol

sinful lotus
#

you are the worst

restive bough
#

said the weeb

marble needle
#

if you're gonna ask technical questions and people reply at least be arsed to some extent to read their replies

#

instead of ignoring and spamming your question for the 9th time to get the same exact responses

restive bough
earnest phoenix
marble needle
#

"only listens into one event"

restive bough
#

wow

#

such an amazing anwser

#

thank you

earnest phoenix
#

lol u noob

#

//here - code

#

😅

restive bough
#

my question was super simple

sinful lotus
#

we answered it + we gave you examples

marble needle
sinful lotus
#

I dont see the reason for you to rant

marble needle
#

and we've given you 5 super simple answers

coral trellis
#

You can't just do client.on('guildCreate', then the next event you want to listen to)

restive bough
#

ik that

sick cloud
restive bough
#

but whatever

#

bye

marble needle
#

apparently you don't lmao

sinful lotus
#

but you asked even you said you know that

earnest phoenix
#

xd

restive bough
#

you guys clearly didn't read my question

#

i wasn't asking how to make add an event listener

sinful lotus
#

we answered that you cant + we cited examples

marble needle
#

"i want to have this in one block" was your first question, speech 100

restive bough
#

thank you for that

earnest phoenix
restive bough
#

this server is full of copy paste "devs"

sinful lotus
#

yes I copy paste my 200 files code heheheh

marble needle
#

if you can't read docs you're nowhere near a position to shit on others

restive bough
#

i can?

marble needle
#

how come you had to ask if you can
node.js docs answer your question

sinful lotus
#

I also gave a link to the docs^^

restive bough
#

i wanted an short awnser from someone

#

not how to make an interval

#

or an callback function

marble needle
#

the art of filtering valuable from trash responses that have nothing to do with your question

sinful lotus
#

first of all your question was vague

restive bough
#

it wasn't

marble needle
#

anyway, research is a crucial part of software development, if you cannot be arsed to google a simple question development may or may not be the wrong hobby

sinful lotus
#

we cant magically answer your question

restive bough
#

it was super clear

#

whatever

#

i'm not wasting my time anymore

marble needle
#

"i want this in one block two code lines" clear 100

restive bough
#

i didn't say two code lines

#

bye

#

everyone

#

thank you for the awnser @sinful lotus

sinful lotus
#

you said this question bro. with this question normally what I have thought is

function stuff() {
  emitter.on()
  emitter.on()
}
#

if you want someone helping you fast clarify what you want

marble needle
#

carification was only part of the problem he repeated what he actually wanted like 3 times while ignoring a shitton of responses telling him that it's not possible

#

to then go on a rant that we're not helping

sick cloud
#

should i use js or ts

mossy vine
#

depends

#

Ts has some very helpful features

#

Personally i still prefer js

restive halo
#

So I had to add a temp workaround for this
But basically what's going on is the entire command was giving no output not even an error message when using "999"
Anyone got any idea why?
Discord.js

neat falcon
#

mobile coding cry

marble needle
neat falcon
#

request 😭

restive halo
#

Not coding it on mobile dont worry lol

marble needle
#

why are you debugging on mobile then 👀

restive halo
#

Was just quicker to grab the screenshot through termux

#

I'm just confused though
On why it specifically isnt working with 999

#

Every other number I've tried is fine

marble needle
#

i mean since it works for any other number it should fail somewhere in the block that handles 999 input, but that block looks fine

#

log num and try a few different inputs (including 999)

restive halo
#

Alright.
Will get to that when I can get on my laptop
Dealing with a ton of updates on it rn

opaque eagle
#

Ew nano

#

Use vim

soft plaza
#

No

#

Don't think so

earnest phoenix
#

vim is like a curse

opaque eagle
#

Vim-haters are horrible people

marble needle
#

no u

earnest phoenix
#

Hi

#

How can i install module quick.db on Windows?

#

Its giving error about sqlite

bold dock
#

I don't use Vim not because I hate it, I don't use it because I'm too dumb to remember every command

earnest phoenix
#

em

#

so i made lb

#

i got it to show 1-10 but i dont know how to make it 10-20

#

anyone help?

sacred bronze
#

in which language is your bot wrote in?

earnest phoenix
#

JS

sacred bronze
#

What is your code?

#

To display results?

earnest phoenix
#

resps.length =

sacred bronze
#

?

earnest phoenix
#

So

#

resps.length = 10

#

is to display

#

top 10

sacred bronze
#

I don't know how your code exactly works because I can't read your mind magically. Modify it to 20 then? GWaobloChildPepeShrug

earnest phoenix
#

so i need to make it 10 - 20

#

if i make it

#

it will do

#

1-20

marble needle
#

is resps an array

earnest phoenix
#

yes

sacred bronze
#

If rersps is an array modifying length value does nothing.

#

You have to modify way you filter/query results.

earnest phoenix
#

so

marble needle
#

create a new array from your original one that removes the first 10 elements

#

and log the first 10 of your second array

#

which essentially is 10-20

sacred bronze
#

Well...

earnest phoenix
#

db.startsWith(currency_${client.user}).then(resps => {

sacred bronze
#

how you filter resps?

earnest phoenix
#

thats example

sacred bronze
#

...

#

Resps then

gusty tartan
#
dblClient.webhook.on('vote', vote => { console.log(`User with ID ${vote.user} just voted!); }`)});
                  ^

TypeError: Cannot read property 'on' of undefined

can someone please tell why this error apair ?
i'm calling the class here

const dblClient = new dblapi("You tried",{})
sacred bronze
#

You have to initiate the webhook.

#

Aka start it wasoever.

#
const dblClient = new dblapi(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });```
#

See if this helps ^

gusty tartan
#

it's isnt something that we should make in the dash right ?

sacred bronze
#

Wdym?

gusty tartan
#

the webhook isn't something that should we setup in the dashboard or it is ?

sacred bronze
#

Oh, you have to get your dbl api token, to set a adrees to point that Upvotes to.

gusty tartan
#

only the api token ? (soory i'm giga dumb)

inner jewel
#

in your bot's edit page you can add the webhook url

sacred bronze
#

^ that

inner jewel
#

where you have the listener running

gusty tartan
#

Oh so i can't use a custom bot for it ?

sacred bronze
#

If you turn on listener on another bot you can.

#

But you have to add the webhook url to the bot you want to get upvotes from.

gusty tartan
#

That not wait i mean
i mean using an actual bot to send a message in a channel when someone upvote

split hazel
#

How would i go about making a timed ban command?

#

I could use setinterval but my bot will definitely not run more than a couple of days straight

mossy vine
#

@split hazel what do you mean by timed ban?

split hazel
#

basically it unbans the user after a specified amount of time has passed.

mossy vine
#

you would need a settimeout

#

not setinterval

#

setinterval executes it every time the given time is up

#

settimeout only does it once

split hazel
#

ah yeah i meant set timeout

#

but set timeout resets after the bot restarts

#

which is a problem with longer ban lengths

mossy vine
#

yeah 🤔

split hazel
#

I heard you can store the time in a database and when it hits that time, unban them. But the question is how would i fire that event

inner jewel
#

store in the db, start a timeout

#

when it runs, remove from db and unban

#

on startup, load all from db and start their timeouts

spare glen
#

any mongoDB guys here

#

i could use some help

carmine echo
#

Is anyone here? I'm trying to install arch and idk how to partition the drive kek

#

like how much swap do I need

#

aaaa

mossy vine
#

when i installed xubuntu i did 8gb for my swap partition

carmine echo
#

just out of curiosity.. what desktop environment did you use?

mossy vine
#

?

#

whats a desktop environment xd

carmine echo
#

ah so you're not a linux person

#

ok

#

It's how it looks basically

mossy vine
#

i installed xubuntu

#

so xfce

#

before you bully me, i like it

carmine echo
#

ok everyone has their tastes

#

I used to use xfce for about a month

#

then I learned that kde exists

mossy vine
#

xubuntu is what ive been using at school for almost 4 years, so im used to it

carmine echo
#

I'm installing arch 👀

late hill
#

@spare glen 👀

spare glen
#

what

late hill
#

That contains your password 👀

spare glen
#

doesnt matter

#

i deleted it

#

@late hill what u thinking

split hazel
#

@inner jewel could you rephrase?

late hill
#

I don't see anything wrong with the code

spare glen
#

doesnt matter

#

i deleted it

#

it sucks

inner jewel
#
tempban(target, time) {
    target.ban()
    saveToDb(target.guildId, target.id, now + time)
    settimeout(() => unban(target), time)
}

unban(target) {
    target.unban()
    removeFromDb(target.guildId, target.id)
}

onStartup() {
    loadAllFromDb((guild, id, when) => settimeout(() => unban(...), when - now))
}```
#

basically this

prime junco
#

So is it wise to keep the commands for my bot in the index?

grim aspen
#

which library?

prime junco
#

Because as it stands I have ALL my commands in the index

#

Discord.js

grim aspen
#

i've done that with mine

#

so i think that's fine

prime junco
#

It seems easier to me doing that then creating individual JavaScript files for them

amber fractal
#

Easiest isnt always best

#

You cant reload commands/modules, and iirc, module.exports is faster, not to mention more organized than all in one file

mossy vine
#

in javascript is there any reason not to use Map() or to use it over objects?

amber fractal
#

If you're an oldie and dont feel like using maps

mossy vine
#

So basically Map is better in every case?

knotty steeple
#

yes

#

map > objects

#

ok thanks

amber fractal
#

I still use objects because Im too lazy to rewrite my stuff

#

unless they become deprecated, probabably staying like that. Unless I get some incentive to actually optimize my bot

spiral condor
#

Hey, I have a small question: I was looking in #mod-logs and I noticed that sometimes bots are rejected for responding to words like "Hello". However, my own bot (which has already been approved) also responds to the words "Good bot" and "Bad bot". Should I remove this feature?

amber fractal
#

I love when people ask this question tbh. You just need to disable it for this guild

#

you dont need to remove it completely :+1:

spiral condor
#

Is my bot on this guild?

earnest phoenix
#

wat

amber fractal
#

if it was approved, it should be

knotty steeple
#

what do you think

#

yes

spiral condor
#

Oh I didn't even know lol

earnest phoenix
#

speechless

spiral condor
#

I'll add an exception for this guild then. Thanks 😃

grim aspen
#

i was wondering, what does async actually do?

inner jewel
#

does something asynchronously

keen drift
#

high iq

wanton walrus
#

howdy

#

does anyone know what it could mean by duplicate

#

the default file hasnt been touched

#

Like I just double checked and there is nothing out of the ordinary

last lava
#

Im having a problem using json as a database since adds elements outside the array, and I can not find the error within my code

#

is there a good way to go about finding the error

wanton walrus
#

^^ fixed my issue above - in-case anyone is ever searching messages, make sure you delete nanos 'default.save' file - itll cause issues

split hazel
#

How would i go on making a spam filter?

wanton walrus
#

well it depends on how smart you want it to be'

#

if you want a simple timer // to have the command wait before running, just add a userid to a set, and have the command wait like a few seconds before executing (if the userid is in the set)

split hazel
#

Someone made a module on npm all about it 😂

wanton walrus
#

??? dont use a npm module for spam timers

#

it's like 7 lines of code

#

if not less

split hazel
#

Hm ok

split hazel
#

Ah i meant like a proper spam filter

#

and that module didnt work because its very outdated

sick cloud
#

make it yourself

sterile hedge
#

Is a raspberry pi a good computer to run a discord bot on?

keen drift
#

Yeah

sterile hedge
#

I have one but never used it for anything

rotund lance
#

Lol I should probably split up my code into some organized files

#

I’m at 2400 lines in a single file now

#

Scroll fer dayyyz

late hill
#

ctrl f

earnest phoenix
#

f

wide ruin
#

ive rewritten my bot

#

it now logs on (from ready)

#

in js

#

but goes off after 30 secs

#

how do i keep it on?

#

(no errors)

sinful lotus
#
   setInterval((a) => {
        client.user.setActivity(activities[Math.floor((Math.random() * activities.length))])
    })

@wide ruin this isnt good

wide ruin
#

should i use the ~~ one

sinful lotus
#

no you dont have ms

#

if you dont have ms means that thing is spamming

#

means api spam

wide ruin
#

oh yeah

#

donw i just add ,10000 to the end?

sinful lotus
#

10 seconds is still spam

#

make it at least one minute per change

wide ruin
#

ok

#

its only changing the status though

sinful lotus
#

also how it turns of after 30 seconds?

wide ruin
#

it just goes offline

sinful lotus
#

what node you are using

#

because if you are using node v10 above and a uncaught promise error happens, it will crash your bot silently

wide ruin
#

that is whats happening then

#

how do i stop it?

sinful lotus
#

handle your promises

wide ruin
#

. . .

sinful lotus
#

Promises can "reject" hence throwing uncaught promise rejection

#

in order to fix that you need to handle your promises properly

wide ruin
#

where do i look to learn how to fix?

sinful lotus
#
async function stuff() {
  try {
    promise() // non awaited promise
  } catch (error) {
    console.error(error)
  }
}

async function stuff() {
  try {
    await promise() // awaited promise
  } catch (error) {
    console.error(error)
  }
}

some example is here ^
a promise that inside an async function but not awaited, if that promise errors your bot will crash silently EVEN inside a try catch block

the second part is a promise that is awaited inside a try catch block, if that promise errors, the error would be caught and logged hence not crashing your bot

#

another thing to catch promise errors are

promise().then(() => {}).catch(() => {})
wide ruin
#

do they both do the same thing?

sinful lotus
#

on the first codeblock I sent, the first function will crash IF the promise rejects while the second function will catch the error if the promise rejects since its awaited inside the async function

the second codeblock is the traditional way of handling promises

wide ruin
#

and where would the .then stuff go?

sinful lotus
#

if you want to know how to determine whether something is a promise for example in discord.js look in the returns part and take a look if it is a promise like how I circled

#

@wide ruin the .then and .catch is traditional way of handling promises. if the function isnt an async one as how I did in the first codeblock

wide ruin
#

so i just ignore it if its an async

sinful lotus
#

yes but you need to put it inside

  1. a try catch block
  2. and make sure it is awaited
wide ruin
#

i have both of them now

sinful lotus
#

yes but seeing you didnt know this until now, you may need to skim through your whole code again

wide ruin
#

where do i need them?

sinful lotus
#

as I said earlier promises

wide ruin
#

just in each .on

#

oh ok

sinful lotus
#

I gave a screenshot on determining what is a promise

#

in discord.js functions so its up to you to study it

wide ruin
#

so where i do stuff that returns a promise, add that

sinful lotus
#

yes if inside an async function
try catch and await

if not async
.catch(console.error)

#

thats all you need to remember

#

with dealing with promise rejection handling

wide ruin
#

if its not an async, id do message.....').catch(console.error)?

sinful lotus
#

yes

#

for example

function stuff() {
  msg.channel.send().catch(console.error)
}
wide ruin
#

and for other stuff that returns a promise

#

right, thanks for the help

wide ruin
#

@sinful lotus

#

still turning off, no errors

sinful lotus
#

@wide ruin try booting the bot with a bare bones code only

#

if that stil dont work thenIm afaik it could be still an error with your code

earnest phoenix
#

can someone help me?

#

@ me if you can

#

@earnest phoenix no one (but me) is going to mention you if no one knows what the problem is

#

😦

#

(that was an invitation to you know.. ask the question)

wide ruin
#

@sinful lotus

#

its got an error now

#

can i dm? its quite long

sinful lotus
#

dont include the stacktrace for now

#

just send it here

wide ruin
#

ok, lemme pastebin

lament meteor
#

how to add a role to a user in d.js masters?

coral trellis
#

member.roles.add()

lament meteor
#

o ty xig

coral trellis
lament meteor
#

normal using stable so yea...

#

ill figure stuff

earnest phoenix
#

@lament meteor or
``
let role = message.guild.roles.find(r => r.name === "name");

let member = message.mentions.members.first();

member.addRole(role).catch(console.error);
``

#

so you ping an member

lament meteor
#

@earnest phoenix that would work for stable

#

not master

earnest phoenix
#

Oh

#

so

#

user.roles.add()

earnest phoenix
#

How would i do to ignore welcome messages in this server (.py) from dms

late hill
#

Read the docs for the library you use

#

Find out how to get the id of the server that was joined

#

Ignore it if it's this server

slender thistle
#

@earnest phoenix A single simple if

#

Get my point?

earnest phoenix
#

Ye

sinful lotus
#

@wide ruin your error is Error: read ECONNRESET
This thing happens in numerous reasons, most common is your connection died somewhere between your vps and discord

sinful trail
#

Beyler Koda Emoji Eklemeyi Bilen Varmı?

earnest phoenix
#

hello

#

i want a help

#

,

grim aspen
#

on what?

earnest phoenix
#

i need web developer

grim aspen
#

what do you mean?

earnest phoenix
#

i want to make a control panel for my bot

grim aspen
#

like on the discord bot website?

earnest phoenix
#

yes

#

@grim aspen

#

@earnest phoenix you need your own website

grim aspen
#

you need that or buy a website

earnest phoenix
#

ur create in glitch

floral geyser
#

I am trying to be able to code in Python on pc but idk really know how to download it the right way
Could someone help me?
Btw when i open command prompt it says microsoft Visual studio's 2017 is this normal?

earnest phoenix
#

@floral geyser widnows?

floral geyser
#

Yes 64

earnest phoenix
#

download

floral geyser
#

Execyt1bke installeer?

earnest phoenix
#

you wanna code for discord?

floral geyser
#

Yes i have made my own discord bot and coded on mobile but mobile sucks so i wanna redo on pc

earnest phoenix
#

so

floral geyser
#

Thanks

#

Gtg tho be back soon

earnest phoenix
#

key

slender thistle
#

NO

#

PLEASE

earnest phoenix
#

what? @slender thistle

slender thistle
#

That's really outdated version

earnest phoenix
#

idk

#

i found the 1st one

#

i dont know py

slender thistle
#

pip install -U git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py[voice] to install rewrite, which is a newer version of d.py with a lot more features

earnest phoenix
#

@floral geyser

slender thistle
mossy vine
#

what is the differnce between Map() in js and dict() in python?

#

some sites say theyre the same, other that they are completely other things

slender thistle
#

Map is arrays, dict is... dicts

mossy vine
#

oh so a dict is a completely different object type?

slender thistle
#

In Python, arrays are lists

#

Dicts in Python are basically JSON

mossy vine
#

so.. objects?

slender thistle
#

A collection

mossy vine
#

oh wow this makes no sense

slender thistle
#

What

mossy vine
#

so its a json, object, and Map() all at once???

inner jewel
#

a dict is a map

mossy vine
#

oh

slender thistle
#

Also, py is OOP, so kinda object too

inner jewel
#

they're both key -> value

earnest phoenix
#

better javascript

slender thistle
#

Good is only an opinion

earnest phoenix
#

yes

#

i need 10 more votes for 120

#

hihi

#

then i apply

floral geyser
#

I am back

amber fractal
#

I only need 5 more, I dont plan on applying any time soon tho

opaque eagle
#

I think what cutie meant to ask was if dict was for key/value storage

amber fractal
#

A dict is just key value storage, equal to a js object, I think

dusky steeple
#

Could someone show me what I am doing wrong here? I keep getting Error Uncaught Promise Error: TypeError: event.bind is not a function at evtFiles.forEach.file (/home/oem/Desktop/RedQueen/bot.js:145:36) and I think it's because of the function at the bottom of this code https://hastebin.com/ixetodewos.js

amber fractal
#

It happens at evtFiles.forEach.file

#

In bot.js at line 145

#

Col 36

dusky steeple
#

which is this line
client.on(eventName, event.bind(null, client)); It worked before

#

which why I am thinking it has something to do with that function at the bottom of that code I posted. IDK if it's supposed to be a function or something else, or if I just have it completely set up wrong.

soft plaza
#

If I have my shard count on auto, will the shard manager automatically create new shards?

#

Working with d.js

inner jewel
#

you can't add more shards without restarting all

soft plaza
#

Ok

split hazel
#

How would i bulk delete a specific users messages?

amber fractal
#

Fetch > Delete

split hazel
#

but how to fetch them

lost scarab
#

is there a way to make sq lite coin system to every server?
cuz when i go in different servers i have 0 coins 🤷

split hazel
#

to every server?

#

and if we're on the same lines then yes

#

some bots have it to automatically set a users value to 0 even when they never sent a message, which uses unnecessary space. Most efficient way is to check on every 'coin system' command if their sqlite table entry exists, and if it doesn't, create one for them and set the value to 0

earnest phoenix
#

@lost scarab so make amount for bot.user not for guild.user @lost scarab

lost scarab
vapid ferry
#

I'm creating a tycoon-type bot and need some information on how I should go to saving data. My bot is coded in lua.

fleet mason
#

mongodb

earnest phoenix
#

@vapid ferry what data do you wanna save?

vapid ferry
#

like money,items,donation status etc

earnest phoenix
#

So with money

#

you can use batabase

#

like quick.db

#

items too ^

#

donation? @vapid ferry

vapid ferry
#

boolean

#

people could like donate and get things doubled and costs like cut in 1/4

sick cloud
#

quick.db isnt a database

earnest phoenix
#

How not?

sick cloud
#

it literally wraps around json or sqlite or something

#

not a db, its a storage wrapper

earnest phoenix
#

yes

vapid ferry
#

I'm fine with saving it as a file on my local machine,

earnest phoenix
#

but it storage data

#

So use fs

sick cloud
#

no

#

just no

#

use a proper database

#

files are prone to corrupt

earnest phoenix
#

okey

#

I am using quick.db

#

and all is working

sick cloud
#

good for you

vapid ferry
#

@sick cloud What do you recommend?

earnest phoenix
#

Every thing

#

if you host on pc

vapid ferry
#

I'm planning to host on a Raspberry Pi

earnest phoenix
#

oh

sick cloud
#

use a database like mysql, rethink, mongo, redis, etc

#

anything

earnest phoenix
#

Hallo, anyone know why when i use dark theme at the site, my css won`t work

#

hmmm...?

#

Idk lol

vapid ferry
#

Anyone able to help me on connecting MySQL to lua?

earnest phoenix
#

hello there

marble elm
#

Don't use Redis as a database use it for caching

quartz kindle
#

Why not? Nothing wrong with it

#

Unless you have sensitive realtime data anf cant afford the slightest possibility of losing < 1 second worth of data

marble elm
quartz kindle
#

Nobody here has terabytes of data

#

Its oerfectly fine to usrme redis as the primary database specially in AOF mode, as long as your dataset fits in memory

marble elm
#

¯_(ツ)_/¯

upbeat solstice
#

Uhm

#

I need help

#

;-;

#

In my bot coding, I'm coding a mute command.

#

But

#

It keeps getting an error

coral trellis
#

Whats the error?

upbeat solstice
#

(I code on Pydroid 3)

#

Do you know how to fix it?

bright spear
#

your indentation is wrong

sick cloud
#

did you tab too much