#development

1 messages · Page 1516 of 1

marble juniper
#

a youtube tutori@l

lusty quest
#

use the one from the d.js-guide

marble juniper
#

*tutorial

formal vine
#

Yes.

marble juniper
#

from multiple years ago

formal vine
#

Most likely

marble juniper
solemn latch
#

furious typing by everyone

marble juniper
#

use the discordjs.guide

#

its always up to date

#

and its the best guide for discord.js

#

nothing beats it

lusty quest
#

anidiotsguide is not bad either

marble juniper
#

yeah

#

but I think the discordjs.guide is still better

#

cuz it has github repos which allow you to quickly copy paste the code

formal vine
#

I want to jump into a much more intense project (with still little to no previous knowledge) I will check out those sites

#

And hopefully it wont be 11 years old

marble juniper
formal vine
#

Outdated*

marble juniper
#

this one is up to date

#

latest version discord.js

formal vine
#

Perfect

#

❤️

marble juniper
#

also the best guide

#

imo

formal vine
#

Thanks lol

#

Both of y’all

marble juniper
#

also the guide I sent you has a linter section

#

which you defenitly should check out

#

cuz a linter can help you make your code more consisent overall

formal vine
#

I dont even know whAt linter is 😦

solemn latch
#

it gets the lint off you, or the cat hair. /s

formal vine
#

Ah makes sense

#

Lol

solemn latch
#

its like a programmable code checker, a set of rules your code needs to follow.

formal vine
#

That actually sounds super helpful

marble juniper
#

like I said

#

helps you make ur code consistent

#

and cleaner

#

kinda like a formatter

#

but also a code checker

#

lol

formal vine
#

i will need that a lot

#

A lot...

marble juniper
#

if you don't wanna bother configuring ur linter

#

then use the standard

#

thats the module called

#

the npm module

#

its like the linter the discordjs guide uses except you don't need to configure it

formal vine
#

I would have no clue how to configure anything so that would be best

marble juniper
#

you don't really need to know how to config the linter

#

they show you the configuration they use

#

in the guide

#

lol

long marsh
#

Sorry, just wanted to show off for a second. I've successfully implemented the Patreon API retrieval of all patrons 😄

pure lion
#

congrats on learning to read the documentation

tribal siren
#

How to check if a user connected to the defined voice channel?

#

for example, through a voice channel name

summer torrent
#

what lib

tribal siren
#

old good djs

summer torrent
#

member.voice.channel for member's voice channel

tribal siren
#

is there something like Client#connect?

summer torrent
#

for what?

tribal siren
#

that you might use for bot.on('connect', async (channel, member) => {

summer torrent
#

you mean voice channel connect event?

#

there is voiceStateUpdate

tribal siren
#

oh is there

#

let me read the documentation for it, thanks

#

is oldState for like a member?

#

oldState.voice.channel

summer torrent
#

oldState is old voice state of member

#

it is oldState.member iirc

#

or .user

tribal siren
#

ok, i will try test it

#

thanks

#

and one more question

#

how to make a bot create a voice channel?

summer torrent
#

<guild>.channels.create

#

and set type to voice in options

tribal siren
#

ok, thank you

sacred aurora
#

is there an event that called when a user leave a voice channel?

earnest phoenix
#

voice state update

tired panther
#

How do I get the administrator of the ban and the reason?

sacred trout
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: module 'discord.ext.commands' has no attribute 'remove_command'

#

client.remove_command('help')

earnest phoenix
#

remove_command is a GroupMixin method, and commands.Bot inherits it.

sacred trout
#

umm english?

#

it gave no error without cogs

simple pulsar
#

. H

earnest phoenix
#

send code, you must've done something wrong.

sacred trout
#

intents = discord.Intents.all()
client = commands.Bot(command_prefix=when_mentioned_or('.'), intents=intents)
client.remove_command('help')

earnest phoenix
#

the error isn't from that file.

sacred trout
#

import discord
from discord.ext import commands, tasks


class Help(commands.Cog):
    def __init__(self, client):
        self.client = client

    @commands.group(invoke_without_commands=True)
    async def help(self, ctx):
        commands.remove_command("help")
        embed = discord.Embed(color=discord.Colour.teal())
        embed.add_field(name="Moderation", value="``Kick, Ban``")
        embed.add_field(
            name="Fun", value="``whois, hello, whomadeyou, devinfo, die, wassup, good, credits, creditz, ping, pool``", inline=False)
        await ctx.send(embed=embed)


def setup(client):
    client.add_cog(Help(client))
    print("Help cog is loaded")
sacred trout
earnest phoenix
tired panther
#

what?

sacred trout
#

do you want to add it like kicked by "the mod"?

tired panther
#

no, I want when somebody kicks/ bans a member. It will send banned Meister by Schwitz

sacred trout
#

yeah so do

#

do you use embed?

#

for kick?

#

@tired panther

tired panther
sacred trout
tired panther
sacred trout
#

thats my bot

#

lol

#

it's ctx.author

#

@earnest phoenix

earnest phoenix
#

SCHWITZ that's not what they're asking

tribal siren
#

and while you are dealing with your problem lemme introduce my djs problem

fallow dust
#

you have error?

tribal siren
#

so uh

sacred trout
#

umm

#

AttributeError: module 'discord.ext.commands' has no attribute 'remove_command'

tribal siren
#

how to change voice channel's bitrate?

sacred trout
#

@fallow dust

earnest phoenix
#

see just get rid of that line commands.remove_command("help")

#

what is that line supposed to do anyway

fallow dust
fallow dust
#

it removes the default help command

sacred trout
#

fixed

#

he is right

earnest phoenix
fallow dust
#

if you know python

#

probably

earnest phoenix
#

?

fallow dust
earnest phoenix
#

You don't even know what you're talking about

sacred trout
tired panther
#
 guild.fetchBan is not a function

code : ```let ban = await guild.fetchBan(user.id)

fallow dust
tired panther
#

guildBanadd from the event

summer torrent
#

what is your djs version

tired panther
#

v12

#

xD

tribal siren
#

@summer torrent how to set a limit and bitrate to a voice channel?

#

i just can't find it in the documentation

past needle
tribal siren
#

ye

past needle
#

VoiceChannel.setUserLimit(10) (any number ofc)

tribal siren
#

oh

#

ok thanks

past needle
#

np

tribal siren
#

what's wrong

past needle
#

setUserLimit is used on a channel

tribal siren
#
    let voice = message.member.voice;
    let rate = args[0];
    if(!rate) return message.channel.send(emb)
    if(isNaN(rate) || rate < 0 || rate > 99) return message.channel.send(embed)
    voice.setUserLimit(rate)
    message.channel.send(embe)
past needle
#

voice.channel.setUserLimit

tribal siren
#

oh

#

ok

#

lemme test

#

oh

#

now it works

#

thanks

past needle
#

np

sacred aurora
lusty quest
#

i think your schema uses the wrong type for a field

#

did you store the guildid as an int or string?

sacred aurora
#

string obviously

#

here's the schema```js
const config = new mongoose.Schema({
guildId: String,
prefix: String,
reminder: Boolean,
action: String,
cd: Boolean,
channelId: String,
lastDate: String
})

#

i'll just delete the doc

#

hope it'll fixed

earnest phoenix
#

wha about jawad tormos bot

lusty quest
sacred aurora
#

ummm i think all document have it automatically

#

but i never use it

eternal osprey
#

hey

#

i have recently made a pokemon bot. How do i actually make a trade function?

#

how would i replace one array in the json file with another?

#

like i honestly have no clue on how to begin.

lusty quest
#

generate a uid for each item and set the id for the item of the users who own it. for trading take the id and set it to a different user

eternal osprey
#

hmmm

lusty quest
#

fuck this cat, sry for the typos

eternal osprey
#
{"1159773":{"id":676,"name":"Furfrou","level":60,"catchChance":0.25,"spawnId":8046692,"owner":"345138133429649408","catchTime":"01/11/2021 11:27 AM","nickname":""}}```this is how my json file looks
#

but atm i really have no clue on how to even begin

eternal osprey
#

@lusty quest

delicate shore
#

hey so

#

I am new to API making

#

Where should I start

#

I want to use my domain for api's

#

Where do I start

signal estuary
#

How can i ask for bot permissions?

client.hasPermission()
client.user.hasPermission()

doesnt work

delicate shore
#

<guild>.me.hasPermission()

tired panther
#
 let entry;
  guild.fetchAuditLogs()
  .then(audit => entry = audit.entries.first())
  .catch(console.error);
``` why cant I define entry?
elfin tulip
#

Does custom emojis work with embed footer?

rustic nova
#

no

tribal siren
#

how to transfer a user to another voice channel?

tribal siren
#

i tried to find it

#

huh

#

thanks

frail holly
#

The API documentation doesnt really provide much info on the userId url authorization method.

velvet bluff
frail holly
#

I agree. Although regardless of Authorization I use in the header, I get a 401 Unauthorized when querying the userId

#

So Im just confused about what to actually use when providing userId.
I assume I wont get all of the same since I don't have a token for that user, but getting any response would be useful to know.

velvet bluff
#

for that you may need your bot token when attached to a discord server which has an user connected to it

#

not too sure about the userid but yeah

#

thats all i know so far...

frail holly
#

Okay for sure.
I can use @me no problem, I was just curious. Building a website so, don't have any bot api functionality I'd normally have lol

velvet bluff
#

then you can simply use your bot application attached to the website to fetch user data

#

(as long as the bot user sees the user in any server and has cached data about it)

pure lion
#

warnings: [{ moderator: message.author.tag, reason: reason, case: this.warnings.length }] would this work in this context?

#

or does it reference the object that it's inside of

frail holly
#

Yes this is true. For this part of functionality it is not guaranteed the user is exposed to a bot. But they are logged in and I have their Oauth2 token. From bot side Im very familiar with how to do it with a wrapper api.

But yeye. Thanks for chattin 🙂

cinder patio
#

it references the class instance

pure lion
#

so say i was making a mongoose document or whatever, it would reference the document being created?

tribal siren
#
bot.on('voiceStateUpdate', async (oldState, newState) => {
  if(newState.channelID === '798117816242012160'){
    newState.guild.channels.create(`${newState.member.user.username} ~ Voice`, {
      type: 'voice',
      bitrate: 64000,
      parent: '736472475625324568',
      userLimit: 15,
      reason: `Member ${newState.member.user.tag} joined VC`
    }).then(c => {
      newState.member.user.setChannel(c.id, `Member ${newState.member.user.tag} joined VC`)
    })
  }
});```
#

what's wrong with this?

#

it creates a channel, sets a category, it's cool

#

but it doesn't move me

pale vessel
#

It's newState.setChannel()

tribal siren
#

oh

#

let me test

pale vessel
#

VoiceState#setChannel

tribal siren
#

oh

#

it works

pale vessel
#

where newState is an instance of VoiceState, not a member

tribal siren
#

thanks for millionth time today i guess

earnest phoenix
fluid basin
#

if you dont have shard, it will just be 1 as it is the bot instance itself

earnest phoenix
#

what are shards actually for?
I know of them but idk why they're used

quartz kindle
#

a shard is a connection to discord

#

each connection can only handle up to 2500 guilds

zenith terrace
#

its a wild tim

quartz kindle
#

if you have more than 2500 guilds, discord will not allow you to connect with a single connection anymore

zenith terrace
#

as we see the wild tim in his natural habitat (the development channel)

quartz kindle
#

you will have to start sharding, which means, splitting your bot into multiple connections

#

lmao

fluid basin
#

tldr; dont worry about shards unless you are reaching over 1.5-2k servers

zenith terrace
quartz kindle
#

just use internal sharding in djs

fluid basin
#

and yes

#

internal so simple

zenith terrace
fluid basin
#

wait is internal sharding multiprocess again

quartz kindle
#

no

fluid basin
#

oh oof

#

prolly need a i7 if you really have large volume

#

aka events

quartz kindle
#

nah

fluid basin
#

but honestly

quartz kindle
#

well yeah, if you have hundreds of thousands of servers

#

and if you use presences lul

#

then rip your cpu

#

and internet

fluid basin
#

tim what do you think the maximum servers you can run with internal

quartz kindle
#

depends on your intents

fluid basin
#

like with the conditions above

quartz kindle
#

and the power of your cpu core

#

and whether you use zlib

fluid basin
#

intel core 2 duo™️

#

wait what why zlib

quartz kindle
#

theres too many variables to consider, but at minimum it should handle 10-20k no problem

fluid basin
#

ah ok thats great

quartz kindle
#

im currently at 7k

#

using on average 5% cpu (with zlib, without presences)

#

if you use zlib stream, then each packet you receive needs to be decompressed

#

which means more cpu is needed

earnest phoenix
quartz kindle
#

you never know :)

rocky hearth
#

Why can't I do super.super.myStuff 😦

cinder patio
#

you shouldn't need to do that

#

if you have to then you should rethink the architecture of your code

rocky hearth
#

hmmm, makes sense.
I should move my method to parent class

delicate shore
#

Ok So I WANT YOUR HELp

#

I am gonna kill myself

#

I CAN"T

#

JUST CANT

crimson vapor
#

huh

velvet jolt
lusty quest
velvet jolt
sacred aurora
#

bruh i already try that

velvet jolt
sacred aurora
#

but when my host restart all the data is gone

lusty quest
#

yea bcs repl.it deletes your files and then load it again from the repo

sacred aurora
#

dunno why tho

#

oof

velvet jolt
#

i mean

#

they got one

sacred aurora
#

hmmm

velvet jolt
#

im using it

#

and it works pretty well

sacred aurora
velvet jolt
#

ye

lusty quest
#

no

velvet jolt
#

if u use uptimerobot

sacred aurora
#

for free?

#

hmmm

velvet jolt
#

yeah lol

sacred aurora
#

isn't that against the tos

lusty quest
#

and uptimerrobot violates the TOS of Repli.it

velvet jolt
#

???

#

it doesnt bruh

solemn leaf
#

is there a good way to talk to lua with js

velvet jolt
#

use flask + uptimerobot

#

y would they show something that breaks theyr own rules?

marble juniper
#

well

velvet jolt
#

doggowave 🤦‍♂️

marble juniper
#

repl is gonna add a 24/7 hosting soon

#

to thier p a i d plan

velvet jolt
#

paid ofc

#

im waiting for that

marble juniper
#

they will probably do the same as glitch

velvet jolt
#

bruh

#

y

solemn leaf
#

is there a good way to talk to lua with js

velvet jolt
#

or u can just find a cheap vps

#

instead of overpaying

solemn leaf
#

is there a good way to communicate between lua and js>

lusty quest
solemn leaf
#

ok ill just while loop a file then

tardy hornet
charred nimbus
#

[ ............]

tribal siren
#

i want to give a specific user all of the permissions of a voice channel, but some of them don't work. What should I put instead some of them?

solemn leaf
#
    const buttons = ['a', 'b', 'up', 'down', 'left', 'right']
    let button = message.content.toLowerCase().slice(1)

    if(buttons.includes(button)) {

mhm bcs iahsuoiahoifd is in this array

#

it logged it when that button isnt in the allowed array

tribal siren
hoary vine
#

first message lol

rustic nova
#

plsu se

hoary vine
#

hi

earnest phoenix
#

can someone please help me
i can't get the bot pfp on my bot's top.gg site to hover

This is what i have rn

 .entity-header__image {
    border-radius: 50% !important;
      border: 3px solid gold;
  animation: float 5s easein-out infinite;
} 
@keyframes float {
  0% {
      box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6);
      -webkit-transform: translatery(0px);
              transform: translatery(0px);
  }
  50% {
      box-shadow: 0 25px 15px 0px rgba(0, 0, 0, 0.2);
      -webkit-transform: translatery(-30px);
              transform: translatery(-30px);
  }
  100% {
      box-shadow: 0 5px 15px 0px rgba(0, 0, 0, 0.6);
      -webkit-transform: translatery(0px);
              transform: translatery(0px);
  }
solemn leaf
#

How can I get a path to a file for os and io on lua

earnest phoenix
#

nvm i fixed it

#

is heroku good

#

for running bot

fluid basin
#

like you just type the path

solemn leaf
#

so

#

"C:\Users\Owner\Desktop\Idk\button.txt"

zenith terrace
solemn leaf
#

@fluid basin

fluid basin
#

yeah pretty much

#

wdym get a path to a file

#

find a file?

velvet jolt
#

lol

fluid basin
#

or to generate a file path

solemn leaf
#

find a file

velvet jolt
#

how would u host a discord bot on repl.it without flask ?

#

KEKW zoomeyes 🤦‍♂️ doggowave

slender thistle
solemn leaf
#

@fluid basin

slender thistle
#

Yis

opal plank
fluid basin
slender thistle
solemn leaf
#

wait I have to cancle out the path

slender thistle
fluid basin
# solemn leaf

also, if you are putting the path in string, use \\ instead of \

slender thistle
eternal osprey
#

{"4317558":{"id":269,"name":"Dustox","level":36,"catchChance":0.4166666666666667,"spawnId":4181200,"owner":"345138133429649408","catchTime":"01/11/2021 1:31 PM","nickname":""},"9983671": hey this is a json file. I actually want to modify one specific field, "owner". How would i do that?

umbral zealot
#

Load the entire json, then modify the object you get from JSON.parse() , then save the file again using JSON.stringify

slender thistle
#

open the JSON file, parse it, json["4317558"]["owner"] = xxxxxxx, write to file

umbral zealot
#

do that until your json breaks because you messed up, or it corrupts because you're trying to read and write at the same time. then use a database.

eternal osprey
#

the object called owner

umbral zealot
#

by... y'know, literally using javascript?

fluid basin
#

(imagine answering without knowing what lang) but ok

umbral zealot
#

Always assume javascript

#

¯_(ツ)_/¯

slender thistle
#

I'd be amazed if Awsome didn't use JS in this case

eternal osprey
#

it's js

umbral zealot
#

yeah so read the article on how to use objects then

#

¯_(ツ)_/¯

feral aspen
#

Hey, Usually, I create a schema for the economy commands, and the users use it, when it comes to updating the schema, people will yet be able to use it, but the schema wouldn't be updated to all the users, so if they would want to use the new feature, it would error out or return as undefined.
Any solution anyone can think of?

eternal osprey
#

there are thousands of ids

#

isn't there some sort of replace function

umbral zealot
#

Right so you're opening yourself up to corruption real fast

#

Ok but not it's literally an object

#

get the object's key

#

change it

#

very basic JS tbh

slender thistle
#

for key in json
json[key]["owner"] = yadayada

#

Apply your own logic here

earnest phoenix
#

I have no idea why he said "i don't know the id", you're changing a property's value, not guessing an ID?

eternal osprey
#

literally have thousands of ids

umbral zealot
#

ok so figure out how to get that ID

eternal osprey
umbral zealot
#

¯_(ツ)_/¯

eternal osprey
umbral zealot
#

Seriously though

#

don't come crying when your json file disappears and you lost your entire data

eternal osprey
#

It might sound logic to you, but not to others

eternal osprey
umbral zealot
#

No, but it will happen, if you use JSON as a database. JSON is not a proper database.

earnest phoenix
#

JSONs are prone to corruption, only meant for read operations, not too many read and write operations, sure they're good for storing data, but not to be used as a database

umbral zealot
#

The solution is "update the schema for all users" I guess?

fluid basin
earnest phoenix
#

Of course

feral aspen
#

Yes, for 350 users, great idea.

#

Anyone can help me with a good solution? Something I can do?

umbral zealot
#

I don't see a problem with it

feral aspen
earnest phoenix
#

Set an interval and update one by one to not make too many database calls in a short amount of time?

umbral zealot
#

updating 350 database entries takes less than a second

#

updating 200,000 entries might take a few seconds but it's still not problematic. that's what databases are for.

#

literally their entire point in existing is being able to read and write to them quickly ^_^

feral aspen
# umbral zealot updating 200,000 entries might take a few seconds but it's still not problematic...

Is there a code that does that? Example in my economy system, I do this to register the user's data.

Data.findOne({
        userID: message.author.id
    }, (err, data) => {
        if(err) console.log(err);
        if(!data) {
            const newData = new Data({
                name: message.author.username,
                userID: message.author.id,
                lb: "all",
                money: 0
            })
            newData.save().catch(err => console.log(err));

            const embed = new MessageEmbed()
            .setColor(cyan)
            .setDescription(`Successfully registered an economy account for **${message.author.username}**!`)

            return message.channel.send(embed);
        } else {
            const economyEmbed = new MessageEmbed()
            .setColor(red)
            .setDescription(`❌ **${message.author.username}** already has an economy account registered!`)

            return message.channel.send(economyEmbed);
        };
    });
umbral zealot
#

What database is that

#

mongo?

earnest phoenix
#

MongoDB

feral aspen
#

MongoDB?

sacred aurora
#

its mongodb

feral aspen
#

?

umbral zealot
#

that's the answer you want

feral aspen
#

I dont see a code that could help my solve my case.

umbral zealot
#

you do'nt see the update() feature?

#

ok

#

well, I see it very clearly

#

I see the update() function with the upsert option, hell, there's even a way to do it in one single line of code

feral aspen
#

How?

umbral zealot
#

Maybe you should... actually read the answers? I Guess?

green kestrel
#

who here makes their beta/dev version of their bot public, and how many people invite it?

#

also is your beta bot up 24/7

fluid basin
#

I think timo does have one iirc

#

@twilit rapids (sorry for ping)

tardy hornet
#

im trying that my bot will leave the vc when the song is over

#
.then (setTimeout(function() {
                          message.member.voice.channel.leave();
                          }, `${song.formattedDuration}`))
                        
pure lion
#

you're passing a string and not a number

#

get rid of the `${}`

#

just do song.formattedDuration

#

assuming that it's a value in milliseconds

tardy hornet
#

its a package, its putting the song distraction

#

@pure lion

earnest phoenix
#

You realize <Promise>.then() expects a callback function right?

#

setTimeout() doesn't return a function

umbral zealot
#

That is also a horrible way to make the bot leave the voice after the song's over

#

discord.js has proper mechanisms for that, like dispatcher.on("end"

tribal siren
#

how to make a bot delete a voice channel once a user disconnects from it?

quick sinew
#

wait wtf is this server for?

tribal siren
#

so how to make a bot delete a voice channel once a user disconnects from it?

fluid basin
#

listen to voice state update, if the state changed from having a voice channel to not, delete that channel

twilit rapids
#

@green kestrel mines in 270 servers and it's up 24/7

fluid basin
#

o.o hi kyoso

twilit rapids
#

Hi

tribal siren
#
if(oldState.channel || !newState.channel) c.delete()```
fluid basin
#

uh

tribal siren
#

oo hi kyoso

fluid basin
#

if the state changed from having to not

#

so its and

#

not or

tribal siren
#

so it's like

#

there was a channel

#

and now there's not

slender thistle
#

yes

tribal siren
#

or it doesn't work this way?

slender thistle
#

Use &&

fluid basin
#

yes

#

and also, channelID would be better

tribal siren
#

oh ofc

#

im dumb

fluid basin
#

instead of channel

tribal siren
#

let's test

fluid basin
#

or means, if old state have voice channel or new state dont have voice channel

#

might cause issues if the user moves around channels

tribal siren
#

still doesn't work :(

if(oldState.channelID && !newState.channelID) c.delete()```
signal estuary
#

Hey i get an error : member.roles.map is not a function
to this:

.addField("Roles:", member.roles.map(roles => `${roles}`).join(', '), true)

Can someone help me how to fix this?

fluid basin
#

what is c

fluid basin
#

you might be looking for .cache.map

tardy hornet
#

@earnest phoenix like that?

signal estuary
fluid basin
#

yes

#

try that

tribal siren
# fluid basin what is c

it's message.guild.channels.create(`Name`, { permissions stuff im lazy to copypaste here }).then(c => {})

fluid basin
#

hm ok, but how do you know which c belongs to the channel that the user is in?

#

you should consider something like oldState.channel

#

and not c

tribal siren
#

fine fine ill copypaste it all here

#
newState.guild.channels.create(`${newState.member.user.username} ~ Voice`, {
      type: 'voice',
      bitrate: 64000,
      parent: '736472475625324568',
      userLimit: 15,
      reason: `Member ${newState.member.user.tag} joined VC`
    }).then(c => {
      c.updateOverwrite(newState.id, {
        VIEW_CHANNEL: true,
        MANAGE_CHANNELS: true,
        USE_VAD: true,
        MUTE_MEMBERS: true,
        DEAFEN_MEMBERS: true,
        MOVE_MEMBERS: true,
        PRIORITY_SPEAKER: true,
        CONNECT: true,
        SPEAK: true,
        STREAM: true,
        CREATE_INSTANT_INVITE: true,
        MANAGE_ROLES: true
      })
      newState.setChannel(c.id, `Member ${newState.member.user.tag} joined VC`)
      if(oldState.channelID && !newState.channelID) c.delete()
    })```
#

this is how it all works

fluid basin
#

nonono

#

you need to check the states in the voiceStateUpdate event

#

not when you create the channel

tribal siren
#

so like uuh

#

if(oldState.channelID && !newState.channelID) newState.channel.delete()

#

let's try or something

fluid basin
#

that code needs to be in the voiceStateUpdate event

slender thistle
#

A completely separate event where you handle checking states

fluid basin
#

similar to your message event

tribal siren
#

yes yes it is

fluid basin
#

the client.on('<event name', () => // blah blah)

signal estuary
#

@fluid basin Thank you 🙂 . How can i filter the role @everyone? So that it doesnt show this as an role

fluid basin
#

(imagine pinging everyone)

#

just remove everyone

slender thistle
#

\u200b entered after @

fluid basin
#

there is a value for it

fluid basin
#

not as 1

#

it won't work that way

#

can you describe the process that the bot should take?

signal estuary
fluid basin
#

e.g.

  1. user enter cmd to create channel
  2. user joins channel
  3. user does stuff
  4. user leaves channel
  5. bot deletes channel
#

yeah the role name I think

#

hold up lemme check

tribal siren
#

yay it works now

#

ty'

signal estuary
tribal siren
slender thistle
#

Use .mention instead of @name

#

or <@&role_id>

fluid basin
#

but iirc role.toString() give the mention

slender thistle
#

Eh... maybe?

#

I'd assume there is

signal estuary
fluid basin
#

you can do role.toString()

#

like I said

signal estuary
fluid basin
#

wdym by "ALL roles" and "one by one"

#

example?

signal estuary
#

because there is then <@@everyone role1 role2 role3> and thats not what i want

fluid basin
#

have you tried role.toString()?

#

and you can filter out everyone

signal estuary
signal estuary
fluid basin
#

role.toString() not toString()

#

role => role.toString

signal estuary
#

role.name.toString()?

fluid basin
#

filter(role => role name not equals '@ everyone')

fluid basin
#

I don't see name

signal estuary
#

How can i ping then every single role?

fluid basin
#

role.toString is the ping

signal estuary
#
.setDescription("Roles: " + msg.member.roles.cache.map(role => role.toString()).join(", "))
slender thistle
#

good

zenith terrace
#

lol

signal estuary
#

thx

fluid basin
#

bruh

earnest phoenix
#

Bruh

#

Just do

#

<GuildMember>.roles.cache.array().join(', ')

misty sigil
#

voltrex just gotta come with the better ways doesn't he

signal estuary
earnest phoenix
#

🗿 You're supposed to filter by guild ID

signal estuary
earnest phoenix
#

You mean

#

Spoon-feed?

fluid basin
#

wdym you dont get it without code

misty sigil
#

.filter

#

.cache.filter().map()

slender thistle
#

!= = not equal

fluid basin
misty sigil
#

@slender thistle this is js

#

!==

fluid basin
#

same thing (in this case)

slender thistle
#

shut up

#

!=

misty sigil
#

shut it twat (jk ly)

fluid basin
#

woah

slender thistle
#

shut your facehole you twat (ly2 bro)

signal estuary
#

. . .

earnest phoenix
zenith terrace
#

@misty sigil shut it you fucking twat waffle on a break stick

fluid basin
#

I should link that large para about matt saying "learn js"

misty sigil
#

that was evie

fluid basin
#

oh evie

misty sigil
earnest phoenix
#

Shut it cock man

fluid basin
#

inb4 post on devrant: "today I met a big sock hanger"

earnest phoenix
#

🗿

misty sigil
zenith terrace
#

wait this is development

fluid basin
#

mfw you just realised

zenith terrace
fluid basin
earnest phoenix
#

Why would you use map instead of casting it to an array and joining it

sacred aurora
#

eh guys

#

if i have mongodb schema that have a String variable named guildId

#

will it set the variable to number?

#

eh or is it string already

lusty quest
#

it should stay a string

sacred aurora
#

hm

lusty quest
#

if it is casted with ' ' its a string

sacred aurora
#

my db broke again after i restart the bot

#

with the same problem

lusty quest
#

the error pointed on the uid mongoose generates iirc

#

could you send in your schema?

sacred aurora
#
const config = new mongoose.Schema({
    guildId: String,
    prefix: String,
    reminder: Boolean,
    action: String,
    cd: Boolean,
    channelId: String,
    lastDate: String
})
#

that the schema

#

here it say guildId tho

#
at path "guildId" for model "GuildData"
lusty quest
#

where did you register the Schema?

sacred aurora
#

umm like saving the document?

lusty quest
#

no you have to register the Schema so Mongoose knows its there

lament rock
#

Does the Mongoose lib have it's own type definitions for what Mongoose offers or do you pass it the global String, Boolean, Number classes

sacred aurora
#

u mean like this?

mongoose.model('GuildData', config);
lusty quest
#

yes

sacred aurora
#

its already did

lusty quest
#

and you call the schema with GuildData in your other files right?

sacred aurora
#

yup

#

so i use module.exports

lusty quest
#

what is the error again? if possible the full stack

earnest phoenix
#
// author message content = "hi :EmojiName:"
message.reply('`'+message.content+'`') // Bot Message: `@Nawal, hi <:EmojiName:EmojiID>`

I want my bot to only send: hi EmojiName or hi :EmojiName:
How can I do that? I don't know regex pandasad

lusty quest
#

unicode emoji or custom emoji?

earnest phoenix
#

custom

sacred aurora
lusty quest
#

you have to send the emoji id with name

earnest phoenix
#

no, I don't want to send an emoji

lusty quest
#

so you want to remove the name?

earnest phoenix
#

I want to parse an emoji from escaped like !zoomeyes to only zoomeyes

past needle
#

to send a animated emojijs <a:emoji_name:emoji_id> for normal custom emojis ```js
<:emoji_name:emoji_id>

fluid basin
#

you can define it in the schema/model

earnest phoenix
sacred aurora
#

i save new document on guildjoin

const newConfig = new Config({
    guildId: guild.id,
    prefix: PREFIX,
    reminder: false,
    action: 'raid/upgrade',
    cd: false,
    channelId: null,
    lastDate: null
  })
  return newConfig.save();
earnest phoenix
#

I don't know regex pandasad

fluid basin
#

for number there shld be int32 int64 decimal

lament rock
#
/<a?:([\w\d_]+):\d+>/ // custom emoji rejex with the name as the capture group
lusty quest
earnest phoenix
#

/<?(?:(a):)?(\w{2,32}):(\d{17,19})?>?/

sacred aurora
#

for the channelId?

lament rock
#

Don't define number lengths!

lusty quest
fluid basin
#

oh thats an oof

#

but you can use native mongodb types?

lusty quest
#

if you use plain mongodb it works

#

yes

earnest phoenix
#

I know, snowflakes can be as long as they would like to, but just for more accurate checks, defining specific lengths would be better at least

lusty quest
#

its just a wrapper for mongodb

dense surge
#

I'm waiting for a DM from Luca from my bot

lament rock
#

It's more expensive computationally to limit the range length of something

earnest phoenix
#

It returns 3 groups

#

Access the second one

#

But after matching it tho

#

<String>.match()

earnest phoenix
#

Use the global flag

#

/g?

#

Yes and also use <String>.matchAll()

#

[...found]

#

Am i able to customise the color that the invite button background changes to on hover with some css ?

misty sigil
#

whats a regex

sterile lantern
#

how would i add more details to

#

config.json

earnest phoenix
#

Just add it?

sterile lantern
#

via a cmd

#
        "hb_automation": "293060399106883584"
    },```
#

i have this rn

#

but i want to make it so if i go

#

;add userhere useridhere

#

it goes into that format

#

i mean i dont think its possible because it needs a comma / not a comma depending on its spot

earnest phoenix
#

Modify the JSON and save it using <fs>.writeFileSync()

sterile lantern
#

acc nvm it doesnt need a comma

#

but

#

how exactly would i save it in that format

#

"user_name": "id"

mellow kelp
#

JSON.stringify

earnest phoenix
#

<JSON>[<property name>] = <value>

#

#

JSON.stringify()

#

#

<fs>.writeFileSync()

restive furnace
#

bloat

#

imagine not using binary

#

or proper db at all

earnest phoenix
#

I don't think they're using it as a database

#

Just adding necessary or temporary properties with values

sterile lantern
#

im not using it for data

#

its temp

#

yea

lusty quest
#

why not redis then?

restive furnace
#

anyways json is bloat

#

that's why i use erlpack to communicate with discord

fluid basin
#

uh redis means setting up another server

#

and not many ppl are willing/have the ability

lusty quest
#

well then

delicate shore
#

Ok guys , Galaxy Gate isn't working out for me
Any other good Hosting service which gives good ram at cheap prices

lusty quest
#

you get what you pay

earnest phoenix
#

DigitalOcean

delicate shore
lusty quest
#

DigitalOcean is a bit more expensive than Galaxy gate

#

but you also get other nice stuff

delicate shore
#

Oh

#

Like

void vale
#

Who can help with discord oauth2? JS

earnest phoenix
#

If you want a good hosting service then go for it

lusty quest
#

API, i think recently they added 3 Free Websites (static)

earnest phoenix
#

That's why i suggested it

delicate shore
#

Thanks

#

Still any other in your thoughts

lusty quest
#

Vultur

earnest phoenix
#

OVH

lusty quest
#

Linode

delicate shore
#

Alr thanks

earnest phoenix
#

Virmatch also

lusty quest
#

wtf are these meme npm packages

earnest phoenix
#

Which ones

lusty quest
#

creates a txt file with a teacup

earnest phoenix
#

PepeLaugh Oh no no no

#

Have you seen

#

H?

lament rock
#

404

lusty quest
#

this are just packages for people who are stupid

solemn latch
#

Oh man wait till tim shows up with all his meme packages

restive furnace
#

Contabo gang

sterile lantern
#

so i did a woopsie and now my entire conf.json is gone

#

eek

solemn latch
#

Git op

lusty quest
#

the bigger thing is 3 people downloaded a 9 years old NPM package that is still on the first version

earnest phoenix
#

There

#

9 million downloads KEKW

lament rock
#

is-finite

#

check mdn for when string.toLowerCase was added

earnest phoenix
lament rock
#

and check the target version for the packages

earnest phoenix
#

Man

#

Look at the literal source code

lament rock
#

oh nvm. The package uses those methods

#

bruh

earnest phoenix
sacred aurora
#

does ```js
client.guilds.cache.keyArray()

return an array of guild id?
lusty quest
#

yea people are stupid

sacred aurora
hardy geyser
#

bruh

lusty quest
#

did your MongoDB work now @sacred aurora

earnest phoenix
sacred aurora
#

nah still guildId error

lament rock
#

I was overthinking where perhaps it's over engineered and uses code points to map string characters to a lower case variant

sacred aurora
#

oh okay

earnest phoenix
lament rock
#

imagine adding bloat

earnest phoenix
#

Well this one is a troll

lament rock
#

brain hurt

lusty quest
#

i want to know how many Newbies to Discord bots used this package until they realise its as useful as a Briefcase for a phone

sterile lantern
#

is there a way for it to only edit the userID section

#

because it just removed the entire conf.json

#

and it didnt post like "username" : "id"

#

it just posted "username"

earnest phoenix
#

@earnest phoenix I still can't manage how to replace the escaped emoji to the emoji name, I'm so bad 😕

#

Use the regex on <String>.replace()

#

The regex i showed + whatever to replace with

sterile lantern
#

huh

#

is that to nawal

#

or me

gilded olive
#

nawal

sterile lantern
#

hm

#

i think i might just use sqlite

gilded olive
#

Good 4 u

earnest phoenix
#
const msg = 'hi :Hello: :Hello2:';
const regex = msg.matchAll(/<?(?:(a):)?(\w{2,32}):(\d{17,19})?>?/g);
message.channel.send(msg.replace(...regex[0], ...regex[2])) // response: hi Hello Hello2

like this?

#

Nope

sterile lantern
#

fs.writeFileSync('conf.json', JSON.stringify(username, id))

#

this doesnt work

cinder patio
#

That's not how json stringify works

#

is username an object

sterile lantern
#
   const args = msg.content.slice(conf.prefix.length).split(' ');
      let username = args[1]
      let id = args[2]
      if(!username) return msg.channel.send("You need to specify the trello user")
      if(!id) return msg.channel.send("You need to specify a user ID")
      fs.writeFileSync('conf.json', JSON.stringify(username, id))```
earnest phoenix
#

JSON.stringify() expects an object

sterile lantern
#

hm

earnest phoenix
#

{ [username]: id }

sterile lantern
#

well

#

the fs.writefile thing

#

just removes the entire conf.json

#

and repalces it

earnest phoenix
sterile lantern
#

username

#

replaces*

#

so if i did .add user1 id

#

it just removes the entire thing and puts user1

earnest phoenix
#

Guess why

#

Have a little deeper look into your code

sterile lantern
#

shouldnt it be

lament rock
#

what even is the return value of JSON.stringify(string, string)

sterile lantern
#
JSON.stringify(conf, { [username]: id }))```
#

i have no clue

earnest phoenix
#

Modify the json, pass the json

cinder patio
#

look up how json.stringify works

lament rock
#

You need to Object.assign to the old JSON data then write the data back to the json

#

Or use mixin-deep since Object.assign is quirky

earnest phoenix
#

Can't they just <JSON>[property] = value

long marsh
#

Is anyone else trying to get their bot verified right now? I've legit just been waiting since like Dec. 26th for this.

The verification form is currently closed for the holidays. We have increased the maximum guild limit for bots to 250 until the form re-opens. The form will re-open on January 11, 2021.

cinder patio
#

you answered your own questions

#

it opens today

long marsh
#

Wasn't a question. I just wanted to share in the frustration of it not being open yet even though it states it will open Jan 11th.

cinder patio
#

maybe you aren't the first in the queue

long marsh
#

I'm not even able to submit the bot's verification.

#

They've locked the form and greyed out the fields.

cinder patio
#

ah

long marsh
#

Maybe it'll open at 11 EST since their headquarters is in San Franciso, CA (which would mean 8am) 🤷‍♂️

gilded olive
#

if its 11 EST then maybe in about 21 minutes

long marsh
#

That's just me guessing, lol

gilded olive
#

I'm 1 hour ahead of their EST and it's 11:39 rn

#

well 40 now

long marsh
#

Wait, where does that put you? Hawaii?

#

Alaska?

gilded olive
#

KEKW nah

#

I don't live in america

#

but close

long marsh
#

Ah, interesting

earnest phoenix
#

🗿

long marsh
#

Easter Island!

#

I was able to get it working 👍

earnest phoenix
#

oh

#

nice

#

good job lmfao i would've ripped my hair out

long marsh
#

Their documentation was extremely lacking, and there's references everywhere regarding how the API isn't being maintained. Nonetheless, after getting an access token, it was fairly simplistic to crawl the list of pledges and get their discord id 👍

cinder patio
#

slash command question: When a user uses a slash command, does the message with the command gets sent, do other people see it?

solemn latch
#

Like the "user did command x" that discord sends?

#

Pretty sure everyone sees it.

cinder patio
#

No like, for example I do /somecommand, do other people see that I did the command? I haven't seen slash commands in action

round vault
#

The site of top.gg I becoming perfect

earnest phoenix
#

Others can see your doing x used command n, but your command message is not visible

round vault
#

My bot has come to approval within only 7 days

#

Before it was more than 3 months

earnest phoenix
#

Only the notification

cinder patio
#

they do not show the args?

earnest phoenix
#

No

cinder patio
#

test

#

I'm assuming this doesn't apply to the commands discord provides

earnest phoenix
#

Built-in commands are not affected

#

And slash-commands notifs are kinda buggy on discord mobile

cinder patio
#

I don't really get the point of the notification

#

the bot should decide if there should be a notification or not

earnest phoenix
#

Not really a notification

#

Like, sends a message in the channel notifying that you used a slash-command

#

For example

#

I do

#

/bruh moment

#

My message becomes invisible and it sends a message saying

#

Voltrex Master used command bruh

#

Kinda a system message

solemn leaf
#

/bruh

cinder patio
#

aha, still I think the bot should decide if there should be a message or not

#

I can't find any bots that have slash commands

solemn leaf
#

bcs not a thing?

#

¯_(ツ)_/¯

cinder patio
#

they are a thing tho

solemn latch
#

Its a thing, I've reviewed a few bots with slash commands already

solemn leaf
#

how do you make them

solemn latch
#

If you search slash on top.gg there are some listed

#

Most libs don't support it yet, so you have to do a lot of it yourself.

earnest phoenix
#

And actually the message is

#

<Username> used <Command name> with <Bot name>

solemn latch
#

Ah yeah that's it.

solemn leaf
#

nice

solemn latch
#

It might be very useful for some people, but imo slash commands are much worse than normal commands.

#

Maybe it's just change though 🤷‍♂️

solemn leaf
#

cant wait for there to be billions of people asking for help

earnest phoenix
#

nah they're definitely worse

#

the lack of sheer features you get with normal message commands destroys the enthusiasm about slash commands

cinder patio
#

Can other people see the arguments? Do only I see the /catch mon: Pikachu?

solemn latch
#

Ah.

cinder patio
#

yea everybody sees it

solemn leaf
#

google

#

you like pokemon?

cinder patio
#

no

#

first bot I found with slash commands

#

I think slash commands would be way more useful if people couldn't see that you used the command

solemn leaf
#

cant you just do like

solemn latch
#

Why is that useful

solemn leaf
#

<slash>#delete()

cinder patio
#

but people see it for a split second

solemn leaf
#

maybe discord will change it

languid dragon
#

unrelated to whatever is happening here, helping @ornate otter in VC

<img class="this-is-my-image" src="url" alt="pog"/>
.this-is-my-image {
  height: 20px;
}
solemn latch
#

🤔

crimson vapor
#

LOL

earnest phoenix
solemn leaf
#

.thisisntmyimage

languid dragon
#

no, because its mine, nerd

solemn latch
#

Who uses their actual image? Just steal it on google

solemn leaf
#

bruh

earnest salmon
#

Yo

solemn leaf
#

hi

distant cobalt
#

how do you change a user's nickname on djs?

earnest phoenix
distant cobalt
#

oki thanks

#

uh

#

it's kinda confusing

earnest phoenix
#

How's it confusing

#

no sample to copypaste 😭

dusky sundial
#

With MariaDB in python, is there a better way to retrieve a single value than this?

    cursor.execute("SELECT ? FROM user WHERE user_id=?", (key, user_id))
    value = cursor.fetchone()
lament rock
#

You could append a "LIMIT 1" to the statement

#

idk of fetchone does that automatically or if it accepts a list of all entries matching that statement then returns the first in that list

distant cobalt
#

In discord.js How do you get an argument's character length?

lament rock
#

string.length

distant cobalt
lament rock
#

"pog".length // 3

distant cobalt
earnest phoenix
#

=

umbral zealot
#

=> is for fat arrow functions, >= is "larger or equal to"

lament rock
#

also. is nickName a string or is nickName an object with a property string?

opal plank
#

my fat arrow functions are only 2 or 3 lines, prob gonna name them thin arrow functions

#

imagine using anon functions rather than named ones

earnest phoenix
#

Calling arrow functions fat D_

opal plank
#

better than calling them whores mmulu

distant cobalt
#

ok

lament rock
#

when I say string.length, the string in this instance is referring to the type of the variable and length is a property of instances of String or primitive strings

harsh blade
#

Nvm just saw it

harsh blade
#

whats the correct function to message.channel.sendmessage

#

on V12

opal plank
#

just send()

harsh blade
#

Alright

#

thank u

lament rock
#

God. How long ago was sendMessage? That's giving me flashbacks to V8

opal plank
#

np

harsh blade
#

just trying to learn

#

and i learn from mistakes

#

xD

opal plank
#

like a tru champ

#

fuck docs, we do try and error here

lament rock
opal plank
#

speaking of errors

harsh blade
opal plank
#

i finally managed to get my shit together yesterday

earnest phoenix
mellow kelp
#

smash your keyboard until it works

opal plank
harsh blade
#

Bruh

#

complicated

opal plank
#

how come?

harsh blade
#

im still in v11

#

lmao

opal plank
#

you send() something on a channel

#

makes perfect sense

#

you dont send a message on a message

earnest phoenix
#

I remember when <Client>#sendMessage() existed in v1

harsh blade
#

Bruhhhh

#

dusty

distant cobalt
#

when using .length does it count the spaces as well?

opal plank
#

yes

earnest phoenix
#

All chars

distant cobalt
#

ok

opal plank
#

^^

distant cobalt
#

now on djs, how do you change a user's nickname in a server?

opal plank
#

member.setNickname()

distant cobalt
#

lol

opal plank
#

np

pale vessel
#

must be a member

#

not a user

distant cobalt
opal plank
#

i assumed they meant user as in a person

pale vessel
#

ic

earnest phoenix
#

But the <String>.length isn't always accurate, the codepoints mess up, you can use [...<String>].length to get the accurate length

distant cobalt
#
const nickUser = message.mentions.members.first()``` see?
opal plank
#

thats just a member

distant cobalt
#

ik

#

lol

opal plank
#

or null