#development

1 messages · Page 1056 of 1

quartz kindle
#

you can remove the reason line

restive pebble
#

Omega

quartz kindle
#

you can leave the rest

fringe axle
#

Okay

earnest phoenix
#

and then when i ask for a line of code people say s poon feedinjg isnt allowed here

#

)_)

restive pebble
#

Asking is bad

fringe axle
#

@quartz kindle same problem

restive pebble
#

Ah

quartz kindle
#

well, technically thats not spoon feeding because its not end code, its for debugging purposes

restive pebble
#

Send the play function

quartz kindle
#

logs?

fringe axle
#

No...

#

Nothing

quartz kindle
#

then your ytdl is broken

#

show code

restive pebble
#

Play function pls

fringe axle
#
case 'play':

        function play(connection, message){
            var server = servers[message.guild.id];

            console.log(server)

            server.dispatcher = connection.playStream(ytdl(server.queue[0], {filter: "audioonly"}));

            server.queue.shift();

            let stream = ytdl("https://www.youtube.com/watch?v=-tJYN-eG1zk", {filter:"audioonly"})
stream.on("info",console.log)
stream.on("progress",console.log)
connection.playStream(stream)

            server.dispatcher.on("end", function(){
                if(server.queue[0]){
                    play(connection, message);
                }else {
                    connection.disconnect();
                }
            })


        }

        if(!args[1]){
            message.channel.send("You need to porvide a link!");
            return;
        }

        if(!message.member.voiceChannel){
            message.channel.send("You must be in a Voice Channel to play music!");
            return;
        }

        if(!servers[message.guild.id]) servers[message.guild.id] = {
            queue: []
        }

        var server = servers[message.guild.id];

        server.queue.push(args[1]);

        if(!message.guild.voiceConnection) message.member.voiceChannel.join().then(function(connection){
            play(connection, message);
        })
    break;
earnest phoenix
#

anyone got the docs to the api thing?

#

i dont have it anymore

pale vessel
#

api thing?

earnest phoenix
#

cant find it

#

the docs to the music discord bot

quartz kindle
#

@fringe axle put the stream code before the dispatcher, and replace your connection.playStream line with the stream one

fringe axle
#

okay

restive pebble
#

.playStream?

quartz kindle
#

hes on v11

restive pebble
#

Oh ok

earnest phoenix
#

i have my own music bot script @fringe axle

fringe axle
#

Same problem @quartz kindle

#

i have my own music bot script @fringe axle
@earnest phoenix and now?

#

¯_(ツ)_/¯

restive pebble
#

Are u providing args?

fringe axle
#

huh

#

I go to eat now. This is the code atm:

#
case 'play':

        function play(connection, message){
            var server = servers[message.guild.id];

            console.log(server)

            stream.on("info",console.log)
    stream.on("progress",console.log)
    connection.playStream(stream)

            server.dispatcher = connection.stream.on("info",console.log)(ytdl(server.queue[0], {filter: "audioonly"}));

            server.queue.shift();

            let stream = ytdl("https://www.youtube.com/watch?v=-tJYN-eG1zk", {filter:"audioonly"})

            server.dispatcher.on("end", function(){
                if(server.queue[0]){
                    play(connection, message);
                }else {
                    connection.disconnect();
                }
            })


        }

        if(!args[1]){
            message.channel.send("You need to porvide a link!");
            return;
        }

        if(!message.member.voiceChannel){
            message.channel.send("You must be in a Voice Channel to play music!");
            return;
        }

        if(!servers[message.guild.id]) servers[message.guild.id] = {
            queue: []
        }

        var server = servers[message.guild.id];

        server.queue.push(args[1]);

        if(!message.guild.voiceConnection) message.member.voiceChannel.join().then(function(connection){
            play(connection, message);
        })
    break;
quartz kindle
#

we are not trying to fix the problem btw

#

we are trying to get logs

restive pebble
#

Wot

fringe axle
#

oh.

quartz kindle
#

to see what the problem is in the first place

fringe axle
#

oh

#

i go to eat now

quartz kindle
#

and you broke everything lol

#

thats not what i meant

fringe axle
#

xD

restive pebble
#

Does the bot joins channel?

fringe axle
#

yes

quartz kindle
#

it joins and leaves immediately

fringe axle
#

right

quartz kindle
#

because the end event fires instantly

fringe axle
#

But i have to go now xD

restive pebble
#

Hmmmm

#

Then

#

Try with some other video

quartz kindle
#

i just tested it on runkit and it seems to work

#

i mean, i get the video info output correctly

#

from the stream.on("info") event

earnest phoenix
#

YOO

restive pebble
#

hmmm

earnest phoenix
#

i just finally fixed my music bot scrippt

#

it fucking works now

restive pebble
#

why doing stream.on

earnest phoenix
#

hoyl shit

restive pebble
#

ytdl has a function

#

ytdl.getInfo

quartz kindle
#

to test the actual stream

#

since thats what goes into the playStream

restive pebble
#

Tim when i am compiling typescript it gives an error saying message.author.fetchFlags is not a function

#

i think i deleted it from their typings

#

¯_(ツ)_/¯

quartz kindle
#

how lol

restive pebble
#

idk

#

but i didnt touched the typings

#

i have to use @ts-ignore

quartz kindle
#

idk

#

shit like this is why i dont use ts

restive pebble
#

hmmmm

#

typings is gay

quartz kindle
#

maybe you have to type cast it or something idk

#

message.author as User

restive pebble
#

¯_(ツ)_/¯

quartz kindle
#

idk how that shit works

restive pebble
#

ill go to support server

#

then

#

kek

earnest phoenix
#
2020-07-14T10:00:12.960696+00:00 app[Worker.1]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
2020-07-14T10:00:12.960697+00:00 app[Worker.1]:     at Module.load (internal/modules/cjs/loader.js:986:32)
2020-07-14T10:00:12.960697+00:00 app[Worker.1]:     at Function.Module._load (internal/modules/cjs/loader.js:879:14)
2020-07-14T10:00:12.960697+00:00 app[Worker.1]:     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
2020-07-14T10:00:12.960698+00:00 app[Worker.1]:   code: 'MODULE_NOT_FOUND',
2020-07-14T10:00:12.960698+00:00 app[Worker.1]:   requireStack: [ '/app/index.js' ]
2020-07-14T10:00:12.960699+00:00 app[Worker.1]: }
2020-07-14T10:00:13.007867+00:00 heroku[Worker.1]: Process exited with status 1
2020-07-14T10:00:13.049564+00:00 heroku[Worker.1]: State changed from up to crashed``` how to cry
restive pebble
#

nice

#

heroku

#

heroku moment

earnest phoenix
#

Hmm

rigid maple
#

pls help me

#

v11

restive pebble
#

glitch moment

#

displayAvatarURL?

earnest phoenix
#

Bro, it literally says there, wasn't able to find main file index.js @earnest phoenix

#

@rigid maple in v11 avatarURL is not a function

#

It's a property

rigid maple
#

message.author.avatarURL ?

#

will i do it

earnest phoenix
#

are you trying to get the avatar of the bot?

#

so umm hi

restive pebble
#

voltrex teach mongoose kek

edit:joke

earnest phoenix
#

If so

v12 => client.user.avatarURL()``` @rigid maple
#

whatever you said i didn't get @restive pebble

#

boing boing

restive pebble
#

it dosent have dynamic @earnest phoenix

#

in v11

rigid maple
#

thanks @earnest phoenix

#

❤️

earnest phoenix
#

Np

#

@restive pebble i think it does idk

restive pebble
#

k

earnest phoenix
#

been 7 minutes and my bot logs are still showing Initializing node_modules, hold on...

#

should i go tothe terminal and type refresh?

#

Wot, where do you host

#

@rigid maple i can show you how to do embeds

#

glitch.com is the fastest free worst hosting service

#

^^what i use

rigid maple
#

i did @earnest phoenix

earnest phoenix
#

I prefer heroku over glitch but using a vps is the best @earnest phoenix

restive pebble
earnest phoenix
#

Bruh

#

I prefer heroku over glitch but using a vps is the best @earnest phoenix
@earnest phoenix when you're poor

golden condor
#

Hi I am making a ban command and I want to test for IDs. Does anyone know how to use a regex for that or have a regex I can use?

real loom
restive pebble
#

k

#

thx

real loom
#

xD

earnest phoenix
#

@golden condor for detecting only a single id or

golden condor
#

a single id

restive pebble
#

ok now tell some nice apis

#

usefull

golden condor
#

like

#

!ban 1234567890

earnest phoenix
#

/(\d{17}|\d{18})/

real loom
#

Usefull for what?

golden condor
#

Is that for ids or mentions?

restive pebble
#

702905673524051988

earnest phoenix
#

IDs

restive pebble
#

is 18 long

golden condor
#

ok

#

tysm

earnest phoenix
#

IDs can be 17 long too @restive pebble

restive pebble
#

ohhh

#

i didnt knew

real loom
#

ok now tell some nice apis
@restive pebble
Usefull for what?

restive pebble
#

hmmmm

golden condor
#
        if (!user) {
            if (banRegex.test(args[0])) user = args[0]
            else return message.channel.createMessage("Please give me a valid user")
        }``` So this would work?
restive pebble
#

like nice api to wrap

real loom
#

Mhm

#

Lib?

restive pebble
#

yes

real loom
#

What libary?

restive pebble
#

kinda

earnest phoenix
#

@golden condor what's banRegex.test

golden condor
#

The regex u gave

earnest phoenix
#

Oh

golden condor
#
const banRegex = /(\d{17}|\d{18})/
real loom
#

I assume u use discord.js?

restive pebble
#

yes

#

i want nice apis

real loom
#

Okay

earnest phoenix
#

pplication Logs
2020-07-14T10:11:02.048135+00:00 app[Worker.1]: at MessageCreateAction.handle (/app/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
2020-07-14T10:11:02.048136+00:00 app[Worker.1]: at Object.module.exports [as MESSAGE_CREATE] (/app/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
2020-07-14T10:11:02.048137+00:00 app[Worker.1]: at WebSocketManager.handlePacket (/app/node_modules/discord.js/src/client/websocket/WebSocketManager.js:386:31)
2020-07-14T10:11:02.048138+00:00 app[Worker.1]: at WebSocketShard.onPacket (/app/node_modules/discord.js/src/client/websocket/WebSocketShard.js:436:22)
2020-07-14T10:11:02.048138+00:00 app[Worker.1]: at WebSocketShard.onMessage (/app/node_modules/discord.js/src/client/websocket/WebSocketShard.js:293:10)
2020-07-14T10:11:02.048139+00:00 app[Worker.1]: at WebSocket.onMessage (/app/node_modules/ws/lib/event-target.js:125:16)
2020-07-14T10:11:02.048140+00:00 app[Worker.1]: at WebSocket.emit (events.js:315:20)
2020-07-14T10:11:02.048141+00:00 app[Worker.1]: at Receiver.receiverOnMessage (/app/node_modules/ws/lib/websocket.js:797:20)
2020-07-14T10:11:02.048200+00:00 app[Worker.1]: (node:4) 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)
2020-07-14T10:11:02.048235+00:00 app[Worker.1]: (node:4) [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.

restive pebble
#

like informative

real loom
#

Hmmm

restive pebble
#

omega

earnest phoenix
#
2020-07-14T10:11:02.048135+00:00 app[Worker.1]:     at MessageCreateAction.handle (/app/node_modules/discord.js/src/client/actions/MessageCreate.js:31:14)
2020-07-14T10:11:02.048136+00:00 app[Worker.1]:     at Object.module.exports [as MESSAGE_CREATE] (/app/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
2020-07-14T10:11:02.048137+00:00 app[Worker.1]:     at WebSocketManager.handlePacket (/app/node_modules/discord.js/src/client/websocket/WebSocketManager.js:386:31)
2020-07-14T10:11:02.048138+00:00 app[Worker.1]:     at WebSocketShard.onPacket (/app/node_modules/discord.js/src/client/websocket/WebSocketShard.js:436:22)
2020-07-14T10:11:02.048138+00:00 app[Worker.1]:     at WebSocketShard.onMessage (/app/node_modules/discord.js/src/client/websocket/WebSocketShard.js:293:10)
2020-07-14T10:11:02.048139+00:00 app[Worker.1]:     at WebSocket.onMessage (/app/node_modules/ws/lib/event-target.js:125:16)
2020-07-14T10:11:02.048140+00:00 app[Worker.1]:     at WebSocket.emit (events.js:315:20)
2020-07-14T10:11:02.048141+00:00 app[Worker.1]:     at Receiver.receiverOnMessage (/app/node_modules/ws/lib/websocket.js:797:20)
2020-07-14T10:11:02.048200+00:00 app[Worker.1]: (node:4) 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)
2020-07-14T10:11:02.048235+00:00 app[Worker.1]: (node:4) [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.```
golden condor
#

or should I do args[0].match(banRegex)

earnest phoenix
#

@golden condor if you on js then use match

restive pebble
#

heroku moment

earnest phoenix
#

Yea

real loom
#

xD

golden condor
#

Oh Ok

#

ty

real loom
#

Brb

restive pebble
#

k

earnest phoenix
#

if(args[0].match(<my regex>))

golden condor
#

I'll test it like this

#
        if (!user) {
            if (args[0].match(/(\d{ 17 }|\d{ 18 })/)) user = { id: args[0] }
            else return message.channel.createMessage("Please give me a valid user")
        }```
restive pebble
#

are u sending an empty msg?

golden condor
#

oop vsc added spaces

restive pebble
#

@earnest phoenix

earnest phoenix
#

@restive pebble its a music thing

restive pebble
#

ok

earnest phoenix
#

it works on my other script folder

#

but doesnt work on main

restive pebble
#

ok

earnest phoenix
#

@earnest phoenix you showed the entire thing but not the actual error

restive pebble
#

yea

#

lmao

earnest phoenix
#

so guys i need help with my work cmd it oonkly works for me
code:

const Discord = require("discord.js")

module.exports = {
    name: "work",
    aliases: ["w"],
    category: "Currency",
    run: async (bot, message, args, err) => {
    let random = Math.floor(Math.random() * 100);
    let prevmoney = await bot.db.collection("Money").findOne({"User_ID": message.author.id})
    console.log(JSON.stringify(prevmoney))
    console.log("Random money: " + random)
    

    await bot.db.collection("Money").updateOne({"User_ID": message.author.id}, {$set:{Money: prevmoney ? prevmoney.Money + random : random}},  {upsert: true})
        
    let embed = new Discord.MessageEmbed()
        .setColor("RANDOM")
        .setTitle(`You worked!`)
        .setDescription(`You worked and got ${random} money!💰`)
        .setFooter("This command is in beta so it wont save your money we are sorry :(")
      message.channel.send(embed);
        
    }
}
lusty quest
#

more infos?

earnest phoenix
#

?

lusty quest
#

what did you expect to do?

misty sigil
#

is 2gb of ram enough for 2 bots

earnest phoenix
#

what did you expect to do?
@lusty quest i want to make it so like when you run it it gives you coins but it only works for me not anyone else like it doesnt even show the embed 😦

quartz kindle
#

depends on many factors, but 2gb is more than enough to start with

earnest phoenix
#

@quartz kindle could you help?

quartz kindle
#

with what

earnest phoenix
#

my work cmd its not working scroll up

lusty quest
#

@earnest phoenix do you create a DB entry for the other users?

earnest phoenix
#

?

#

im new to mongoDB

#

so i dont think so

lusty quest
#

@misty sigil depends on how large your bot is. With 110 Guilds i currently use 80-90MB with one bot

#

@earnest phoenix then you know why it wont work

earnest phoenix
#

ok so how do i make a DB entry?

lusty quest
#

how did you made yours?

restive pebble
#

lul

misty sigil
#

@misty sigil depends on how large your bot is. With 110 Guilds i currently use 80-90MB with one bot
@lusty quest what lib?

lusty quest
#

d.js-light

earnest phoenix
#

how did you made yours?
@lusty quest ?

lusty quest
#

@earnest phoenix there has to be atleast one Document with your Infos. How did you made this one?

earnest phoenix
#

uhh must be from previous attempts

#

im not sure

lusty quest
#

i suggest that you learn how to use mongoose. otherwise you will have a hard time understanding what is going on

earnest phoenix
#

uhh mongoose?

lusty quest
#

or Mongodb depends what you use as lib

earnest phoenix
#

what?

#

im using discord js

hot grove
#

hi what do u guys recommend for hosting

earnest phoenix
#

vps

restive pebble
#

lmao

earnest phoenix
#

bruh

#

just

#

tell

#

me

#

what

#

to

#

fix

lusty quest
#

thats easy. fix your knowledge on the lib you use for connecting to mongodb

earnest phoenix
#

im usinf discord.js

lusty quest
#

discord.js doesnt offer you a way to connect to mongodb

earnest phoenix
#

?

#

should i just use quick.db?

quartz kindle
#

how did you save your money in mongodb?

earnest phoenix
#
const Discord = require("discord.js")

module.exports = {
    name: "work",
    aliases: ["w"],
    category: "Currency",
    run: async (bot, message, args, err) => {
    let random = Math.floor(Math.random() * 100);
    let prevmoney = await bot.db.collection("Money").findOne({"User_ID": message.author.id})
    console.log(JSON.stringify(prevmoney))
    console.log("Random money: " + random)
    

    await bot.db.collection("Money").updateOne({"User_ID": message.author.id}, {$set:{Money: prevmoney ? prevmoney.Money + random : random}},  {upsert: true})
        
    let embed = new Discord.MessageEmbed()
        .setColor("RANDOM")
        .setTitle(`You worked!`)
        .setDescription(`You worked and got ${random} money!💰`)
        .setFooter("This command is in beta so it wont save your money we are sorry :(")
      message.channel.send(embed);
        
    }
}

``` code
quartz kindle
#

that command assumes there is already a saved profile for the user in mongodb

lusty quest
#

he has no idea how he got the profile

quartz kindle
#

if there is no profile saved for that user, it wont work

earnest phoenix
#

ok?

#

so how do i fix

quartz kindle
#

thats why im asking, how did you save yours

earnest phoenix
#

previous attemps

quartz kindle
#

how did you create a user with 0 money

earnest phoenix
#

?

quartz kindle
#

or how do you define an initial money

#

like if a user never used your bot before

#

how do you give him a starting amount of money

earnest phoenix
#

i dont know?

quartz kindle
#

how did you give yourself a starting amount of money?

lusty quest
#

i think the updateOne or a other method created it on a older attempt

earnest phoenix
#

how did you give yourself a starting amount of money?
@quartz kindle dont know how thoe tbh

quartz kindle
#

lol

slender wagon
#

Derku do not just copy codes

earnest phoenix
#

im not

#

lmfao

#

i made it

slender wagon
#

mmk

lusty quest
#

what did you use for connecting to your MongoDB?

earnest phoenix
#

mongoDB

#

okay deroku

#

is there a module on npmjs

quartz kindle
earnest phoenix
#

yes

quartz kindle
#

i dont use mongo, but something like this should work ```js
if(!prevmoney) {
await bot.db.collection("Money").updateOne({...},{$set:{Money:0}},{upsert:true})
prevmoney = 0;
}

#

or something along those lines

earnest phoenix
#

uhh ok

quartz kindle
#

if there is no previous money

#

create a new profile and give it 0 money

#

with the author id of course

earnest phoenix
#

so where would i put?

quartz kindle
#

upsert:true means create a new if an existing is not found

earnest phoenix
#

so where would i put?

quartz kindle
#

read your code

earnest phoenix
#

uhh

#

ok?

#

wait how do i make a start.bat?

#

lol i just moved to VSC

distant bramble
#

i am making a discord invite tarcker

#

so

#

i need to give it perms

#

what are the necessary perms for this

quartz kindle
#

create instant invite for creating invites

#

and manage server for reading them

#

i believe

distant bramble
#

ok

earnest phoenix
#

wait how do i make a start.bat?

distant bramble
#

tysm @quartz kindle

#

those are the perms

earnest phoenix
#

@quartz kindle still doesnt work

quartz kindle
#

well figure it out, sorry but i cant baby-sit you through everything

earnest phoenix
#

i need java nerds who are familiar with microoptimization and java's GC

#

so im doing a paperspigot plugin which is already trash in performance as is and im playing around with potion effects

#

the spigot api requires me to make a new potioneffect object to apply it to an entity

tulip ledge
#

Hi Tim! 👋

earnest phoenix
#

should i make the potion effect a final field in a class or just create a new instance everytime i want to apply it

#

i'm unsure how the GC behaves with that

#

(the properties of the potion effect don't ever change)

#

im doing my best to leave a low memory footprint

#
if(!prevmoney) {
      await bot.db.collection("Money").updateOne({"User_ID": message.author.id}, {$set:{Money: 0 }},{upsert:true})
      prevmoney = 0;
    } else {
      await bot.db.collection("Money").updateOne({"User_ID": message.author.id}, {$set:{Money: prevmoney ? prevmoney.Money + random : random}},  {upsert: true})
    }
```doesnt work
#

what doesn't work

#

the code

#

what doesn't work
@earnest phoenix

#

i know it's the code

#

what about it doesn't work

#

you can't just tell me "doesn't work" and expect me to understand what doesn't work

#

where's the context in that?

tulip ledge
#

Just giving us code and saying doesn't work we can't do much

earnest phoenix
#

that's like going to the doctors and telling them "cure me" without telling them anything else

tulip ledge
#

Provide us with more context please

lusty quest
#

he still got probably the issue that the code only works for him and dont create a new Document for non existing users

earnest phoenix
#

doesnt work dang it

tulip ledge
#

What

#

Does

#

Not

#

Work

earnest phoenix
#

the

#

code

tulip ledge
#

What piece

slender thistle
#

what in the code doesn't work

tulip ledge
#

What is not working

slender thistle
#

which part of it

earnest phoenix
#

thw whole

lusty quest
#

they want to know what you expect the code to do

earnest phoenix
#

to make it have the user 0 coins and then like im not sure tbh ;;-;;

#

it's almost been 8 minutes and we still do not know what doesn't work

#

correction

#

it's been 8 minutes

tulip ledge
#

We're not wizards or something

#

If you don't provide us with context we can't do much 🤷‍♂️

earnest phoenix
#

i donated my crystal ball to BLM so unfortunately i can't know what they want to say

quartz kindle
#

you have console.logs in your code

#

what do they say?

gray finch
#

First of all, where did you copy the bot

#

Second, did you modified it?

distant bramble
#

lets say i have a role named

#

verified

#

so i need i to assing it to a newly joined and verydied memeber to tat role

#

so

#

i need to have it

#

so it takes

#

the name

earnest phoenix
#

filter for it

distant bramble
#

i mean

earnest phoenix
distant bramble
#

rn i have to use the role id

earnest phoenix
#

stop
writing
your messages
like this
and instead write it in one cohesive message

#

that's why i said filter for it

distant bramble
#

kk

obtuse jolt
quartz kindle
#

and when somebody else runs the command? @earnest phoenix

earnest phoenix
#

nothing

#

i said

quartz kindle
#

the logs

#

what does it log

earnest phoenix
#

nothing

#

like the embed doesnt even show

quartz kindle
#

the logs should still show

earnest phoenix
#

nothign the cmd doesnt run

#

nope

quartz kindle
#

then put another log: console.log("bla") before the let random line

earnest phoenix
#

ok

#

then put another log: console.log("bla") before the let random line
@quartz kindle logs nothing..

obtuse jolt
#

it logs bla to the console

#

unless your console is broken or you dont have access to read it or something

earnest phoenix
#

no

#

its not borken

#

broken

celest basin
#

how can i make special theme look like this
and how can i active Shards

earnest phoenix
#

edit css

earnest phoenix
#

yeah

#

because you have a dif bot

obtuse jolt
#

thats not how it works

earnest phoenix
#

smh

obtuse jolt
#

console.log is a global thing on javascript

#

it works on browsers, nodejs bots and any thing that has javascript in it

#

you cant just not have it

celest basin
#

How do I get to CSS

earnest phoenix
#

smh I TRIED ITS NOT IT IT JUST DOESNYT WORK OK

#

How do I get to CSS
@celest basin lmao

celest basin
#

?

obtuse jolt
#

you put it in the detailed description @celest basin

earnest phoenix
#

@quartz kindle it logs nothing

celest basin
#

I do not have any options to access the CSS file

earnest phoenix
#

bruh

obtuse jolt
#

<style> tags

quartz kindle
#

if it still logs nothing even if its the first line of the run function, then the problem is not even there

earnest phoenix
#

?

quartz kindle
#

if the code doesnt get executed, the problem is not the code

#

is whatever comes before

#

the command handler

obtuse jolt
earnest phoenix
#

is whatever comes before
@quartz kindle but how

obtuse jolt
#

lmao it didnt work

#

rip

celest basin
#

yup

earnest phoenix
#

@quartz kindle yeah theres no problem

#

before cmd handler

obtuse jolt
#
<p style="text-align:center;">[TEXT]</p>```
earnest phoenix
#

@quartz kindle nope

#

not working

celest basin
#

@obtuse jolt I think you didn't understand what I mean

obtuse jolt
#

probably not

celest basin
obtuse jolt
#

damn i want that

earnest phoenix
#

BRUH HELP IT JUST DOESNT WORK

quartz kindle
#

@earnest phoenix "not working" doesnt help solving the issue

#

you need to communicate properly

#

explain, show code examples, test, debug, put console.logs everywhere, see until where your code works and where it stops working....
i said its possible that your problem is in the command handler, so you need to at least show the code for the command handler, if you dont understand anything else

earnest phoenix
#

@celest basin overwrite the css classes with the html style tag in your description

#

you can get the classes with inspect element

#

and you can access the existing stylesheet rules with whatever stylesheet viewer your browser has

#

if any

obtuse jolt
#

.titleandvote

quartz kindle
#

css gradients

plucky harness
#

how do u catch missing permissions error in discord.py

slender thistle
#

commands extension or on_message?

plucky harness
#

yea

slender thistle
#

which one

plucky harness
#

on_command_error

lost chasm
#

is this ProBot Birthday Event#3905 a scam?

plucky harness
#

isinstance(error, ??)

slender thistle
#

commands.MissingPermissions

hazy sparrow
#

how do i define args in command handler?

slender thistle
#

time to read the docs

summer torrent
#

@lost chasm probably

hazy sparrow
#

do i have to define everything?

summer torrent
plucky harness
#

lemme read again ig

slender thistle
#

Where are you looking?

plucky harness
#

i wasnt looking just came here to ask

lost chasm
#

@summer torrent doesn't seem smart to ask potential scammers if their product is a scam - I don't believe they will ever say "YES" 😄

slender thistle
#
>>> commands.MissingPermissions
<class 'discord.ext.commands.errors.MissingPermissions'>
>>> commands.BotMissingPermissions
<class 'discord.ext.commands.errors.BotMissingPermissions'>
#

If you are trying to do something within the command itself, a try-except is fine

plucky harness
#

ty now i can catch that

#

yea thanks

limpid pulsar
#

I have this problem
basically, I have many socketio listeners on my webserver
but when I open one page on my webserver, I only want it to trigger the event listener for that route
but it's triggering all of them
is there a node support server that I can ask in? or do you or do you know anyone who knows node express?

quartz kindle
#

show code

earnest phoenix
#

can someone help with my work and bal cmd? basicly my whole coin system

split hazel
#

Well then how can we help?

earnest phoenix
#

well im using Discord.js and mongoDb

#

and my work cmd just doesnt work

knotty steeple
#

Just saying "I get an error" doesn't give us enough information on your problem.

#

say what happens

#

any kind of error

#

show code

quartz kindle
#

we've already been through this

#

he wants some kind of magical fix that we magically come up with

earnest phoenix
#

?

knotty steeple
#

oh yea hes using magiclang just use magic to fix the magic code

#

ezzz

earnest phoenix
#

stfu

quartz kindle
#

@earnest phoenix "not working" doesnt help solving the issue
you need to communicate properly
explain, show code examples, test, debug, put console.logs everywhere, see until where your code works and where it stops working....
i said its possible that your problem is in the command handler, so you need to at least show the code for the command handler, if you dont understand anything else

knotty steeple
#

read this

earnest phoenix
#

i didnt even say not working lmfao

quartz kindle
#

well im using Discord.js and mongoDb
and my work cmd just doesnt work

misty sigil
#

and my work cmd just doesnt work
hmm

earnest phoenix
#

doesnt work

#

not not working

quartz kindle
#

its literally the same thing?

knotty steeple
#

are u just going to argue or post details about the problem

misty sigil
#

same, non useful information

knotty steeple
#

because if its the first stop

earnest phoenix
#

code: ```
const Discord = require("discord.js")

module.exports = {
name: "work",
aliases: ["w"],
category: "Currency",
run: async (bot, message, args, err) => {
let random = Math.floor(Math.random() * 100);
console.log("blah")
let prevmoney = await bot.db.collection("Money").findOne({"User_ID": message.author.id})
console.log(JSON.stringify(prevmoney))
console.log(Random money: ${random})

if(!prevmoney) {
  prevmoney = 0;
  await bot.db.collection("Money").updateOne({"User_ID": message.author.id}, {$set:{Money: 0 + prevmoney.Money + random}},{upsert:true})
}
let embed = new Discord.MessageEmbed()
    .setColor("RANDOM")
    .setTitle(`You worked!`)
    .setDescription(`You worked and got ${random} money!💰`)
    .setFooter("This command is in beta so it wont save your money we are sorry :(")
  

  message.channel.send(embed);

    
}

}

misty sigil
#

Have you tried console.log lines to figure out where it breaks?

quartz kindle
#

and you said the blah doesnt show in the console, correct?

earnest phoenix
#

mhm

#

correct

quartz kindle
#

so the problem is not there

#

not in this code

#

show other code

#

command handler

#

message event

#

etc

misty sigil
#

That’s a command handler or message event thing

earnest phoenix
#
const Discord = require("discord.js");

module.exports = {
  name: "vote",
  category: "Bot Information",
  aliases: ["rate", "upvote"],
  run: async (bot, message, args) => {
    let voteEmbed = new Discord.MessageEmbed()
      .setThumbnail("https://cdn.discordapp.com/avatars/701741237966995456/9f3bbf6be522c76191608334234be96f.png?size=128")
      .setColor("#2f3136")
      .setTitle(`Hay! ${message.author.username} want to vote me?`)
      .addFields(
        {
        name: "Did you know?",
        value: `\`\`If you vote you may get some special perks!\`\``,
        },
        {
        name: "Invite Link",
        value: "[Click Here](https://top.gg/bot/701741237966995456/vote)"
        }
      );
    message.channel.send(voteEmbed);
  }
};
``` another cmd
tulip ledge
#

Anybody knows what this mean?

null OkPacket {
  fieldCount: 0,
  affectedRows: 1,
  insertId: 0,
  serverStatus: 34,
  warningCount: 0,
  message: '(Rows matched: 1  Changed: 1  Warnings: 0',
  protocol41: true,
  changedRows: 1
} undefined
null OkPacket {
  fieldCount: 0,
  affectedRows: 1,
  insertId: 0,
  serverStatus: 34,
  warningCount: 0,
  message: '(Rows matched: 1  Changed: 1  Warnings: 0',
  protocol41: true,
  changedRows: 1
} undefined

I did a nsql query and did console.log after seeing it didn't change the data

knotty steeple
#

and this one works?

earnest phoenix
#

and this one works?
@knotty steeple i tihnk so

#

try it dek-vote

#

wait bot offline

delicate shore
#

See this

#

It always works at second time

#

Not first

#

Any sol

#

And it takes username

#

Not nickname

earnest phoenix
#

yeah it works @knotty steeple

misty sigil
#

Not for us

#

it’s a message event/command handler issue

#

show me your message event

earnest phoenix
#

?

misty sigil
#

for the handler

delicate shore
#

You saying me ?

misty sigil
#

no

delicate shore
#

Ok

golden condor
#

@tulip ledge null is a class which is OkPacket

quartz kindle
#

show code pcgamer

delicate shore
#

PG*

#

Ok

quartz kindle
#

@earnest phoenix as i said before, the problem is not in the commands. the problem happens BEFORE the command

golden condor
#

PC gamer pog

tulip ledge
#

null is a class which is OkPacket ok yeah well I can read why is it happening tho?

golden condor
earnest phoenix
quartz kindle
#

so you need to show the code for your message event, or command handler, or main file, or whatever how your bot works

#

not there either

misty sigil
#

that’s not a problem

earnest phoenix
#

so what is

misty sigil
#

show us where the message stuff is done

#

the message event. commonly under /events/message.js

knotty steeple
#

show us the message event

golden condor
#

No need to be like that, I'm just tryna point that out as I can't read your mind to see whether or not you can read it @tulip ledge

tulip ledge
#

I just need to know why it's happening

quartz kindle
#

it shows the rows were changed tho

delicate shore
#

  if(command === "embarrass"){
    let channel = msg.channel
    let member = msg.mentions.members.first() || msg.member,
  user = member.user;   channel.createWebhook(`${user.username}`, {
    avatar: `${user.displayAvatarURL()}`,
 }).then(webhook => console.log(`Created webhook ${webhook}`)).catch(console.error);
  
    const embed = new Discord.MessageEmbed()
    .setColor("RANDOM")
    .setDescription(`test`)
    .setFooter("ok")
    
    try {
        const webhooks = await channel.fetchWebhooks();
        const webhook = webhooks.first();

      var emb = ['I genuinely like the nutshack.' ,
                 'Trollface is my favorite meme. PROBLEM?',
                'I get legitimetly scared when I play five nights at freddys',
                'delet this.',
                'I once deep fried a vibrator.',
                'Sometimes.. I think why am I alive',
                'I could not teach my son how to ride a bike cause I can not ride one myself.',
                'I am a gamer, therefore, I am better than you.',
                'my favorite emote is :joy:',
                'I vomit over my girlfriend while she’s sleeping and clean it all up before she wakes up.',
                'My grandma runs faster than me, and she is 95 with arthritis.',
                'Thanks for the gold kind stranger!',
                'I have a crush on the map from dora the explorer.',
                'I got my parents to buy me a Macbook for gaming',
                ]
      
        await webhook.send(emb[Math.floor(Math.random() * emb.length)], {
            username: `${user.username}`,
            avatarURL: `${user.displayAvatarURL()}`,
        //    embeds: [embed],
        });
    } catch (error) {
    msg.reply("Err ahhh! Do I have the perms to manage weebhooks?")
        console.error('Error trying to send: ', error);
    }
    }``` @quartz kindle
golden condor
#

USE A BIN PLEASE

delicate shore
earnest phoenix
quartz kindle
#

@delicate shore you have two mistakes there

hazy sparrow
#

i get this whenever i do a command. te command works fine though

delicate shore
#

ok?

quartz kindle
#

firs, dont create a new webhook on every single command, the channel will become filled with tons of webhooks in the server configuration

delicate shore
#

oh

#

then?

golden condor
#

Can these people read I wonder

delicate shore
#

edit it?

quartz kindle
#

second, youre not waiting for the webhook creation to finish

#

you're immediatelly sending a message regardless if the webhook exists or not

misty sigil
#

@quartz kindle @misty sigil this?
@earnest phoenix EUREKA! your line 102 if/else if returns if you aren’t the owner

#

try removing the line 102 if/else, and that should work

quartz kindle
#

so basically you made all your commands owner only lol

misty sigil
#

yes Tim

earnest phoenix
#

oh lol

misty sigil
#

that’s basically it

knotty steeple
#

🧠

#

owner only but can't run it

hazy sparrow
misty sigil
#

it’s

golden condor
#

Can you read pls

misty sigil
#

R E A D

quartz kindle
#

cannot send empty message

delicate shore
#

hey @quartz kindle then hwo can i make it edit

knotty steeple
#

post code

delicate shore
#

but first create

golden condor
#

Please people read

knotty steeple
#

also

delicate shore
#

one

knotty steeple
#

read

hazy sparrow
#

i dont have any empty strings

earnest phoenix
#

wait so that MEANS THE CODE WOULD WORK?

misty sigil
#

YES

knotty steeple
#

do u send variable contents

misty sigil
earnest phoenix
#

YES

#

OK LET ME TRY

#

NOW

knotty steeple
#

do u send variable contents
@hazy sparrow

hazy sparrow
#

whats that

knotty steeple
#

like send(variable) a

hazy sparrow
#

umm

knotty steeple
#

umm?

hazy sparrow
#
message.channel.send(message.channel.send( "**:game_die:" + "|" + message.author.username + "** rolls a dice!" + `\n` + ":blank:" + "|" + "It's a " + "**" + Math.floor(Math.random() * (6- 1 + 1) + 1) + "**"))
       
earnest phoenix
#

Wtf

hazy sparrow
#

oh wait

#

i got it

knotty steeple
#

why is there 2 functions

hazy sparrow
#

i found the mistake

earnest phoenix
#

Sending a message inside a send message function

knotty steeple
#

ur send is in a send

earnest phoenix
knotty steeple
#

mate

delicate shore
#

tim help

knotty steeple
#

tim u should be paid for this

misty sigil
#

What do you need help with

hazy sparrow
#

lmao true

misty sigil
#

(Plus saying "help" without any details is useless, refrain from doing that)

tulip ledge
#

message.channel.send(message.channel.send(

delicate shore
#

tim help
pls*

tulip ledge
#

Noice

delicate shore
#

(Plus saying "help" without any details is useless, refrain from doing that)
@misty sigil he knows my ques

misty sigil
#

@delicate shore pls*
@delicate shore With what

#

is it editing messages?

delicate shore
#

nooo

#

webhooks

misty sigil
#

could’ve just said that

delicate shore
#

ok

#

@quartz kindle how can i add a timeout so it deltes the weebhook after 2 sec

#

because delteing weebhook don't delete msg

tulip ledge
#

setTimeout

earnest phoenix
#

Deleting a webhook doesn't affect a message

delicate shore
#

but what is usage

quartz kindle
#

@delicate shore when a webhook is created, it is added to the guilds webhooks list. you probably dont want to edit existing webhooks to avoid interfering with them, but you also dont want to spam new webhooks for no reason.

  1. await guild.fetchWebhooks
  2. webhook = webhooks.find(webhook => webhook.name === "my webhook here")
  3. if(!webhook) { webhook = await channel.createWebhook() }
  4. if(webhook.channelID !== message.channel) { await webhook.edit() }
  5. webhook.send()
delicate shore
#

o

quartz kindle
#

so basically you want to maintain a single webhook for your bot for that guild

delicate shore
#

ok

quartz kindle
#

if it doesnt exist, create it

delicate shore
#

but isn't it better

#

if bot deletes it

#

after 1 sec

quartz kindle
#

then every time you use the command, get this webhook, and check if its in the right channel, if not, change the channel

#

then send

earnest phoenix
#

If discord doesn't pay tim we should raid discord HQ xQcM

quartz kindle
#

Lol

delicate shore
#

btw

#

can u help with that also

#

deleting webhooks

quartz kindle
#

you cant delete webhooks

#

not the message

earnest phoenix
#

NEW STREAM: raiding discord HQ

quartz kindle
#

unless your bot has manage messages

delicate shore
#

you cant delete webhooks
@quartz kindle i cannot delete the webhook?

quartz kindle
#

messages sent via webhook have no author, they dont belong to your bot

delicate shore
#

ik

#

i am talking about

quartz kindle
#

they can only be deleted by users with delete message permission

delicate shore
#

webhook

#

can they be deleted?

#

with my bot

quartz kindle
#

the webhook itself yes

#

it can be deleted from the guild

#

so it cant be used anymore

delicate shore
#
//All code here
setTimeout(() => {
       webhook.delete()

      }, 3000)
     
#

like this?

quartz kindle
#

yes

#

but

#

it would be better to keep it

delicate shore
#

o

quartz kindle
#

so you dont have to create -> send -> delete

#

on every single command

delicate shore
#

but i am getting confused

#

in otherway

earnest phoenix
#

Yea creating webhooks again and again and again fastly would be an api abuse

delicate shore
#

o

earnest phoenix
#

Discord doesn't tolerate api abuse very well

#

can someone try dek-w

#

pls

delicate shore
#

dek-w

quartz kindle
#

however, using the webhook edit method introduces a race condition

#

but better like that than spamming webhook creates

delicate shore
#

however, using the webhook edit method introduces a race condition
@quartz kindle and eleting one?

#

deleting*

quartz kindle
#

if you delete, then you need to create next time

#

thats spamming webhook creates

delicate shore
#

o

#

i am getting confused with editing

#

because

earnest phoenix
#

(node:6140) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'remove' of undefined

 let tounmute = message.mentions.members.first() || bot.users.cache.get(args[0]);
 const config = await MuteRole.findOne({ GuildID: message.guild.id });
 let muterole = config.RoleID;

                tounmute.roles.remove(muterole);```

help ?
#

Second one is a user

#

Users don't have roles

misty sigil
#

it’d be message.guild.cache.get(args[0]) right?

earnest phoenix
#

message.guild.members.cache.get(args[0])

tulip ledge
#

What

#

yeah like VLotrex said

quartz kindle
#

i mean, if its easier to understand, just use the create delete method

misty sigil
#

oh right

quartz kindle
#

but it makes much more api requests than the edit method

delicate shore
#

  if(command === "embarrass"){
    let channel = msg.channel
    let member = msg.mentions.members.first() || msg.member,
  user = member.user; 

. webhook = webhooks.find(webhook => webhook.name === "Black Sheep")
 await guild.fetchWebhooks

 if(!webhook) { webhook = await channel.createWebhook(`${user.username}`, {
    avatar: `${user.displayAvatarURL()}`,
 })
 if(webhook.channelID !== message.channel) { await webhook.edit() }

.then(webhook => console.log(`Created webhook ${webhook}`)).catch(console.error);
  

    try {
        const webhooks = await channel.fetchWebhooks();
        const webhook = webhooks.first();

      var emb = [responses]
      
        await webhook.edit(emb[Math.floor(Math.random() * emb.length)], {
            username: `${user.username}`,
            avatarURL: `${user.displayAvatarURL()}`,
        //    embeds: [embed],
        });
    } catch (error) {
    msg.reply("Err ahhh! Do I have the perms to manage weebhooks?")
        console.error('Error trying to send: ', error);
    }
    
    
  }
#

something like this?

tulip ledge
#

please use a bin for big code blocks

misty sigil
#

weebhook

tulip ledge
#

Try and see

delicate shore
quartz kindle
#

but well

#

with discord.js doesnt really matter

#

they dont cache webhooks

delicate shore
#

o

#

so means i can

#

delete

#

and

#

create?

quartz kindle
#

its still more, but yes

#

for example, lets do a comparison

delicate shore
#

o

#

did u check the code

quartz kindle
#
// create delete method
1. create
2. send
3. delete

1. create
2. send
3. delete

1. create
2. send
3. delete
#
// edit method without caching
1. fetch
2. create
3. send

1. fetch
2. send

1. fetch
2. send

1. fetch
2. edit (if changed channels)
3. send
#
// edit method with caching
1. fetch
2. create
3. send

1. send

1. send

1. edit (if changed channels)
2. send
#

each section would be a user command

#

so 4 commands with the create method, do 12 api requests

#

4 commands with the edit method, would do 10 requests if you change channels once

delicate shore
#

o

quartz kindle
#

4 commands using the edit method with caching and changing channels once, would do 7 requests

delicate shore
#

ok

quartz kindle
#

its a matter of efficiency basically

hazy sparrow
#

does anyone here has nitro? i need a help from them

delicate shore
#

problem is

#

i dunno how to code

#

it

#

😦

quartz kindle
#

i mean

#

the create delete method is easier i guess

#

so just go for that

delicate shore
#
 if(command === "embarrass"){
    let channel = msg.channel
    let member = msg.mentions.members.first() || msg.member,
  user = member.user; 
let webhook = webhooks.find(webhook => webhook.name === "Black Sheep")
 await guild.fetchWebhooks
 if(!webhook) { webhook = await channel.createWebhook(`${user.username}`, {
    avatar: `${user.displayAvatarURL()}`,
 })
 if(webhook.channelID !== message.channel) { await webhook.edit() }
.then(webhook => console.log(`Created webhook ${webhook}`)).catch(console.error);
    try {
        const webhooks = await channel.fetchWebhooks();
        const webhook = webhooks.first();
      var emb = [responses]
        await webhook.edit(emb[Math.floor(Math.random() * emb.length)], {
            username: `${user.username}`,
            avatarURL: `${user.displayAvatarURL()}`
        });
    } catch (error) {
    msg.reply("Err ahhh! Do I have the perms to manage webhooks?")
        console.error('Error trying to send: ', error);
    }
  }```
#

i know it's incorrect

quartz kindle
#

just go back to how you had it before

#

and use the create delete method

delicate shore
#

ok

#

but i might get rate limited

quartz kindle
#

the problem you had before was that you were not awaiting the create

#

and also not deleting it properly

#

thats why it only worked on the second command

hazy sparrow
#

tim a general question, do you know how to get a animated emoji id without nitro?

misty sigil
#

what do u want

indigo geyser
#

use \

quartz kindle
#

you'd need someone to use it i guess

indigo geyser
#

nvm

hazy sparrow
#

but i cant even type the emoji

#

it animated

delicate shore
#

:wobble:

hazy sparrow
#

and i dont have nitro

indigo geyser
#

yeah sorry

#

use a bot

delicate shore
hazy sparrow
#

-_-

#

i need it FOR a bot

indigo geyser
#

well, use that bot

#

pass the id

#

the name*

quartz kindle
#

:runmeow:

indigo geyser
#

and get the id

delicate shore
#
  if(command === "embarrass"){
    let channel = msg.channel
    let member = msg.mentions.members.first() || msg.member,
  user = member.user;   channel.createWebhook(`${user.username}`, {
    avatar: `${user.displayAvatarURL()}`,
 }).then(webhook => console.log(`Created webhook ${webhook}`)).catch(console.error);
  
    const embed = new Discord.MessageEmbed()
    .setColor("RANDOM")
    .setDescription(`test`)
    .setFooter("ok")
    
    try {
        const webhooks = await channel.fetchWebhooks();
        const webhook = webhooks.first();

      var emb = ['I genuinely like the nutshack.' ,
                 'Trollface is my favorite meme. PROBLEM?',
                'I get legitimetly scared when I play five nights at freddys',
                'delet this.',
                'I once deep fried a vibrator.',
                'Sometimes.. I think why am I alive',
                'I could not teach my son how to ride a bike cause I can not ride one myself.',
                'I am a gamer, therefore, I am better than you.',
                'my favorite emote is :joy:',
                'I vomit over my girlfriend while she’s sleeping and clean it all up before she wakes up.',
                'My grandma runs faster than me, and she is 95 with arthritis.',
                'Thanks for the gold kind stranger!',
                'I have a crush on the map from dora the explorer.',
                'I got my parents to buy me a Macbook for gaming',
                ]
      
        await webhook.send(emb[Math.floor(Math.random() * emb.length)], {
            username: `${user.username}`,
            avatarURL: `${user.displayAvatarURL()}`,
        //    embeds: [embed],
        });
    } catch (error) {
    msg.reply("Err ahhh! Do I have the perms to manage weebhooks?")
        console.error('Error trying to send: ', error);
    }
    
    
  }
 
hazy sparrow
#

ok let me try that

delicate shore
#

i am awaiting tim

#

but it doesn't work on first try

quartz kindle
#

you're not

delicate shore
#

await webhook.send

quartz kindle
#

let webhook = await channel.createWebhook()
await webhook.send()
await webhook.delete()

hazy sparrow
#

it justs sends :coinflip:

#

no id

delicate shore
#

@hazy sparrow there is a bot

#

called Animated Emoji

#

it can use any animated emoji

#

i have that in my server

#

use that

hazy sparrow
#

can you send the link in dm

restive furnace
#

just do \:emoji:.

delicate shore
#

:wobble:.

#

it works

#

:wobble:

#

but it only shows a sec

hazy sparrow
#

i know

#

i can catch it that fast

#

;-;

delicate shore
#

alright tim

#

i got rate limited

hazy sparrow
#

i want the id of this

slender thistle
#

436677458339823636

hazy sparrow
#

ok ty

rigid maple
#

How do I delete my answer when I ask a bot question ?

#

pls ticket me

earnest phoenix
#

message.delete()

summer torrent
#

"ticket me"

rigid maple
#

Deleting the message of the bot ? @earnest phoenix

summer torrent
#

<Message>.delete() will delete the message

earnest phoenix
#

@quartz kindle well uhh the command (work command) it works but when the user runs again it doesnt store the number like the cmd works but the number doesnt get stored into the database

delicate shore
hazy sparrow
delicate shore
#

it generates a random color

#

i mean

#

no

#

it sets the embed

#

color to random

earnest phoenix
#

yup

hazy sparrow
#

do i have to define RANDOM?

sudden geyser
#

No.

delicate shore
hazy sparrow
#

ok great

delicate shore
#

this red color is random

sudden geyser
#

The library generates the random color for you.

delicate shore
#

it can be anything

hazy sparrow
#

this is something i never knew i wanted

earnest phoenix
#

@quartz kindle well uhh the command (work command) it works but when the user runs again it doesnt store the number like the cmd works but the number doesnt get stored into the database

sudden geyser
delicate shore
#

help me if you can

rigid maple
#

did not delete my messages @earnest phoenix

rigid maple
#

How do I delete my answer when I ask a bot question ?

summer torrent
#

<Message>.delete

hazy sparrow
#

@delicate shore can i set the thumbnail to "RANDOM" for it to give random colours?

earnest phoenix
#

You must be kidding.

delicate shore
#

@delicate shore can i set the thumbnail to "RANDOM" for it to give random colours?
@hazy sparrow no

hazy sparrow
#

oof ok

delicate shore
#

thumnail cannot be set to random

#

you gotta provide a link or directory

hazy sparrow
#

is there a way to do so?

delicate shore
#

where it is saved

#

no

hazy sparrow
#

owo bot does it though

delicate shore
#

what

earnest phoenix
#

@misty sigil

well uhh the command (work command) it works but when the user runs again it doesnt store the number like the cmd works but the number doesnt get stored into the database

delicate shore
#

oh that

hazy sparrow
delicate shore
#

that

misty sigil
#

is an api

delicate shore
#

is random

#

api

#

yep

hazy sparrow
#

ohh

misty sigil
#

or it could be canvas

hazy sparrow
#

ok thanks

delicate shore
#

np

#

@misty sigil can u help me

misty sigil
#

with what

delicate shore
#

my bot does not delte the webhook

misty sigil
#

idk

rigid maple
#

@summer torrent I'm using v11 doesn't it have to be like this message.delete()

delicate shore
#

😦

misty sigil
#

i've never worked with hooks

delicate shore
#

ok

#

@quartz kindle can u help

quartz kindle
#

did you even fix your code?

#

looks still the same for me

delicate shore
#

i added delete

summer torrent
#

@rigid maple it is

delicate shore
#

it's not working tho

quartz kindle
#

you are not awaiting the creation

rigid maple
#

?

quartz kindle
#

you have to await the createWebhook

delicate shore
#

how tho

earnest phoenix
#

well uhh the command (work command) it works but when the user runs again it doesnt store the number like the cmd works but the number doesnt get stored into the database

delicate shore
#

i am awating

quartz kindle
#

like i said before

rigid maple
#

<Message>.delete() ?

quartz kindle
#

let webhook = await channel.createWebhook()

#

you dont need to fetch

#

furthermore that fetching is wrong

#

it will fetch the first webhook, whatever it is, even if its other people's webhooks

delicate shore
#

let webhook = await channel.createWebhook()
@quartz kindle do i need to entter name and avatar here as well?

quartz kindle
#

no

#

avatar is optional

delicate shore
#

name?

#

because i entered it

quartz kindle
#

there is no name during creation

delicate shore
#

earlier

quartz kindle
#

only when sending

delicate shore
#

o

#

k

quartz kindle
#

when creating there is only avatar and reason

earnest phoenix
#

well uhh the command (work command) it works but when the user runs again it doesnt store the number like the cmd works but the number doesnt get stored into the database
@quartz kindle could you help?

golden condor
#

@quartz kindle what about the name?

quartz kindle
#

i meant username

#

webhook name is one thing, webhook username is another thing

#

should have clarified

delicate shore
#

it makes webhooks but now don't even send

#

msg

#

and keeps saying error

#

and logs nothing

quartz kindle
#

dude

delicate shore
#

yes?

quartz kindle
delicate shore
#

what

quartz kindle
#

thats where you are creating the webhook

#

thats what you need to await

#

not add another empty createWebhook

delicate shore
#

oootgoogogogogg

hazy sparrow
#

how do i edit a meddage?

#

message*

quartz kindle
#

message.edit()

delicate shore
quartz kindle
#

remove the .then()

#

you can leave the .catch()

delicate shore
#

ok

earnest phoenix
delicate shore
#

now?

#

still not working

#

@quartz kindle

quartz kindle
#

.>

#

remove .then() on .then(woefhowuehouwhg) means remove .then(wouehouwehouwhge) not remove .then and leave (owuehowuhetuwe)

lusty quest
#

tim did you have a stroke?

quartz kindle
#

fpheiheoghpeihpi

delicate shore
#

o

#

but @quartz kindle that was just for console

quartz kindle
#

yes, but thats how promise chaining works

#

if you do let bla = await a(a).then(b).then(c)

#

bla gets the result of c, not a

delicate shore
#

ok

#

it worked

#

thanks

peak venture
#
    let ShipTable = [];
    console.log(Array.length)
    for(var j=0; j < Array.length; j ++) {
      ShipTable.push(`<tr><td>${Array[j][3]}}]</td><td>[${Array[j][2]}]</td><td>${Array[j][1]}</td><td>${Array[j][0]}</td><td>${(Array[j][4] / Array[j][1]).toFixed(0)}</td></tr>`)
    }```
quartz kindle
#

Array.length makes no sense

peak venture
#

nvm. found it

quartz kindle
#

Array is the base array object, you should not be using it as a variable

slender thistle
#

Quite easier to keep track of that stuff unlike in programming languages where casing doesn't matter

peak venture
#

reworked the ShipTable.toString() and then replaced using regex

quartz kindle
#

array.toString() does the same as array.join(",")

still badge
quartz kindle
#

you need array.join("") if you want to join with no delimiter

still badge
#

anyone no y i get this error?
its in my play command

lusty quest
#

more code?

still badge
#

?

quartz kindle
#

that error means you're trying to use .get on something that doesnt exist

still badge
misty sigil
#

that doesn't contain get

barren basin
#

Hello, does someone know how to open an image as an array ?

misty sigil
#

oh now id does

still badge
#

yeah

#

so idk y im getting that error

quartz kindle
#

then if you get that error, it means client.musicQueue doesnt exist

#

@barren basin open an image as an array?

#

what kind of array?

#

array of pixel data?

barren basin
#

yes

still badge
#

then wat i use for it?

#

if its not musicQueue

quartz kindle
#

you need to use an image parser or something. which language are you using?

barren basin
#

javascript

quartz kindle
#

@still badge did you copy paste that code?

#

@barren basin the canvas library can do that

#

and probably other image manipulation libraries can as well

#

such as jimp and sharp

still badge
#

no i did most of it myself i got the url from a github i think

#

sry the link

barren basin
#

ok thank you i'll see that

quartz kindle
#

well if you created it yourself...

obtuse jolt
#

What’s a good file based database for nodejs

still badge
#

im a noob

#

cause it dont work

obtuse jolt
#

Lots of reads and writes

quartz kindle
#

client.musicQueue is not a standard property

#

it doesnt exist in discord.js

#

unless you create it yourself

#

the code you are using, assumes there is a client.musicQueue created somewhere, by you

lusty quest
#

@obtuse jolt use sqlite if you want to have it local

still badge
#

hold on

lusty quest
#

otherwise something like Postgres, mysql or mongodb

hazy sparrow
#

how do i define args in a command handler? do i have to define discord, then client, then message, then args?

grizzled raven
#

mongodb and others can also be local, sqlite is just the easiest to setup

quartz kindle
#

doesnt matter what you define

still badge
#

i got it

hazy sparrow
#

i meant

lusty quest
#

@hazy sparrow ```

cmd.run(client, message, args, settings);

quartz kindle
#

you only need that in your main file

hazy sparrow
#

ah ok

quartz kindle
#

the file where you do client.login()

still badge
#

@quartz kindle ty lol i was missing a collection

quartz kindle
#

👍

hazy sparrow
quartz kindle
#

what about it

lusty quest
#

this splits your arguments off your prefix

hazy sparrow
#

do i have to put it in the command handler also?

lusty quest
#

yes

quartz kindle
#

if you want it to be accessible by your commands, yes

hazy sparrow
#

okay to do so i have to define message

#

for which i have to defiine Discord.Client()

quartz kindle
#

no...

hazy sparrow
#

for which i have to define discord.js"

lusty quest
#

on Message event?

quartz kindle
#

^

lusty quest
#

this gives you the message object

#

and for client you can just pass your client to the command handler

#

or attach it to your events if you have a event handler

quartz kindle
#

or just get it from any other discord class

hazy sparrow
#

so wll this work

module.exports = {
    name: 'roll',
    description: "this is a dice command. it generates random numbers from 1-x or by default, 6. .",
    execute(message){
        
        const roll = Math.floor(Math.random() * (6- 1 + 1) + 1)
        const args = message.content.slice(prefix.length).split(/ +/);
       
         if(roll === 1) {
        message.channel.send( "**:game_die:" + "|" + message.author.username + "** rolls a dice!\n" + ":blank:" + "|" + " Booo... It's a " +  "**1**")
       
         }  if(roll === 2) {
            message.channel.send( "**:game_die:" + "|" + message.author.username + "** rolls a dice!\n" + ":blank:" + "|" + " Booo... It's a " +  "**2**")

         } if(roll === 3) {
            message.channel.send( "**:game_die:" + "|" + message.author.username + "** rolls a dice!\n" + ":blank:" + "|" + " Nice! It's a " +  "**3**")
    
         } if(roll === 4) {
            message.channel.send( "**:game_die:" + "|" + message.author.username + "** rolls a dice!\n" + ":blank:" + "|" + " Yikes It's a " +  "**4**")
    
         } if(roll === 5) {
            message.channel.send( "**:game_die:" + "|" + message.author.username + "** rolls a dice!\n" + ":blank:" + "|" + " What a lucky day it is! It's a " +  "**5**")
         
         } if(roll === 6/>6) {
            message.channel.send( "**:game_die:" + "|" + message.author.username + "** rolls a dice!\n" + ":blank:" + "|" + " WHOA! It's a " +  "**6**")
    
         }
    
    
        }
     
    
    
    }   
    
#

@quartz kindle @lusty quest

lean swan
#

Anyone know how to fix this?
UnhandledPromiseRejectionWarning: Error: Something took too long to do.
It happened after try to kick all ALT spamming bot

hazy sparrow
#

dont care about the number in the string

knotty steeple
#

otherwise something like Postgres, mysql or mongodb
@lusty quest those aren't file based

#

aka 1 single file for all data

lusty quest
#

@knotty steeple i know but a single file database is anyways a bad idea

knotty steeple
#

@hazy sparrow that looks horrendous

lusty quest
#

they are slow af

knotty steeple
#

no not really

lusty quest
#

wait until it aproaches 1GB

knotty steeple
#

sqlite can handle 1tb what is u saying

lusty quest
#

there is a difference between a json db and sqlite

knotty steeple
#

why would u use json as a db

lusty quest
#

idk some people here do

#

@hazy sparrow wtf is this?

hazy sparrow
#

a dice command...

lusty quest
#

yea but why 6 different messages?

knotty steeple
#

make it 1 message

hazy sparrow
#

i anted to give out a diffrent message for each number

#

wanted*

knotty steeple
#

if u want uniqueness use an array of messages and get from the array based on the roll

#

using 6 ifs is inefficient