#development

1 messages · Page 1686 of 1

earnest phoenix
#

Why have those little shield cards tho lol

lament rock
#

Not my website. It's a partner's and the link is a 302

earnest phoenix
#

lol 190 mb ram far away with 4 times smaller bot

#

Oh

#

hmm

long crow
#

You can log it from where the command is executed/run. For example like mine is executed from message event js try { const time = moment().format('YYYY MM DD HH:mm:ss'); command.run(message, args); console.log(`${time}: ${message.author.id} used command: ${command.name}`); //Log what command used } catch (error) { console.error(error); }
This of course the simpleton to check who run the command and what command. You will need to replace the console.log line with your own db/json or whatever you prefer. This is what it look like :

lament rock
#

I can get ram down to 80MB stable anyways. Just need to finish an update

frigid mountain
earnest phoenix
#

My ram usage is way too high due to cached presences omegalul

lament rock
#

built in memory leak

#

feature not a bug

earnest phoenix
remote crane
#

hi

solemn quartz
#

guys

#

i need help

earnest phoenix
#

With?

solemn quartz
#

anti-spam automod,
I tried to follow a tutorial on youtube but it doesnt work

#

i understand how you do it but i dont know how

earnest phoenix
#

Don't follow outdated YouTube tutorials

solemn quartz
#

its from march

pulsar bone
#
//----------------cus---------------- 
bot.on("message", message=> 
{   
    if(message.content.startsWith("help customembed"))
    {   
        let customembedhelp = new Discord.MessageEmbed()   
        .setDescription("customembed <thing you want to embed>")   
        message.reply(customembedhelp);
    }   
    
    if(message.content.startsWith("customembed"))
    {     
         let args = message.content.split(" ")     
         if(!args[1])
         {
             message.channel.send("please enter Something to embed");
         }       
         else
         {       
             let customembed = new Discord.MessageEmbed()       
             .setDescription(`${customembed}`)       
             message.reply(customembed);     
         }  
    } 
});
lament rock
long crow
earnest phoenix
solemn quartz
pulsar bone
solemn quartz
#

i dont think it's outdated

earnest phoenix
#

It doesn't matter, just think of a logic and implement it

solemn quartz
#

wait what is this

earnest phoenix
solemn quartz
#

you are trying to put an embed as itself's description?

feral aspen
#

What do they mean by The only guaranteed properties are code, channel, and url. Other properties can be missing.
https://discord.js.org/#/docs/main/stable/class/Invite?scrollTo=code

true mortar
#

gdfzhgf

earnest phoenix
#

since you need perms for it

earnest phoenix
#

like manage invite

feral aspen
#

Alright!

#

Question.

#

Instead of using .toString(), can't I just use invite and finish?

#

Or should I really use invite.toString()

earnest phoenix
#

invite? The invite object?

marble juniper
feral aspen
feral aspen
earnest phoenix
#

You gotta cast it to a string

#

Invite.toString()

solemn quartz
#

guys

#

im overthinking right now

feral aspen
#

Example, in the channel object, I send the channel without toString() and it doesn't send the channel object.

#

Instead it sends the mention of the channel

#

Can't it be same for the invite where it sends the link?

solemn quartz
#

i could make a bot shutdown command by just making it run objects that dont exist so that there is an error and it stops working

earnest phoenix
#

Yea then you don't need to cast it to string since its automatically casted to a string in that method @feral aspen

solemn quartz
#

and that isnt my target rn

earnest phoenix
solemn quartz
#

im doing like 3 researches at the same moment

timid jetty
#

but i dont know youtube_dl

#

library

feral aspen
#

Welp

halcyon copper
#

I made a chat bot

feral aspen
#

It's returning this...

#

.. and whenever I try to set a channel in the mongodb database, it won't work.

#

It stays null...

#
// Invite Create Event
if (server.inviteCreate === null) {
    modlogs.addField("**Invite Create**", `:offgray: - Disabled\n\`ID: invitecreate\``, true);
} else {
    modlogs.addField("**Invite Create**", `:onblurple: - Enabled, set as <#${server.inviteCreate}>\n\`ID: invitecreate\``, true);
};
// Invite Delete Event
if (server.inviteDelete === null) {
    modlogs.addField("**Invite Delete**", `:offgray: - Disabled\n\`ID: invitedelete\``, true);
} else {
    modlogs.addField("**Invite Delete**", `:onblurple: - Enabled, set as <#${server.inviteDelete}>\n\`ID: invitedelete\``, true);
};
#

.. and yes I do use the save() to save the channel, but it doesn't work, idk why.

slender thistle
#

server.inviteCreate is a method, isn't it

feral aspen
#
{
  _id: 603be640f73d0e283025be0d,
  name: "Alright, Don't Ask",
  serverID: '737011108954505267',
  prefix: 'ok!',
  description: 'Welcome to my server.',
  mutedRole: '776710562821570560',
  guildMemberAdd: '758978182807420938',
  guildMemberRemove: '758978182807420938',
  messageDelete: '758978182807420938',
  messageDeleteBulk: null,
  messageUpdate: '758978182807420938',
  leaveMessage: '**{member_name}** left the server.',
  __v: 0,
  joinMessage: 'Welcome **{member_name}** to **{server}**.',
  autoRole: '776710533130223626',
  embed: true,
  dmJoinMessage: 'Welcome to our server, **{server}**.',
  dmLeaveMessage: "It's sad to have you leave our server, **{server}**.",
  dmEmbed: true,
  roleCreate: '758978182807420938',
  roleDelete: '758978182807420938',
  roleUpdate: '758978182807420938',
  channelCreate: '758978182807420938',
  channelDelete: '758978182807420938',
  channelUpdate: '758978182807420938',
  inviteCreate: null,
  inviteDelete: null
}
#

Returns this.

slender thistle
#

Oh it's custom data

feral aspen
#

Yes, columns, I guess.

#

Yup!

slender thistle
#

Can you print server.inviteDelete?

#

Why not just check for !server.inviteDelete?

feral aspen
#

I figured out the issue.

#

I forgot to update the model.

#

👀

pulsar bone
#
let invite = `click the emoji to invite me => [💋](link)` 
        message.reply(invite); 

i used the above code but it isn't getting sending as hyperlink it sends it as normal text

marble juniper
#

hyperlinks only work in embeds

vivid fulcrum
#

only webhooks can send hyperlinks in a normal message content

pulsar bone
#

imagine sending a non blue hyperlink because the hyperlink text is a emoji

vivid fulcrum
#

there's a few creative uses

#

hyperlink custom emojis that make up a button picture for example

#

but it doesn't show up well on mobile because parsing breaks lol

marble juniper
#

pft mobile

#

lol

#

just make the button
long

#

I meant

#

tall

urban cape
#

Is it possible to have a clickable link in a Embed, in the Description. And if it is possible, how can I do that.

slender wagon
#
guilds.forEach((item, i) => {`Guild ${i + 1}: ${item.name} ${item.id}`})

i wanted to add this on a embed description should i map it or something?

woeful pike
#

the subtle art of slapping await in every syntactically valid position

slender wagon
#

lmao

#

it shouldn't be there h?

woeful pike
#

I think you missed a few awaits in there

await guilds.forEach(
  await (async (item, i) => {
    await `Guild ${(await i) + await 1}: ${await item.name} ${await item.id}`;
  })
);
lament rock
#

await will have no effect on that expression

woeful pike
#

that should fix it hopefully

lament rock
#

therefor, unnecessary

slender wagon
#

oh thanks oop

slender wagon
#

lmao

#

no more awaits

#

i just want to add it into an embed

#

no jokes this time

marble juniper
#

need more awaits

slender wagon
astral schooner
#

I am using quick.db how do I define it

lament rock
#

To answer your question, you should use map instead of forEach. map returns an Array<string> which you can .join("\n") or some other character other than \n

slender wagon
#
const db = require('quick.db');
lament rock
#

Also, that's incorrect

slender thistle
#

Wouldn't that be more inefficient?

astral schooner
#

db is defined but if there is this in the database, I want it to send the specified message.

slender thistle
#

Is that a blacklist command

lament rock
#

Compared to using forEach, yes. Their goal is to cast all their guild names and ids to a string into an embed description

astral schooner
#

yes

slender wagon
slender thistle
#

Could it be replaced with a for instead?

lament rock
#

replace forEach with map

woeful pike
#
if (x, true)

this is gonna be a fun bug for you to figure out lol

slender thistle
#

KEKW

slender wagon
#

am i being cyberbullied by Xetera now?

#

or..

slender thistle
#

not you

woeful pike
#

not you I was talking to the zmod person

slender wagon
#

oh lol

marble juniper
#

anyone know what database I should use that doesn't take a year to learn and use properly

woeful pike
marble juniper
#

maybe one that can be learned in a week and doesn't require a lot of effort

#

lol

lament rock
#

what would the for keyword be for? for is for iterating over an Iterable, but they'd be concatenating strings together manually which is more work than just casting all of the guild Objects to an Array<string> in the format of ${item.name} ${item.id}
and then joining the Array together then passing that to the embed description

#

Which is what map is for

marble juniper
#

a database with a lot of github repos that use it so I can do

#

preferrably

woeful pike
#

just pick any it doesn't matter

slender thistle
#

This could technically be done in just one loop with a for, though bear with me since I'm pretty much tired by now

woeful pike
#

sqlite is alright

marble juniper
woeful pike
#

I don't care you can use mongodb

lament rock
#

if things can be done in one loop, then a for is not necessary

slender thistle
#

But yeah to be fair I see why map would be used instead

marble juniper
#

ok

opal plank
#

quickdb best db

marble juniper
#

nah

#

text files

slender thistle
#

How would a map exactly be done here?

woeful pike
#

it's not my project so it makes absolutely no difference to me

marble juniper
#

for a discord bot

opal plank
#

but will my bot be approved if its using postgres? akkostupid

woeful pike
marble juniper
#

my bot actually runs on a dedi using docker lol

opal plank
#

i legit had someone dm me sking that

marble juniper
#

but I prefer having the database not serverless

woeful pike
#

why does that make any difference to you

marble juniper
#

I don't wanna pay thier pricing stuff

woeful pike
#

also you have a dedicated server + docker but you're sitting here twiddling your thumbs over a hard database? lmao

slender wagon
#
guilds.map((item, i) => {item.name, item.id}).join("\n")

would this be a thing or am i horribly wrong once again?

marble juniper
woeful pike
#

that's not even valid syntax

opal plank
#

the fuck am i looking at

woeful pike
#

just go look up what map does and don't guess

opal plank
#

template literals do be hard

slender wagon
#

ight

opal plank
#

lookup template literals while u at it

woeful pike
#

guessing with 0 programming intuition is like the most painful thing ever... for both parties involved

marble juniper
#

yes

lament rock
#

for:

const guilds: Map<string, Guild>;
let string = "";
for (const g of guilds.values()) {
   string += `${g.name} ${g.id}\n`
}
embed.setDescription(string.trim())

map:

const guilds: Map<string, Guild>;
const string = guilds.map(g => `${g.name} ${g.id}`).join("\n");
embed.setDescription(string);
woeful pike
#

it's ok I have plenty of experience helping randoms

marble juniper
#

the worst part is when you have to help someone with 0 Programming knowledge

slender thistle
#

With map it's technically two loops, right?

woeful pike
lament rock
#

no. map iterates over each entry of the Iterable once

#

same as for loops

slender thistle
#

map once, and what about .join?

marble juniper
#

map just is a loop that creates a new array from that array

#

lol

woeful pike
#

I mean 2 loops is basically the same thing as 1 loop

#

there's no difference in time complexity

lament rock
#

Array<T>.join(string); joins all entries of the Array to a string joined by the string passed to join

marble juniper
#

why do I think of binary trees when I think of time complexity

slender thistle
#

Oh, don't mind my sleepy me's curiosity

marble juniper
#

lol

slender thistle
#

Ya anyhoo thanks for the explanation

lament rock
#

It's fine. JS can be interesting

#

coding on mobile tho, pain

marble juniper
#

ts is more fun

#

have been using ts for a few weeks recently

lament rock
#

TS is a lot of effort for what it's worth. Just be type safe in JS with VSCode and CheckJS

opal plank
#

well in all fairness im not too far off either

marble juniper
#

im lovin it ||not sponsored by mcdonalds||

opal plank
#

its literally annotating types

#

if you are REALLY tired of ts

junior idol
lament rock
#

Not a huge effort to where it's unbearable, but if your project is already JS, don't bother unless you absolutely need TypeScript

opal plank
#

just slap //@ts-nocheck ontop and just enjoy the intellisence from it

marble juniper
#

lol

pale vessel
#

coULd NOt finD A DEcLaraTIon FILE FOr MoDULE 'moDULe-NamE'.

marble juniper
#

just use //@ts-ignore

#

bruhhh

lament rock
#

Also this

opal plank
pale vessel
#

or require()

opal plank
#

its not like ts ONLY offers types btw

marble juniper
#

just change require to import

opal plank
#

theres a shitton other features you can use from ts

marble juniper
opal plank
#

my point stands

#

its still a type

slender wagon
lament rock
#

TS is mainly just type safe JS, but offers compilation to lower versions of es standards

marble juniper
#

python sucks

#

python is just advanced yaml files

lament rock
#

cool amandacomfy

slender thistle
#

That emote is so cute

marble juniper
#

if I said that on twitter I would have been cancelled by the python devs

pale vessel
#

i just felt like there was no point rewriting a bot in ts but i did it anyway and now i feel like i regret it

#

now i have to cope with it

slender thistle
#

Twitter is breeding ground for narcissists and adult toddlers who only cry and never listen

lament rock
#

I have a ts branch for my bot and it was painful beyond compare

marble juniper
#

twitter is just a toxic wasteland

opal plank
#

sounds like yall are not used to ts, thats about it

pale vessel
marble juniper
#

lol

opal plank
#

literally the only people i hear complaning about ts is people who havent used it for more than a couple weeks

slender thistle
#

Hey Erwin I'm used to TS

opal plank
#

lies and deceit

pale vessel
#

wow excuse me i am used to transport stream

slender thistle
marble juniper
#

lol

slender thistle
#

April Fools!

opal plank
#

tis the third u dork

marble juniper
#

just say anything controversial on twitter on april 1st and say it was april fools

opal plank
marble juniper
#

ez fix

#

toxic haters erased

sudden geyser
#

hold on I got this

#

typescript sucks

opal plank
#

i will slap you with a chair

sudden geyser
#

wish I had a chair in my room

opal plank
#

you barely know js, much less ts

marble juniper
#

ts is better than js

#

l

#

ol

slender thistle
#

Erwin plz

marble juniper
#

ik it compiles to js

opal plank
#

i mean cmon

marble juniper
#

but still

opal plank
#

am i on the wrong shiv ? Kek

slender thistle
#

Why you gotta do me like that, man

opal plank
#

if i ever go to python

slender thistle
#

Typing annotations gang

opal plank
#

imma bring all my ts shit to it

#

fuck calling crap ctx

#

fuck calling bots self

#

fuck calling shit snake case

sudden geyser
#

Every program that can be written in JavaScript will eventually be written in JavaScript

lament rock
#

For what it's worth, if I'm writing something new, I'll use TS because I love type safety, but for old projects, I won't bother converting. I'm proficient enough in JSDoc to do just about whatever I need to

opal plank
#

fuck all that crap

pale vessel
#

what

opal plank
#

imma add whatever i want

slender thistle
#

NO ERWIN

opal plank
#

and i wanna see who'll stop me

#

STOP ME HO

#

WATCH ME FLY

slender thistle
#

I'LL BLOCK YOU

opal plank
#

NO BALLS

slender thistle
#

NO BALLS?

slender thistle
opal plank
#

I WILL CALL MY BOT INSTANCE CLIENT

#

I WILL CALL MY CTX PAYLOAD

slender thistle
#

NO

opal plank
#

AND YOU CANT STOP ME

#

PASCAL CASE FTW

slender thistle
#

YOUR MAMA IS PASCAL CASE

opal plank
#

I SHANT YIELD

marble juniper
#

imagine not using camel snake case

#

I_Like_Camel_Snake_Case

slender thistle
#

YOUR MAMA BOUTTA LOSE HER TYPING ANNOTATIONS

opal plank
#

YOUR MOMMA BOUTTA GET A TYPE ANNOTATION OF BIGINT

sudden geyser
#

that hurts

slender thistle
#

YO MAMA CAUSE AN INTEGER OVERFLOW IN PYTHON

lament rock
#

Shitposting in dev. Kinda weird

slender thistle
#

It's dev shitpost

opal plank
#

indeed

lament rock
#

ok

sudden geyser
#

discord is just one giant shitpost

pale vessel
slender thistle
#

Exactly!

opal plank
marble juniper
#

me everytime I visit discordjs.guide

#

I can do it

#

im not a beginner

#

lol

opal plank
pale vessel
#

why are you visiting that site doe if you're not a beginner

opal plank
#

imagine needing to check docs

marble juniper
opal plank
#

*this meme was made by intellisense gang*

pale vessel
#

LOL

#

darn

marble juniper
opal plank
#

hence why we should foward people to detritus

#

so they are forced to learn to use intellisense

#

since theres barely any docs

marble juniper
#

lol

opal plank
#

do it for the future of development. Detritus for president # 2024

pale vessel
#

erwin why are roles in collection<role> nullable in detritus

marble juniper
#

just use my lib with a long name

#

discord.js-light-commando

pale vessel
#

i really liked channel.can() though

#

no need for long permissionsFor() or permissionsIn()

opal plank
#

theres quite a few other handy methods like that

marble juniper
#

should have called it channel.chan()

#

channel chan! owo

opal plank
#

channel.canReadHistory

slender thistle
#

import discord as discord_chan

marble juniper
#

lol

pale vessel
#

message.canDelete

#

can can

opal plank
pale vessel
#

CAN

opal plank
#

is so much better tho

#

this already checks for overrides

marble juniper
#

@slender thistle

if (message.author.username === 'Shivaco') hugs.request('Shivaco')
#

🥺

opal plank
#

and guild permissions

slender thistle
#

@marble juniper huggle

opal plank
#

check admin => check guild role perm => check overrides

pale vessel
#

btw is user.name same as user.tag in djs? since user.username also exists

opal plank
#

if any of those come, it returns true

pale vessel
#

wait no

#

member.name as member.displayName in djs, ignore what i just said

opal plank
#

i think username comes with whole thing

#

if you mean with discriminator

#

hmmmm let me check that rq

earnest phoenix
#

i wanna compile es2020 code with babel but their docs is bs so i cant find a way to configure that with .babelrc

quiet topaz
earnest phoenix
opal plank
#

@pale vessel

pale vessel
#

what the fuck

opal plank
#

i think it actually caches old changed names

#

which is really pog

pale vessel
#

so name is displayName

#

ok cool

#

makes sense

opal plank
#

also what i said

pale vessel
opal plank
#

if u change names i think it gets pushed into that array

pale vessel
#

i hope it doesn't

opal plank
#

i hope it does

#

for mod tools thats fucking amazing

pale vessel
#

changes name 999 times

opal plank
#

well duh of course it probably has expiration

pale vessel
#

i c

opal plank
#

also discord ratelimits on changing nickanmes

marble juniper
opal plank
#

just checked

marble juniper
#

like unironically I want a keyboard like that

opal plank
#

it dont

marble juniper
#

with just copy and paste keys

#

like not even joking

pale vessel
#

goooooooood

quiet topaz
opal plank
marble juniper
#

lol

opal plank
earnest phoenix
#

@opal plank are you still working on your "epic" discord api lib

pale vessel
#

but an array for names is kind of odd though

opal plank
pale vessel
opal plank
marble juniper
#

I expected detritus to have more memory usage than discord.js
Im ||dissappointed||

#

lol

opal plank
#

detritus pog

solemn quartz
#

Guys, i just finished coding a rps command, how is it possible that it has OVER 90 LINES.
it literally is more long than moderation commands

opal plank
opal plank
#

the heck is an rps command

solemn quartz
#

rock paper scissors

slender thistle
#

Rock paper sci-

pale vessel
#

Science

opal plank
#

didnt i make one before in here?

marble juniper
#

my longest file is 32 lines long

#

in my bot

#

in my rewrite

solemn quartz
#

no.

#

i spent 1 hour+ of my life coding a rock paper scissors command...

opal plank
#

how

marble juniper
#

how

#

how can you spend an hour on a rock paper scissors command

#

I would only need 10 minutes at max

#

lol

solemn quartz
#

with embeds, 10 possible events, reactions, etc

pale vessel
#

1 hour ain't bad

solemn quartz
#

for 10 possible events i mean that the bot could win in 3 possible ways, same for the player, it could end in a tie in 3 ways, and the user could not answer in 30 seconds

solemn quartz
#

fun fact: i did this command because i couldn't do the anti-spam automod thing and i felt bad

#

i needed to do something

opal plank
#
function gr() {
  return ['rock', 'paper', 'scissors'][Math.floor(Math.random() * 3)]
}
switch(args[0]) {
  case 'rock': {
    let gr = gr();
     message.reply(`You played ${args[0]}, i played ${gr} and ${gr === 'rock' ? 'we tie' : gr === 'scissors' ? 'you lose' : 'you win'}`);
  }
  case 'scissors': {
    let gr = gr();
     message.reply(`You played ${args[0]}, i played ${gr} and ${gr === 'scissors' ? 'we tie' : gr === 'paper' ? 'you lose' : 'you win'}`);
  }
  case 'paper': {
    let gr = gr();
     message.reply(`You played ${args[0]}, i played ${gr} and ${gr === 'paper' ? 'we tie' : gr === 'rock' ? 'you lose' : 'you win'}`);
  }
}

@solemn quartz done

#

let me actually try that

woeful pike
#

imagine not using modulo to calculate the result of rock paper scissors

solemn quartz
#

oh x2

earnest phoenix
#

h

pale vessel
#

mfw fallthrough case

solemn quartz
#

pog trough pain

opal plank
#

@solemn quartz

#

legit took me what

opal plank
#
    function gR(): string {
      return ['rock', 'paper', 'scissors'][Math.floor(Math.random() * 3)];
    }
    switch (args[0]) {
      case 'rock': {
        let gr = gR();
        message.reply(
          `You played ${args[0]}, i played ${gr} and ${
            gr === 'rock' ? 'we tie' : gr === 'scissors' ? 'you lose' : 'you win'
          }`,
        );
        break;
      }
      case 'scissors': {
        let gr: string = gR();
        message.reply(
          `You played ${args[0]}, i played ${gr} and ${
            gr === 'scissors' ? 'we tie' : gr === 'paper' ? 'you lose' : 'you win'
          }`,
        );
        break;
      }
      case 'paper': {
        let gr = gR();
        message.reply(
          `You played ${args[0]}, i played ${gr} and ${
            gr === 'paper' ? 'we tie' : gr === 'rock' ? 'you lose' : 'you win'
          }`,
        );
        break;
      }
      default:
        message.reply('invalid input');
    }```
pale vessel
#

what's your point

solemn quartz
pale vessel
#

they're starting out plus they have much more stuff to add

earnest phoenix
solemn quartz
opal plank
#

either way you get the idea

#

1h+ on this is too much

#

20 minutes at most

opal plank
earnest phoenix
#

@opal plank

#

weeb

opal plank
#

@crimson vapor weeb

earnest phoenix
#

ok how did that line break happen

opal plank
#

yes

cerulean ingot
#

how would i make for example us1.node.solarhost.club:2020 go to mystik.dev with no port

solemn quartz
#

i couldn't even send it here

#

why is everyone silent now?

opal plank
#

OMG

#

WHAT

#

THE FUCK IS THIS

marble juniper
#

lmao

solemn quartz
#

oh

#

lmao

cerulean ingot
#

can someone help me pls

opal plank
#

AND embed builders

solemn quartz
#

what

opal plank
#

n.tag embed builder bad

#

fuck

solemn quartz
#

what

opal plank
#

look at it

#

dont ask

#

read

marble juniper
#

you

#

have a million if statements

#

this reminds me of yandere dev

#

ngl

opal plank
#

pains me

marble juniper
#

yes

#

me too

#

this was when es5 was new

#

but dude

#

we have es2020

#

and further

#

lol

#

es5 is from 2009

solemn quartz
#

what

#

guys

opal plank
#

esIndentation Beyond

solemn quartz
#

1st rule of programming:
If it works, DONT TOUCH IT.

opal plank
#

we are giving you feedback

#

no

#

shoo

#

if its shit, fix it

#

thats rule n 1

solemn quartz
#

what no

opal plank
#

you cant possibly argue bad code is okay just cuz it works

#

performance is something to account in coding too

earnest phoenix
#

too much code
here's a shorter one:

// copyright code913 do not copy ![mmulu](https://cdn.discordapp.com/emojis/587328389929500692.webp?size=128 "mmulu")
const rps = ["rock","paper","scissors"];
let c = rps[Math.round(Math.random() * 3)];
let p = rps.includes(args[0].toLowerCase()) ? args[0].toLowerCase() : null;
if (!p) return message.reply("dude are you dumb that's not a valid choice");
message.reply(`you chose ${p} i chose ${c} ${rps.indexOf(p) > rps.indexOf(c) ? "ye won :sob:" : rps.indexOf(p) == rps.indexOf(c) ? "draw :angry:" : "i won"}`);
#

oh shit forgot to reply to the message

marble juniper
#

yeah

#

but

#

your code should be touched

#

because its horrible

earnest phoenix
#

code is code

marble juniper
#

and if its horrible its hard to maintain

opal plank
marble juniper
#

or add new code to it

marble juniper
earnest phoenix
#

weird coming from you

earnest phoenix
# earnest phoenix too much code here's a shorter one: ```js // copyright code913 do not copy <:mmu...

just in case you need it, here's a one liner:

// copyright code913 do not copy ![mmulu](https://cdn.discordapp.com/emojis/587328389929500692.webp?size=128 "mmulu")
const rps=["rock","paper","scissors"];let c=rps[Math.round(Math.random()*3)];let p=rps.includes(args[0].toLowerCase())?args[0].toLowerCase():null;if(!p)return message.reply("dude are you dumb that's not a valid choice");message.reply(`you chose ${p} i chose ${c} ${rps.indexOf(p)>rps.indexOf(c)?"ye won :sob:":rps.indexOf(p)==rps.indexOf(c)?"draw :angry:":"i won"}`);
#

it's literally just the whole code without line breaks and spaces

solemn quartz
#

i didnt even see that at first

#

lol

opal plank
#

that means : dont copy it, cuz you likely dont understand what it does

solemn quartz
#

rock paper scissors?

#

i mean

#

what else should it do?

earnest phoenix
#

break your brian?

solemn quartz
marble juniper
#

let me make ur life a lot easier

#

using this code

#
const SELECTIONS = [
  {
    name: 'rock',
    emoji: '✊',
    beats: 'scissors',
  },
  {
    name: 'paper',
    emoji: '✋',
    beats: 'rock',
  },
  {
    name: 'scissors',
    emoji: '✌',
    beats: 'paper',
  },
]

function isWinner(selection, opponentSelection) {
  return selection.beats === opponentSelection.name
}
#

fuck discord

#

there

#

its that easy

#

doesn't need a million if statements

solemn quartz
#

too clean for me

marble juniper
#

too easy on the eyes for you

slender thistle
#

There's never too clean unless your code is literally unoptimized

marble juniper
#

lol

#

ur code has a million if else statements chained together

solemn quartz
#

yes but it works :))

marble juniper
#

yes but its shit

solemn quartz
#

no

marble juniper
#

completely fucking dog shit

solemn quartz
#

no u

marble juniper
#

its horror

solemn quartz
#

no u

marble juniper
#

its worse than any horror game or horror movie that I have ever seen

solemn quartz
#

no u

marble juniper
#

I reverse all no u's

solemn quartz
marble juniper
#

no

solemn quartz
#

no u

opal plank
#

do you even know whats going on, in all honesty?

#

it feels like you just copy/pasted everything over and over

#

like its some sort of lego building

solemn quartz
#

i did

opal plank
#

well thats why

earnest phoenix
#

hey erwin

solemn quartz
opal plank
#

its coding not tetris

earnest phoenix
#

i wanna tell you smth

marble juniper
earnest phoenix
#

but you have to promise not to yell

marble juniper
opal plank
#

cannot promise if its about embed builders

marble juniper
#

take this badge

earnest phoenix
#

its not

proven lantern
opal plank
#

then go ahead

solemn quartz
#

you are hurting my code's feelings

earnest phoenix
#

i once tried to make a bot with commando

#

oh hi shiv pls no ban

opal plank
slender thistle
#

this_variable_contains_my_response_body_rendered_in_json

marble juniper
#

I mean it fits this requirement

#

your code

opal plank
slender thistle
#

this_fucking_variable_that_took_me_an_hour_to_figure_out_that_contains_my_data_that_i_store_and_use_globally

opal plank
marble juniper
#

I laughed at that harder than I should have

opal plank
#

just sideways

marble juniper
#

lmaooooo

opal plank
#

the numbers inside contains the amount of spaces from the margin

marble juniper
#

reminds me of what react had

opal plank
marble juniper
#

react also had

#

nested code

#

like a fucking bird

solemn quartz
#

but look how good it looks :))

opal plank
earnest phoenix
#

w3schools has the most cancer variable names

myShit myVar myFunction myAss myMy
opal plank
#

actually

#

wait a second

#

chotto matte

earnest phoenix
#

that is pog

earnest phoenix
#

except the emojis

opal plank
pale vessel
#

OH NO MESSAGEEMBED

#

ERWIN MAD

opal plank
#

not that

#

the first line

solemn quartz
#

what

opal plank
#

i would not doubt they are actually doing a listener per command

marble juniper
#

thats a rule I follow

solemn quartz
#

what

#

wdym

pale vessel
solemn quartz
#

and btw im italian and im making the bot in english, so coding is actually more difficult for me

earnest phoenix
#

they mean dont have more than one client.on("thighpics")

pale vessel
#

no shit

earnest phoenix
solemn quartz
#

i think i'll just go to sleep, best decision i can take rn

earnest phoenix
#

gasp me too

opal plank
earnest phoenix
#

i just finished my total cancer frontend on my multiplayer repl and left my friend to do the other shit

opal plank
#

time to go back to FBI memes

earnest phoenix
#

NOOOOOOOOOOOOOOOOOOOOOOO

opal plank
earnest phoenix
#

oh btw i have an exposed .env because it's in a different folder and repl doesnt care

opal plank
#

i'll slap you with a chair

earnest phoenix
quartz kindle
#

dafuq going on here

solemn quartz
#

nothing

#

just them insulting my code

#

and me going to sleep in 5 mins

earnest phoenix
#

hi timmy

quartz kindle
#

wdym nothing, you guys are trashing my home and wrecking my chairs

earnest phoenix
solemn quartz
#

what

#

no

opal plank
earnest phoenix
#

yes

marble juniper
# earnest phoenix they mean dont have more than one `client.on("thighpics")`
const predictions = await model.predict(img_tensor).dataSync()

for (let i = 0; i < predictions.length; i++) {
    const label = labels[i]
    const probability = predictions[i]
    const percentage = Math.round(probability * 100)

    if (label === 'thighs' && percentage > 80) client.emit('thighpics', attachments[0].url)
    console.log(`${label}: ${percentage}`)
}
marble juniper
#

we will booli untill you learn how to write good code

#

code that is not hell

#

code that a dev can read

#

other than you

earnest phoenix
#

if nobody else can read your code it reduces impostors 😎

marble juniper
#

lol

earnest phoenix
#

IoI

marble juniper
#

there are bugs among us

solemn quartz
#

guys

marble juniper
#

Line 420 wasn't a bug
2 bugs are remaining

solemn quartz
#

1 thing

earnest phoenix
earnest phoenix
solemn quartz
#

i never used a db

#

i feel bad

earnest phoenix
#

me too

#

i used sqlit

solemn quartz
#

whats sqlit

earnest phoenix
#

im just not gonna fix that typo

#

sql is lit

earnest phoenix
solemn quartz
#

hm

earnest phoenix
#

and i used the quick.db package to use it

solemn quartz
#

so can someone suggest me a free simple to use database and what i should try to do with it so that i can understand db s ?

drifting wedge
#

@flat pelican do you think i am able to run a flask server in a cog?

earnest phoenix
flat pelican
#

in a cog?

drifting wedge
flat pelican
#

you mean with a Discord bot?

drifting wedge
#

shiv gave me a aiohttp thing

#

yes

#

but i want to try flask

#

if not aiohttp works

#

but flask > aiohttp

#

run it async

#

basically

flat pelican
#

🤔

drifting wedge
#

local

solemn quartz
slender thistle
#

You're in for a rough time with Flask on your d.py bot

drifting wedge
#

lmfao

#

so no need for nginx etc

flat pelican
#

flask isn't supporting async btw

drifting wedge
#

but id prefer flask / quart over aiohttp

#

quart yeah

slender thistle
#

Try quart probably

drifting wedge
#

but whatever

slender thistle
#

or Sanic

drifting wedge
#

yeah

#

quart ^

flat pelican
#

but you can run flask inside a cog technically with threading

drifting wedge
#

but like do i just run it?
or do i need to do some weird shit?

slender thistle
#

Quarrt?

drifting wedge
#

yes

slender thistle
#

Since it's async you don't really need to worry about threading it

drifting wedge
#

do i need to do the aiohttp thingy u did

unreal estuary
#

help pls

drifting wedge
#

or just normally runing it?

slender thistle
#

Apply similar logic

#

with the run method and uh

#

initializing it

unreal estuary
#

im getting started with threejs and im getting this error

#

var scene  = new THREE.Scene();```
vivid fulcrum
#

reference threejs from a cdn

earnest phoenix
#

@pale vessel you think nested code is bad? try using deno

unreal estuary
#

i have

#

ill try again

earnest phoenix
#

i mean its supposed to not be touched but

unreal estuary
#

is this normal

earnest phoenix
#

@pale vessel DUDE I THINK I FOUND A WAY TO GET V14 NODEJS ON REPL

#

Make a deno repl then change the run command in .replit to run="node yourfile.js"

#

for some fucking reason they have node v14 loaded on node's younger bro but not on it's own one

marble juniper
#

why don't they just update node on thier node.js repl's to v14

#

like just why

#

v12 isn't even lts anymore

crimson vapor
mighty ember
#

what is wrong with this code?

<p style="color:white;font-size:150px;">IMPORTANT:</p>
<p style="color:white;font-size:50px;text-align:center">The bot should be always online, but if it is not, then it crashed. (if it is offline, please PM 𝐄𝐥𝐢𝐬𝐨#4303 because it most likely crashed)</p>
opal plank
mighty ember
#

it won't load on the website

earnest phoenix
mighty ember
#

i just keep reading past it, i can't see the program

#

🤦

earnest phoenix
#

color: white;

vivid fulcrum
#

css doesn't care about whitespaces

mighty ember
#

i don't think that's it

umbral zealot
#

hold up, "won't load the website"?

#

css can't prevent a website from loading

#

or that HTML either

frigid mountain
#

How do I check how many roles are in a server?

vivid fulcrum
#

in which lib

marble juniper
#

check the docs

umbral zealot
#

guild.roles.cache.length

mighty ember
#

just that part

frigid mountain
mighty ember
#
<p style="color:white;font-size:150px;">IMPORTANT:</p>
<p style="color:white;font-size:50px;text-align:center">The bot should be always online, but if it is not, then it crashed. (if it is offline, please PM 𝐄𝐥𝐢𝐬𝐨#4303 because it most likely crashed)</p>
earnest phoenix
mighty ember
#

no

#

background is force dark

unreal estuary
umbral zealot
#

what if you try another color

unreal estuary
#

ive been following the tutorial on the site

opal plank
#

css is fun

unreal estuary
mighty ember
#

nope

earnest phoenix
#

bro just use <h1> instead of styling your font size

mighty ember
#

i want it specific

vivid fulcrum
#

it can't go offscreen

#

it's inside of a parent container

umbral zealot
#

hey did you know by the way there's a PREVIEW feature in the edit page? lol

marble juniper
#

look at it on mobile

unreal estuary
#

lol

vivid fulcrum
#

but what i was getting at was

#

the bot description is a container

umbral zealot
#

@mighty ember does it work on preview or not? Cuz it works here

pale vessel
#

Ey LTT gang

mighty ember
#

i fixed it

#

just made it smaller

pale vessel
#

crazy how they actually made an OF account and uploaded uncensored version of their April Fool's video

vivid fulcrum
#

not me planning to open one when i turn 18

pale vessel
#

ah lol you said that last year

#

when you gonna turn 18?

earnest phoenix
#

is it possible to import nodejs builtin modules in deno

vivid fulcrum
pale vessel
#

amazing

vivid fulcrum
#

uh

earnest phoenix
vivid fulcrum
#

i don't think so

quartz kindle
#

damn you're young

pale vessel
vivid fulcrum
#

^

quartz kindle
#

too smart to be that young

#

gottem

earnest phoenix
pale vessel
#

tell me why deno is better

quartz kindle
#

deno has its own version of the built in modules, no?

sudden geyser
#

Yes, it does.

quartz kindle
#

you have to use the deno versions

unreal estuary
#

deno supports typescript or something idk

sudden geyser
#

boring!

earnest phoenix
vivid fulcrum
#

deno is a fanatic idea that'll never live up to its expectations

sudden geyser
#

What makes you say?

unreal estuary
#

its just not that necessary

earnest phoenix
#

not sure if it works for node builtin modules

#

no it cant import builtin ones

#

time to use the deno ones

umbral zealot
# earnest phoenix Why?

you're doing var time = something(time) , how do you expect time to be defined before it's defined?

#

node can't magically know what the second time is.

#

¯_(ツ)_/¯

slender thistle
#

(technically the first one)

earnest phoenix
#

if you're not in strict mode the second time would be undefined iirc

#

emphasis on iirc

#
let captchaChannel = database.query(`SELECT channel FROM captcha WHERE guild_id = ${server}`);
let captchaLogs = database.query(`SELECT logs FROM captcha WHERE guild_id = ${server}`);
let captchaRole = database.query(`SELECT role FROM captcha WHERE guild_id = ${server}`);


    const embed = new Discord.MessageEmbed()
    .setColor("#24B2E4")
    .setDescription("*If you ever see `#deleted-channel` and/or `@deleted-role` and/or `undefined`, please edit the configuration with the `s.edit` command.*")
    .setFooter(`Command requested by ${message.author.username}#${message.author.discriminator}`)
    .setTitle("🛠 | Captcha - Panel:")
    .addField("📨 | Verification channel:", `<#${captchaChannel.values}> (**${captchaChannel.values}**)`)
    .addField("🏅 | Role given when the user has successfully completed the captcha:", `<@&${captchaRole.values}> (**${captchaRole.values}**)`)
    .addField("📩 | Logs channel:", `<#${captchaLogs.values}> (**${captchaLogs.values}**)`)
    //.addField("⏰ | Verification time:", `${time} seconds`)
    message.channel.send(embed)```

In my database, there are identifiant (check picture), but my bot return « undefined » for `captchaChannel`, `captchaLogs` and `captchaRole`, why??
umbral zealot
#

Can you not do SELECT * instead of doing 3 different queries for each values

#

like, why 3 separate queries

#

Also, you should learn about asynchronous code. Guaranteed 100% your database queries aren't sync, so you need either a promise resolve or a callback for each of your queries.

earnest phoenix
#

No because there will be several servers in this table

quartz kindle
umbral zealot
#

there will definitely be several servers

#

that's why oyu have a WHERE clause

#

SELECT * means "get all the columns" not all the rows.

earnest phoenix
#

module.exports.run = async (client, message, args, emojis, database) => {

#

i have this on the top of my command

umbral zealot
#

Or, I mean, you could do SELECT role, channel, logs FROM captcha WHERE guild_id = ${server};

#

Ok and what's database

quartz kindle
#

await database.query()

umbral zealot
#

how are you defining it, with what npm module

#

Because I bet it's callbacks

earnest phoenix
#

in my message.js event: let database = mysql.createConnection({ host: login.host, user: login.user, password: login.password, database: login.database });

umbral zealot
#

Ok so mysql being which npm module

earnest phoenix
#

message***.js***

umbral zealot
#

the require part

crimson vapor
umbral zealot
#

wait it was mysql2 you were using, wasn't it?

earnest phoenix
#

mysql2

#

yes

umbral zealot
#

which uses callbacks, not promises

#

like this ```js
connection.query(
'SELECT * FROM table WHERE name = "Page" AND age > 45',
function(err, results, fields) {
console.log(results); // results contains rows returned by server
console.log(fields); // fields contains extra meta data about results, if available
}
);

unreal estuary
#

did anyone else know this lol

earnest phoenix
#

everytime use function() ? @umbral zealot

umbral zealot
#

you need to have a callback, yes.

earnest phoenix
#

Ok, thx u for your help 😉

umbral zealot
crimson vapor
#

you could also use arrow functions

umbral zealot
#

yeha but let's not confuse the solution with more data that's not relevant

#

they'll figure it out

unreal estuary
#

arrow functions are hot

umbral zealot
#

Arrow functions are tight but promises are tighter.

#

Fuck callbacks tbh

unreal estuary
#

i mean i think they literally look nicer

earnest phoenix
unreal estuary
earnest phoenix
#

ok

#

thx

umbral zealot
#

but only in the callback

earnest phoenix
#

Ye

frigid mountain
#

I'm a professional stake.overflow search coder lol

earnest phoenix
#

is there a bot where i can ban members with similar names?

earnest phoenix
earnest phoenix
#

try em and see which works

#

or make your own

#

¯_(ツ)_/¯

frigid mountain
earnest phoenix
#

k

#

tell me pls i want to ban raiders

#

search for moderation bots

umbral zealot
#

or raid protection, or alt protection.

earnest phoenix
#

or dbl weeb protection

summer torrent
#

That is 99% of dbl

lament rock
#

100%. The remaining 1% just doesn't accept it or know it yet

summer torrent
#

or they are not weeb

umbral zealot
#

ez, if you've ever watched anything that's animated and drawn on a tv screen you're a weeb so it's fine we're all weebs by definition.

summer torrent
#

is Tsubasa anime

umbral zealot
#

Transformers? That's as good as watching Gundam Wing, you damn weeb 😛

summer torrent
#

😳

blissful coral
#

Anyone wanna help with some express wack stuff

#

that doesn't wanna work uwu

crimson vapor
#

Issue? @blissful coral

blissful coral
#

one sec

crimson vapor
#

@blissful coral lol

blissful coral
#

Figured it out

#

ts was being wack

crimson vapor
#

Bruh

uneven fulcrum
#

ok so i have this

#
      if(message.content.startsWith('$claim')) {
        let voted = await topgg.hasVoted(message.author.id)
        if(!voted) {
          message.reply("You havent voted yet. Use $vote to vote on top.gg")
        } else {
          message.reply('Thanks for voting and supporting us as we grow! You have been awarded 25k bobux')
          this.economy.addBal(message.author.id, 25000)
        }
#

but people can keep spamming $claim

#

and get infinite

crimson vapor
#

Use a database to check that they Already used the command

frigid mountain
#
const Discord = require('discord.js')

module.exports = {
    name: 'createchannel'
    aliases: ['c'],
    run: async (message, args) => {
    const createChannel = message.guild.createChannel(name, "text")
     
     message.channel.send("i have created channel")
        
    }
}

It's a code that let's your bot create but it doesn't work at all pls help :(

uneven fulcrum
#

but i have 300 users

#

so i have to create a new thing when they vote i guess

crimson vapor
#

You only need to use a time stamp for when they use the command properly

#

Idk what dB you use so I can’t help Past this

#

Fuck phones amirite

uneven fulcrum
#

the webhooks are confusing for me

#

i dont understand them

crimson vapor
# uneven fulcrum mongodb (mongoose)

Just create a model for it, or add it to the user model, then set it to a time stamp when they use the command. Then check if the time stamp is less than 1 day away and they voted

frigid mountain
#
const Discord = require('discord.js')

module.exports = {
    name: 'createchannel'
    aliases: ['c'],
    run: async (message, args) => {
    const createChannel = message.guild.createChannel(name, "text")
     
     message.channel.send("i have created channel")
        
    }
}

It's a code that let's your bot create but it doesn't work at all pls help :(

earnest phoenix
crimson vapor
#

Right

frigid mountain
earnest phoenix
frigid mountain
earnest phoenix
#

with 106 accs

earnest phoenix
frigid mountain
frigid mountain
earnest phoenix
frigid mountain
earnest phoenix
unreal estuary
#

whats the max number of characters in a message

unreal estuary
#

im pretty sure u use message.guild.channels.create

earnest phoenix
#

1048 in add field

unreal estuary
#

😖

#

ohh thanks guys

#

or girls

#

(;

slender wagon
#
 mfa_enabled: false,

what does mfa mean in discord user accounts

sudden geyser
#

Multi Factor Authentication.

#

Aka 2FA / Two Factor Authentication.

slender wagon
#

ohh right

#

so why does the user response from the discord api give info on that part

unreal estuary
#

wheres the docs for <client>.generateInvite()

sudden geyser
#

What library are you using?

exotic bane
#

what is wrong in this it is not reponding nor giving any error py @client.command() async def randomnum(ctx, num1,num3): if num3 > num1: await ctx.send('2nd number should me smaller than the other ') else: num2 = randint(1, num1) await ctx.send(f'the number is {num2}') if num2 == num3: await ctx.send('you won !!!') else: await ctx.send('you lost ...')

sudden geyser
#

One issue is you aren't setting the type of num1 or num3

exotic bane
sudden geyser
#

yah

frigid mountain
#

How do I make my embed line up like these

dusky sundial
#

should work without it

sudden geyser
#

It'll default to string.

frigid mountain
sudden geyser
#

My previous message wasn't directed to you.

frigid mountain
sudden geyser
#

Depends. What exactly do you want to line up about the embed?

exotic bane
# sudden geyser yah

sir now ?? py @client.command() async def randomnum(ctx, num1,num3): if int(num3) > int(num1): await ctx.send('2nd number should me smaller than the other ') else: num2 = randint(1, int(num1)) await ctx.send(f'the number is {int(num2)}') if int(num2) == int(num3): await ctx.send('you won !!!') else: await ctx.send('you lost ...') this is also not working

sudden geyser
#

Interesting. Could you try testing if the command is even dispatching (like commenting out the code and just printing to see if it works)?

exotic bane
earnest phoenix
jovial nexus
#

is there a way to listen to new reactions of a message sent after the bot has been restarted?

dusky sundial
#

Store the message ID somewhere, and load it when your bot starts

jovial nexus
#

thanks

placid meadow
#

sup ppls

pale vessel
#

or use your library's raw event

crimson vapor
#

@opal plank does detritus have message collectors built in?

pale vessel
#

no

crimson vapor
#

How are they made then?

pale vessel
#

just good ol client.on()

sudden geyser
#

Listen for messages, run your processor, do something if it passes

pale vessel
#

i tried to imitate dpy's wait_for

#

for whatever reason

#

but it works

heavy marsh
#

Does d.js have to check if its a stage channel

#
let VC = message.member.voice.channel || Need to have it here
sudden geyser
heavy marsh
#

ooh ok

zenith terrace
unreal estuary
#

how do you sync a channels permissions with its category in discord.js

#

or does it do it automatically when you make a channel with a parent

zenith terrace
#

it should sync automatically when created

unreal estuary
#

ok thanks!

lusty kindle
#

Hi

unreal estuary
#

ello

earnest phoenix
#

Merhaba

#

Top.gg oy vermeden komut yasak kodu olan varmı

unkempt ocean
#

Please keep this channel English only

#

Also this is not a codeshare server so if you need any development questions feel free to ask in here.

earnest phoenix
#

Anyone have a banned script command without voting in top.gg?

#

I just wanted to ask like how can I do it

#

hi

blissful coral
#

Cannot POST /submitdata

#

@crimson vapor any idea why I would be getting this?

#

nvm my dist just didn't update

earnest phoenix
#

does anybody know how to get values from mongo in descending order using python

unreal estuary
#

can someone help me with an error