#development

1 messages · Page 1295 of 1

misty sigil
#

just shove your ID in a string?

feral aspen
#

const hamoodihajjiri = MYID?

#

Like that

#

const HamoodiHajjiri = 528256079101034506;

earnest phoenix
#

get the user through his id

#

guild.members.cache.get("id");

#

that'll return a GuildMember object or null if none was found

feral aspen
#

Alright.

#

const HamoodiHajjiri = guild.members.cache.get("528256079101034506")

#

?

earnest phoenix
#

yes

feral aspen
#

Alright.

earnest phoenix
#

you can't get statuses of GuildMember objects tho you need to get the User object of it through member.user then you can get his/her statuses

feral aspen
#

I am using the ID to get the status of the member.

earnest phoenix
#
document.addEventListener("click",() => {
window.location.href = "https://donatebot.io/checkout/721707451375943740";
});

look at my brain

feral aspen
#

That is what I am trying to do

#

like send the status of the member.

earnest phoenix
#

you're first getting the user through his ID

#

then you can check his status

#

lemme get the docs

#

you should know about presences if you used the Playing smth stuff for discord bot statuses

feral aspen
#

I tried this! 😐

#
    message.channel.send(message.HamoodiHajjiri.presence.status)```
misty sigil
#

what

feral aspen
#

It didnt work.

#

🤦‍♂️

earnest phoenix
#

bruh

#

message.Hamoodi

#

why message

misty sigil
#

no

#

it’s just Hamoodi

#

no message

feral aspen
#

It worked.

earnest phoenix
#

@feral aspen you're getting the PROPERTY HamoodiHajjiri of OBJECT message even though you're defining a VARIABLE HamoodiHajjiri which is not a PROPERTY of OBJECT message

(too lazy to emphasize bold text so i just went for CAPS)

feral aspen
#

last Question

#

Is there a way I can check if this message is not in a specific server ID, then return;

misty sigil
#

uh

#

yea?

feral aspen
#

How can I do that?

misty sigil
#

just use an if statement

feral aspen
#

Just that.

#

I know

misty sigil
#

message.guild exists?

feral aspen
#

if(message.guild === "serverID") return; ??

misty sigil
#

no

queen tiger
misty sigil
feral aspen
#

oh shoot, i forgot.

#

Thank you.

earnest phoenix
#

is this allowed

document.addEventListener("click",() => {
window.location.href = "https://donatebot.io/checkout/721707451375943740";
});
pale vessel
#

why not

#

where though

earnest phoenix
#

lolum

carmine summit
#

uh

#

why name name still not green?

#

its been 7.14285714286 weeks

earnest phoenix
#

why name name still not green?
@carmine summit name's name is not green because name's name is name

misty sigil
earnest phoenix
#

me and you in the same kool server

carmine summit
#

why me not in koolserver?

earnest phoenix
#

why me not in koolserver?
@carmine summit you notum in koolum serverum because you notum clickum joinum buttonum

#

||we're trolling||

ashen yarrow
#

How do I make a discord bot

fickle sapphire
silver lintel
#

how to find all the last usernames of a user?

#

djs

earnest phoenix
#

@silver lintel what exactly do you mean?

#

all the usernames?

silver lintel
#

idk, something like this where it shows

#

but definately not all

earnest phoenix
#

@silver lintel bruh that's the list of every single member of the server

silver lintel
#

no, thats me

earnest phoenix
#

smh

#

what the fuck is that anyways

pale vessel
#

you need to track them, discord doesn't offer username history

#

i think that's what you meant..?

silver lintel
#

yes ok

earnest phoenix
#

that's kinda like a privacy breach if you let anyone other than the user himself see the usernames

carmine summit
#

hm

#

can DSL detect if the bot is online or not even if the bot is not in this server?

earnest phoenix
#

yes

#

the DSL bot regularly syncs data with top.gg

#

if top.gg doesn't get another load of data sent by DSL every interval then it'll assume it's offline

carmine summit
#

Then, Why not, remove the bot that is offline for more than 3 days in the queue?

earnest phoenix
#

@carmine summit why you say DSL when you're talking about DBL

carmine summit
#

hm?

earnest phoenix
#

DSL == Discord Server List
DBL == Discord Bot List

carmine summit
#

What does this mean: 8. Must have a clear and obvious point of entry (e.g. a working help command)

pale vessel
#

you must document your help command

earnest phoenix
#

50% wrong

pale vessel
#

at least say use .help for help or mention for help in your description/bot status

carmine summit
#

what is my bot's activity is something like: Playing ?help | website.xyz

earnest phoenix
#

It just means your bot should have a clear description of how to use
A help command is recommended but botums have become weirder nowadays so smth else is also allowed

carmine summit
#

does that count?

earnest phoenix
#

yes

#

that is an obvious point of entry

carmine summit
#

cool

#

hmm

earnest phoenix
#

How to add welcome message during javascript code (I dont want readymade code) just tell me the starting I dont know the starting. And in which file should it be server.js or any file else.

#

@earnest phoenix it's still spoonfeeding

#

Yeah

#

But just the starting plz

#

Rest I will do

#

Because I am a noob

#

Discord.js?

#

This is my first ever bot

fickle sapphire
#

client.on(‘guildMemberAdd’, member => {})

earnest phoenix
#

Lol on me 😔😖

fickle sapphire
#

I think it is guildMemberAdd

#

Not sure tho

earnest phoenix
#

Ok Thanks

#

@earnest phoenix you're not a noob you just need to learn more stuff

gilded lily
#

how to make botlist like DBL

earnest phoenix
#

@earnest phoenix yes Thanks for motivating me it helped a lot lub you 😘

#

how to make botlist like DBL
@gilded lily there is no guide online but I'm sure it's super duper easy

#

@earnest phoenix what is the function of DBL?

#

@earnest phoenix yes Thanks for motivating me it helped a lot lub you 😘
@earnest phoenix uhhh are you gay or smth....

#

@earnest phoenix I am a boy

#

@earnest phoenix what is the function of DBL?
@earnest phoenix just a place where people can add their shit bots for the world to see

#

@earnest phoenix oh nice

#

@earnest phoenix are you girl or boy?

#

I'm gapple

zenith terrace
#

this isnt development

earnest phoenix
#

@earnest phoenix what ?

carmine summit
#

how can I use substring() but it starts from the left

gilded lily
#

@gilded lily there is no guide online but I'm sure it's super duper easy
@earnest phoenix I was jk I know how to make one

earnest phoenix
#

how can I use substring() but it starts from the left
@carmine summit add 0 as the second parameter

carmine summit
#

ok

earnest phoenix
#

that tells javascript to start from that character

#

0 is the leftmost character

#

(you should know that js stuff starts always from 0)

carmine summit
#

ok

#

ty

raven urchin
#

Is it possible to use a different lavalink_host instead of the hostings lavalink_host?

carmine summit
#

It doesn't work on my code

#

see I have a code that returns miliseconds

#

and i want to convert them into seconds

#

without decimals

zenith terrace
#

moment

earnest phoenix
#

@carmine summit Math.round?

zenith terrace
#

or that

earnest phoenix
#

also can you send the code

carmine summit
#

yeah im just gon use Math.floor

earnest phoenix
#

remember that you can't use it on strings

#

so parseInt() the string first

carmine summit
#

Yeah Yeah

earnest phoenix
#

or just go straight for Math.round() if you're not using strings

#

Can I add purge,warn,welcome,ban,kick,mute,instant reply, economy,music in one bot?

silver lintel
#

Ofc it's your bot

earnest phoenix
#

@silver lintel is it poss.?

#

yes

silver lintel
#

Ofc

pale vessel
#

remember that you can't use it on strings
@earnest phoenix you can

earnest phoenix
#

And how to get a bot verified? And get verified bot developer tag

#

everything is possible in programming (other than NOT having AI take over the world)

#

And how to get a bot verified? And get verified bot developer tag

#

?

#

?

#

you can't get badge anymore

#

but you can still be verified

#

@earnest phoenix why?

#

ask discord why

#

Lol

#

And how to get a verified bot?

carmine summit
#

So basically, Don't trust JavaScript with GEMDAS

earnest phoenix
#

@earnest phoenix your country tell me your country so we can talk in a primary language

#

to be verified you need to have your bot in atleast 75 servers then follow the instructions they DM you

#

@earnest phoenix we can't chat in any language other than english in this channel
we're not supposed to ask programming stuff in #general-int (the only channel that allows other languages)

#

@oak cliff can we chat in other languages here

#

@pseudo temple stop

#

adverts

oak cliff
#

general 2 only so if someone needs dev help in another language you can talk there

earnest phoenix
#

ok

carmine summit
#

Is timers updating every 2 seconds considered as "1. Abide by top.gg’s Terms of Service, Discord’s Terms of Service, API rate limits and Developer terms."

earnest phoenix
#

@carmine summit yes it is API abuse

carmine summit
#

uh

earnest phoenix
#

make it 10 minutes

carmine summit
#

ok

earnest phoenix
#

that's the rate limit

carmine summit
#

10 minutes!?

earnest phoenix
#

go lower and you'll be beaned

carmine summit
#

alright

earnest phoenix
#

@earnest phoenix oh and is there any way to get inside on android not using pc or laptop

#

@earnest phoenix of course

#

but it's VERY VERY VERY VERY VERY RISKY

#

so i won't help with that

carmine summit
#

so uh

earnest phoenix
#

@earnest phoenix what will happen what are the risk?

carmine summit
#

I cant make live timers?

earnest phoenix
#

@earnest phoenix I want to get inside a bot using android nothing else

#

idk

#

ask auger

#

@earnest phoenix I was asking this

#

he hosts his bot on his phone

#

@earnest phoenix auger

#

Who is he?

zenith terrace
#

do you have to ping every message

earnest phoenix
#

I can't ping him

#

@faint prism

#

he's the guy

#

Oh

carmine summit
#

Is timers illegal?

#

like updating every 2 seconds

earnest phoenix
#

@carmine summit no

#

they're against API rate limits if they update too fast

#

@faint prism Can you help me in getting inside my bot from android nothing else?

#

But you won't be sued for them

carmine summit
#

is 2 seconds "too fast"?

earnest phoenix
#

@carmine summit yes

#

Server stats bot says discord forced them to make the timers uodate every ten minutes

slender thistle
#

What are you updating @carmine summit

carmine summit
#

message

earnest phoenix
#

oh

slender thistle
#

Is it a constant interval?

earnest phoenix
#

messages have API limits of 5 seconds for everything

#

It will load the servers to load every 2 sec making the servers slow that's what I red

carmine summit
#

yeah, I think

long ginkgo
#

I want giveaway bot

slender thistle
#

Make it 5-10 minutes

earnest phoenix
#

@long ginkgo search it on top.gg or make it yourself

#

@long ginkgo make it

slender thistle
#

Just because it abides with ratelimits doesn't mean it's not abuse

earnest phoenix
#

^

carmine summit
#

Whats 5 minutes in miliseconds?

earnest phoenix
#

but if you're going for channels like server stats bot the the limit is 10 minutes

#

Whats 5 minutes in miliseconds?
@carmine summit 5 * 60 * 1000

#

5X60=300
300X1000= 300000

slender thistle
#

5 * 60 = 300 * 1000 = 300000

earnest phoenix
#

@carmine summit 5 * 60 * 1000
@earnest phoenix isn't it 100?

#

spoonfeed

carmine summit
#

xD

earnest phoenix
#

@earnest phoenix isn't it 100?
@earnest phoenix milli means thousandth

#

@slender thistle nice calc.

#

@earnest phoenix then what the 100

slender thistle
#

thanks

earnest phoenix
#

1000 is nano

carmine summit
#

So uh, What if the message will expire in 10 minutes?

earnest phoenix
#

100 is milli 1000 nano

carmine summit
#

clearInterval()

earnest phoenix
#

@carmine summit make the limit 7 min.

slender thistle
#

1 second = 1000 milliseconds

earnest phoenix
#

@slender thistle noice

#

BATTERY OP

carmine summit
#

7 minutes, then the message can be updated every 2 seconds?

slender thistle
#

...???

#

You have to make it 7 minutes constant

carmine summit
#

???

earnest phoenix
#

@carmine summit no make the update 7 min. And the message to delete after 10 min. It will give you 3 min. Lifeline

slender thistle
#

not "7 minutes first and then 2 seconds after"

carmine summit
#

What if its not constant

earnest phoenix
#

@carmine summit make it atleast 7 min.

carmine summit
#

like, It will not edit after 5 minutes

#

whats the recommended interval

#

shivaco's phone prob died KEKlaugh

earnest phoenix
#

@carmine summit see if the limit is 10 min. Make the min. Limit 5 min. So if bot gets late it will update at 7 or 8 min. Giving you 2min. Life.

#

shivaco's phone prob died :KEKlaugh:
@carmine summit I was thinking the same

carmine summit
#

Im so confused

earnest phoenix
#

@carmine summit make the limit 5 that's all and update after 5 sec.

#

That's all

carmine summit
#

Ok

#

@carmine summit make the limit 5 that's all and update after 5 sec.
@slender thistle is this ok?

#

yep, his phone prob died

earnest phoenix
#

@carmine summit yeah try I think it ok

#

@carmine summit I am in india and he is in Russia probably he is eating or sleeping

#

He is just 30 min ahead of me

carmine summit
#

wait @slender thistle's a male?

silver lintel
#

bruh you ping every message

earnest phoenix
#

I think

#

@silver lintel yes

carmine summit
#

k.

earnest phoenix
#

Had an habit due to replying in a fast messaging channel

#

You from which country?

#

I think Russia!

slender thistle
#

wait @slender thistle's a male?
@carmine summit yes

make the limit 5 that's all and update after 5 sec.
eh I'd say go for it

earnest phoenix
#

Wait shivaco a russian a Soviet union?

#

With first 5 letters of your name I thought you are ind.

pale vessel
#

development think3d

slender thistle
earnest phoenix
#

How to become mod?

slender thistle
#

-faq 12 -c

gilded plankBOT
earnest phoenix
#

@slender thistle in this server

carmine summit
#

My bot won't get declined if i do this?

slender thistle
#

I highly doubt we would decline it unless it was actually getting ratelimited

carmine summit
#

alright,

#

no editing editing

earnest phoenix
#

What is the prefix of dbl?

carmine summit
#

it make bot decline decline

#

RIP time and effort, You will be missed

slender thistle
#

DBL? You mean @pliant gorge?

#

It only has -ping command

earnest phoenix
#

@slender thistle yup

carmine summit
#

-ping

pliant gorgeBOT
#

dslWaddle I'm alive!!!

earnest phoenix
#

-ping

pliant gorgeBOT
#

dslWaddle I'm alive!!!

earnest phoenix
#

-commands

#

How to add bot in this server I want to add

slender thistle
earnest phoenix
#

I want bot developer role

slender thistle
carmine summit
#

how can I make uhh

#

get a random

#

string

#

from

#

array

split nexus
#

Hello.

slender thistle
#

Generate a random index and then get an element under that index

carmine summit
#

In. English?

split nexus
#

what?

sand sparrow
#

I've got an error else if wont work in my bot commands
(js)

split nexus
#

wait

#

I've got an error else if wont work in my bot commands
@sand sparrow got it

silver lintel
#

show the rest of the code

slender thistle
#

Define "not working"

sand sparrow
#

Yes

silver lintel
#

what do you mean 'wont work'

open rune
#

unwork

#

xD

slender thistle
#

In. English?
@carmine summit What programming language do you use?

sand sparrow
#

Else if

split nexus
#

@sand sparrow Ok

silver lintel
#

because there is a semi colon on the first line

split nexus
#

the

if(command === "ping");{
#

you need to remove the ;

open rune
#

yes

sand sparrow
#

BRUH

#

I didn't see it

split nexus
#

on the

if(command === "ping");{

line

sand sparrow
#

It works

open rune
#

lmao, it's ok @sand sparrow, common error

silver lintel
#

also when somehthing doesnt work, check logs

split nexus
#

I SOLVE IT

sand sparrow
#

I'm bad at this

silver lintel
#

itll tell you excatly whats wrong

earnest phoenix
#

Define "not working"
@slender thistle i love shivy

split nexus
#

@sand sparrow I can help you with discord.js

sand sparrow
#

Oooo

#

Dm?

split nexus
#

Yea

sand sparrow
#

I need more help lol

open rune
#

just ask

#

anyway guys, does Luca have chat bot / clever bot feature?

#

because, I am lonely rn

slender thistle
#

Nope

open rune
#

;-;

#

shiv, fill up my emptiness

slender thistle
earnest phoenix
#
let p = `${...[ /* an array*/]}`;

SyntaxError: Unexpected token ...
wut

silver lintel
#

whats ... stupposed to be

earnest phoenix
#

spread operator

silver lintel
#

ahh yes

earnest phoenix
#

ye thats not gonna work

#

if i define the array before it works

#

hmm

pale vessel
#

what

earnest phoenix
pale vessel
#

why inside a template literal and ...array should be inside an array

earnest phoenix
#

cuz

#

me dumbo

#

.join(", ");

#

... will return multiple values, but string literal thing only supports 1

#

ok

pale vessel
#

no template literal .toString()s it

earnest phoenix
#

no template literal .toString()s it
@pale vessel u cant .toString() multiple values

pale vessel
#

it's an array

#

muh dude

earnest phoenix
#

a spread array

#

this is outside a string

pale vessel
#

we're talking about the fact that he's putting an array inside a template literal

earnest phoenix
#

its not [1,2,3] its 1,2,3

#

well u can put an array

#

but not with ...

#

ok

#

so spread operator no work outside objects?

#

no

#

(or func params)

#

functions are objects

pale vessel
#

function params work

earnest phoenix
#

||kthnxbai||

#

@earnest phoenix you from india I came to know via emoji

#

Bhenchod How to add purge command?

silver lintel
#

js?

#

then you would use bulkdelete

urban ridge
#

I am making a bot list too

earnest phoenix
#

how to make bot list @urban ridge

urban ridge
#

easy

#

learn

#

lol

#

ummm

#

it's pretty easy

#

I won't release any codes tho.

slender thistle
#

Responsive website with backend that utilizes a database

urban ridge
pale vessel
#

good luck making money off of it though

slender thistle
#

Thing is, are you sure you want to mention it here

earnest phoenix
#

yes

slender thistle
#

not you

earnest phoenix
#

ojk

urban ridge
#

ummmm

#

I just wanted to show off my new project 😭

pale vessel
#

new and original project :)

slender thistle
#

in a bot/server list's support server?

carmine summit
#

How can I make the Among Us effect, You know, the animation in was An Impostor.

#

it like, type animation

molten charm
#

I have made my bot open a server, but I cannot authorize myself, how do I authorize myself?

carmine summit
#

w -> wa -> was -> was n -> was no -> was not

#

like dat

silver lintel
#

Just edit it

#

Edit the message many times

carmine summit
#

i wanna make it a loop

#

for loop, rather

open rune
#

Oh, understand

sudden cape
#

Edit the message or generate an gif

open rune
#

so the text will show up one by one, right?

carmine summit
#

yeah yeah

open rune
#

ok idk

carmine summit
#

ima think its somekind of str.substring(i, 0)

open rune
#

jk, I will try it for u

slender thistle
#

Editing messages quickly enough will just be a pain in the ass

#

a letter per second

carmine summit
#

xD

#

I need it that way

sudden cape
#

what language are you using?

slender thistle
#

But, if you really wanna make it a thing... create an empty string, use a foreach on a string (if that's possible), append a letter to the empty string and edit the message

open rune
#
msg.channel.send('w').then(message => {
  message.edit('wa').then(msg => {
    msg.edit('was')
  })
})

@carmine summit probably like that?

pale vessel
#

woah

open rune
#

"pain in the ass"

silver lintel
#

That wouldn't be that efficient

carmine summit
#

PLEASE NO

pale vessel
#

wouldn't that be abuse? you should create an interval

slender thistle
#

Imagine not abiding by ratelimits

#

Yes, this ^

carmine summit
#

im ok with 2 seconds per letter

open rune
#

yes, coz that style without interval is an "pain it the ass"

#

but simpler

#

xd

slender thistle
#

but

#

callback hell

#

But, if you really wanna make it a thing... create an empty string, use a foreach on a string (if that's possible), append a letter to the empty string and edit the message
why not do this

open rune
#

yes

earnest phoenix
#

Use canvas to generate a GIF

open rune
#

lol, use flash

earnest phoenix
#

A billion times better

#

lol, use flash
@open rune that will be even better KEK

carmine summit
#

i dunno how to use canvas lol

earnest phoenix
#

i dunno how to use canvas lol
@carmine summit ask flazepineapple he's a godum

carmine summit
#

@pale vessel

raven urchin
#

I have a question in terms of the Lavalink_host, is it possible to use a different one instead of using the hostings Lavalink?

earnest phoenix
#

oof

silver lintel
#
message.channel.send("w").then(msg => {
  setTimeout(function() {
  msg.edit("wa");
  }, 1000)
setTimeout(function() {
msg.edit("was");
}, 2000);
})

Something like that?

carmine summit
#

BRUH

#

im just gon use foreach

silver lintel
#

But you could use for loop to add each letter

#

And edit that

earnest phoenix
#

a guy was asking me for help

#

in DMs

#

told em to come here but they ain't here

solemn jolt
#

Iam creating a bot in github and hosted by heroku i use json db and all json db reset in 24H for now i wanna use a nother DB

#

I don't now about a nother db?

pale vessel
#

something like this```js
let string = "hello";
let counter = 0;

let interval;

channel.send("word: ").then(sent => interval = setInterval(() => {
if (!string[counter]) return clearInterval(interval);
sent.edit(sent.content + string[counter]);
counter += 1;
}, 10000));```

earnest phoenix
#

*takes deep breath*

@solemn jolt JSONDBs ARE THE MOST RISKY THING IN THE ENTIRE UNIVERSE STOP USING THEM SWITCH TO SMTH LIKE SQL OR MONGO
AND DON'T WHINE ABOUT NOT BEING ABLE TO UNDERSTAND THEM
NOBODY IS BORN WITH PROGRAMMER SUPERPOWERS (except me)

compact oriole
#

Yeap

#

Code913 speaking facts

cinder patio
#

The best way to use a database in heruko is to use a cloud database, otherwise you'll have to setup a ton of stuff, I don't know how it's done

pale vessel
#

heroku has a postgresql database for free

compact oriole
#

Use mongodb atlas free tier or that

solemn jolt
#

Mangodb?

compact oriole
#

Mongo

solemn jolt
#

How i can use mango db

pale vessel
#

depends, do you want to self host it?

compact oriole
#

Mongodb atlas is best for small things

solemn jolt
#

Yeh

compact oriole
#

And @solemn jolt it is MONGO NOT MANGO

#

read it

solemn jolt
#

@compact oriole 😂 thx

earnest phoenix
#

also please learn actual freaking programming

pale vessel
#

you can use mongodb atlas like affax said and get the driver that supports the programming language that you use

open rune
#

mongo in javanese means please

pale vessel
compact oriole
earnest phoenix
#

god staying in dbl has made me tenfold salty from these weirdass whitenames

solemn jolt
#

How i can lern mongo db ?

compact oriole
#

Youtube

#

Google

earnest phoenix
#

@compact oriole wait you have Kurzgesagt emotes

open rune
#

google

pale vessel
#

you can read their documentation

compact oriole
#

Bro I'm on their server

earnest phoenix
#

invite meh

#

DM

compact oriole
#

It is public

pale vessel
#

click
it

compact oriole
#

Just join it yourself

#

Yea

earnest phoenix
#

I'm on mobile

#

f

#

also we're gettinf oof topic real quicko

carmine summit
#
let shown
    let str = args.slice(0).join(' ')
    msg = await message.channel.send(args[0].substring(0, 1))
    str.split('').forEach(letter => {
      shown = shown + letter
      msg.edit(shown)
    })
pale vessel
#

i gave you an idea of what i had: ```js
let string = "hello";
let i = 0;

let interval;

channel.send(string[i]).then(sent => interval = setInterval(() => {
i++;
if (!string[i]) return clearInterval(interval);
sent.edit(sent.content + string[i]);
}, 5000));```

the bot sends a message. after that, it creates an interval (by assigning it to a variable so that it can be cleared when done). it'll add a counter and edit the sent message until it reaches the end of the string (where it would clearInterval itself).

earnest phoenix
#

@carmine summit why are you making among us bot in discord

#

How to get invite link of a bot

pale vessel
#

get the bot id

earnest phoenix
#

@earnest phoenix

pale vessel
earnest phoenix
#

Ok

#

How to get bot id is it client I'd?

pale vessel
#

yes

earnest phoenix
#

Ok

sudden cape
#

Or you can generate an link in OAuth2 on the developer site

carmine summit
#

uh

#

its for

sudden cape
#

Where you created the bot

carmine summit
#

my server

#

that has

#

15k members

#

and i need it

#

to make matchmaking easier

earnest phoenix
#

No it's not coming

carmine summit
#

by renaming their VC

#

to their code

#

so people wont just hop into a VC and ask "code?"

earnest phoenix
#

How to get invite link of a bot

sudden cape
#

@earnest phoenix Have you benn to discord developer wesite?

carmine summit
#

@earnest phoenix

earnest phoenix
#

@sudden cape how to go

#

I dont know dev site

#

Its my own bot

sudden cape
earnest phoenix
#

And I dont know how to get invite lonk

#

Link**

sudden cape
#

There you can create the applicaton

silver lintel
#

Go to that link and go to oauth2

carmine summit
#
let shown = ''
    let str = args.slice(0).join(' ')
    msg = await message.channel.send(args[0].substring(0, 1))
    str.split('').forEach(letter => {
      setTimeout(foo => {
      shown = shown + letter
      msg.edit(shown)
      }, 500)
    })
```the setTimeout wont work properly
earnest phoenix
#

@sudden cape I have created application but how to get link?

sudden cape
#

You also have to go to bot and create an bot

earnest phoenix
#

@sudden cape I have

earnest phoenix
#

I have

pale vessel
#

mate

#

hello

#

@carmine summit

sudden cape
#

Then go to OAuth2

#

And click bot in the field of options

#

The click on the perms that you want the bot to have

#

Then copy the link

carmine summit
#

can you explain how the interval works

#

also, the interval dont work

pale vessel
#

interval repeats the function given after specified period of time (in milliseconds)

#

also, i tested it on my bot and it worked

carmine summit
#

it wont work on mine

pale vessel
#

show me what you did

#

were there any errors?

#

setTimeout won't work in your case, it only runs once

mild flower
#

hey whenever i do node . i always get module not found
even if it is a blank workspace with no module requirements

carmine summit
#
let shown = ''
    let str = args.slice(0).join(' ')
    msg = await message.channel.send(args[0].substring(0, 1))
    str.split('').forEach(letter => interval = setInterval (() => {
      shown = shown + letter
      msg.edit(shown)
      }, 5000));
pale vessel
#

you need to define interval

#

it could be before shown

#

i don't know what you're doing with that code but it would be easier for me to explain what i did

mild flower
violet mesa
#

how do i make anti spam?

carmine summit
#
let i = 0
    let shown = ''
    let str = args.slice(0).join(' ')
    msg = await message.channel.send(args[0].substring(0, 1))
    str.split('').forEach(letter => {
      console.log(i)
      setTimeout(() => {
      shown = shown + letter
      msg.edit(shown)
      i++
      }, 2000 * i)
    })
```logs `0` for every word... WEIRD
earnest phoenix
#

its normal

carmine summit
#

why tho

tight plinth
#

2000*0

violet mesa
#

kirito how is asuna lol

carmine summit
#

oh wtf

#

now it logs 1 for every letter...

violet mesa
#

i see u guys are busy ill come ask later idk js

carmine summit
#

why my i++ no work Confused_Dog

tight plinth
#

do a for loop

#

ez

carmine summit
#

no plz

#

rip lines

mild flower
#

bruh

carmine summit
#

k fine ima do for loop

mild flower
#

can anoybody help me

carmine summit
#

HMMMMM

#

sus

#

then it will run twice

#

HMM

pale vessel
#

what https://discordapp.com/channels/264445053596991498/272764566411149314/762613754176340048 does:

  1. define string to use (string)
  2. define a counter (i) for the string (first index first, so 0)
  3. define an unassigned variable (interval) (for clearInterval)
  4. send the first letter (strings can be iterated so we can use indexes! that would be string[i])
  5. after the message is sent, create an interval by assigning interval a setInterval with a function. the function adds 1 to the counter (i++) and appends the next letter to its content (sent.content + string[i]). this could go on until the accumulated index does not exist on the string (if (!string[i])), it will stop the interval by clearing it (clearInterval(interval))
sand sparrow
#

re

carmine summit
#

my. i++. does. not. work

mild flower
#

Why is this happening

carmine summit
#

my. i++. does. not. work

mild flower
#

pls help

#

im oging insane

pale vessel
#

show your code

mild flower
#

wait one sec

carmine summit
#

so apparently

#

i moved the i++ to the top

#

and it worked

#
let i = 0
    let shown = ''
    let str = args.slice(0).join(' ')
    msg = await message.channel.send(args[0].substring(0, 1))
    str.split('').forEach(letter => {
      i++
      console.log(i)
      setTimeout(() => {
      shown = shown + letter
      msg.edit(shown)
      }, 1000 * i)
    })
#

why tf did i not block it

#

what is wrong with me

mild flower
#

@pale vessel

pale vessel
#

how did you start your script?

mild flower
#

listen

#

even if i go in a blank workspace

#

and type node .

#

it shows me that

slender thistle
#

isn't there a missing })

pale vessel
#

show your package.json

silver lintel
#

Unfinished brackets

pale vessel
#

that can be looked on later

mild flower
pale vessel
#

and your index file is called?

mild flower
#

index.js

pale vessel
#

hm

#

can you send the full error?

mild flower
#

Unfinished brackets
fixed all of that but it didnt make a difference

#

can you send the full error?
ok

#
  throw err;
  ^

Error: Cannot find module 'C:\Users\farah'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1065:15)
    at Function.Module._load (internal/modules/cjs/loader.js:911:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}```
earnest phoenix
#

are you sure you don't have any other files

pale vessel
#

but don't think that's the cause

silver lintel
#

I'm probably wrong, but isnt it new Disocrd.client?

earnest phoenix
#

the error indicates they're trying to require a local path

mild flower
#

ok i fixed that still problem persists

pale vessel
#

yeah

#

that was just the code

earnest phoenix
#

did you mess with node_modules

mild flower
#

no

earnest phoenix
#

then you're trying to require your path somewhere

pale vessel
#

do you have any other files in your main directory like cry said

mild flower
pale vessel
#

your index.js is 46kb?

mild flower
#

yes

#

only 900 lines of code

pale vessel
#

so that wasn't the code...

earnest phoenix
#

lol

mild flower
#

uh

pale vessel
#

jeez

mild flower
#

basically

earnest phoenix
mild flower
#

its the code without all the commands

wintry sun
#

Hi I am a new dev

mild flower
#

i just took out the commands chill

#

but why am i getting the same errror everywhere

#

in different projects

#

whenever i type node .

earnest phoenix
#

imagine going to the doctors because you keep coughing but you don't mention that you smoke a pack of cigs a day

pale vessel
#

great analogy

mild flower
#

also

#

its not a problem of the code

#

cus the same code works on heroku

#

and the bot is running on the same code on cloud

#

so its a local thing

pale vessel
#

it could be that you don't have some of the modules

#

heroku installs modules inside the package.json so it's guaranteed to work

#

try running npm i

mild flower
#

did it

pale vessel
#

try starting your bot

mild flower
#

doesnt work

pale vessel
earnest phoenix
#

did npm i run successfully

#

if nothing else

mild flower
#

yes

earnest phoenix
#

delete your node_modules folder and re-run npm i

mild flower
#

ok

#

uh i did it

#

but the node_modules folder didnt regnerate

pale vessel
#

where did you run it

earnest phoenix
#

^

mild flower
#

wdym

#

where

#

u mean directory of the files?

pale vessel
#

is it the same directory as your index.js?

mild flower
#

yes

earnest phoenix
#

either npm didn't install packages successfully or you didn't run it in the right dir

#

double check it

mild flower
#

wait

#

uh what

#

how do i change the directory

earnest phoenix
#

cd <dir> or just boot up cmd in the dir from the context menu

#

i have winterminal so it's a bit different but you should have something like this for cmd

mild flower
#

wait

earnest phoenix
#

don't tell me you've been running node in the wrong dir the entire time

pale vessel
mild flower
#

ok im in the directory now

#

what

pale vessel
#

try running node .

#

oh wait didn't you delete the dir

#

run npm i

earnest phoenix
#

^

mild flower
#

ight

#

ah its fixed

#

thanks

#

a bunch

#

oop

earnest phoenix
#

let Days = moment.duration(message.createdTimestamp - message.guild.createdTimestamp).asDays()

#

this is correct?

mild flower
#

wait

pale vessel
#

well, only you know the values

mild flower
#

if i do node . from visual studio code

pale vessel
#

was it correct?

earnest phoenix
#

the days are like this

mild flower
#

it gives me the same errro

pale vessel
#

just round them

mild flower
#

do i need to do it cmd every tiem

earnest phoenix
#

because vsc terminal is just cmd

#

you have to cd to the correct dir

#

lol

#

oh

mild flower
#

uh

pale vessel
#

cdeez nuts

earnest phoenix
#

that's PS

#

PS follows .net syntax

#

cmd follows msdos syntax

mild flower
#

but how do i do it

#

then

earnest phoenix
#

Set-Location -Path <p>

#

i think you can omit the path arg

#

it's there by default

mild flower
#

ah thank you

#

it will stay there permanently?

earnest phoenix
#

no

mild flower
#

need to do it every tiem?

earnest phoenix
#

well, if it isn't going to stay there permanently, obviously yes

#

or you can open your project folder with vsc

#

vsc is going to recognize it as a project and the terminal path is going to default to the current path

mild flower
#

ah worked

#

will do that from now on

#

here is 1 bobux

pale vessel
#

thank you

earnest phoenix
#

i love using windows terminal instead

#

tabs yum

#

and WSL2 support

#

No one asked.

#

but they did hun lol

violet mesa
hearty wren
#

Windows terminal is so amazing

#

Finally tabs

#

I only found out 3 days ago and left bed at 4 am to download it

violet mesa
#

lol

silver lintel
#

Hoe to add space after every character in js? .split('').join(' ')

sudden geyser
#

@silver lintel are you not doing that

pale vessel
#

did you just answer yourself

sudden geyser
#

also if you want to get every character in an array, you should use the spread operator instead of splitting by ""

silver lintel
#

Oh it's right then

#

also if you want to get every character in an array, you should use the spread operator instead of splitting by ""
@sudden geyser ?

pale vessel
#
[..."string"] // ["s", "t", "r", "i", "n", "g"]```
silver lintel
#

:O

sudden geyser
violet mesa
#

how do i make anti spam discord.py
can anyone help?

earnest phoenix
#

how to i make customable prefix to my bot

violet mesa
#

do u use python js or ...

boreal iron
#

Save the prefix in a file as array for example together with the guild id, load and cache the file on startup and there you go

balmy anchor
#

Hi guys,
Do you know how to make a command with multiple arguments?
like a message or something?

silver lintel
#

What lib?

balmy anchor
#

djs

silver lintel
#

Args?

balmy anchor
#

yess....

violet mesa
silver lintel
#

Command: !command hi hello :)
args = ['hi', 'hello', ':)'];
console.log(args[0]) //hi

#

Is this what you want @balmy anchor

balmy anchor
#

something like this:

(Example) !role create My Name Is SuperMan

silver lintel
#

Ahh ok

balmy anchor
#

I know how to do it,
But I dont want to make an if all the time for any arg

silver lintel
#

What are you trying to do?

balmy anchor
#

a command to create a role with multiple args

#

!r create My name is bla bla and bla

silver lintel
#

And you want the role to be called 'ny name is blah blah blah'?

balmy anchor
#

yes

violet mesa
balmy anchor
#

I've already made it but I just want to have the command with multiple args and not only 1 or 2

silver lintel
#

then args.slice(1).join(" ") is that i think

balmy anchor
#

thx ill try

#

@silver lintel Thx It's working!

feral aspen
#

Doesn't work, anything wrong with this code?

#
        welcomeChannel[bot.guilds.cache.get(message.guild.id).id] = {
            name: message.guild.name, 
            channel: channel
        }
        fs.writeFile("../../welcomeChannel.json", JSON.stringify(welcomeChannel), (err) => {
            if(err) console.log(err);
        });
    }```
silver lintel
#

Np

earnest phoenix
#

you tell us

#

it's your code, debug it

violet mesa
#

?

earnest phoenix
#

@violet mesa if nobody is helping why keep spamming the same question

#

wait for somone

violet mesa
#

i wasnt spamming

#

if someone comes he wont search would he

feral aspen
#

it's your code, debug it
still cant seem to know the problem

earnest phoenix
#

also you can goto discord.py server and they'll probably help

silver lintel
#

Logs?

feral aspen
#

it doesnt writefile thats it

violet mesa
#

also you can goto discord.py server and they'll probably help
@earnest phoenix im not in any

earnest phoenix
#

@feral aspen welcomeChannel is an array?

slender thistle
#

also you can goto discord.py server and they'll probably help
best they'll tell you is to either rtfd or google it

#

Can't really vouch for that server anymore

#

Anyway, @violet mesa still need help?

feral aspen
#

const welcomeChannel = require("../../welcomeChannel.json")

violet mesa
#

yep

earnest phoenix
#

python after all

violet mesa
#

i do

slender thistle
#

anti-spam is tricky

#

You need to store previous message contents from users

violet mesa
#

json go brrr

earnest phoenix
#

@feral aspen JSON DATABASE WHY WHY WHY WHY WHY WHY

feral aspen
#

Bro, I didnt ask for the opinion, I just asked what's the problem.

slender thistle
#

back to square one saying JSON databases are fine if used properly

earnest phoenix
#

bruh

glacial wyvern
#

@earnest phoenix, Bruh moment öyle bir andır ki

feral aspen
#

Bruh

violet mesa
#

ill make an empty list of through python to json

#

and add message

#

(each user has its own using id)

#

and remove everything after 5 seconds

earnest phoenix
#

JSON needs to be completely parsed before it can be used in the code
If you need just a single object from it you'll need to parse the whole fucken thing
Real fucken databases like SQL and MongoDB only read files when they're needed not all the time

silver lintel
#

Not that easy

earnest phoenix
#

also it corrupts easily

#

and sucks anyways

#

but your choice

feral aspen
#

Alright.

#
        welcomeChannel[bot.guilds.cache.get(message.guild.id).id] = {
            name: message.guild.name, 
            channel: channel
        }
        fs.writeFile("../../welcomeChannel.json", JSON.stringify(welcomeChannel), (err) => {
            if(err) console.log(err);
        });
    }``` It doesn't writefile, I tried putting the Stringify something else, still doesnt work
slender thistle
#

ill make an empty list of through python to json
@violet mesa The only thing I can come up with a dictionary, user ID as key with a nested dictionary as value, containing message content and count

violet mesa
#

how can i do that

#

so i make a list with user id

#

then add all the messages to that list

#

and remove after 5 seconds

#

if there is 5 messages that are the same

#

i delete

silver lintel
#

It is not that easy

violet mesa
#

them

#

It is not that easy
i know

#

im just lying idea's of what i can do

#

send the list to json

silver lintel
#

1
2
3
Spam
Spam
clear
Spam
Spam
Spam
4
5

feral aspen
#

Bruh

violet mesa
#

mhm

#

so i make a list with user id
put in json
then add all the messages to that list
and remove after 5 seconds
if there is 5 messages that are the same
i delete and mute for 5 mins
#

this is what i came up with

#

does that sound good?

silver lintel
#

If you are clearing the whole list, the messages the user sends before are not included in the next lidt

violet mesa
#

mhm true

silver lintel
#

Which means they don't get counted

violet mesa
#

true true

#

mhm

silver lintel
#

1
2
3
Spam
Spam
clear
Spam
Spam
Spam
4
5
@silver lintel

violet mesa
#

yep

#

mmhhhmm

#

maybe i create a list every 5 mins and just put aside the other list for now but if the next messages contain what the last list has they get muted

slender thistle
#

store time when last repeated message was sent inb4

violet mesa
#

?

slender thistle
#

basically when last repeated message was sent

#

check if it happened within, say, 5 seconds

#

if yes, increment your count

violet mesa
#

neat

#

now i need to see how to do that

#

lol

slender thistle
#

if not, reset the antispam data

violet mesa
#

ima create the json file

slender thistle
#

I'd suggest against JSON database for this

#

specifically, storing on each message

violet mesa
#

what should i save in?

tight plinth
#

a real db

violet mesa
#

just a normal python list?

slender thistle
#

Cache

violet mesa
#

whats cache

slender thistle
#

store in memory

#

literally a dictionary as bot property

violet mesa
slender thistle
#

h

#

e

#

almost

#

I meant not using a JSON database for every message sent

violet mesa
#

yea

#

wait

#

why do i need to save it like that

#

i can save it in a normal list cant i?

slender thistle
#

why list

violet mesa
#

what shall i use?

#

@slender thistle

slender thistle
#

The only thing I can come up with a dictionary, user ID as key with a nested dictionary as value, containing message content and count

violet mesa
#

im saying a list cause i dont need any extra files or any complicated stuff

#

oh

prisma oriole
#

wouldnt a hash map be better suited, or am i missing the point of what hes doing?

violet mesa
#

guess ill use a key

#

what should i name it so it doesnt look bad

#

lol

#

messages

#

ill call it messages

slender thistle
#
bot.antispam = {
    123: {
        "message": "spam",
        "count": 2,
        "last_sent": some_datetime_object_that_was_stored_when_the_message_was_sent
    }
}
violet mesa
#

ok

#

so

#

on message

#

and then i get a var to save when it was sent

#

then "last_sent" would be the var

#

so

slender thistle
#

what

violet mesa
#

"last_sent"=varname?

slender thistle
#

Did you really understand what I meant

#

did you see the message and count keys

violet mesa
#

no mad pls

thin turret
slender thistle
#

Are you familiar with Python dictionaries?

violet mesa
#

kinda

#

im new ok

#

no mad

slender thistle
#

I really suggest you take a step back and learn basic Python itself

#

because you wouldn't have a problem understanding my snippet if you were more familiar with Python dictionaries

#

in any case

violet mesa
#

help me finish this project and then ill learn python

#

like

#

yea

thin turret
#

You need 🐍 to work with 🐍

#

How are you going to build a house without knowing how to use the tools

feral aspen
#

bot.channels.cache.get(channel).send("Welcome to the server!")

#

Cannot read property send.. 😐 am I dumb?

slender thistle
#

the message key is the message content itself, count key is the number that's incremented if now - last_sent (both datetime objects) in seconds is <= 5

feral aspen
#

or just missing something

thin turret
#

what is channel defined as

violet mesa
#

@thin turret i thought i knew most but i guess no cause i saw some tuts

feral aspen
#

module.exports = async (bot, message) => {
    const channel = welcomeChannel[message.guild.id].channel

    if(channel === null) return;

    bot.channels.cache.get(channel).send("Welcome to the server!")
}```
#

That is how I did that.

violet mesa
#

the message key is the message content itself, count key is the number that's incremented if now - last_sent (both datetime objects) in seconds is <= 5
@slender thistle mhm

pale vessel
#

use if (!channel)

thick gull
#

json dee bee

thin turret
#

what does welcomeChannel[id] return

dark kestrel
#

don't use json database

thin turret
#

^

dark kestrel
#

smh

slender thistle
#

Once again, being unhelpful in fixing the issue instead of bashing people for using a JSON database

violet mesa
#

@slender thistle can we go to dms so u can shout at me ?

prisma oriole
#

its a pretty simple fix, just use channel.id assuming you used the entire channel object when storing

dark kestrel
#

so what is the problem

#

cuz i just opened discord

#

bot.channels.cache.get(channel).send("Welcome to the server!")
@feral aspen i think u save the channel object in that json

#

so maybe u just have to do channel.id

prisma oriole
#

thats what i said

dark kestrel
#

ok

#

nvm

prisma oriole
#

lol

earnest phoenix
#

👀

slender thistle
#

Overall idea is following:

import datetime

bot.antispam = {}

@bot.event
async def on_message(message):
    data = bot.antispam.get(message.author.id)
    if data:
        if (datetime.datetime.utcnow() - data["last_sent"]).seconds <= 5 and data["message"] == message.content:
            if data["count"] < 5:
                # increment the "count" key
            else:
                # punish and reset the data
prisma oriole
#

nice

violet mesa
#

@slender thistle thx i shall now learn python

slender thistle
#

👍

thin turret
#

Pog

violet mesa
#

# increment the "count" key before i go do that do i just do data["count"] += 1?

#

or again im dumb

feral aspen
#

so maybe u just have to do channel.id
@dark kestrel Yes, I saved the entire channel information into that json file, thank you though.

violet mesa
#

@slender thistle ?

slender thistle
#

:)

#

You got it right

violet mesa
#

yay!!!

pale vessel
#

is there i++ in python?

slender thistle
#

Nope

pale vessel
#

ic

slender thistle
#

It's either n = n + 1 or n += 1

violet mesa
#

n+= 1 is best in my opinion cause if u have long var names it will be easier to see

#

but who am i to judge

slender thistle
#

it's the same thing ¯_(ツ)_/¯

violet mesa
#

yep

slender thistle
#

With strings though it can get trickier

#

like

        if i != len(s) - 1:
            if i < 3:
                string = s[: i + 1] + string
            else:
                string = s[i - 2: i + 1] + "," + string
thin turret
#
          burger.keepEating()
       else: 
          puke()
#

?

thick gull
#

what

slender thistle
#

Pascal case for properties

#

blyat

thin turret
#

What matters is burger flavor not burger casing

carmine summit
#

plz teach how to use canvas

thin turret
#

Look at the docs

pale vessel
#

burger.keepEating() if burger.IsGood else puke()

#

...right?

#

idk