#development

1 messages · Page 1257 of 1

umbral zealot
#

just change the target's css directly if you own it. if you do'nt own it, you shoudn't be touching the css

unkempt ocean
#

I don't know how to change iframe's css target

cinder patio
#

You can change the style only via javascript as far as I know

unkempt ocean
#

without js

cinder patio
#

get the element(s) from the iframe, then change their style

earnest phoenix
#

How would I have my bot send a message when someone boosts my server?

#

( Sorry if I am interrupting )

unkempt ocean
#

its my own website, but it's not showing css @umbral zealot

umbral zealot
#

Why are you using iframes? Is this the 90's? 😛

unkempt ocean
#

I can see it on inspect mode

#

trying to show my website on my bot's description

umbral zealot
#

Then edit the CSS in your website?

cinder patio
#

@earnest phoenix what language and library?

earnest phoenix
#

@cinder patio djs

unkempt ocean
#

my website looks right, but iframe llooks like just html

cinder patio
#

In your message event, if the message.type is USER_PREMIUM_GUILD_SUBSCRIPTION, then someone boosted your server

#

I am not sure how to get who boosted, though

earnest phoenix
#

discord doesn't provide that data

#

so there's no certainty that you can get it

#

however

umbral zealot
#

well, d.js does

earnest phoenix
#

^^

#

uh

#

am i blind or is there no booster data there

#

boost messages are one way to get who boosted

cinder patio
#

I think the author of the message is the one who boosted

earnest phoenix
#

oh

umbral zealot
#

Polo is the booster.

earnest phoenix
#

that's the author

#

Maybe if they had like the Server Booster role

umbral zealot
#

Who else would be the author of a booster message?

earnest phoenix
#

you can't tell which role is the booster role as of right now iirc

umbral zealot
earnest phoenix
#

yeah boost messages are one way however guilds can turn off boost messages

#

or you can check user flags

#

If they're on

#

@earnest phoenix

#

or see the list of boosters and check if the user is in them

#

it's finnicky, discord doesn't provide actual data about it

umbral zealot
#

So. step 1, turn on booster messages. step 2, listen to messages system messages with the USER_PREMIUM_GUILD_SUBSCRIPTION type. thumbs

earnest phoenix
#

yeah that's the only way as of right now (that works)

#

every other way isn't able to detect when a current booster reboosts

#

fun fact

#

the event for it exists

#

user accounts receive it

#

discord just doesn't send it to bots for whatever reason

#

i need to know that who is inviting members in my server with welcome message

#

how to set that ??

#

plzz help??

#

i need to know that who is inviting members in my server with welcome message
@earnest phoenix ...why?

#

there are better ways

#

because i want to know all the details of my server

#

discord also doesn't send who invited the user

umbral zealot
#

Yeah you can sort of track invites but not temporary ones, only permanent ones.

earnest phoenix
#

you can also track temp ones with enough dedication

#

dear discord api,

fuck you

sincerely,
invite manager bots

#

i need to know who has invited the user

#

these aren't accurate though

#

i sent you a screenshot above, read it

umbral zealot
earnest phoenix
#

ok

umbral zealot
#

But again this method is unreliable at best, and doesn't work at all if you let users make their own temporary invites

earnest phoenix
#

@earnest phoenix use invite managers api

#

ok

faint prism
#

anyone have an idea any occasionally there will still be a gif preview in a message even after the link has been removed?

#

for example

earnest phoenix
#

does it appear for other people too

faint prism
#

yeah

earnest phoenix
#

it's discord messing up then

faint prism
#

it's somewhat rare

#

I've considered adding a sleep to the edit

earnest phoenix
#

i'd suggest using an embed and setting the image url to the loading gif

faint prism
#

hmm yeah

crisp meteor
#

Can I request a simple code?

sudden geyser
#

what do you mean

solemn leaf
#

@faint prism add a delay it might be like if a message gets deleted to fast it cant be remvoed and is god mode

crisp meteor
#

I want a code ban discord.js 11

sudden geyser
#

We can't just give you code, but we can help you on how to write it via if you have a question

#

also you should migrate to v12 soon.

solemn leaf
#

@crisp meteor okay we wont stop you from coding it

crisp meteor
#
client.on('message', message => {
  if (!message.guild) return;
  if (message.content.startsWith('!ban')) {
    const user = message.mentions.users.first();
    if (user) {
      const member = message.guild.member(user);
      if (member) {
        member
          .ban({
            reason: 'They were bad!',
          })
          .then(() => {
            message.reply(`Successfully banned ${user.tag}`);
          })
          .catch(err => {
            message.reply('I was unable to ban the member');
            console.error(err);
          });
      } else {
        message.reply("That user isn't in this guild!");
      }
    } else {
      message.reply("You didn't mention the user to ban!");
    }
  }
});```
#

Well can you help me convert it into a version 11 ?

earnest phoenix
#

use the docs

crisp meteor
#

I could not xD

earnest phoenix
#

that sucks xD

crisp meteor
#

Quasi complicated

umbral zealot
snow urchin
earnest phoenix
#

run is a promise

#

try catch won't work unless you await it

charred geyser
#

is anyone particularly familiar with the mongoose module of node js

#

im trying to make a sort of xp leaderboard

#

and i am able to find and sort objects in the collection

#

but im not sure how to get just the level and create a leaderboard out of it

#
    const leaderboard = await profiles
      .find({ guildId: message.guild.id })
      .sort({ level: -1, xp: -1 })
      .limit(10);
    console.log(leaderboard);
#

im finding the guild id and then sorting level and xp

#

and limiting it to 10

#

so it console logs a list of the top 10 levels

#

but obviously i dont wanan send the entire object

#
  {
    xp: 223,
    level: 10,
    _id: 5f676fbe165e2dce55b48144,
    guildId: '750784696283299911',
    guildName: 'example',
    userId: '428555808117227520',
    username: 'example#0001',
    __v: 0
  }
#

i wanna get just level and xp for each object

#

oh and username

#

and then format it into an embed

crisp meteor
#
client.on("message", (message) => {
if(message.content === prefix+"ban") {
if (!message.guild.member(message.author).hasPermission('BAN_MEMBERS')) { return message.channel.send('You do not have the permission for ban users"  !'); }
if (!message.guild.member(client.user).hasPermission('BAN_MEMBERS')) { return message.channel.send('I don\'t have the permission for ban users" !'); }
if (message.mentions.users.size === 0) { return message.channel.send('You need to ping a user !'); }
let banMember = message.guild.member(message.mentions.users.first());
if (!banMember) { return message.channel.send('User not found!'); }
banMember.ban().then((member) => {
message.channel.send(member.displayName + " has left the server")
message.channel.send(member.displayName + " has been successfully banned by " + message.author);
})
}
});```
#

He replies to me and writes "You need to ping a user !"

charred geyser
#

jesus christ

crisp meteor
#

And when I choose the person to block, nothing is done

charred geyser
#

the formatting on that

earnest phoenix
#

bots have a gender

charred geyser
#

😮

#

lmao

opal plank
#

indeed, mine identifies as a Gender Ratelimiter Fluid

charred geyser
#

lmfao

earnest phoenix
#

how do you expect the mention collection to have something in it when you're telling it if the message content equals exactly to prefix+ban

opal plank
#

cof cof strartswith

earnest phoenix
#

you can't order a cheeseburger and then complain that you didn't get fries because you only said you wanted a cheeseburger, no?

opal plank
#

cof cof

charred geyser
#

lol

#

erwinnnn

#

pls halp

#

:3

opal plank
#

no, shoo

charred geyser
#

😭

opal plank
#

dunno mongo

crisp meteor
#

@earnest phoenix Fix it , I didn't get you ):

opal plank
#

im postgres supremacist

earnest phoenix
#

i'm not your slave, fix it yourself

opal plank
#

its your code, if you want someone to work on it just pay them

crisp meteor
#

wtf

opal plank
#

¯_(ツ)_/¯

charred geyser
#

bruh how is he saying cry fix it

#

lmao

opal plank
#

@charred geyser ever heard of concat?

#

or push() ?

charred geyser
#

@crisp meteor your code is searching for exactly prefix + "ban" so it cant find the mention becuase to it there is no other content

#

i think

opal plank
#

lemme give you a tip

charred geyser
#

😮

opal plank
#

if you using embed description, its a string

charred geyser
#

thats cool

opal plank
#

concat can merge strings

charred geyser
#

yeah

opal plank
#

if you using fields

charred geyser
#

i just read it

opal plank
#

fields is an array

#

😉

charred geyser
#

ilysm

opal plank
charred geyser
#

pogger champ

#

erwin you are my pog champ

opal plank
crisp meteor
#

Well this code works,
But when I write the prefix + kick
Don't say mention member

#
client.on("message", (message) => {
if(message.content === prefix+"kick") {
var member= message.mentions.members.first();
member.kick().then((member) => {
message.channel.send(":wave: " + member.displayName + " has been successfully kicked :point_right: ");
}).catch(() => {
message.channel.send("Access Denied");
});
}
});
vernal rivet
#

O.o

opal plank
#

imagine hardcoding prefix

#

also var

vernal rivet
#

Imagine not using a command handler

opal plank
#

add your prefix there rather than hardcoding it

vernal rivet
#

^^^^

crisp meteor
#

In case you typed -kick

#

He does not respond with anything

vernal rivet
#

Also var is safe to use in some cases, I looked it up a while back, it has to with scopes shrug

crisp meteor
#

But if you write -kick @crisp meteor

opal plank
#

var be like: scopes? whats that? never heard of

crisp meteor
#

Works

opal plank
#

var is good for iterations

vernal rivet
#

No has to do with scopes I mean

opal plank
#

there are cases you'd use vars

#

but 99% of the time you dont

vernal rivet
#

Mhm

opal plank
#

that just means you copied snippets from somewhere thats 4 years old

vernal rivet
#

Lol

#

I mean var I believe is safer if it's out of scope. shrug I have to find it again.

silent cloud
#

yo

#

why it writes to me

#
if(!msg.member.hasPermission("ADMINISTRATOR")){
            return msg.channel.send(":x: | Вы должны быть администратором сервера что бы загрузить backup!");
        }
#

error in hasPermission

vernal rivet
#

Var is different in different languages. Most oop Lang's uses var more than Lang's like js

#

What is the error?

silent cloud
#
2020-09-20T17:05:04.926055+00:00 app[worker.1]:         if(!msg.member.hasPermission("ADMINISTRATOR")){
2020-09-20T17:05:04.926056+00:00 app[worker.1]:                        ^
2020-09-20T17:05:04.926057+00:00 app[worker.1]: 
2020-09-20T17:05:04.926057+00:00 app[worker.1]: TypeError: Cannot read property 'hasPermission' of null
charred geyser
#
    if (!message.member.hasPermission("ADMINISTRATOR")) {
      return message.channel.send(
        ":x: | Вы должны быть администратором сервера что бы загрузить backup!"
      );
    }
#

maybe?

silent cloud
#

no

#

bot.on('message', msg => {

vernal rivet
#

hasPermission doesn't exist on member. Ahhhhhhhh I am guessing msg is type of Message, so that would make member be typeof GuildMember

silent cloud
#

wait a minute

#

i will test it

vernal rivet
#

Ok

charred geyser
#

mhm

opal plank
#

what?

#

member is null u bork

silent cloud
#

?

opal plank
#

has permission of null

silent cloud
#

so?

opal plank
#

member is null

vernal rivet
#

Oh right

opal plank
#

so its likely a DM

charred geyser
#

lol

silent cloud
#

so its likely a DM
@opal plank nope

#

not dm

#

in server

#

i can invite you

opal plank
#

check for member

vernal rivet
#

I forgot that it complaining about it, and object it's is attached to

opal plank
#

if member exist

charred geyser
#

console log

#

message.member

#

maybe

silent cloud
#

nooo

opal plank
#

could be banned member too i guess

charred geyser
#

ok

#

yeah

silent cloud
#

could be banned member too i guess
@opal plank can i invite you ?

#

you see

charred geyser
#

nooo
@silent cloud why?

opal plank
#

i'd rather not

charred geyser
#

bruh we dont need to be on the server

vernal rivet
#

msg is message.

opal plank
#

keep support here if possible

#

specially cuz im on 100 servers on this account

silent cloud
#

i want to show it to you but rly

#

idk

charred geyser
#

@silent cloud try console logging message.member

silent cloud
#

why

opal plank
#

cant be arsed to go leave one or two server just for a 5 minute endeavor

charred geyser
#

would you just try

tidal marlin
#

How does not declaring type of variables work in JS? Like not using 'let' 'var' or 'const'

charred geyser
#

it is too difficult

opal plank
#

marek

#

Ts

vernal rivet
#

Nope

silent cloud
#

hmmm

opal plank
#

oh, THAT

vernal rivet
#

You can use comment blocks

opal plank
#

let is mutable, so is var

tidal marlin
#

But I have variable that doesn't have anything in front of it

opal plank
#

const is constant, its value cannot change and will error once it attempts to be changed

tidal marlin
#

and it works

#

I ask how it works

opal plank
#

thats global

vernal rivet
#

Yes type doesn't matter in js

tidal marlin
#

Oh

#

so I made global variable

#

okay thanks

opal plank
#

bad

#

indeed

#

type DOES matter in js btw

#

:c

tidal marlin
#

Yes

charred geyser
tidal marlin
#

One thing in my RPG file

opal plank
#

Yes type doesn't matter in js

sudden geyser
#

JS has weak typing

charred geyser
#

@silent cloud did you try?

vernal rivet
#

I mean when declaring it doesn't as it changes it's type based on value

tidal marlin
#

has string and cause of it numbers don't add up correctly

opal plank
#

'string' * number works

#

actually

#

here

charred geyser
#

damn i really do be the only one without green name 😭

tidal marlin
#

Will it be multiplied?

sudden geyser
#

no

sudden geyser
#

yeah hence "weak typing" except JS wanted to get down and really take the crown

opal plank
#

js is a butifouel oop lang

vernal rivet
tidal marlin
#

Nice

vernal rivet
#

C# is the best oop in my opinion

tidal marlin
#

just use brainfuck

opal plank
#

Scratch best lang, no room for arguments

vernal rivet
sudden geyser
#

I'm starting to dislike oop

vernal rivet
#

If you use scratch, there is something wrong with you

#

Unless your very young then maybe

restive furnace
#

C++ is best for OOP and DOP in my opinion, for FOP, well Haskell is best.

sudden geyser
#

It's the sound of taking computer science

cinder patio
#

All of those "inconsistencies" can be explained

vernal rivet
#

Cpp is the best, but as fair as beginner friendly c# is actually more friendly

sudden geyser
#

Yeah they all can broken down to make sense, but imagine if you didn't have to live with most (if not, all) of those inconsistencies

silent cloud
#

fixed

#

i deleted this functionkekw

sudden geyser
#

even python doesn't allow you to do something like undefined = "hi"

silent cloud
#

but now new

vernal rivet
#

Why would you?

restive furnace
#

Cpp is the best, but as fair as beginner friendly c# is actually more friendly
hmm yes, ||pointers||.

sudden geyser
#

Me?

silent cloud
#

im do a backup bot

vernal rivet
#

Yes

sudden geyser
#

I wouldn't, but why would the language allow that?

silent cloud
#

how i can create json files with backup data

earnest phoenix
#

The C family is hell
Hail ECMAScript

silent cloud
#

in glitch it working, heroku not

vernal rivet
#

shrug idk man, but doesn't make them bad

opal plank
vernal rivet
#

Lol

opal plank
#

out of all that other ones, i think this is the only one i dont particularly undertsand

sudden geyser
#

Imo it does. It's just more holes that are just left there

charred geyser
#

lol

earnest phoenix
#

how i can create json files with backup data
@silent cloud WHY JSON DATABASE WHY WHY WHY WHY WHY LIKE FIVE WHYs WHY

charred geyser
#

yeah

sudden geyser
#

That one kinda makes sense

charred geyser
#

just use a proper database

cinder patio
#

0.1 + 0.2 doesn't really equal 0.3

#

What lite said ^

silent cloud
#

@silent cloud WHY JSON DATABASE WHY WHY WHY WHY WHY LIKE FIVE WHYs WHY
@earnest phoenix bcos it rly

vernal rivet
#

It's a bool statment

opal plank
#

howcome 0.5 + 0.1 does equal 0.6 then?

restive furnace
#

The C family is hell
Hail ECMAScript
Well....... C is a pointer ||hell||. C++ isn't so bad, C# is MS Java.

earnest phoenix
#

0.1 + 0.2 doesn't equal 0.3
@cinder patio because it equals 3/10

sudden geyser
#

most langs have that 0.1 + 0.2 floating math issue

opal plank
#

i thought floats didnt work like that

vernal rivet
main trench
#

Does anyone have the d.js link on how to make a command to set a certain channel for a specific command? Like "*setchannel Botspam #bot-spam"

cinder patio
#

You want to restrict a certain command to a specific channel, via a command

main trench
#

In a way yeah

cinder patio
#

You would have to use a database for that, just saying

main trench
#

Hmm

cinder patio
#

There isn't a discord.js tutorial on that

main trench
#

Ah dang

cinder patio
#

You can still try to create it yourself, though.

main trench
#

I'll try but I'm not exactly sure how to do it lol

cinder patio
#

You'll have to learn how to use databases first, and which database to use.

opal plank
#

you get extra points for using postgres

#

😉

main trench
#

Any good recommendations for that?

vernal rivet
#

Lol

opal plank
#

postgres might be too advanced depending on what you going for tbh

#

you might wanna go mongo or quick

#

maybe even sqllite

vernal rivet
#

Quick is the easiest to learn tbh

main trench
#

Aight

#

How exactly do db's work?

opal plank
vernal rivet
#

Lol

opal plank
#

its basically storing data

main trench
#

Lel

opal plank
#

you shape the data format

#

depending on the database it changes too

#

just get something thats ACID compliant

main trench
#

Got it

stark abyss
#

how to make a bar chart for xp

proud hawk
#

How do some bots trigger bypass too like when someone bypasses the n word the bot still automatically deletes it and warns u how come, is it possible?

silent cloud
#

HOW TO CONNECT DB AND HEROKU

stark abyss
nimble kiln
#

heroku.connect(database)

stark abyss
#

what db

nimble kiln
#

repl.deleteAllCode(plusDatabase)

stark abyss
#

how to make a bar chat for xp

main trench
#

Hrmm im getting errors trying to install quick.db

#

Nvm figured out the issue

#

Actually take that back I didnt lmao

grand path
#

@quartz kindle

async function handleUserInput(msg) {
try {
const content = msg.content;
if(content.includes(myBotId)){
return;
}
const inputArgs = content.split(" ");
if(inputArgs.length > 0) {
const command = inputArgs[0].toLowerCase();

        console.log(`Content: ${JSON.stringify(msg.content)}`);

        if (command === COMMAND.PING.command && inputArgs.length === 1) {
            msg.reply('pong');
            return;
        }
        else if(command === COMMAND.SLAP.command) {
            doActionToUser(msg, "slaps", inputArgs);
        }
        else if(command === COMMAND.KISS.command) {
            doActionToUser(msg, "kisses", inputArgs);
        }
        else if(command === COMMAND.WITTYTODO.command) {
            setTimeout(function() {
                console.log('heavy command started');
                wittyToDo(msg, inputArgs);
            }, 2);
            console.log('heavy command executed');
        }
        else if(command === COMMAND.HELP.command) {
            msg.reply(helpText());
        }
    }
} catch (err) {
    console.log("Error: " + err.stack);
    msg.reply(helpText());
}

}

function startDiscord() {
client = new Discord.Client();

client.on('ready', () => {
    console.log(`Logged in as ${client.user.tag}!`);
});

client.on('message', async(msg) => {
    const run = async () => {
        handleUserInput(msg);
    };
    run();
});

client.login(token);

}

#

discord blocks the user requests

solemn latch
#

ah chat spam

grand path
#

if the previous user request didn't get a reply

#

I mean if the previous reply runs in background for 2 mins.. the next request keeps waiting

#

!slap should have gotten the reply instantly

stark abyss
#

{
"310418778423033858": {
"weeklyDonation": 90000
},
"388306694813384704": {
"weeklyDonation": 995001
},
"438518069091106816": {
"weeklyDonation": 20000
}
}

How can I sort this json file by weeklyDonation (most to least) of how can I get all of them from highest to lowest

solemn latch
#

js is single threaded

#

if your doing a task thats "blocking" other tasks, then its blocking those tasks

prime narwhal
#

@quartz kindle

async function handleUserInput(msg) {
try {
const content = msg.content;
if(content.includes(myBotId)){
return;
}
const inputArgs = content.split(" ");
if(inputArgs.length > 0) {
const command = inputArgs[0].toLowerCase();

        console.log(`Content: ${JSON.stringify(msg.content)}`);

        if (command === COMMAND.PING.command && inputArgs.length === 1) {
            msg.reply('pong');
            return;
        }
        else if(command === COMMAND.SLAP.command) {
            doActionToUser(msg, "slaps", inputArgs);
        }
        else if(command === COMMAND.KISS.command) {
            doActionToUser(msg, "kisses", inputArgs);
        }
        else if(command === COMMAND.WITTYTODO.command) {
            setTimeout(function() {
                console.log('heavy command started');
                wittyToDo(msg, inputArgs);
            }, 2);
            console.log('heavy command executed');
        }
        else if(command === COMMAND.HELP.command) {
            msg.reply(helpText());
        }
    }
} catch (err) {
    console.log("Error: " + err.stack);
    msg.reply(helpText());
}

}

function startDiscord() {
client = new Discord.Client();

client.on('ready', () => {
    console.log(`Logged in as ${client.user.tag}!`);
});

client.on('message', async(msg) => {
    const run = async () => {
        handleUserInput(msg);
    };
    run();
});

client.login(token);

}
@grand path wath app for create bot???

solemn latch
#

please dont quote that

stark abyss
#

use a bastebin pls

grand path
#

@prime narwhal don't get u

earnest phoenix
#

if your doing a task thats "blocking" other tasks, then its blocking those tasks
@solemn latch don't confuse threading with asynchronous work

solemn latch
#

you can use vsc

stark abyss
#

and you just pinged two peopel

solemn latch
#

is he not complaining about tasks being blocked @earnest phoenix ?

earnest phoenix
#

@stark abyss stop using json as a db

stark abyss
#

i am using it for around 20 people

earnest phoenix
#

woo from what i can see they just said it's blocking

stark abyss
#

you still want me to stop?

grand path
#

u blaming JS now? come on..

earnest phoenix
#

yes, i do

grand path
#

discord is not receiving input

stark abyss
#

i don't understand

grand path
#

problem should be in discord library

solemn latch
#

🤔

#

i didnt read the article could be crap. just was the first result

stark abyss
#

@earnest phoenix

#

what

earnest phoenix
#

what what

stark abyss
#

bruh

prime narwhal
#

what application do you use to create bot's ???

stark abyss
#

discord portal ??

earnest phoenix
#

there isn't an "application"

solemn latch
#

its just programming, any decent code editor will do

stark abyss
#

cry what db do you recommend then

earnest phoenix
#

depends on what you want to do

#

small scale, i personally use sqlite

#

large scale, postgresql

stark abyss
#

i suck at db they are too complicated for me

earnest phoenix
#

there are also some nosql databases (that i haven't used) like mongo

stark abyss
#

i have spent so much time trying to learn how to use them but it never works for me

#

i tried mongodb

solemn latch
#

databases are generally much easier than json db's

stark abyss
prime narwhal
#

your watch viniccius13???kkk

#

kk

#

discord.js is good application for create bot's???

solemn latch
#

sure

#

if you like js

#

but you dont make it in discordjs, discordjs is just a library

vernal rivet
#

application?

#

what woo said

fringe axle
#

Code?

solemn latch
#

cmdNamd
did you mean to use cmdName?

opal plank
#

feels like google recommendations/corrections tbh

#

Did you mean spaghetti?

solemn latch
#

lol

faint prism
#

@faint prism add a delay it might be like if a message gets deleted to fast it cant be remvoed and is god mode
@solemn leaf I could probably delete instead of edit if an embed still exists

solemn latch
#

someone needs to make an image generator with google corrections @opal plank

opal plank
#

and send it on every 5th message

solemn latch
#

lmao

opal plank
#

Raidbots got nothing on us, recommendation bot is where its at

#

true spam

#

Did you mean 'true ham'?

earnest phoenix
#

i used to have a grammar nazi module on my bot

#

the first implementation of it i forgot to... make it ignore bots

#

so it just kept on correcting itself

opal plank
#

the moment i added a +say command

#

oh my...

#

lemme see if i can find it, one sec

prime narwhal
#

cmdname

#

???

faint prism
#

i used to have a grammar nazi module on my bot
@earnest phoenix I love it

solemn leaf
#

dont delete

#

bcs then youll have the same bug

solemn latch
#

did you type the name of the variable wrong @prime narwhal

solemn leaf
#

and dont ping pls

#

erwin

#

erwin

#

hey erwin

opal plank
#

@earnest phoenix

prime narwhal
#

omg

solemn leaf
#
process.on('uncaughtException', async (err) => {
    let me = await bot.users.fetch("485987127809671168")

    me.send({ files: [{ attachment: `${err}`, name: 'err.txt' }] });
}).on('unhandledRejection', async (err) => {
    let me = await bot.users.fetch("485987127809671168")

    me.send({ files: [{ attachment: `${err}`, name: 'err.txt' }] });
})
opal plank
#

remember kids, always remove bots from your commandws

earnest phoenix
#

oh my

opal plank
#

had to instantly kill the bot

solemn latch
#

lel

solemn leaf
#

erwin

#

100% complete?

opal plank
#

@solemn leaf i am well aware that you recieved help from Tim and someone else earlier today

#

not proud of you

solemn leaf
#

yes you are lol

#

and

opal plank
#

no im not

solemn leaf
#

I dont even need buff

earnest phoenix
#

this was wayyy back in 2017

solemn leaf
#

I can just remove buf

#

and just put the string

opal plank
#

huh?

solemn leaf
#

it works still

opal plank
#

not sure if attachments work like that

solemn leaf
#
process.on('uncaughtException', async (err) => {
    let me = await bot.users.fetch("485987127809671168")

    me.send({ files: [{ attachment: `${err}`, name: 'err.txt' }] });
}).on('unhandledRejection', async (err) => {
    let me = await bot.users.fetch("485987127809671168")

    me.send({ files: [{ attachment: `${err}`, name: 'err.txt' }] });
})
#

try it

opal plank
#

meh too lazy for that

#

might grab a beer and go code tbh

#

i gotta debug a library too and generate errors

cerulean salmon
#

how can i know which invite code the newly joined member used ?

earnest phoenix
#

me need help

#

i am using VSC

opal plank
#

be very careful about what you ask next

#

@earnest phoenix and just ask your question

solemn latch
#

🤔

opal plank
#

dontasktoask

earnest phoenix
#
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)')]
solemn latch
#

wasnt even a question

earnest phoenix
#

what does this mean

opal plank
earnest phoenix
#

the error line was client.run('TOKEN')

opal plank
#

also VSC is an editor

earnest phoenix
#

how to fix it

opal plank
#

unrelated to whats outputting that

earnest phoenix
#

kk

#

Another question, why does it say: raise RuntimeError("PyNaCl library needed in order to use voice") RuntimeError: PyNaCl library needed in order to use voice

drifting wedge
#

out of 10

#

how much do you guys rate mongodb?

sudden geyser
#

sql gang

obtuse jolt
#

hell yeah

#

i rate this ^^

solemn latch
#

also am an sql user

digital ibex
#

mongodb is quite good

sudden geyser
#

I've not actually used MongoDB, but it's a fine choice. If you're still worried you could try it out and see what you like and don't like.

digital ibex
#

i'd say an 8, 0exe

earnest phoenix
#

how much do you guys rate mongodb?
@drifting wedge 8.314159/10

stark abyss
#

how to create the bar chart

#

like 407/500

cinder patio
#

You won't usually see a difference in the database until whatever you're doing is getting very big. You should choice based on ease of use at first.

stark abyss
#

anyone know how to make that

solemn latch
#

as in a bar?

#

in what lib/language

stark abyss
#

yeah djs

solemn latch
#

like canvas?

stark abyss
#

yep

#

I know how to create the canvas but unsure about that bar chart

solemn latch
#

make a grey rectangle, put a white rectangle above it for the width you want

#

for example, a 100px wide grey rectangle, with another rectangle above it thats 87 pixels wide would be 87% full

stark abyss
#

oh

opal plank
#

now we just grab a nice bottle, sit down, relax, and wait for the ratelimits to pour in

sudden geyser
#

The attached emoji feels weird.

opal plank
#

no nitro

#

¯_(ツ)_/¯

eternal osprey
#

hey guys

#

await coro(*args, **kwargs)
TypeError: on_message() takes 0 positional arguments but 1 was given

#
import os 
import discord, requests, itertools
from discord.ext import tasks
from dotenv import load_dotenv 
from nike_module import get_nike_shoes, get_links


client = discord.Client()  

NIKE_SNKRS_URL = 'https://www.nike.com/fr/launch'

channel = client.get_channel(742361041882841159)

s = requests.Session() 

r = s.get(NIKE_SNKRS_URL) 


@client.event 
async def on_ready(): 
    '''Event Handler: Handles the event when the client 
    has established a connection to Discord.'''
    print(f'{client.user} has connected to Discord!') 

@client.event
async def on_message(): 
    '''Bot replies back with sneaker info when it sees a command.'''

@tasks.loop()
async def the_loop_ting():


        if r.ok:
            shoes = get_nike_shoes()  
            links = get_links()  
            bot_message = ''  

            for shoe, link in zip(shoes, links): 
                bot_message += shoe + '\n' + link + '\n\n'

            bot_message += 'For more Nike Sneakers releases and info: ' + NIKE_SNKRS_URL
            await channel.send(bot_message) 
        else: 
            await channel.send('We could not make contact with the Nike site. Our conclusion is that the Nike site is down. Please try again later!')

if __name__ == '__main__':
    
    client.run('') 
    
#

i tried the loop it

#

but it was showing me that error

#

any fixes?

sudden geyser
#

on_message takes a single argument, message

#

You defined it with no parameters.

#

@eternal osprey

eternal osprey
#

so i should do:

sudden geyser
eternal osprey
#

on_message(message):

still merlin
#

I have a quick.db question, If I wanted to make a custom prefix with quick.db would multiple files work, Like I make a command file (setprefix.js) and set my prefix to args 1 or 2 in that file, Would I still be able to define my prefix as whatever used in setprefix.js? like er

Setprefix.js
```db.set(prefix_${message.guild.id}, args[2]) //(<setprefix !)
if(db.prefix_${message.guild.id}, db.set(prefix_<)) //never used quick.db before, Im hoping this will set < to the prefix if no prefix is given or a prefix has never been set
return message.channel.send('No prefix given!');

index.js
```const prefix = db.get(`prefix_${message.guild.id}`) //get my prefix-
if(`db.prefix_${message.guild.id}`, db.set(`prefix_<`)) //idk if this should be in setprefix.js or here
slender wagon
#

how can i make canvas faster to send?

misty sigil
#

more POWWWWEEEEERRRRRR ig

#

damn the jeremy clarkson got to me there

stark abyss
#

Could not parse font file

#

what does that mean

earnest phoenix
#

how do i let people able to change the prefix of my bot?

misty sigil
#

With a database

opal plank
#

@earnest phoenix map your prefixes

misty sigil
#

NOT A JSON FILE

opal plank
#

and database

earnest phoenix
#

I knowwwwww

opal plank
#

then why u ask?

earnest phoenix
#

But wtf do i go to learn the code

opal plank
#

you need to know 3 things

#

await/promises, database query and maps

#

thats all

earnest phoenix
#

I JUST GOTTA LEARN THE CODEE

#

WHERES A PLACE WHERE I CAN LEARNNN

stark abyss
#

calm down

earnest phoenix
#

RE

misty sigil
#

Depends what DB you wanna use MATE

earnest phoenix
#

huh ;-;

misty sigil
#

what db do you wanna use

stark abyss
#

not all database have the same thing

earnest phoenix
#

ohh

#

npm i quick.db

opal plank
#

startup//
import all prefixes from database
map all prefixes with their guild ids

//message event
if message starts with (prefix map.get(guild) || standart prefix)

// command to add prefix
map.set(guild prefix)
database.set(guild, prefix)

#

thats the framework there mate

earnest phoenix
#

huh ;-;

opal plank
#

those are the steps you need

misty sigil
#

That’s literally everything you need

opal plank
#

^^

earnest phoenix
#

Alright

opal plank
#

how you do that is up to you, you could use arrays to map your prefixes, or patch them onto guild along with d,js, you can do MANY things, you have plenty of paths to take. THe one i gave you is the simpliest one

earnest phoenix
#

But how do i even get into the database, all i did in command prompt was "Npm i quick.db" I dont knnow what to do from there

opal plank
#

read the docs on quick db

earnest phoenix
#

Aight

opal plank
#

check its examples

earnest phoenix
#

Alright

#

Some quick background?

opal plank
#

I simply cannot fathom the fact that i just removed my ratelimiter and there hasnt been a single ratelimit yet, like wtf Ross?

slender wagon
#

so no one has a clue on how i can make canvas send faster?

opal plank
earnest phoenix
#

IS IT SOME QUICK BACKGROUND?!

opal plank
#

@slender wagon some friends are porting their image generator to Rust, its much faster

#

though Rust is a language

#

up to you

#

¯_(ツ)_/¯

slender wagon
#

wait how does that work

#

lol

opal plank
#

code your own image generator in Rust rather than using canvas js

#

¯_(ツ)_/¯

earnest phoenix
#

I give up on coding shit

slender wagon
#

so basically not use canvas?

opal plank
#

not what i said

slender wagon
#

@earnest phoenix then you don't belong in this channel

opal plank
#

you using Javascript

#

correct?

slender wagon
#

yeah i'm using js

opal plank
#

Rust is a completely different language

slender wagon
#

yeah ik

#

do you use rust?

opal plank
#

so if you use Rust to generate images like an API you can make it much quicker

#

thats what a couple of my friends have been doing

slender wagon
#

oh

#

okay

earnest phoenix
#

@earnest phoenix then you don't belong in this channel
@slender wagon Shut up, thats what u all are, clowns that clown on people that are new to something, and dont know how to be nice, the only people who ever helped me here was Erwin, and Mattew

slender wagon
#

but do u know a way to make canvas a bit faster?

opal plank
#

nope

slender wagon
#

alright

#

@earnest phoenix this is the dev channel if u want drama feel free to go in dm's

earnest phoenix
#

Then dont be mean ¯_(ツ)_/¯

opal plank
#

BRUH

#

this is one bucket load of shit

#

ngl

#

NOT A SINGLE RATELIMIT

#

aparently the library doesnt like ME limiting it

earnest phoenix
#

oof

opal plank
#

just throw at it without a single fucking ms of dlay and it behaves

earnest phoenix
#

how can I get the name of a sent emoji?
ex: /emoji papagan

opal plank
#

try to help it by limiting the events and it clogs

#

like wtf

earnest phoenix
#

:papagan:

#

bro hahaha?

opal plank
earnest phoenix
#

you must be kidding

opal plank
#

fucking twitch mate

#

never again

vernal rivet
earnest phoenix
#

Twitch is dumb, the moderation system is full of assholes, lol

opal plank
#

what?

#

im talking about bots not users

#

👀

earnest phoenix
#

Still

vernal rivet
#

i hear something about rust

opal plank
#

yes

earnest phoenix
#

Twitch

vernal rivet
#

are we making fun of it?

opal plank
#

its stable like wtf

vernal rivet
#

oofers

opal plank
#

this is twice as many as it has ever gotten with my aid

#

i give up ngl

slender wagon
#

what are you trying to do

vernal rivet
#

and that is why i don't do that lol

opal plank
#

i was helping the library to handle IRC JOIN connections by limiting it on my end

#

aparently the lib enjoys more that i just throw the joins at it without delay

#

and let it handle itself

#

rather than me trying to ratelimit it

slender wagon
#

lol

opal plank
#

AHA!

#

IT FAILED

vernal rivet
#

oh?

opal plank
#

ITS NOT MY SHIT VODE

#

thank god

vernal rivet
#

rip

#

serenity is wack kellyded

slender wagon
#

damn how can i draw the presence status in canvas

sudden geyser
#

serenity as in the library?

vernal rivet
#

yes

stark abyss
#

my code was here

earnest phoenix
#

you got told already to stop using json as a db and that structure is god awful

stark abyss
#

never mind

#

it's not even that bad

#

i am using for 10-20 members i am not learning db for that

#

i have spent so much time trying to learn db

earnest phoenix
#

you say that now but you're going to throw a fit when something corrupts

misty sigil
stark abyss
#

liek i said i am only using for around maximum of 20 users

misty sigil
#

it will still corrupt

stark abyss
#

and the only thing its gonna store is their id and a value

misty sigil
#

JUST USE QUICK.DB

#

PLEASE

stark abyss
#

I fucking suck at life

#

i don't know how to code

misty sigil
#

it’s as simple as db.set("userID_value", "value")

#

and db.get("userID_value")

stark abyss
#

its gonna be very small file

#

it will be fine

misty sigil
#

NO

#

IT WILL NOT BE

stark abyss
#

x2

misty sigil
#

NO

stark abyss
#

is the max

misty sigil
#

NO

#

NO

stark abyss
#

calm your ppHop

misty sigil
#

db.set(${user.id}_weeklydonation, number)

#

db.get(${user.id}_weeklydonation)

stark abyss
#

omg i am not spending another 3 hours on this

misty sigil
#

it’s not hard

#

quick.db is so fucking easy a toddler could do it

#

quick.db is so fucking easy a toddler could do it

#

quick.db is so fucking easy a toddler could do it

#

UGH WILL YOU FUCK OFF DISCORD

stark abyss
#

okay cool

#

i use quick db

#

calm down sir

misty sigil
#

ok

hardy matrix
#

i need help making my sever

#

i just need help wit bots

silver lintel
#

How good is quick.db? I'm trying MongoDB but it's complicated

misty sigil
#

quick.db’s ok ig but mongo always better

stark abyss
#

I can’t even start with mongodb

#

Imagine being that dumb

silver lintel
#

How is mongo better

misty sigil
#

more scale able

vernal rivet
#

quick.db is really easy to use and understand, but it does make a local sqlite file where it stores its data. mongo is better as it is remote, and is more scale able.

silver lintel
#

I'm only working on like 20 user's inventory balance and serverinfo stuff

snow urchin
#

the scroll u see, is as far as it goes

#

so ye.. big

misty sigil
#

Looks like you console.logged client

vernal rivet
#

its an object

#

yea it looks like the client object

snow urchin
#

its not client

#

dont think so anyways

#

not logged anywhere at all

misty sigil
#

also that pfp

vernal rivet
#

it could also be axios

misty sigil
#

I love it

snow urchin
#

dont use axios

misty sigil
#

it could be node-fetch or something

snow urchin
#

nah it aint

vernal rivet
#

shrug what is using http?

snow urchin
#

hmm

#

nothing rly

#

node-fetch is but dk why it would throw that fat dump

vernal rivet
#

because it was called on the object

misty sigil
#

check for console.log things

vernal rivet
#

if you don't use the body property of the response object then it will throw something like that

torn ravine
#

@misty sigil when was the last atMods

misty sigil
#

gimme sec

sharp thicket
#

Can you please talk about dev stuff

#

Hmm 🧐

#

Second one

#

☝️

sudden geyser
#

They're both going to be quite slow tbh if you're cloning

valid frigate
#

why are you cloning a value

sharp thicket
#

Yeah lol

valid frigate
#

ic

sudden geyser
#

That only applies to non-primitive types though I believe

#

Actually nvm, it's an array so i'm wrong

#

Yeah I was thinking of arguments to the method. In my opinion, just use the one you want. I'd go with the second one.

vernal rivet
#

arguments ||when they are called parameters, but no one cares||

humble gyro
#

@opal plank ```ts
type ChannelMethod = 'a' | 'b' | 'c';

faint prism
#

arguments ||when they are called parameters, but no one cares||
@vernal rivet

parameters:
class MyClass (parameters)

arguments:
...
new MyClass(arguments)
...

vernal rivet
#

they are still called parameters, at least what i was taught. formal and actual parameters

faint prism
#
public class Person
{
  private string Name {get; set;}

  public Person(string name) // parameters
  {
    Name = name;
  }
}

Person newPerson = new Person("Mike"); // argument
vernal rivet
#

you do realized that arguments are still parameters, correct? formal parameters are what is being asked for. actual parameter is what is being passed in. you can fact check me, you can call it arguments, but i personally like actual parameters more, because that makes a shit ton more sense.

sudden geyser
#

By convention most people consider parameter to be like variables.

#

It's just nice to have something to differentiate

vernal rivet
#

that makes actually no sense.

sudden geyser
#

What about it makes no sense?

faint prism
#

that's just what I learned in college was the naming for it

vernal rivet
#

formal and actual parameters, Formal parameters are what is being asked by the method, function, or constructor. Actual parameters are what value is being passed in. its the actual value that the method/function/constructor will use.

faint prism
#

sounds a lot like an argument

sudden geyser
#

You can call them this and that. In the end they both share the same meaning to both of you.

faint prism
#

I'm okay with that

vernal rivet
#

agree to disagree

solemn leaf
#

what does this error mean

#
axios = require('axios').default; axios.get('https://www.youtube.com/results?search_query=owo+you%27re+so+warm').then(function (response) {
    let str = require("util").inspect(response.data);
    console.log(str)
    let a = str.match(/\shref\=\"(\/watch\?v\=.*)\"/)[1];
    let buf = new Buffer.from(`${a}`)
    message.author.send({
        files: [{
            attachment: buf, name: 'answer.txt' }] })
})
sudden geyser
#

It means something was too long.

#

Can you share what line the error caame from.

solemn leaf
#

that is it

#

in the pastebin

#

and it would have to come from let str

#

?

sudden geyser
#

Is it coming from message.author.send(...)?

#

I doubt it would come from util.inspect

solemn leaf
#

Mk

#

so

#

answer.txt

#

is to long of an name?

sudden geyser
#

No, a as a variable.

#

Also why are you scraping YouTube?

#

Why not use their public API?

solemn leaf
#

public api

#

as qpita

sudden geyser
#

Is the quota too low for what you're doing? Cache the result?

solemn leaf
#

qouta

#

yeah

#

its only 100 songs globally

snow urchin
#

how can i find the source of a missing permissions error? happens every few hours

sudden geyser
#

Handling promise errors is usually the best step else they can be vague.

solemn leaf
#
axios = require('axios').default
const ytdl = require("ytdl-core");
axios.get('https://www.youtube.com/results?search_query=owo+you%27re+so+warm').then(function (response) {
    let str = require("util").inspect(response.data);
    console.log(str)
    let a = str.match(/\shref\=\"(\/watch\?v\=.*)\"/)[1];
    let buf = new Buffer.from(`${a}`)
    message.author.send({ files: [{ attachment: buf, name: 'answer.txt' }] })
    message.member.voice.channel.join().then(function (connection) {
        connection.play(a);
    })
})
#

so that should work

#

abort(TypeError: Cannot read property '1' of null). Build with -s ASSERTIONS=1 for more info.

sudden geyser
#

Aki may I ask what you're trying to do specifically? You say the quota is too low because you're only allowed to get 100 songs globally, yet you're trying to parse raw HTML and sending it as an attachment. What do you think a is supposed to be? A URL?

#

And scraping is not always the best option. Say if YouTube blocks your IP because of it.

solemn leaf
#

1 vpn 2 im only sending as an attachment temp

#

@sudden geyser

sudden geyser
#

That's just not how it works at all. You're sort of trying to attach a website's HTML content

solemn leaf
#

then how does it work

sudden geyser
#

How do you want it to work. What do you want a to be? It needs to be something attachable, like an image buffer or a buffer for file content.

quartz kindle
#

Buffer.from() doesnt need the new

#

cannot read property 1 of null means no matches were found on str.match()

solemn leaf
#

It should return that

#
<a id="thumbnail" class="yt-simple-endpoint inline-block style-scope ytd-thumbnail" aria-hidden="true" tabindex="-1" rel="null" href="/watch?v=h6DNdop6pD8">
      <yt-img-shadow ftl-eligible="" class="style-scope ytd-thumbnail no-transition" style="background-color: transparent;" loaded=""><!--css-build:shady--><img id="img" class="style-scope yt-img-shadow" alt="" src="https://i.ytimg.com/vi/h6DNdop6pD8/hqdefault.jpg?sqp=-oaymwEZCPYBEIoBSFXyq4qpAwsIARUAAIhCGAFwAQ==&amp;rs=AOn4CLCaooz9RwRH1ZvNTTjtLuQabZHtqQ" width="246"></yt-img-shadow>
#

from that

#

it did work>?

tough bramble
#

If I would add the API to my bot before it's verified will it work or will it bring up an error?

solemn leaf
#

?

quartz kindle
#

@tough bramble you need to be verified to get an api key

solemn leaf
#

Tim coulg you help flushedawkward

tough bramble
#

Cool! Just wanted to check haha

faint prism
#

If I would add the API to my bot before it's verified will it work or will it bring up an error?
@tough bramble dbl api?

tough bramble
#

Yeah

faint prism
#

would you even have a token for their API if you weren't approved?

tough bramble
#

No, Tim just explained this

faint prism
#

I'm not keeping up

sudden geyser
#

db.get(...) returned null and you tried to call .join("\n") on it. @earnest phoenix

tough bramble
#

@faint prism No worries lmao

sudden geyser
#

I don't know if .get(...) can even return an array, but you should check what you're doing.

cerulean salmon
#

do you guys know any very cheap hosting site ?

sudden geyser
#

Check what you're doing. Does .get() have the capability of returning an array? Why is badges null? Should you do an if condition to see if it's null beforehand?

faint prism
#

check the pins

#

galaxy something was $2-3 iirc

solemn leaf
#

Auger

#

could you help

silver lintel
#
var myobj = {guildID: message.guild.id, muteRole: muteRole.id}
    const db = await MongoClient.connect(url, { useUnifiedTopology: true }).catch(console.error);
    const dbo = db.db("mydb");
    const collection = await dbo.createCollection("serverSettings").catch(console.error);
    dbo.collection("serverSettings").insertOne(myobj, function(err, res) {
    if (err) throw err;
    console.log("1 document inserted");
    db.close();
      
    dbo.collection("serverSettings").findOne({}, function(err, result) {
        if (err) throw err;
        console.log(result.name);
        db.close();
      });
  })

MongoError: connection pool closed

vernal rivet
#

I am no expert with mongo but I am pretty sure that you shouldnt be nesting functions like this.

#

You are probably closing the connection while trying to access it shrug

silver lintel
#

oof

sonic lodge
#

yeah, immediately after the first db.close(); comes a dbo.collection(..., and at that point the connection is definitely closed

vernal rivet
#

cough cough ||sqlite has that exact problem, but it's called database locked||

silver lintel
#

i want it to be

guildID: {
  muteRole: muteRoleID
}

but its currently ```json
{
_id: 5f67f494c3a3d361248cafc7,
guildID: '753764342071164990',
muteRole: '756763721061105715'
}

digital ibex
#

make it an object?

#

change ur schema to ```js
guildID: { muteRole: String }

silver lintel
#

is that right?

digital ibex
#

no

#

that makes no sense

vernal rivet
#

what doesn't make sense?

#

that makes sense to me

digital ibex
#

what is he doing with guildID? and how is he indexing it?

silver lintel
#

its my first time using a database :(

digital ibex
#

well u dont want that, ur just creating another object which is useless

silver lintel
#

i want to access the guilds muterole

digital ibex
#

what ur doing is { objectid: id { objectid: id, guildID: guildid, muteRole: roleid }}

#

what u need to do is <Schema>.muteRole

silver lintel
#

what would myObj be then?

digital ibex
#

what

silver lintel
#

idk :(

vernal rivet
#

do you know what key-value pairs are?

silver lintel
#

yes

#

i think

#

like

#

"player": {
"highscore": 5000,
"kills": 20
}

#

or something like that

#

im not sure

vernal rivet
#

yes

#

key is a string, and the value is any. but the problem is that you can't use a variable to define a key, but you can have a key define a value. this is what lost was talking about. the guildID key, is not the object, its a property name. but there are ways of using an object to be used as the property name

silver lintel
#

ok how

#

ive got a big group called serverSettings

#

and i want eachproperty name to be a guild id

#

unless thats dumb

vernal rivet
#

read this, it will explain how to do it.

silver lintel
#

if using the myCar thing,

#

would it be dbo.collection("serverSettings").insertOne(myCar, function(err, res) {

vernal rivet
#

yes

faint prism
#

I've wondered how js can tell the difference between err and res. in other languages it's the order you provide the arguments

vernal rivet
#

i would assume its either based on types, or its that order shrug

faint prism
#

mmm types yeah

sudden geyser
#

JS doesn't really know the type as it's all done at runtime.

#

You can pass anything to it really.

#

So it's up to you as the programmer to check what type it is.

vernal rivet
#

i mean you can, but you can define types in the program nomnomnom

sudden geyser
#

But you can't really have JS do it for you like how other languages allow or force you to set the type of a variable/parameter

vernal rivet
#

no, but you still can do it, and if the program is well documented, and the have the type/param tag in the block comment it will declare the type for you

sudden geyser
#

The tags (JSDoc) isn't really part of JavaScript. It's like Python's types module. You can set the type to be an int but it doesn't actually force it to be a type int. It's to guide the programmer but not the program.

vernal rivet
silver lintel
#

how to get muterole of a guild

#

im doing it wrong

stark abyss
#

396983037264658433,20000 how can i delete , and insert space between
so 396983037264658433 20000

#

can someone just tell me please

earnest phoenix
#

@stark abyss you can use the simple

#

String.replace(",", " ")

stark abyss
#

oh

earnest phoenix
#

To replace the FIRST , only

#

If you want to replace all

#

Use .repalceAll

stark abyss
#

ok ty

digital ibex
#

replace replaces all occurrences

slate oyster
#

So I am working on V4 of my bot
It's nothing of the former glory of V3 of my bot so far
The first command I am working on is my ban command
It is working, in fact it is the only command working in V4 (Help screens are a pain to autogenerate, so I will probably port V3s. Procrastinating on that)
Anyways, my (working) ban command has 3 TODO statements.

#

I want V4 of my bot to have the best ban command (:
(That is probably unrealistic)

sage bobcat
#

One message removed from a suspended account.

still merlin
#

It’s not that unrealistic to want that

slate oyster
#

The best ban command should obviously have things such as mod logs and timed ban
Maybe a web dashboard that people can ban users from (that's probably overboard)
It should optionally notify the user that they were banned, and for what reason
And I don't know what else competition is doing to snazz their ban commands

hazy sparrow
#

Is there a way to get the tag of the person who has the most "xp" in quick.db?

still merlin
#

Probably

#

you can use ‘db.get()’

opal plank
#

@still merlin why the ! ?

still merlin
#

Typo, I’m on my ipad

opal plank
#

I was about to comment thats typescript only syntax lol

hazy sparrow
#

you can use ‘db.get()’
@still merlin should i like get all the people and compare them and get the person with the most xp?

still merlin
#

I’ve never used quick.db before, So that depends on what you choose. Maybe just try and get a xp level

vernal rivet
#

check docs

thick gull
#

quickdb doesn’t have a feature like that iirc

digital ibex
#

it wouldn't be a useful db if u couldnt query, they do have that

opal plank
#

Hence why sql is good. And postgres even better

#

@hazy sparrow

hazy sparrow
#

alr, thanks

#
const db = require("quick.db");
const used = new Map();
const duration = require("humanize-duration")
module.exports = {
    name: 'work',
    description: "flip a coin!",
    
    execute(message){
      if(message.author.id == 542278740537769985){
      
      
      if (used.has(message.author.id)) {
          const remaining = Duration(cooldown - date.now(), { units: ['h', 'm'], round: true})
          message.channel.send(`You have worked recently! Please wait ${remaining} before working again.`).catch((err) => message.channel.send(`Uh oh! AN Error!\n \`\`\`js ${err} \`\`\``))
      } else {
        
      const bal = new db.table(`${message.author.id}mybal`);
            
         
          db.add(`${message.author.id}mybal`, 2)
          message.channel.send("you got **2** bowbucks for working").catch((err) => message.channel.send(`Uh oh! AN Error! \n \`\`\`js ${err} \`\`\``))
          
          used.set(message.author.id, Date.now() + 1000 * 60)
          setTimeout(() => { used.delete(message.author.id), 1000 * 60})
      }

              
      
      }}
    
     
        
    }

it does this

solemn leaf
#

wasnt me

opal plank
#

Hmmm is there a way i can get the event type without re-typing it?

solemn leaf
#

I found soemthing called youtube-search

#

its a npm

#

that is like youtube api

#

with out quotas

sonic lodge
#

don't think so

stark abyss
#

Why wouldn’t a variable work I mean you probably tried it but just wondering

hazy sparrow
#
const db = require("quick.db");
const used = new Map();
const duration = require("humanize-duration")
module.exports = {
    name: 'work',
    description: "flip a coin!",
    
    execute(message){
      if(message.author.id == 542278740537769985){
      
      
      if (used.has(message.author.id)) {
          const remaining = duration(cooldown - date.now(), { units: ['h', 'm'], round: true})
          message.channel.send(`You have worked recently! Please wait ${remaining} before working again.`).catch((err) => message.channel.send(`Uh oh! AN Error!\n \`\`\`js ${err} \`\`\``))
      } else {
        
      const bal = new db.table(`${message.author.id}mybal`);
            
         
          db.add(`${message.author.id}mybal`, 2)
          message.channel.send("you got **2** bowbucks for working").catch((err) => message.channel.send(`Uh oh! AN Error! \n \`\`\`js ${err} \`\`\``))
          
          used.set(message.author.id, Date.now() + 1000 * 60)
          setTimeout(() => { used.delete(message.author.id), 1000 * 60})
      }

              
      
      }}
    
     
        
    }

^ it gives this:

solemn leaf
#

@opal plank

#

Nested functions?

#

yes

opal plank
#

i already got it

#

also yikes nested functions

#

and forEach()

hazy sparrow
#

anyone help?

solemn leaf
#

@opal plank Im kiddin

#

I wouldnt do that to you

#

But erwin

#

this npm I found

opal plank
#

?

solemn leaf
#

doesnt need api key

#

no qouta or limit

opal plank
#

sounds sketchy

solemn leaf
#

and is easier then api

#

facts are facts

opal plank
#

ip grabbers too

solemn leaf
#

.

#

its legit called

#

yt-search

#

and it can grab my ip

#

its illegal to do anything bad to it so

opal plank
#

i wont call out a package out of the blue like that, its just really sketchy that its doing that

#

i guess you could try puppeteer and scrape it tbf

solemn leaf
#

erwinnn

#

leave me bee

#

its okay if I get virus

#

my pc treash anyways

opal plank
solemn leaf
#

erwin could you help me?

opal plank
#

no

solemn leaf
#

what if I said pretty please

opal plank
#

i'd say im still dissapointed in you

solemn leaf
#

I dont need code

opal plank
#

for going out on my back and asking around for the last bit of help you needed for the code before

#

you got 90% off me and then went on ask around the last 10

solemn leaf
#

Ill leave nested functions

opal plank
#

huh?

solemn leaf
#

how can I get v out of an fucntion?

opal plank
#

why would u get v out of a function?

solemn leaf
#

bcs

#

videos.forEach(function (v) {
})

#

I dont need anything

#

in this

#

I just need v

#

and putting the script in it is nesting

opal plank
#

you donkus

#

stop using the wrong thing then

#

use a proper loop

#

out of all the loops you have in your toolbelt you choose what is arguably the worst/most inefficient loop

#

@earnest phoenix you can put ur bot in any botlist, just dont advertise it here

solemn leaf
#

what do I use then

opal plank
#

check js loops

solemn leaf
#

Im only doing it once

#

lol

opal plank
#

loop in this context means an iterator, not something that'll keep repeating

hazy sparrow
#
const db = require("quick.db");
const used = new Map();
const duration = require("humanize-duration")
module.exports = {
    name: 'work',
    description: "flip a coin!",
    
    execute(message){
      if(message.author.id == 542278740537769985){
      
      
      if (used.has(message.author.id)) {
          const remaining = duration(cooldown - date.now(), { units: ['h', 'm'], round: true})
          message.channel.send(`You have worked recently! Please wait ${remaining} before working again.`).catch((err) => message.channel.send(`Uh oh! AN Error!\n\`\`\`js${err} \`\`\``))
      } else {
        
      const bal = new db.table(`${message.author.id}mybal`);
            
         
          db.add(`${message.author.id}mybal`, 2)
          message.channel.send("you got **2** bowbucks for working").catch((err) => message.channel.send(`Uh oh! AN Error! \n \`\`\`js ${err} \`\`\``))
          
          used.set(message.author.id, Date.now() + 1000 * 60)
          setTimeout(() => { used.delete(message.author.id), 1000 * 60})
      }

              
      
      }}
    
     
        
    }
solemn leaf
#

stop

#

fuckign

#

repositng

earnest phoenix
#

^^^^^

warm portal
#

Can we code in Mobile ?

earnest phoenix
#

@warm portal yes, but it will be horribly hard