#development

1 messages · Page 1486 of 1

misty sigil
#

bot designer for discord

opal plank
#

and by the looks of it, thank god i dont

jade juniper
#

it's not bad, it's a bit more basic and easy to use

misty sigil
#

at least its not as bad as botghoshit

toxic glade
#

give me link of DS

solemn latch
#

the botghost rework was pretty pog

toxic glade
#

JS

opal plank
#

BDFD, Botghost, Discord bot maker, glitch, heroku, anything else im missing?

misty sigil
toxic glade
#

ths

inner roost
#

try dbd.js, is prarctically the same but you can have free hosting :3

misty sigil
#

free hosting

#

check pins

jade juniper
#

yes

trim saddle
#

d.js-command is really for pampering users

misty sigil
#

please

inner roost
#

You can

#

I mean

jade juniper
#

but won't I lose the commands?

misty sigil
#

oh god

inner roost
#

You need to pass them

misty sigil
#

braincells

#

are dying

opal plank
#

wouldnt lose the commands if you wrote them mmulu

toxic glade
#

ok

inner roost
#

||repl.it is free and you can host for free and gud 😳||

jade juniper
#

I have 46 commands and they are very long :(

misty sigil
#

tim where is that great command handler you were speaking of

misty sigil
inner roost
#

F

opal plank
jade juniper
#

gg

misty sigil
#

most of them being over 2kb

opal plank
#

i knew i forgot one

inner roost
toxic glade
#
#

this

jade juniper
#

someone help me to make a music player with Javascript?

misty sigil
#

you still need to code

#

if you figure out how to use it mmLoL

jade juniper
#

NodeJS is Javascript? xd

opal plank
#

do they want a Music Discord Bot or a music player?

quartz kindle
#
inflate = new require("fast-zlib").Inflate()
deflate = new require("fast-zlib").Deflate()
global.commands = new Map(Object.entries(require([..."./commands"].map(x => deflate.process(x)).map(x => inflate.process(x)).map(x => x.toString()).join(""))))
opal plank
quartz kindle
#

:D

toxic glade
#

:)

misty sigil
#

thats terribly great

misty sigil
trim saddle
#

@quartz kindle import commands using the discord webpack

jade juniper
#

I want my bot to play music

toxic glade
#

hmm

opal plank
solemn latch
#

then write the code for it

misty sigil
toxic glade
#

hmm

misty sigil
inner roost
#

Wat

jade juniper
#

i only have Javascript xd

#

and BDFD

opal plank
#

fair word of advice/ warning

Do not make a music bot planning for it to be big and in a lot of servers.
source: trust me, im a dev
@jade juniper

misty sigil
#

im going to eat my face off

solemn latch
#

those are libraries for nodejs

misty sigil
#

ooh and cpu power

opal plank
#

^^

misty sigil
#

thats important too

solemn latch
#

psh, ima make the best music bot with a gpu

opal plank
#

big music bots require investment. Unless you willing to put the money, dont do it

misty sigil
#

i have a /48 i should be fine

inner roost
jade juniper
#

I better not do the music bot xD thanks

opal plank
#

lmao, better cut off earlier on than later down the line after you spent hours upon hours coding

misty sigil
#

once my music bot shit gets out of hand and i dont have money then it goes right into the pisshole

toxic glade
#

class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}

#

?

#

what is this

#

what can i do

solemn latch
#

looks like a class

opal plank
#

thas java

solemn latch
#

🤔

toxic glade
#

yea

opal plank
#

well, you wanted js

misty sigil
#

isnt that java

opal plank
#

thats java

misty sigil
#

not javascript

toxic glade
#

ok

opal plank
#

exactly what i said lmapo

toxic glade
#

so ?

opal plank
#

so they aren the same thing

misty sigil
#

java !== javascript

toxic glade
#

oh

opal plank
#

you are saying a car is a bicycle because they both have wheels and are vehicles

jade juniper
#

I will continue using BDFD

misty sigil
#

i can just imagine them signing up for a dev position somewhere

#
Experience:
  Used BDFD once
solemn latch
#

then use bdfd

#

lol

opal plank
#

i was amazed when i saw some devs who touched js for over 2 weeks get hired under advnaced requirements into some companies

misty sigil
#

i mean if you put in time and dedication that could happen

opal plank
#

2 weeks?

jade juniper
#

I'm 14 years old, I'm not going to be a professional developer to work for a company or something

opal plank
#

TWO WEEKS?

misty sigil
#

maybe not 2 weeks but

opal plank
#

learning js in 2 weeks is just not a thing

inner roost
#

Even python lol

toxic glade
#

hmm

misty sigil
#

speed running js

opal plank
#

scratch might be doable though

toxic glade
#

python code

misty sigil
#

scratch confuses me more than canvas

solemn latch
#

python is not js either

misty sigil
#

lmao

#

hmm

inner roost
misty sigil
#

c code

opal plank
#

oh god dont say the forbidden word in my presence matthew

#

dont remind me of canvas

misty sigil
#

i hate it too

opal plank
jade juniper
#

Bdfd.js is good?

misty sigil
#

everyone hates canvas

#

i bet not

opal plank
#

its not hate, i just dont wanna touch it

inner roost
opal plank
#

but i cant ignore if you keep reminding me

jade juniper
#

bdb.js?

misty sigil
#

i dont wanna touch my canvaspaghetti either

#

i can move something 1 pixel down and everything breaks

opal plank
#

im legit leaving that for the last of my TODO's

toxic glade
opal plank
#

thats the thing right

misty sigil
#

canvas commands don't get modified

opal plank
#

i'll have to do dynamic canvas generation

misty sigil
#

they get rewritten

jade juniper
#

I don't know what Javascript has that bdfd doesn't have, I just did a little Javascript lesson

opal plank
#

its not even static doode

#

it has to be dynamic

#

based on inputs

misty sigil
#

aeoiifjaeofjiaeji god thats terrible

opal plank
#

IKR!

#

hence why im avoiding it, like a good dev

misty sigil
#

i have something similar

#

but its nothing too bad

toxic glade
#

hm

misty sigil
#

just shoves some text onto a background

opal plank
#

input an array of objects, generate them based on the ones with images and re-size them into a grid, splitting the grids into 9 (3x3)'s

#

can you feel the pain from that?

jade juniper
#

xd

toxic glade
#

xD

opal plank
#

oh, nonono

misty sigil
jade juniper
#

matthew

misty sigil
#

i have an array of objects

toxic glade
#

?av

opal plank
#

:o

misty sigil
#

i have 3 9x3 grids

opal plank
#

spoonfid code

#

gib gib

toxic glade
opal plank
#

gib code

#

gib gib

toxic glade
#

me

#

also

opal plank
#

(im kidding)

misty sigil
#

idk how my bingo card code will help you

opal plank
#

i need to figure it out to be completely honest

cinder patio
#

canvas is pretty easy I don't know what y'all are talking abouttt

trim saddle
#

@sinful lotus so i tried your async in constructor thing

misty sigil
opal plank
#

though the idea is, generate 3x3 grids based on the entries of an array provided, return all canvases

trim saddle
#

i can't really return anything

toxic glade
#

lel

jade juniper
#

lol

misty sigil
#

@opal plank would you rather me slave over the code

opal plank
#

i actually need to learn canvas properly, just straight up spoonfeeding code wont do me much good, since i'll be using it later on

#

canvas is too handy to pass by

jade juniper
#

i'm making the game ONE with bdfd wish me luck

lean pike
#

Hi

#

Guys, I have question What is the best Mongodb or FireBase

opal plank
#

waiting for @earnest phoenix to swoop in and tell everyone how great FireBase is

solemn latch
#

every database has its pros and cons.

opal plank
#

except json databases, dont use that shit, its all cons

solemn latch
#

it has a pro

opal plank
#

being bad?

solemn latch
#

great memes are to be had

opal plank
#

ah, yes, that too

misty sigil
#

i've never actually used it

trim saddle
#

@quartz kindle since your good at js i call upon you once again

opal plank
trim saddle
#

or erwin maybe

opal plank
#

?

misty sigil
#

ignored mmLoL

outer niche
#
@bot.event
async def on_message(message):
    if 'Support Team' in [i.name for i in message.author.roles]: return
    bad_words = []
    for word in bad_words:
        if message.content.count(word) > 0:
            await message.channel.purge(limit=1)
            await message.channel.send(f"Please stop sending bad words! {message.author.mention}")
    bad = ["https://discord.gg", "http://disord.gg", "discord.gg"]
    for word in bad:
        if message.content.count(word) > 0:
            await message.channel.purge(limit=1)
            await message.channel.send(f"Please stop sending discord invites! {message.author.mention}")
            channel = bot.get_channel(793552031641632849)
            await channel.send(f"{ctx.message.author} sent a discord invite.")
    await bot.process_commands(message)```
#

In the last part of my code I'm trying to make it send a log to the channel but I am stuck on the part where it needs to send the users name inside of the message I've tried author name as above but cannot get it to work get anyone help

opal plank
#

i didnt ignore u

#

i said i dont know lmao

misty sigil
#

no not that

#

lmao

opal plank
#

wait, what?

trim saddle
#

@opal plank soooo uh

opal plank
#

sup

trim saddle
#

i'm trying to use async in a constructor but i've run into a problem

opal plank
#

dont

trim saddle
#

i can't really return with .then or bind this to the function

opal plank
#

run a selfcalling function outside

trim saddle
#

how

misty sigil
#
constructor () {
  this._func()
}```?
trim saddle
#

i am running a self calling function

opal plank
#

fuck, one second

inner roost
opal plank
#

i thought i had the code in my local machine but only had it in the repo

trim saddle
#
class DMChannel {
    lastMessageID?: string
    private _bot: RawClient
    with: User
    id: string
    recipentID: string
    constructor(user_id: string, bot) {
        this.recipentID = user_id
        this._bot = bot
        // can't use anything from this function at all
        (async function(snowflake) {
            const d = await bot.http.initDM(snowflake)
            const { recipients, id } = d 
        }).bind(this)(this.recipentID)
        
    }
}
opal plank
#

check what i sent

toxic glade
#

?

#

what is this

opal plank
#

code

inner roost
#

Lol

quartz kindle
#

make the constructor return the promise

#

then await it

opal plank
#

reee its what i did tim

quartz kindle
#

also, you're calling this inside a function declaration

#

which makes it lose the context

#

you need an arrow function

#

to preserve the this

trim saddle
#

what the

quartz kindle
#

ah wait nvm, you're using this outside the function

trim saddle
#

this is the one case where arrow functions work?

opal plank
toxic glade
#

hmm

quartz kindle
#

yes, arrow function is the way to go here

outer niche
#

@inner roost do you see in the code where it is sending a message to a different channel that is where I'm working at where I have CTX message author is where I'm trying to figure out the problem I basically just want the user's name right there but I cannot figure out how to

quartz kindle
opal plank
quartz kindle
#

sent first but no context and no explanation :^)

opal plank
#

i said to take a look at it, which basically implies it

quartz kindle
#

but people want spoon fed explanations :D

opal plank
outer niche
#

Ok thx

gilded olive
#

np

solemn latch
#

author is a user

#

it wont have any roles

opal plank
#

like the OG's,watch and learn son

#

imagine not digging on loadash, react, vue and some other big libs for some handy hacky snippets

#

mmulu 100% not me

#

this one didnt come from there tho

#

had to ask a friend for a good way to set the constructor (library) as ready, that was the solution

misty sigil
#

this is great fun

solemn latch
#

oh wait, py .author is a member in some cases pogey

misty sigil
#

nginx is having a big stroke and i have fairytale of new york on repeat even though its 4 days after christmas

quartz kindle
#
class A {
  constructor(x) {
    return fetch(x).then(z => {
      this.data = z;
      return this;
    })
  }
}

let c = await new A("google.com")
#

:^)

misty sigil
#

why is it c and not b

quartz kindle
#

because why not

#

c for class

#

xD

earnest phoenix
#

How do you make an order that changes the language of all orders? I'm looking on a browser but I can't find anything if you know how to do

earnest phoenix
opal plank
tame kestrel
#

Exactly why reinvent the wheel 😭😭

earnest phoenix
#

hello

tame kestrel
#

Hoi

earnest phoenix
#

can you solve the question above

#

...

#

Help me Please How do you make an order that changes the language of all orders? I'm looking on a browser but I can't find anything if you know how to do

#

Change bots language??

solemn latch
earnest phoenix
#
String.prototype.user = async () => {
    return client.users.fetch(this);
}

await "id".user();

now this is useful

#

ik bout websites not bot

opal plank
#

use a command handler for the love of god dude

earnest phoenix
#

Yes language @earnest phoenix

solemn latch
#

yeah, i can

#

use a command handler

#

thats the solution

earnest phoenix
#

no...

#

The language of all commands

misty sigil
#

use a command handler

#

is the solution

earnest phoenix
misty sigil
#

it will make your bot more performant

solemn latch
#

what website

misty sigil
#

the code will look better

opal plank
misty sigil
#

just everything looks way better

earnest phoenix
earnest phoenix
earnest phoenix
#

Nan using an commands not on a website

tame kestrel
#

“member” is undefined

#

That’s your problem, please fix that

earnest phoenix
#

"roles" undefned

misty sigil
#

its not like the earth

#

mmLoL _ _

earnest phoenix
#

So.-.

quartz kindle
earnest phoenix
#

😦

earnest phoenix
misty sigil
#

message => {}
guild => undefined
roles => err

earnest phoenix
misty sigil
#

member is undefined

#

then

earnest phoenix
#

what

quartz kindle
#

because member is undefined

earnest phoenix
#

exactly

#

what Tim and Matthew said

tame kestrel
#

😳

earnest phoenix
#

How do you make an order that changes the language of all orders? I'm looking on a browser but I can't find anything if you know how to do helppppppp me pleaseeeeeeeee

quartz kindle
#

"roles" OF undefined, aka get "roles" from undefined, aka undefined.roles, aka roles does not exist in undefined

misty sigil
#

languages.json

#

ideally you'd want to have translations

#

in a file

#

then you can use them as needed

quartz kindle
#

lmao

earnest phoenix
#

Oh '-' not too understood.-. @misty sigil

misty sigil
#

ok take an example

#
{
  "en": {
    "help_explanation": "This is a help command. Use it to see all the commands, or view the details of one command by using `help <command name>`"
  },
  "sco": {
    "help_explanation": "This is a 'elp command. Ye can use it tae see all the commands, or view details o' ane o' the commands usin' the command `help <command name>`"
  }
}```
#

etc

earnest phoenix
#

scottish

misty sigil
#

😭 sad

earnest phoenix
#

Ahh okey thanks @misty sigil

misty sigil
#

is that google chrome console?

earnest phoenix
#

lol yeah

misty sigil
#

lmao i use it too

quartz kindle
earnest phoenix
#

@misty sigil Last thing and you have to do this with all the command

misty sigil
#

what?

earnest phoenix
#

For the language

#

and what is that?

#

.-.

dusty fern
#

how to make it where if you ping the bot it responds with prefix

earnest phoenix
earnest phoenix
dusty fern
#

I really dont know can i please have code or something

earnest phoenix
#

@earnest phoenix can you explain your question...

#

hey! so, is there any way to change pages by click in a button

(js + html)

#

change pages as in

#

on the same site?

earnest phoenix
#

@earnest phoenix Desolating for the answer a tiny may late

#

those two messages are english but don't feel like it at all

terse finch
#

using discord.py how do i get the server from ctx? is it ctx.guild?

earnest phoenix
earnest phoenix
terse finch
earnest phoenix
# earnest phoenix yes

i mean you can just split your pages into different routes and have buttons lead to a href of another page, a more modern approach would be to make your pages divs, then just show one div, hide others

#

or you can abandon old ooga booga web development and use something like react + react router

outer niche
#
@bot.event
async def on_message(message):
    if 'Support Team' in [i.name for i in message.author.roles]: return
    bad_words = []
    for word in bad_words:
        if message.content.count(word) > 0:
            await message.channel.purge(limit=1)
            await message.channel.send(f"Please stop sending bad words! {message.author.mention}")
            channel = bot.get_channel(793552031641632849)
            color = discord.Color.red()
            em = discord.Embed(color=color, description=(f"{message.author} sent bad words."))
            await channel.send(embed=em)
    bad = ["https://discord.gg", "http://disord.gg", "discord.gg"]
    for word in bad:
        if message.content.count(word) > 0:
            await message.channel.purge(limit=1)
            await message.channel.send(f"Please stop sending discord invites! {message.author.mention}")
            channel = bot.get_channel(793552031641632849)
            color = discord.Color.blue()
            em = discord.Embed(color=color, description=(f"{message.author} sent a discord invite."))
            await channel.send(embed=em)```
#

It is seeming to be that my auto moderator system is not letting any of my commands be run can anyone help me out above is the code

earnest phoenix
#

protip

#

don't bother having a word filter

#

an invite filter works because sure, there's only a limited number of ways an invite can embed and/or be clickable

#

but people will always find a way to bypass your word filter

outer niche
#

I am aware of that but that still does not solve my problem of why not in my commands will work with this code in the bot

shut spear
#

is there any way to check what user added bot to a server?

earnest phoenix
#

poll the audit logs

#

other than that, no

proper heath
#

(node:23780) UnhandledPromiseRejectionWarning: Error [TOKEN_INVALID]: An invalid token was provided. at WebSocketManager.connect (C:\Users\unffo\Desktop\Discord Bot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:133:26) at Client.login (C:\Users\unffo\Desktop\Discord Bot\node_modules\discord.js\src\client\Client.js:223:21) (Use node --trace-warnings ...to show where the warning was created) (node:23780) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict(see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:23780) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. PS C:\Users\unffo\Desktop\Discord Bot>

Can someone help

earnest phoenix
#

have you tried reading the error

proper heath
#

I tried running my bot in termina and was shown this

#

I have, still confused

misty sigil
#

uh..

#

get a right token????

earnest phoenix
#

what is there to not understand about 5 words

misty sigil
#

a correct one????????????

#

An invalid token was provided

#

thats a big hint

#

you should've got it from [TOKEN_INVALID] actually

mellow kelp
#

these guys at discord.js spend their time making errors readable for their users, only for this to happen 😔

misty sigil
#

ikr

#

if you can't read THOSE errors what errors can you read??

earnest phoenix
#

i wonder what these people do when they get a BSOD

#

you get the most unhelpful error message

dusky marsh
#

Why even act surprised anymore that there are people who purely copy code and dont jack about reading or fixing errors lmao

misty sigil
#

its a bit of fun

crimson vapor
#

just don't get a BSOD

#

ez

earnest phoenix
#

hey

#

can someone give me the github's link for topgg-autoposter package

#

?

mellow kelp
#

pinned messages

earnest phoenix
#

thx

ionic dawn
#

[SQL Question] I need store a few ID's per user.

Should I do it this way?
Table name: [user_id]
value: [servers_ids]
rows: [

  • 9584753837162375
  • 9375637564734343
    ]
#

a table per user and rows for ids or... a single table with userids and serve ids

proper heath
#

Now, run the file with your text editor and you should get a output showing that the bot is ready.

#

How do I do this?

mellow kelp
proper heath
#

Python btw

#

Does anyone know?

mellow kelp
#

using arbitrary tables doesn't seem like a good idea tbh

proper heath
#

Python

Now, run the file with your text editor and you should get a output showing that the bot is ready.

How do I do this?

ionic dawn
#

@mellow kelp how would you set up the structure? BongoCatU

mellow kelp
#

you wanna store guild members, not users right?

ionic dawn
#

are you spanish?

mellow kelp
#

si oldEyes

ionic dawn
#

Can we move to #general-int a second so I can explain my idea faster? haha

mellow kelp
#

k

gilded olive
#

You can do something like

#

print("bot is ready")

#
from discord.ext import commands

bot = commands.Bot(**kwargs)

@bot.event
async def on_ready():
      print("bot is ready")```
inner roost
earnest phoenix
#

hi

earnest phoenix
earnest phoenix
inner roost
normal sage
#

ex, python main.py

gilded olive
#

Thats not what he was asking

#

he wanted to know how to output bot is ready or something to the terminal which i explained^^^^

earnest phoenix
#

How can I give client.emit to a specific file - I'm using eris, but the same concept applies to discord.js

quartz kindle
#

explain

earnest phoenix
#

i make this

#

But as this is the prefix handler I wish I could give client.emit only on it, avoiding loading all messageCreate events

quartz kindle
#

you want to implement something like a middleware?

#

well, one way would be to create a custom event

static trench
#

anyone know a good discord.py eval command i can use? github is drawing blanks

quartz kindle
#

client.emit("customMessage", message);
client.on("customMessage", message => {})

quartz kindle
static trench
earnest phoenix
static trench
#

hey humans. so i wanted to host my d.py bot on my raspberry pi. it has many files and a few cogs. how do i host it? can i murge it all into a single file?

shy turret
#

im a bot just... first of all, make sure you actually made a working bot. second of all, vps hosts exists (most bot hostings are expensive)

sterile lantern
#

you could get a good VPS for $3 / month

#

lmao

digital ibex
#

hi

#

im getting started with zerossl and im a bit stuck, lemme show u

#

and it says i've done something wrong, any ideas?

earnest phoenix
#

Set the TTL to 3600(or lower)

static trench
#

my bot works fine BTW

#

its in 150 server

#

s

shy turret
#

idk about rasp pi

#

i guess u need to wait for someone who knows how to use that 🤷

static trench
#

ok

#

ill ask my other devs.

earnest phoenix
static trench
#

i can run a basic bot but my actual verifed bot is many files. can i merge them into one?

earnest phoenix
#

Similar to how you would run it on a computer, if you have os on the raspberry pi (e.g. raspbian) just download the software you would normally use to run it, thats how I did it

static trench
#

yes ik

#

but its multi file. is that a problem?

earnest phoenix
#

no

static trench
#

ok?

earnest phoenix
#

My bot consists of the main script and multiple json files etc

static trench
#

ya

earnest phoenix
#

All works how it should

static trench
#

ok.

#

so i am using nano to hosy

#

host

#

or should i use a CD like on a VPS

earnest phoenix
#

¯_(ツ)_/¯

static trench
#

ok

earnest phoenix
#

I can only tell you it works on raspberry pi well, hope someone else can answer your other questions :)

static trench
#

ok

#

well you telling me it works is enough

#

ill figure out the rest

#

thx for the help!

earnest phoenix
#

np :)

static trench
#

🙂

#

are you D.py or D.js?

earnest phoenix
#

py

static trench
#

oh nice

#

same

#

and u have ras py 4?

ionic dawn
#

every server ID contains 18 chars right?

fair badge
#

think so

#

when the rules say that a bot must work with permissons=0, what does that mean?

#

all of my commands/menus use embeds so i'm not sure how to get around that

opal plank
#

for example, 1 is a valid id (clyde)

#

strictly speaking, iirc it started with 16 numbers, now its up to 18, it grows in size as more and more channels grow, eventually it overflows into 19

opal plank
#

or have common sense and not do "Cannot join because im missing permissions ADMINISTRATOR"

fair badge
terse finch
#

how do you guys make your bot flexible for multiple servers with different setups?

opal plank
#

@terse finch explain more pls

terse finch
#

like currently my small project is hard coded for a server. now another server wants to use it so i need to make it modular so that their roles, ids, channels etc work without having to hard code everything in. like whats best practice?

opal plank
#

database + cache

mellow kelp
#

yeah make a setup command to configure roles and channels and stuff

opal plank
#

lets take prefixes as an example

terse finch
#

i know nothing about caches and very little with databases lol

opal plank
#

let give you a quick walkthrough

mellow kelp
#

caching is pretty easy

terse finch
#

ok

mellow kelp
#

you cache something to store its value temporarily

#

instead of querying data from a database each time something happens, you can just cache it if it's not gonna change in some time

terse finch
#

ik what it is. i dont know how to implement it

mellow kelp
#

there are many ways

#

for example, you can add a cache property to your client

#

where you could cache stuff like guild prefixes

opal plank
#

Image the following

You have a map used to set the prefixes of your servers

//index.js
const Prefixes = new Map();

Now, we follow onto the next stage, your message/command handler

//index.js
let prefix = "DEFAULT PREFIX HERE"
/*You are checking if your map has an entry for the specific guild, you may use channels or any other index you want*/
if(Prefixes.has(message.guild.id)) prefix = Prefixes.get(message.guild.id);

There, now you have a way to get each guilds specific prefix. Now, moving on to how to set them

//prefix.js or prefix command
Prefixes.set(message.channel.id, args[0]) // args 0 being the prefix they sent in the message

Done, now you have a way for users to set their prefixes. Things to keep in mind:
Check for permissions, you only want admins/moderators to be using this command, check for MANAGE_SERVER, MANAGE_SERVER or ADMINISTRATOR permissions (my recommendation).

Second issue, when your bot restarts, it loses all cache, this is where the database comes in. Databases stores things undefinitively.

So, whenever the user uses the command !prefix & you want to set their guild id and prefix onto the database (whichever database you prefer using, postgres being my recommendation);

On your startup, i'd recommend declaring Prefixes and loading all prefixes from your database. That assures that you are only doing 1 call to the database on the startup, and then you have them in memory super fast and quick.

This does not only applies to prefixes, it applies to anything tbh, roles, channels, users, so its up to you, this is just a framework example for you
@terse finch

ionic dawn
misty sigil
#

should i learn postgres

opal plank
#

depends what for

misty sigil
#

because im bored

opal plank
#

you need a simple db? postgres isnt for you. You need something that will scale? postgres is for you

#

Its like using a chainsaw to break a thin stick, if that makes sense. Postgres can do almost anything and is good in almost every area. Thats the main issue, it might not be the right tool for your job

misty sigil
#

where does mongo fall in the scalability and simplicity graph

terse finch
#

i only have a little mysql and simple nosql experience but the rest of it makes sense @opal plank thanks

opal plank
#

mongo from what i heard is a lot simplier that most. MySql is basically postgres tbh, but postgres is far better

#

as the name suggests, postgreSQL

misty sigil
#

postgrenos(ql)

opal plank
#

SQL syntax applies to postgres, so there isnt much of a learning curve

blissful coral
#

Does anyone know if I can connect to my mongoDB database on my VPS from compass on windows 10 using port forwarding from my domain?

trim saddle
#

@opal plank can you help me figure out the logical order things should be done in, it might need you to like, look with live share or something

ionic dawn
#

im having a problem with SQL, does anybody knows why is this happening?

Im parsin the field to an array, and then removing an specific element using "splice", but after removing it it leave a blank space and if I add anything it comes with a , infron...

opal plank
#

then its not SQL< its your insertion thats fucked

#

how are you inserting the server_id?

ionic dawn
#

push

trim saddle
#

actually i think i have a way less complicated idea

opal plank
#

well no shit, how?

ionic dawn
#

xD

opal plank
#

cuz SQL has its own thing for that

ionic dawn
opal plank
#

in postgres is array_concat(arr 1, element1,el2,el3)

#

why u doing that?

ionic dawn
#

cause I want this:

user_id | server_id
bla | bla,bla,bla,bla

opal plank
#

then why in the living god are you using raw text?

ionic dawn
#

well its an actual array

#

wdym by raw text

opal plank
#

no, thats a text

#

SQL has ACTUAL arrays

#

you are just storing a string with commas

#

its not an array

ionic dawn
#

so I can just change the field type and then thats it?

opal plank
#

dunno, have to look at the docs. In postgres you'd do just that

#

and of course, change the query to array_append()

#

rather than SET

trim saddle
#

@opal plank so my dumb ass brain had a fart

#

i tried initiating a class with async stuff and it was getting problematic

opal plank
#

didnt i answer that question before with the constructor?

trim saddle
#

yeah but what i was doing was just gonna cause later problems

opal plank
#

i see

ionic dawn
#

fixed the problem with this:

array.filter(item => item);
#

MySQL don't have an Array DATA_TYPE so..

jade juniper
#

BDFD or DBD?

#

I use BDFD and I think it would be a problem to change to another programming, what do they say?

stuck pike
#
const Discord = require("discord.js");
module.exports = {
  name: "channelsetup",
  description: "info",

  async run (client, message, args){

const guild = message.id



    let category = guild.channels.find(c => c.name == "Akemi logs" && c.type == "category")

    


    guild.channels.create(`logs` , {
      type: 'text',
    
      permissionOverwrites: [
    
        {
            id: message.guild.id,
            deny: ['VIEW_CHANNEL']
    
        },
        {
            id: message.author.id,
            allow:  ['VIEW_CHANNEL']
    
        }
        
        
    
    
        
    
    
      ]
      
    
      
    
    
    
    })
    guild.channels.find("name","logs").setParent(category)
    
    
    
    console.log(category)
mellow kelp
#

guild.channels doesn't have a find method

#

you're probably looking for guild.channels.cache or something

stuck pike
#

i kept guild.channels.cache.find

#

still error lawl

mellow kelp
#

um

#

oh wait

#

your guild is just a string

#

you're assigning it to a message id

stuck pike
stuck pike
#
module.exports = {
  name: "channelsetup",
  description: "info",

  async run (client, message, args){
    if(!message.member.hasPermission("MANAGE_SERVER")) return message.channel.send('You can\'t use that');
    let chan = message.guild.channels.cache.find((x) => (x.name === "ban-unban logs"))
    if(chan) return message.channel.send('Already done the Setup');

    const server = message.guild;
    console.log("setup done")
   server.channels.create(`Ban-Unban logs` , {
     type: 'text',

     permissionOverwrites: [

       {
           id: message.guild.id,
           deny: ['VIEW_CHANNEL']

       },
       {
           id: message.author.id,
           allow:  ['VIEW_CHANNEL']

       }
        ]
     })```
#

this works but it doesnt stop the code if the chnnel is already there

#

it still creates the channels

carmine summit
#

return

sudden geyser
#

It's already there it seems.

stuck pike
#

yea

mellow kelp
#

ah yes

#

channel-chan

earnest phoenix
#

Bruh

stuck pike
#

wots wrong?

earnest phoenix
#

ban-unban logs?

#

You realize you can't have channels with a space in it right

stuck pike
#

wait wot

#

m stupid sorry

mellow kelp
#

oh and maybe you also want to use channels.fetch

#

since sometimes the channel you're looking for exists but isn't in the cache

stuck pike
mellow kelp
#

like

#

as a fallback if you can't find it in the cache

earnest phoenix
#

No

stuck pike
#

ngl discord.js older version was better

earnest phoenix
#

Channels are cached by default

mellow kelp
#

wat

#

why

#

oh aight

#

all of them?

earnest phoenix
#

Yes

mellow kelp
#

oh k

#

so the fetch thing would only be useful for members and users ig

stuck pike
#

thx guys it works now

earnest phoenix
#

Np

stuck pike
#

my stupid typo

#

should i boost this server?

#

i hab 2 boosts

mellow kelp
#

well its already boosted

#

better spend those boosts somewhere else i guess

earnest phoenix
#

PepeLaugh Fetching members 👉 ram 🔥

stuck pike
#

yea lmao

mellow kelp
#

oh messages aren't cached by default either, are they?

#

like, older messages

earnest phoenix
#

Messages have a constant

#

Cache size

stuck pike
earnest phoenix
#

It's 200 messages per channel by default

stuck pike
#

cool

mellow kelp
mellow kelp
#

so i should probably also use messages.fetch() as a fallback

earnest phoenix
#

PepeLaugh API abuse

mellow kelp
#

my command needs to get a message by id

#

for reaction roles

pale vessel
#

you can just use fetch()

mellow kelp
#

yea

pale vessel
#

it checks in cache first anyway

mellow kelp
#

thats what im doing

#

oh really

pale vessel
#

ye unless you add force: true

mellow kelp
#

ive been wasting my time adding it as a fallback KEKW

#

anways

#

my code is gonna look a bit cleaner now

earnest phoenix
#

hi

atomic vault
#

hi

sinful lotus
mellow kelp
#

if anything, you can make an async function that returns an instance of the class

trim saddle
#

@sinful lotus it's ok i figured out a different way around it

mellow kelp
#

like an init() static method

sinful lotus
#

what I recommended was

ionic dawn
#

@mellow kelp me echas una mano?

mellow kelp
#

ia

sinful lotus
#

construct the class by adding the properties you need, then make a method to initialize the async method in class

ionic dawn
#

algo que funcionaba dejo de funcionar y estoy por pegarme un tiro

mellow kelp
trim saddle
#

@sinful lotus i figured out a less problematic way to do it

sinful lotus
#

as long as you are happy 2loodgasm

earnest phoenix
#
bot.on('message', msg => {
    if (msg.content == "/name") { 
        if(people[msg.author.id] === true) {
            msg.guild.members.forEach(member => member.setNickname('bob')); 
        };
    };
});```
#

anybody know why

pale vessel
#

jeez

earnest phoenix
#

Uncaught TypeError: msg.guild.members.forEach is not a function

#

it says its not a function

pale vessel
#

don't do that

earnest phoenix
#

well its for a joke

#

but why does it say that forEach isnt a function

#

when it is

opal plank
#

forEach is a function, but not members

#

cuz you want emmbers.cache

sand condor
#

why are you

#

looping through

opal plank
#

not members @earnest phoenix

sand condor
#

all members

earnest phoenix
#

its a joke

#

its hard to explain

sand condor
#

wasn't very funny

pale vessel
#

flagged by api = joke

opal plank
earnest phoenix
#

im making a bot that names everyone in a server i own "Redditor"

opal plank
#

sounds like API abuse

sand condor
#

yeah sadly the api doesn't take jokes very well

earnest phoenix
#

how is that api abuse

#

what

opal plank
#

spamming the api with member nicknames?

sand condor
#

your looping through every member and setting a nickname ?

#

how is it not

earnest phoenix
#

because its easier than manually doing

opal plank
#

first, you arent awaiting for it

#

which will likely lead into a ratelimit

#

second, even if you await it and not spam the api with quick succession of requests (im not sure d.js is shielded with nickanme reatelimiter), its still a real bad idea to do that

#

at the VERY LEAST add some delay between calls

pale vessel
#

don't use forEach()

earnest phoenix
#

@opal plank but theres like a million bots made with discord js, and all together probably send WAAAYYYY more requests than this does

#

plus theres only like 100 people in my server

pale vessel
#

that's not how it works

opal plank
earnest phoenix
#

first fallacy of tu quoque

#

second never said that

#

and i didnt imply it eithr

#

I dont understand your reasoning there

opal plank
#

you did, you assume something is right just because others do it

earnest phoenix
#

no..?

opal plank
#

which doesnt make it right at all

earnest phoenix
#

my argument is that

#

Missing Access is not a permission error, it simply means the resource is not visible to your bot. how handle this and send proper response?

#

the servers can handle it

#

I am trying to create a channel

opal plank
#

and my argument is that you arent:
a) awaitng promises
b) ratelimiting it
c) following general API guidelines

ionic dawn
#

How can I access to any of those ids? arr[x].id?

[
  [
    GuildEmoji {
      id: '792978100450623539'
    },
    GuildEmoji {
      id: '793010907675492352'
    }
  ],
  [
    GuildEmoji {
      id: '792938932018872340'
    },
    GuildEmoji {
      id: '792973332763902024'
    }
  ]
]
opal plank
#

<array>[index] return that position in the array

#

so, yes, arr[index].id

#

cool

pale vessel
earnest phoenix
#
    at RequestHandler.execute ```
opal plank
#

oh

earnest phoenix
#

The channel is private. It works when channel is not private.

opal plank
#

well you are making a channel that your bot doesnt have permission to see aparently

#

how is that confusing?

earnest phoenix
#

All i want is send proper response to user

opal plank
#

dm them?

earnest phoenix
opal plank
#

permissionsIn(channel).has(Permission)

earnest phoenix
#

Missing Access is not Permission err?

opal plank
#

it means you cant even see the channel

earnest phoenix
#

yes

#

when bot cannot see channel then it gives err

#

if channel is open for everyone and i use command it works fine.

opal plank
#

cuz you are creating a channel that your bot doesnt have permission to even see

earnest phoenix
opal plank
#

create permissions for yourself to be in

earnest phoenix
#

its multi server bot

opal plank
#

you adding the user to the channel, add yourself too

opal plank
earnest phoenix
opal plank
#

VIEW_CHANNEL

earnest phoenix
#

oh

#

(message.channel.permissionsFor(client.user.id).has(["SEND_MESSAGES", "VIEW_CHANNEL"]))

#

this correct?

pale vessel
#

yes

opal plank
#

looks good

earnest phoenix
#

but it doesn't works

opal plank
#

it should

earnest phoenix
#

it doesn't check and executes code.

#

thats the issue i have

opal plank
earnest phoenix
#

i know that

opal plank
#

then add a breakpoint onto your code

#

oh

#

i fucking know why that code isnt working

pale vessel
opal plank
#

@earnest phoenix you are referring to the original channel, not the created one

opal plank
#

and thats why you add a breakpoint

#

you should really use the debugger on your code my dude

earnest phoenix
#

okkk

pale vessel
#

doesn't matter

crimson vapor
#

flaze

#

check veldchat

earnest phoenix
#

okk

pale vessel
#

i can't join

#

oh

earnest phoenix
#

this correct?

rocky hearth
cinder patio
#

just do piece && ...

#

instead of Boolean(piece)

#

Typescript doesn't know that Boolean is supposed to return true if piece is not falsey

crimson vapor
#

well since you added | null ts thinks it may be null

#

and .alliance of null will error

cinder patio
#

wow, really?

whole matrix
#

How can I make an discord server list website? i looked it up on yt but no one have done it i think

near stratus
gilded olive
stuck pike
#

Looking for partners dm me for info

crimson vapor
#

how do you get all of the values of a map

#

in an array

rocky hearth
rocky hearth
crimson vapor
#

I have a map

#

and I need to get the value of one

earnest phoenix
crimson vapor
#

and I have a value that is in the map

#

oh

earnest phoenix
#

or [...map.values()];

#

why not use djs collections tho

near stratus
crimson vapor
#

im not doing code with djs

earnest phoenix
whole matrix
earnest phoenix
#

glitch is terrible

#

don't use it for hosting

#

especially not for a bot

#

saying from experience

near stratus
#

Yeah ik

#

10$ for 1000hours a month

whole matrix
#

oh

near stratus
#

I can have 2 VPS with that

#

I can even get 4 VPS with Vultr

cinder patio
rocky hearth
#

yes or I could do, !!piece to make it boolean

whole matrix
#

?well is the there any other way i can make an discord bot/server list for free?

cinder patio
#

you can make anything for free

ionic dawn
#
[
  [
    GuildEmoji {
      animated: false,
      name: 'smiley',
      id: '792978100450623539',
      deleted: false,
      guild: [Guild],
      requireColons: null,
      managed: false,
      available: true,
      requiresColons: true,
      author: null
    }
  ]
]
prisma wraith
#

Hard work

ionic dawn
#

how do I get the id Umaru_cry_FB

#

im trying arr[0].id..

#

isnt working

cinder patio
#

arr[0] is another array

earnest phoenix
#

@ionic dawn that's an array inside an array

ionic dawn
#

ik

cinder patio
#

... then you should know how to get the id

earnest phoenix
#

arr[0][0]

near stratus
earnest phoenix
#

@near stratus every single free host sucks

#

lemme repeat that

near stratus
earnest phoenix
#

EVERY 👏 SINGLE 👏 FREE 👏 HOST 👏 SUCKS

near stratus
#

But it works for beginners

earnest phoenix
#

heroku and glitch are not meant for bots

stuck pike
#

Best free host?

regal kiln
#

None of the commands of my application are working but they are active.

near stratus
stuck pike
earnest phoenix
#

repl.it is good enough for now but you never know discord might block them too

stuck pike
#

Something.host good

#

100 mb ram

earnest phoenix
#

just like they did with 90% of computers at glitch, TWICE

#

read the first pin in this channel

near stratus
earnest phoenix
near stratus
#

Yeah

#

I tried AWS too but it was hell lot work

earnest phoenix
#

hi

#

you can use that 7$ for a vps

#

and deploy stuff from repl

near stratus
earnest phoenix
#

ight

near stratus
#

*technically

cinder patio
#

Unlimited RAM and CPU for 7$? thonkku

earnest phoenix
#

@cinder patio unlimited repls

#

the unlimited storage and ram is a lie

cinder patio
#

what does unlimited repls mean

earnest phoenix
#

On free plan you cant have more than 20 repls running at a time

#

The "unlimited storage and ram" basically means you can have as much repls using as much total storage and ram together

#

every single repl still has a limit of 1GB storage and 4GB ram iirc

cinder patio
#

aha

#

that's pretty good for 7$

#

actually that's pretty good for free as well

earnest phoenix
#

nah

near stratus
#

yah

#

I only got 4GB RAM at 5$ VPS

#

But the Storage was better though

#

But Repl.it Got their own Database System

earnest phoenix
#

Out of curiosity, can you hide your token on repl.it?

cinder patio
#

most likely yes

near stratus
earnest phoenix
#

I see

lusty quest
#

doesnt Repl.it limit you in many ways? like its using a VPS but on Training wheels

near stratus
lusty quest
#

just get a Cheap VPS or create a VM on your PC and hack around until it breaks

#

this is how i learned most stuff

cerulean solstice
#

Who knows how to make bots in here i need some help making my own bot i have $$

#

Someone who knows what they are doing

dusky sundial
#

Pretty sure you're not allowed to ask for paid services here

dull hinge
#

How do you make bots

cerulean solstice
#

Ohh im sorry.

#

I just need help willing to do whatever for a ticket/mod bot

#

i need some custom features

#

That i have ideas on

dusky sundial
#

You need to learn a programming language, and then learn how to use the discord library for that language @dull hinge

cerulean solstice
#

@dusky sundial Could you help me?

dull hinge
#

ok

dusky sundial
#

I don't take commissions, you'd be better off looking at a website like fiverr for something like that

cerulean solstice
#

I dont have to pay you, you could just help me?

earnest phoenix
#

how to get only numbers and omit words like
if i using !getnum 30abc it's only get the number

dusky sundial
#

Uh- I don't do bots for free either. Like I said, go to Fiverr.com or another freelancer website if you wanna find people who make bots for you

#

In what lang Dunz?

earnest phoenix
dusky sundial
lament rock
#

you can use string replace with a regex which matches non digits and replace it with ""
/\D/g

silver lintel
#
console.log(board)
board[0][1] = 'x';
console.log(board)
[ [ '_', '_', '_' ], [ '_', '_', '_' ], [ '_', '_', '_' ] ]
[ [ '_', 'x', '_' ], [ '_', 'x', '_' ], [ '_', 'x', '_' ] ]
``` how does that work
lament rock
#

Are the entries in the Array a reference to a variable?

near stratus
silver lintel
lament rock
#

Idk then. I just tested this and got a similar result when I referenced a variable for all 3 entries in the Array. I did not when I instanciated new Arrays

#

Discord formatting hides the underscores

#

It is a reference because the value it's filling is the Array(3).fill("_")

earnest phoenix
#

circular object moment?

lament rock
#

Nah. Just haha memory management

silver lintel
#

so i just define the array manually

lament rock
#

Yeah

silver lintel
#

Oof okay thanks

#

I switched that line of code and i was stumped for a long time when i didn't change any other code at all

lament rock
#

if it isn't broke, don't fix it

craggy pine
#

Quick nub Discord.js question:
Editing embeds in this way should be fine correct?

              msg.edit(priceEmbed.setDescription("The price of the Inquisitors Mace is still the same! \n" + "The Price is: " + displayPriceProperly),
              priceEmbed.setColor('#FF69B4'),
              priceEmbed.setTimestamp(),
              priceEmbed.setFooter("I've check prices: " + i++ + " times"));

Noticed after I experimented doing it that was with the , after each one I got an [object],[object] above my embed now.

My previous code was just msg.edit(thing) for each one so it did a ugly kinda quad edit quickly LUL when I did this the objects wern't there.

lusty quest
#

did you got some code above ? like a field that is no longer used but still referenced?

lament rock
#

it should be edit(null, embed)

craggy pine
#

Oh?

lusty quest
#

ohh right yea

earnest phoenix
#

first argument is content eh

craggy pine
#
              msg.edit(null, priceEmbed.setDescription("The price of the Inquisitors Mace is still the same! \n" + "The Price is: " + displayPriceProperly),
              priceEmbed.setColor('#FF69B4'),
              priceEmbed.setTimestamp(),
              priceEmbed.setFooter("I've check prices: " + i++ + " times"));
lament rock
#

Discord API content is nullable on PATCH

craggy pine
#

like that?

lament rock
#

yeah

craggy pine
#

That's odd.

#

lemmy try. Thanks 🙂

lament rock
#

Some libs handle it differently

#

also, every embed method returns this which would be a reference to the MessageEmbed, which you could just chain the methods such as .setColor(...).setTimestamp()

craggy pine
#

Oh I can do that Thinkies good to know

#

oh I see.

#
              msg.edit(priceEmbed.setDescription("The price of the Inquisitors Mace is still the same! \n" + "The Price is: " + displayPriceProperly)
              .setColor('#FF69B4')
              .setTimestamp()
              .setFooter("I've check prices: " + i++ + " times"))

That's certainly a lot better on the eyes

lament rock
#

I agree

#

don't forget the null as well

craggy pine
#

Ya I did that and it kinda geeked out

#

trying a tweak with it

lament rock
#

oh?

craggy pine
#

I got it. Thanks

lament rock
#

Excellent

craggy pine
#

Without (null,) fixed it honestly. It was probably something weird with how I did the edits. When I did it the way you suggested (Without the null,) it went away mexShrug

#
 msg.edit(priceEmbed.setDescription("The price of the Inquisitors Mace is still the same! \n" + "The Price is: " + displayPriceProperly)
              .setColor('#FF69B4')
              .setTimestamp()
              .setFooter("I've check prices: " + i++ + " times"))

https://scs.twilightgamez.net/CxKD2.png

stuck pike
#

Anyone who can share his support serve

#

Server?

earnest phoenix
#
            permissionOverwrites: [
                {
                    allow: 'VIEW_CHANNEL',
                    id: message.author.id
                },
                {
                    deny: 'VIEW_CHANNEL',
                    id: message.guild.me
                },{
                    allow: 'VIEW_CHANNEL',
                    id: message.bot.id
                }]``` how to give permission to bot for created channel. I am not using `ADMINISTRATOR` perm.
stuck pike
#

What's the problem?

earnest phoenix
#

the new channel i created it doesn't show bot

stuck pike
#

Which bot the bot who created it?

earnest phoenix
#

yes

stuck pike
#

Use view channel allow

earnest phoenix
#
                    allow: 'VIEW_CHANNEL',
                    id: message.bot.id
                }]```
stuck pike
#

Id : client. Id

earnest phoenix
stuck pike
#

Yea

#

@earnest phoenix because u want the bots id

#

To allow

earnest phoenix
#

yes

stuck pike
#

What const u made tho

lament rock
# craggy pine Without (null,) fixed it honestly. It was probably something weird with how I di...

now I know why. Because you used the commas instead of chaining the methods, you were passing the mutated state of the embed into the edit function's params.

Basically what you did
edit(embedWithDescSet, embedWithColorSet, embedWithTimeStampSet, embedWithFooterSet);

instead of just edit(embedWithAllSet)

the embed with the desc was the content (discord.js strigifies the object) so it shows [object, Object]
then the embed with color set as the MessageOptions

stuck pike
#

Const Client =New Discord. Client @earnest phoenix

earnest phoenix
#

Yes Worked @stuck pike Thanks

stuck pike
#

Nps

earnest phoenix
#

permissionOverwrites is better or updateOverwrites

craggy pine
#

@lament rock ya makes sense. Thanks again SataniaThumbsUp

stuck pike
#

I us permission

#

Use*

earnest phoenix
#

is there any difference?

stuck pike
#

Must be

earnest phoenix
#

kk

sacred trout
#

hello

#

can anyone help me?

lament rock
sacred trout
#

what???

#

wtf?

#
async def wanted(ctx, user: discord.Member = None):
    if user == None:
        user = ctx.author

    wanted = Image.open("wanted.jpg")
    asset = user.avatar_url_as(size = 128)
    data = BytesIO(await asset.read())
    php = Image.open(data)
    php = php.resize((244,306))

    wanted.paste(phh, (189,262))

    wanted.save("profile.jpg")

    await ctx.send(file = discord.File("profile.jpg"))```
#

having erro with this any ideas?

lament rock
#

what's the error?

sacred trout
#

umm

#

no error and no result as well

#

lol

stuck pike
#

Bruh canvas gay ngl

sacred trout
#

lol

stuck pike
#

Same problem with me multiple times

#

I just deleted it

sacred trout
#

lmao

stuck pike
sacred trout
#

could you not fix it?

stuck pike
#

@sacred trout bruh no erorrs

sacred trout
#

yes ik

stuck pike
#

There should be something to fix

#

;-;

sacred trout
#

ik but WHAT?????????????????????????????????????

#

can you look at the code?

stuck pike
#

I did

#

I didn't find anything wrong tho

sacred trout
#

bruh

#

lol

#

wtf do i do