#development

1 messages · Page 1756 of 1

sacred palm
#

i have code rn that does this but it spams the message

#

when the server name does match or doesnt

#

and i need to fix this

#
function intervalFunc() {
  var server = bot.guilds.cache.get("801048326514409502");
  if(server.name == 'Spooky Month')
  {
    bot.channels.cache.get('841977665672970240').send("Server name is Spooky Month :white_check_mark:")
  }else{
    bot.channels.cache.get('841977665672970240').send("Server name is Spooky Month :x:");
    clearInterval();
  }
}

setInterval(intervalFunc, 5000);
#

if someone can fix this pls do

#

i need it looping every 5s Unless the server name is The correct one

#

and if its false then loop again

#

loop check for the name to be Spooky Month again

#

and if someone is so good in javascript.....make it so it only loops at october

#

all rest of the months it doesnt loop no matter wat

#

so unless its october on ur machine

#

and in ur browser

#

the event would work and loop normally

lyric mountain
#

why don't u just get the guild by name?

#

instead of looping

clear marlin
#

why don't you execute the code in october

sacred palm
#

Idk

sacred palm
#

thats not professional

lyric mountain
#

dot dot dot

#

it's less professional to loop every guild

sacred palm
#

Wdym every guild

#

lol

clear marlin
#

unless its in only one guild

sacred palm
#

only my guild would it be looping

#

only 1

#

which is mine

#

lol

lyric mountain
sacred palm
#

wat

#

oh also

#

i think i will release this bot to everyone

sacred palm
#

in the future

#

rn its only 1

clear marlin
#

so that would be a lot to cache in that case

lyric mountain
#

so you're bothering with "professional" stuff on a private bot?

#

bro

sacred palm
gaunt ermine
#

How to make a message which is sent when someone votes? Discord.js

lyric mountain
#

also, stop using var

#

use let

gaunt ermine
lyric mountain
#

for the second time

gaunt ermine
lyric mountain
#

then wait

sacred palm
lyric mountain
#

dot dot dot

#

bruh

sacred palm
#

lol

#

this complex stuff man

#

i just began on learning js

lyric mountain
#

this ain't

sacred palm
#

this is

lyric mountain
#

ain't

sacred palm
#

is

lyric mountain
#

wanna see something complex?

sacred palm
#

no

lyric mountain
#

then ain't

sacred palm
#

unless u talking about my code

clear marlin
#

you could do this

setTimeout(()=>{
// your code
}, //time in ms)
sacred palm
#

ok then aint

clear marlin
#

but its very unprofessional

#

to be

clear marlin
#

caching the guild name everytime time period

sacred palm
#

hmm

lyric mountain
#

here are my two cents: don't bother with professional stuff, you're not writing a commercial-grade software

sacred palm
lyric mountain
#

if u wanna go full professional then you shouldn't even be writing code to begin with

sacred palm
#

i already have it every 5s

#

so idk

lyric mountain
#

you should be documenting and gathering requirements

lyric mountain
#

that's what professional means

sacred palm
#

Oki

#

not rrly

lyric mountain
#

no bro

sacred palm
#

i just need to fix this 1 bug rn

clear marlin
#

I still think its kinda dumb, don't get me wrong, to be simultaneously caching something that's gonna be triggered in october

sacred palm
#

can someone help me

lyric mountain
#

can you at least let us finish typing?

sacred palm
#

the bug is that it keeps spamming that the server name is correct or incorrect

#

how do i fix this

sacred palm
lyric mountain
#

don't go full professional on a bot, you'll waste a holy hell of time just by bothering with that, it's not worth it UNLESS you're making a commercial-grade software, which bots AREN'T

clear marlin
#

hey, I mean I don't mind people doing something perfect

#

even if its something small

lyric mountain
#

professional includes a shitton of stuff, not only "minor" stuff

clear marlin
#

its a good step to something better

sacred palm
#

YE

#

so can someone help me fix this bug

#

:C

lyric mountain
#

yes, forget the loop

#

only execute the code on october

sacred palm
#

Wha-

#

No

#

XD

#

This a event

lyric mountain
#

then u don't want a solution

sacred palm
#

not a command

#

remember

lyric mountain
#

did I say command?

sacred palm
#

U made it seem so yes

lyric mountain
clear marlin
#

you can use a setTimeout as a event too

lyric mountain
#

I said code

sacred palm
#

"execute"

clear marlin
#

events

lyric mountain
#

yes, you execute code

sacred palm
#

it will be going forever

clear marlin
#

execute

sacred palm
#

and how do i do it

#

and can u FIX MY CODE

#

the way u mean

clear marlin
#

wait, you already do have a setInterval

#

that should work perfect shouldn't it

lyric mountain
#

but won't

sacred palm
#

:C

#

bruhhhh

clear marlin
#

what

sacred palm
lyric mountain
#

HOWEVER, I can show you the path

sacred palm
#

yes

#

pls

clear marlin
#

that's sadistic

sacred palm
#

didnt even know that was a word

#

and have no idea what it means lol

umbral zealot
lyric mountain
#

now that you have the month, you can execute that part of the code ONLY on october (or whatever month u want)

#

now lets move on to the loop

clear marlin
#

I still don't understand why you would not not execute the code in october rather than forever

#

why not add the code in october

sacred palm
#

WHAT

sacred palm
#

i could forget too

lyric mountain
#

filter the guild cache by name, check if it equals "Spooky Month"

sacred palm
#

example...?

lyric mountain
#

with the result of the filter, do a for loop and do whatever you want inside it

lyric mountain
sacred palm
#

TBH

sacred palm
lyric mountain
#

then leave that idea for later

#

until you have a better grasp of js

sacred palm
#

i learned that for looping is yesterday

#

i dont totally understand it yet

boreal iron
#

Without learning the basics you won’t get far.

sacred palm
#

Maybe

#

but i want this done

#

rrly badly

lyric mountain
#

want != can

weary crypt
#

Yea I would learn the basics of the language first...

sacred palm
lyric mountain
#

also, don't let people write code for you UNLESS it's a co-programmer

#

THAT is unprofessional

weary crypt
#

But that is up to you

sacred palm
lyric mountain
sacred palm
lyric mountain
#

I want a lambo

sacred palm
boreal iron
sacred palm
#

d e a l

clear marlin
sacred palm
#

😂

lyric mountain
sacred palm
#

lololll

lyric mountain
#

anyway

sacred palm
#

anyway

lyric mountain
#

leave that idea for later on

sacred palm
#

what idea

lyric mountain
#

focus on learning js

sacred palm
#

a lamboooooo

#

i am

#

BUT I RRLY WANT TO DO DISSSSS

#

FIRST

lyric mountain
#

but you cant

sacred palm
#

i can

#

!

boreal iron
#

Or an even better idea learn something better than JS lmao

sacred palm
#

with the help of others

sacred palm
#

no

#

its in my list

#

so i have to learn it

lyric mountain
sacred palm
#

idc

sacred palm
#

no

boreal iron
sacred palm
#

oki

lyric mountain
#

we're helping

#

learn js

#

THEN do that

boreal iron
#

I mean you got your links to the docs already.
Go on with that and get back after writing your own code if it doesn’t work.

sacred palm
lyric mountain
#

tbf, listen to my words, that code you have WILL spam the hell out of that channel

sacred palm
#

whats tbf

lyric mountain
#

to be fair

worn sonnet
#

Warning: spoon-feeding is not allowed

lyric mountain
#

yes

#

your current snippet

sacred palm
#

oh

#

no

lyric mountain
#

it will

sacred palm
#

it just says it every 5s

#

if u dont stop it yes it will spam alot lol

lyric mountain
#

that's called "spam the hell out of that channel"

sacred palm
#

XD

#

welp ye

#

it does that

clear marlin
sacred palm
#

and idk how to fix it

clear marlin
#

maybe read the documentation of js first

#

I'm sure that'll help you

sacred palm
#

i did

#

no help

lyric mountain
#

you're not clearing the interval if the server matches

#

so it'll spam continuously

sacred palm
#

ye

#

how do i fix this

lyric mountain
#

learn js

#

that's how

sacred palm
#

server name

sacred palm
boreal iron
#

Don’t get me wrong but the way how you write and don’t read let me think you’re a little to young to code and should concentrate on your school first. okeh

lyric mountain
#

literally no joke, you lack fundamental knowledge of programming

#

that's dangerous

sacred palm
#

lol

boreal iron
sacred palm
#

they are

#

except pre school or whatever its called

#

MIDDLE SCHOOL

#

i think

#

u learn math

#

and ur language, how to speak

#

and how to write

lyric mountain
#

bruh

sacred palm
#

so thats helpful

#

and thats basically it

lyric mountain
#

yk schools are progressive right?

boreal iron
#

What? How old are you if we speak about pre-school?

sacred palm
#

no more good help

sacred palm
lyric mountain
#

also wtf?

sacred palm
#

XD

sacred palm
#

nope

lyric mountain
#

they do

clear marlin
weary crypt
#

Mine did

sacred palm
#

mine does teach how to cook

lyric mountain
sacred palm
#

WELL MINE DIDNT

#

yet atleast

weary crypt
#

You literally need to pick up the elective

umbral zealot
#

This is starting to sound a lot like #general

weary crypt
#

agreed

sacred palm
umbral zealot
#

Please keep the channel on topic ^_^

sacred palm
#

we are

boreal iron
#

Shh

sacred palm
#

ANYWAY

lyric mountain
#

TL;DR: focus on learning fundamental stuff of programming, ONLY THEN try to make that idea you have

sacred palm
#

XD

umbral zealot
#

Yes. Step 1: learn a programming language.

sacred palm
lyric mountain
sacred palm
#

ok

#

is HTML easier than js?

boreal iron
#

Omg

lyric mountain
#

html is not a prog lang

umbral zealot
#

HTML isn't a programming language.

sacred palm
#

hyh

#

huh

#

it is tho

lyric mountain
#

isn't

weary crypt
#

No it is not

sacred palm
#

then what is it

lyric mountain
#

html is a structure for web pages

sacred palm
#

ah well

#

is html easier than js

boreal iron
#

I feel physical pain.

umbral zealot
#

It's a markup language, not a programming language.

#

It's used for formatting only.

sacred palm
#

yes

boreal iron
#

Then learn html to code your bot lmao

weary crypt
#

lol

sacred palm
#

no

lyric mountain
sacred palm
#

IS HTML EASIER THAN JS

umbral zealot
#

It's not the same thing!

lyric mountain
#

they can't be compared

weary crypt
#

Not really comparable

sacred palm
#

BRUH

#

OK HOW ABNOUT THUIS

boreal iron
sacred palm
#

IS CODING A WEBSITE EASIER THAN LEARNING JS

lyric mountain
#

no

sacred palm
#

bruh

lyric mountain
#

because it includes js

sacred palm
#

BRUH

umbral zealot
#

Coding a website requires HTML, CSS and JavaScript. 3 different things.

weary crypt
#

Me who uses MVC 😎

sacred palm
#

aaaaaaa

umbral zealot
#

Coding a bot only requires one programming language.

sacred palm
#

OK

sacred palm
#

so can someone fricking fix my codeeee

lyric mountain
#

they were dinos

sacred palm
#

AND MY BUG

boreal iron
#

lmao

sacred palm
#

which the is the same thingggg

lyric mountain
#

no

sacred palm
#

bruhhhhh

lyric mountain
#

learn programming first

#

you lack fundamental knowledge

umbral zealot
sacred palm
sacred palm
lyric mountain
#

yep, broken link

sacred palm
#

bruh

umbral zealot
#

what the

sacred palm
#

XD

umbral zealot
#

weiiiiird.

lyric mountain
#

you added a 1 on the end

umbral zealot
#

¯_(ツ)_/¯

boreal iron
#

Embarrassing!

sacred palm
#

😂

lyric mountain
#

dot dot dot

weary crypt
#

Wth is this chat

sacred palm
#

sodium is tasteless right?

#

about me

lyric mountain
#

sodium does have a taste

sacred palm
#

Well

lyric mountain
#

but you won't feel it

sacred palm
#

what is tastier??

#

the chicken

umbral zealot
#

Guys MarioFP

sacred palm
#

no

boreal iron
#

Learn JS dude.. stop that

sacred palm
#

No

boreal iron
#

Case closed. Next please.

sacred palm
#

no

opal plank
sacred palm
#

idk

opal plank
lyric mountain
#

just jokin, nothing important

opal plank
lyric mountain
#

what do you mean by "unfreeze an object"?

opal plank
#

Object.freeze()

#

the idiots that made the package did that to one of the entries

#

now i cant modify them, forcing me to clone them and cache them elsewhere

lyric mountain
#

could be worse

#

as it seems, you can't thaw an object

opal plank
#

this

lyric mountain
#

ik

#

that's how I found Object.seal()

opal plank
#

well, either way, how the fuck do i unfreeze that shit

lyric mountain
#

you can't as it seems

opal plank
#

fuck, cloning it is

crimson vapor
#

hi Erwin

boreal iron
sacred palm
#

rip to my code

#

2021 - 2021 R.I.P.

#

AHJAHHA

#

|NIO RIp

#

U SUCK GUYS

#

SOMEONE FIXED MY CODE

clear marlin
#

what

sacred palm
#

AND MADE IT BETTER

#

IT WORKS!!!!

#

F YEAHHHH

#

LETS GOOOOOOOOOOOOOOOOOOOO

clear marlin
#

NO SPOONFEEDING HERE

sacred palm
#

NOT HERE

#

IN ANOTHER SERVER

#

MUAHAHAHAA

#

LETS GHO!

clear marlin
#

stop

sacred palm
#

i can learn js now

#

no

clear marlin
#

yes

weary crypt
fresh verge
#

boreal iron
#

Copy the message link as dot posts are not "allowed"

sacred palm
sacred palm
boreal iron
#

God damn laziness anywhere

weary crypt
#

I hate taking code, takes the joy out of making something hard. But to each their own I guess

sudden geyser
#

All programs borrow code

weary crypt
#

?

clear marlin
#

?

sacred palm
#

yo

#

someone help me

#

is there a way to do this: if u use the Spooky Month Name And then change it back it does a message in a channel
?
Rrly would be cool
and if i would know how to do that
i could do this to anything
like
Name Change to "Galaxy's Basement Christmas Edition"
and smth would happen
which i can do
with the code i have
but i also want to do a message when u change it back
from a specific name

umbral zealot
#

What

#

Change what exactly? I don't understand

boreal iron
#

U SUCK GUYS
SOMEONE FIXED MY CODE

lyric mountain
#

like, are you really proud of being spoonfed a ridiculously simple code?

boreal iron
#

That’s all I remember

lyric mountain
#

tsk tsk, don't tell me you're going to live with hardcoding server names

umbral zealot
#

If the question even made sense, maybe we could have helped in the first place? Man, this kid sounds like an overexcited 6 year old screaming at mommy to get one of 58 candy in the display and being so hyper they can't speak right.

lyric mountain
#

oh all that hope and joy will last very little, then it'll become despair and remorse for skipping steps in programming

opal plank
opal plank
sacred palm
#

lemme explain

#

The "Normal Server Name" Would be "Galaxy's Basement

#

Now a Special Name Would be smth not "Galaxy's Basement"

#

and that would most likely happen bc theres a holiday or a special event

#

now i wanna make it so

umbral zealot
#

mmmkay and that requires a bot, to change something like 12 times a year? ia_think_thonk

crimson vapor
sacred palm
#

when u change BACK from the Special Name into the "Normal Server Name" u would get a message in a channel

sacred palm
#

and i have a bot

#

i just need the code

#

lmao

lyric mountain
#

so you don't have the bot

#

you have an empty cocoon

sacred palm
sacred palm
cinder patio
#

... and you rather waste a few hours asking people for code, rather than just renaming the server yourself whenever you want...

umbral zealot
#

You need the code for what exactly

sacred palm
umbral zealot
#

Detecting that the server name has changed?

sacred palm
lyric mountain
sacred palm
lyric mountain
#

I could do that blindfolded with turned off pc

sacred palm
#

that the server name has changed BACK from the special name

umbral zealot
#

Right

sacred palm
#

so just like

umbral zealot
#

so look for guildUpdate event

sacred palm
#

ye

#

idk how to use it tho

umbral zealot
#

Well then go learn javascript.

#

It's easy as pie if you know it

sacred palm
sacred palm
lyric mountain
#

@umbral zealot bruh, you don't understand how deep his case goes

sacred palm
quartz kindle
#

jabbascript

sacred palm
umbral zealot
#

Well we're not going to help you "right now"

umbral zealot
#

Our help is, go learn the language.

sacred palm
quartz kindle
#

i mean

sacred palm
#

not noqw

#

now

umbral zealot
#

It's not the help you want but it's the help you deserve and need.

sacred palm
quartz kindle
#

guildUpdate gives you 2 objects, a guild object before the update, and a guild object after the update

lyric mountain
quartz kindle
#

just use it to compare the guild names

lyric mountain
#

professional

sacred palm
quartz kindle
#

like you use any other event?

umbral zealot
#

By using a simple javascript compare condition. Which you'd know, if you knew the language.

sacred palm
#

bc idk how events work lmao

quartz kindle
#

do you even have any code

sacred palm
#

yes

quartz kindle
#

show your existing code

lyric mountain
#

yet you have a bot...

sacred palm
#

alot i would say

sacred palm
lyric mountain
#

a bot without events KEKW

sacred palm
quartz kindle
#

any file that has events

sacred palm
#

lmao

sacred palm
lyric mountain
#

let me guess: someone made it for you?

sacred palm
#

question

sacred palm
#

i said that already lmfao

sacred palm
lyric mountain
#

did u make ANY code in your bot?

sacred palm
#

i use a tutorial

lyric mountain
#

there it is tim, you know what you're handling with

sacred palm
#

xd

umbral zealot
#

Then back to "go learn JS and stop being a Tyler!"

sacred palm
#

Lmao

sacred palm
quartz kindle
#

well, first of all, if someone else coded for you, then you has to ask them to do these changes and additions for you. trying to do it yourself requires knowing how it works, or you will end up breaking stuff

#

and the answer is always "yes, if you do it right"

#

as in

#

it 100% depends how your current code looks like

lyric mountain
quartz kindle
#

lel

opal plank
#

Frankenstein code

lyric mountain
#

frankenstein but all pieces are from other frankesteins

quartz kindle
#

code is a web of interconnected strings. if you change one, you need to update everything that has strings connected to it

opal plank
#

except if u use typescript

crimson vapor
#

you don't need to

opal plank
#

its smart enough to change paths and warn you about changes

quartz kindle
#

thats not ts

opal plank
quartz kindle
#

thats your editor

#

lel

crimson vapor
#

well ts does warn you

opal plank
#

no, ts will pretty much screech at ur type errors

crimson vapor
#

if something doesn't exist

quartz kindle
#

it will scream at you yes, but your editor changes the paths, not ts

#

you can do that in js as well

opal plank
#

well yeah

lyric mountain
#

cof cof intellij cof cof

opal plank
#

details, details

quartz kindle
#

limão

opal plank
#

laranja

crimson vapor
#

huh

opal plank
#

limão = lime(lemon) in portuguese, but it resembles the word lmao

crimson vapor
#

ah

lyric mountain
#

wouldn't lime be lima?

opal plank
#

hmmm i think u right bout that

crimson vapor
#

contrary to popular belief, lemons are not limes

quartz kindle
#

not all lemons are limes but all limes are lemons

lyric mountain
#

limes are suckable, lemons suck you

crimson vapor
opal plank
#

wdym?

crimson vapor
#

with the bar

lyric mountain
opal plank
#

thats gross

lyric mountain
#

new vs old

crimson vapor
#

and the about me (which doesn't show bc not added)

clear marlin
opal plank
quartz kindle
#

expire-ments

#

things that expire

#

(hopefully)

crimson vapor
#

expire-mints

#

mints that expire

#

(sadly)

opal plank
#

y'know whats funny/

crimson vapor
#

nope

opal plank
#

between the first and second screenshots, the member count updated

#

talk about timing

crimson vapor
#

do you fetch all users on startup?

opal plank
#

not anymore

lyric mountain
#

yall've been foreshadowed what discord will look like in the future

#

purple haze

crimson vapor
#

I kinda like that

#

tbh

opal plank
#

thats a weed strain

crimson vapor
#

looks good

opal plank
#

but thats also none of my business

quartz kindle
#

isnt that misleading advertising? discord's website been showing that UI for ages, and discord never looked like that

opal plank
#

where my pure black theme?

#

cyan/gold accents with pure black background

quartz kindle
#

bitcoin gold

opal plank
#

yes

lyric mountain
#

discord themes would be sick

wheat mesa
#

Just allow us to have custom themes 😩

lyric mountain
#

imagine if servers could make server-specific themes

sage bobcat
#

One message removed from a suspended account.

opal plank
#

cough cough mods cough cough

lyric mountain
#

like custom backgrounds for channels

opal plank
#

okay

#

let me 100% honest

#

i DID have an idea like that , but for stage channels

#

how cool would it be to remove message topic ratelimits and have backgrounds?

#

it would legit be a spotify collab

#

edit channel topic to current song + background when inside the stage channel with the art cover of the song playing

quartz kindle
#

/hug

crimson vapor
opal plank
#

dunno

crimson vapor
#

I only have ts5

opal plank
#

i used to code themes for some mods, back in my old obscure past

#

so it wouldnt be hard to do it

#

but i dislike using mods myself

clear marlin
#

obscure

boreal iron
plain holly
#

How do i make it so that my discord bot can send custom emojis and animated emojis?

latent heron
#

greyple kinda nasty tbh

#

i'd prefer the purple haze

clear marlin
plain holly
#

oh so you don't need ur bot to have nitro or anything?

clear marlin
#

no ofc not

plain holly
#

ok

#

thx

earnest phoenix
#

:200iq:

#

:freerealestate:

plain holly
#

it just sends its name

#

but it doesn't send its id

#

even tho i put it in the msg

#

and it doesn't send the angle brackets

umbral zealot
#

Is the bot on the guild where that emoji is?

plain holly
#

yes

umbral zealot
#

can you show the code you use to send it?

plain holly
#

im tryna send the guild's custom emoji

plain holly
#
await ctx.send(":diamond:")
#

wait

#

why doesn't the id show

clear marlin
#

the id was invalid probably

plain holly
plain holly
#

wait how do u get the id

umbral zealot
#

Send \:diamond: in chat to get it

#

that's the exact thing you'll need to send

clear marlin
#

yes ^

plain holly
#

when the bot sends it?

umbral zealot
#

the latter is what I'd send from the bot.

plain holly
#

oh ok

clear marlin
#

you could also do

const emoji = <client>.emojis.cache.get("emoji id")```
#

alternatively

plain holly
#

oh ok

plain holly
#

if i don't have nitro

#

cuz doing \

#

before the emoji doesn't work

clear marlin
#

there are other ways around, like using a bot that show's your emoji list

umbral zealot
#

maybe there's a way to find it by name in dicsord.py? ?I don't know that lib so I can't really say

clear marlin
#

dicsord

#

lol

umbral zealot
#

common typo

umbral zealot
#

at least I'm not talking about pythong

#

or diablow

clear marlin
#

pythong

visual goblet
#

would there be a way to use multiple discord libraries together?

#

i use discord.py but is there a way to use discord.js too?

umbral zealot
#

That wouldn't make much sense

earnest phoenix
umbral zealot
#

I mean you can start two different bot codes with the same token, that works

#

but you can't "mix" them

earnest phoenix
#

you can use nodesocket which will only work in unixbased system but not so efficent

near stratus
marble juniper
#

why would you mix both anyways

#

both are not even meant for the same programming language

visual goblet
#

well obviously i know they arent the same

#

im not that stupid

marble juniper
#

so why

visual goblet
#

it was only a question to see if it was possible

umbral zealot
#

What exactly are you trying to do

visual goblet
#

dont know it was only a question

marble juniper
#

pretty sure its not

near stratus
#
import subprocess
subprocess.run("node", "index.js")

it's weird and stupid

marble juniper
#

unless you wanna port over discord.js to python or discord.py to js

marble juniper
#

technically you could have both processes running a an api or something

visual goblet
#

i only asked because discord.js has more users and documentation

marble juniper
#

they could communicate using http requests

visual goblet
#

but my bot is already made in python

marble juniper
#

but like

near stratus
visual goblet
#

i dont feel like switching'

marble juniper
#

in my opinion either use 1 lib or don't

#

using 2 libs meant for different languages at the same time is dumb

visual goblet
#

im gonna try that out akio

near stratus
#

Be like me and code the whole bot from scratch just because you installed 650 npm modules

visual goblet
marble juniper
#

have fun

#

im not stuck in your skin so I don't have to do it lol

visual goblet
#

i mean yeah obv

marble juniper
#

yes

visual goblet
#

also would any of you know how to take heroku and have it install a github repo

marble juniper
#

idk

#

can't help with this one

solemn latch
#

heroku's docs probably explain it.

visual goblet
#

ah fair

#

heroku does pip install but it cant just only do pip install for a hithub repo

#

github*

#

so it cant find my module for my pag help command

#

so ill have to figure that out

solemn latch
visual goblet
#

thank you

earnest phoenix
#

Anyone knows a libary,which evulates a expression without eval an returns a boolean
Like: "1==1&&2==3" would be false

opal plank
#

whats the concern about eval?

rocky hearth
#

for drag and drop in html
the element which is being dragged, looses some opacity.
Can we stop that?

earnest phoenix
visual goblet
#

eval can get into your computer files i hear and some other dangerous stuff so its highly despised ig

#

but you can make it owner only so its not that bad

opal plank
#

there are open eval bots even

umbral zealot
#

only way to "parse javascript" without doing an eval is... well... You have 2 choices.

  1. You can write your own custom javascript parser that will do simple exact operations that you've pre-determined as valid, making for a very limited language
    OR
  2. You can actually do an eval, but, inside a docker machine running something like the piston engine which ensures it's impossible to escape the sandbox. This makes for a very valid and fully functional eval but one that takes a lot of power to run and is complex to setup.
earnest phoenix
umbral zealot
#

I've done some pretty extensive research on this, and every module except piston has very blatant security flaws letting you escape the "vm" itself. You need some docker shit for this to work

ionic sage
#

I have a giveaway command and it has a setTimeout function. I am planning to make a giveaway end command but how do i actually stop that timeout? (we can use clearTimeout but then how do i stop only that timeout whose giveaway was ended using that command and not all?)

earnest phoenix
#

That's why i never use eval.I parse everything

opal plank
umbral zealot
opal plank
#

i do something similar for my reaction collectors

umbral zealot
#

Giveaways bots that persist between reboots are actually a fair bit of complicated code tbh 😄

opal plank
#

this is what i ended up doing

#

the timers key is just a Node.Timeout

#

so it'll run when it ends

ionic sage
#

ok

ionic sage
opal plank
ionic sage
opal plank
#

i literally explained a good way you could do it too

earnest phoenix
ionic sage
opal plank
#

why do everyone go for giveaways or music bots? not kink shaming, but there are so many out there already

ionic sage
lyric mountain
#

because they're simple/popular

opal plank
lyric mountain
#

giveaway is basically a one-liner

opal plank
#

multipurpose bots dont grow anymore

ionic sage
#

sad

#

lol

lyric mountain
#

and music is most plug 'n play if you don't mind the bug overflow

earnest phoenix
opal plank
#

if u doing it for fun, thats fine

#

but i would discourage making a multi purpose bot to get it famous

earnest phoenix
opal plank
#

its been a couple years now that multi purpose bots dont grow anymore

lyric mountain
earnest phoenix
#

which line?

opal plank
#

which is exactly what i was suggesting with my chat

earnest phoenix
#
timeout.start(callback, 1000, 'giveawayid');

like this

opal plank
#

oh i see

#

well yeah, that'd work i guess

#

prob need to be careful though

#

by the time the giveaway ends, message might not be present anymore

lyric mountain
earnest phoenix
lyric mountain
#

like, undefined is already falsey ain't it?

#

so just !module would suffice

#

or !window, !global, !self

earnest phoenix
#

no idea why maybe i was bored

lyric mountain
#

30mm or 50mm?

#

which bore size?

cinder patio
#

if they were to do !module they would get the errror "module is not defined"

lyric mountain
#

= !module

cinder patio
#

typeof module !== "undefined" checks if module is defined

#

nope

#

run that code in your browser and then run !module

trail slate
#

Hi

lyric mountain
#

ah I see, typeof also catches not defined exceptions

cinder patio
#

Rake probably didn't write that if they don't know why they wrote that lol

lyric mountain
cinder patio
#

That code was made to support old browsers

lyric mountain
#

is there any browser that still don't support let?

cinder patio
#

¯_(ツ)_/¯

umbral zealot
#

internet explorer 11

boreal iron
#

Damn was about to say it

cinder patio
#

The code Rake sent is overkill if you're only executing it in Node.js, and barely readable too

umbral zealot
#

Actually wait, I think even IE11 supports it, and it's IE9 and older that doesn't or some shit

lyric mountain
#

fuck IE

earnest phoenix
lyric mountain
#

although that IE partial compatibility is practically irrelevant

boreal iron
#

Unfortunately not

#

You would wonder how much people still use it

lyric mountain
#

there are very few possible ways not having individual let instances would wreck stuff

lyric mountain
#

as in the second screenshot

#

other than that, IE seems to support it

rocky hearth
#

y dont they delete IE from this world??

sudden geyser
#

IE to perish soon

lyric mountain
earnest phoenix
#

next year 2022 june

rocky hearth
#

send it to mars

sudden geyser
#

Still maintaining their cobol and FORTRAN code base

earnest phoenix
#

There are still pc with windows 98 in europe

rocky hearth
#

burn them

lyric mountain
#

moon or country?

earnest phoenix
#

Europe is a continent

lyric mountain
#

also is america but we don't talk about that here

brave tendon
#

How can I check if a category exists? 😮

earnest phoenix
cinder patio
#

Some people use Win98 by choice

crimson vapor
#

some people are insane

earnest phoenix
#

client.channels.cache.find(x=>x.name==name&&x.category) @brave tendon

boreal iron
#

Even if getting something to run on it is horrible

earnest phoenix
#

some part of win 10 is still based on xp

crimson vapor
#

having access to the internet is a hell of a lot better than standing your point about an os

woeful pike
#

you can still support older browsers that don't have let by compiling down

lyric mountain
#

downpiling

opal plank
woeful pike
#

yis

opal plank
#

if only it was this simple

#

i really dont get people not using ts even in lax mode which would really not have any meaningful difference than simply using js

#

just some extra intellisence from whatever libs have it shipped along

#

230% cpu usage @quartz kindle

#

though its using workers now

#

there should be 7 threads dealing with the absurd amount of presences now

quartz kindle
#

lel

earnest phoenix
#

why does adding a number to parseInt(mystring) return a string with the number at the end

lusty quest
#

welcome to Javascript where nothing makes sense

clear marlin
#

welcome

earnest phoenix
#

yeah

woeful pike
#

what is mystring

#

that shouldn't happen

cinder patio
#

you're probably adding a string to it not a number

earnest phoenix
#
let m = str.match(/\d+$/)[0]
#

this is the string

woeful pike
#

m is not a string here

opal plank
#

$ should match until end of string, no?

#

it should return an array

earnest phoenix
opal plank
#

used: and then the actual array

lyric mountain
#

stringementer

quartz kindle
#

you probably did something weird

lyric mountain
#

ur probably doing the second case

earnest phoenix
#

i was

#

oof

quartz kindle
#

nub

#

:^)

earnest phoenix
#

hey

lyric mountain
#

arnold

lament rock
#

It can be strictly typed as well which is good

#

why null's type is an object is beyond me tho

sacred palm
#
const checkSpooky = setInterval( () => {
  const server = bot.guilds.cache.get("801048326514409502");
  if(server.name !== 'Spooky Month') return;
  bot.channels.cache.get("841977665672970240").send("Server name is Spooky Month :white_check_mark:");
 clearInterval(checkSpooky)
}, 5000)

This is code to send a message when going from a official name to Special name

how do i send a message when going from special Name to normal name?

lusty quest
#

use a else if statement

sacred palm
#

no

#

bc that would not work with alot of these

weary crypt
#

oh its you again

sacred palm
#

i will have a decent amount of special names

#

could i just use else if ?

#

i think so

#

but idk how the event would work

#

thats why im asking in the first place lmao

cinder patio
#

you should put all the special names in an array

#

and use <Array>.includes

umbral zealot
#

Checking every second for something that might happen like 12 times a year is ridiculous especially if you have a guildUpdate event

solid turret
#

hi

earnest phoenix
#

So,im getting a

Error: Cannot find module 'discord.js'
Require stack:

Error, but Discord.js is clearly installed.

sudden geyser
#

You could run npm install in your project directory to reverify.

copper cradle
#

show your package.json file

sudden geyser
#

and show your package.json as well as snails said

earnest phoenix
# copper cradle show your package.json file
{
  "name": "simple-discord-bot",
  "version": "0.0.1",
  "description": "A simple discord bot, mainly used as a template.",
  "main": "index.js",
  "scripts": {
    "start": "node index.js"
  },
  "dependencies": {
    "express": "^4.17.1",
    "graceful-fs": "^4.2.4",
    "quick.db": "^7.1.2",
    "ms": "^2.1.3",
    "moment": "^2.29.1",
    "moment-duration-format": "^2.3.2",
    "os": "^0.1.1",
    "cpu-profiler": "^2.1.1",
    "cpu-stat": "^2.0.1",
    "figlet": "^1.5.0",
    "util": "^0.12.3",
    "g-i-s": "^2.1.6",
    "twemoji-parser": "^12.1.2",
    "imageapi.js": "^1.3.2",
    "canvacord": "^5.1.0",
    "discord-rich-presence": "^0.0.8",
    "discord-rpc": "^3.2.0",
    "discord.js-pagination": "^1.0.1",
    "canvas": "^2.8.0",
    "node-fetch": "^2.6.1",
    "humanize": "^0.0.9",
    "got": "^11.8.1",
    "erit-ytdl": "^0.1.3",
    "soundcloud-downloader": "^0.2.4",
    "simple-youtube-api": "^5.2.1",
    "discord-ytdl-core": "^5.0.1",
    "string-progressbar": "^1.0.3",
    "path": "^0.12.7",
    "fs-extra": "^9.0.1",
    "fs": "^0.0.2",
    "opusscript": "^0.0.8",
    "sequelize": "^6.6.0",
    "sqlite3": "^5.0.2",
    "ytdl-core": "^4.4.5",
    "amethyste-api": "^1.1.4",
    "randomstring": "^1.2.1",
    "sourcebin_js": "^0.0.2",
    "html-entities": "^2.3.2",
    "snekfetch": "^4.0.4",
    "@wordpress/html-entities": "^3.0.0",
    "@types/html-entities": "^1.2.16",
    "superagent": "^6.1.0",
    "jimp": "^0.16.1",
    "discord.js": "^12.5.2"
  },
  "engines": {
    "node": "12.x"
  },
  "repository": "https://github.com/KeemROH-Development/Simple-Discord-Bot/",
  "license": "MIT",
  "keywords": [
    "node",
    "bot",
    "discord"
  ],
  "author": "repl.it user <replituser@example.com>"
}```
#

That's been a Base Package.json I use in all my projects.

#

I've tried npm install discord.js

#

I've tried completely removing the package then re-installing it.

quartz kindle
#

jesus christ so many dependencies

earnest phoenix
quartz kindle
#

thats not an excuse lol

#

many of those are totally useless

earnest phoenix
#

Eh, not necessarily.

sudden geyser
#

You probably don't need most of them

#

For example, the fs package comes with Node.js

earnest phoenix
#

Anyways, regardless of the fact I have so many.

#

Any advice on my problem?

sudden geyser
#

Are you running your bot on repl.it?

earnest phoenix
#

glitch, premium.

quartz kindle
#

did you add discord.js using the "add package" button?

earnest phoenix
quartz kindle
#

run enable-pnpm in the console

earnest phoenix
#

Running...

prime mist
#

ls node_modules/discord.js?

earnest phoenix
quartz kindle
#

no idea what that is

#

probably a dependency of one of your useless packages

earnest phoenix
#

-_- mhm k

quartz kindle
#

lmao

earnest phoenix
#

lmfao, Me spamming Alt+Tab waiting for it to go off that one thingy

prime mist
#

More people should use docker for hosting. I think digitalocean will host a container for $5 a month or so.

quartz kindle
#

just trying to help yo, many of those packages are literally useless

#

like literally literally

#

lmao

earnest phoenix
#

IT FINALLY MOVED @quartz kindle

#

🤣

#

pnpm works @quartz kindle , thanks a bunch!

quartz kindle
#

now go clean your deps

earnest phoenix
#

Yup lmao

#

Hey

quartz kindle
#

fucking 360 seconds to finish

#

jesus

prime mist
#

Haha yes. Don't start a project with a base package.json. install as you need something.

feral aspen
#

Hm...

#

Anyone remind me how we put the picture.

quartz kindle
#

you mean footer icon?

feral aspen
#

Yes.

earnest phoenix
#

i belive its

quartz kindle
#

in the setFooter

#

check the docs

feral aspen
#

Mhm. 👍

earnest phoenix
#

$footerIcon or SetFooter

#

[]

#

()

sudden geyser
quartz kindle
#

nah just run rm -rf on it

#

:^)

prime mist
quartz kindle
#

yes

eager vine
#

Ah yes lmao

sudden geyser
#

may I introduce you to npm install no-one-left-behind

cinder patio
#

It's a great package

#

You basically will never have to do npm i again!

#

I recommend

crimson vapor
#

what is this

#

how does it work

sudden geyser
#

of power

mental raven
#

How can I make a lockdown command in discord.py that locks every channel for everyone?

tardy hornet
#

how can i make that it will give the amount by the animal it choose, it did not work for me and i dont know what to do? https://sourceb.in/vcWvRIggsx

#

i hope i explained it better now^

eternal osprey
#

hey!

sudden geyser
eternal osprey
#
 setTimeout(() => {
        message.channel.send(embed2)
      }, 5000);
        }
        {
          item1 = opponent1[Math.floor(Math.random() * opponent1.length)];
        item2 = opponent2[Math.floor(Math.random() * opponent2.length)];
        const embed3 = new discord.MessageEmbed()
        .setColor("RANDOM")
        .setFooter("Pokehub Coordinates || PVP")
        .setDescription(`${item1}`)
        setTimeout(() => {
        message.channel.send(embed3)
      }, 5000);
        const embed4 = new discord.MessageEmbed()
        .setColor("RANDOM")
        .setFooter("Pokehub Coordinates || PVP")
        .setDescription(`${item2}`)
        setTimeout(() => {
        message.channel.send(embed4)
      }, 5000);
        }``` why is 1 timeout working, and thenit just spams the rest of the code
#

without checking for other timeouts?

sudden geyser
#

timeouts are asynchronous and don't care about the scope outside of them

#

but maybe your issue is with the message.channel.send

#

What exactly are you trying to do? Analyzing your code is difficult since you haven't well-defined a hierarchy via indentation and formatting.

#

Are you trying to send one embed, said 5 seconds, send the next, wait 5 seconds, and send the last one?

sudden geyser
#

Then you need to nest the timeouts inside one another.

forest drift
#

Ok, just a quick question, so i know that "rainbow roles" arent allowed on discord, but for example lets say you had a role that every 10min went from dark green to light green, and then 10min later went back to dark green, repeated. Would this also count as a violation of TOs? If so, is there any way around it in which it wouldn't count as a violation, also please note this is a bot thats only ever going to be in a single server changing a single role.

sudden geyser
# tardy hornet how can i make that it will give the amount by the animal it choose, it did not ...

There are a few issues with your source code:

  1. You repeatedly access the element from the index randomly generated by creating multiple conditional statement. Instead, I recommend you replace this for a switch statement and have a variable to set.
  2. You declared the moneyee variable in the local scope of the if conditional block. It won't be available outside it.
  3. In the database, you're writing the value of random_money instead of the random money selected.

For example, you could do this instead: ```js
const animals = [
"lion",
"fox",
"moose",
"sheep",
"raccoon",
];

let index = Math.floor(Math.random() * animals.length);
let money = null;

switch (animals[index]) {
case "lion": {
money = 4000;
break;
}
case "fox": {
money = 2000;
break;
}
// ...
}

// money should be a number by now. Write it to the database and do whatever else you need with it (such as sending the amount to the user in a message)

sudden geyser
forest drift
#

ok, thanks

sudden geyser
#

In the setTimeout function you pass, you create another setTimeout inside it. For example:

setTimeout(() => {
  console.log("Awe");

  setTimeout(() => {
    console.log("some");

    setTimeout(() => {
      console.log("sauce")
    }, 1000) // 1 second (+ 2 from the previous two)
  }, 1000); // 1 second (+ 1 from the previous one)
}, 1000); // 1 second
#

Run it in your browser to experiment

eternal osprey
#

the problem is, is that each 2 embeds are started and closes using a {}

#

so it wouldd look like this:

#
 setTimeout(() => {
          setTimeout(() => {
            setTimeout(() => {
         
        message.channel.send(embed2)
      }, 5000);
        }
        {
          item1 = opponent1[Math.floor(Math.random() * opponent1.length)];
        item2 = opponent2[Math.floor(Math.random() * opponent2.length)];
        const embed3 = new discord.MessageEmbed()
        .setColor("RANDOM")
        .setFooter("Pokehub Coordinates || PVP")
        .setDescription(`${item1}`)
        message.channel.send(embed3)
      }, 5000);``` see the issue occuring?
tardy hornet
#

in the footer

sudden geyser
#

One issue crippling your program is the formatting. It's hard to visualize

#

I don't know what's going on outside the scope of the code you've shared, but the example I've shown you is a solution to your problem.

eternal osprey
eternal osprey
#
{

const embed1 = ...
 setTimeout(() => {
message.channel.send(embed1)
}, 5000);
}
{
const embed2 = ...
 setTimeout(() => {
message.channel.send(embed1)
}, 5000);
}```
sudden geyser
#

Why are you forcing the two to be independent

opal plank
crimson vapor
#

no

fresh verge
#

How do I make it so like a var, let, or const is not local to like an if statement?

sudden geyser
#

You can raise the scope the variable is part of.

#

Or you could use var to raise the scope to the function scope

#

You may want to research the kind of variables and what they do in JS

prime mist
fresh verge
#

I need help fixing 2 issues. 1st, it doesn't select the correct message, it selects the message above the attended message. 2nd, if args 0 isn't a correct message, or there is a space after the message id it goes through and gives me an error.

shrewd arrow
#

Hey how do I changed the prefix

#

I did wb-prefix bwb-

#

Wb was my new prefix

wheat mesa
#

Can... you show your code?

soft glade
#

i have a levels system for my friends bot and i was wondering if i can make it so it would show how much xp a user needs to level up....

@client.command()
async def level(ctx, member: discord.Member = None):
    if not member:
        id = ctx.message.author.id
        with open('users.json', 'r') as f:
            users = json.load(f)
        lvl = users[str(id)]['level']
        xp = users[str(id)]['experience']
        await ctx.reply(f'You are at level {lvl} with {xp} xp points!')
    else:
        id = member.id
        with open('users.json', 'r') as f:
            users = json.load(f)
        lvl = users[str(id)]['level']
        xp = users[str(id)]['experience']
        await ctx.send(f'{member} is at level {lvl} with {xp} points!')

heres my level check command