#development

1 messages ยท Page 1419 of 1

cinder patio
#

weathers[raid.cell_id] is undefined?

eternal osprey
#

yeah

cinder patio
#

Awsome, now log weathers

eternal osprey
#

i did

twilit geode
#

It's not guaranteed that dmChannel is actually a DMChannel. You have to create one first with <User>.createDM()
did you try this?

eternal osprey
#

this is the result

cinder patio
#

Ok so, weathers is an array of objects, which contain a cell_id and a weather number. You will have to iterate through that array to get the matching cell_id

#

weathers.find(obj => obj.cell_id === raid.cell_id).weather

#

for example

eternal osprey
#

okay yeah i basically did the same for the pokemons.

young flame
#

is there anyway to like

#

see if someone spams a message more then x time

earnest phoenix
#

you have to keep track of that yourself

young flame
#

H

#

i think i have an idea

eternal osprey
#

var tmpWeather = weathers.filter(obj => obj.cell_id === raid.cell_id).weather

#

still returns undefined

#

or should i still have the parseInt in my function?

cinder patio
#

still have parseInt... but it shouldn't return undefined

eternal osprey
#
  var tmpWeather = parseInt(weathers[raid.cell_id]);
  weathers.filter(obj => obj.cell_id === raid.cell_id).weather```basically like this, but this returns NaN again
cinder patio
#

find not filter

young flame
#

okay so

#

i found a way to get each message

#

but i dont know how to make it like oh this user setna message 70 times in 5 seconds

#
spam(message)
   function spam(message) {
}
#

thats about as far as i got

eternal osprey
#
var weatherString = "";
            
  var tmpWeather = parseInt(weathers[raid.cell_id]);
  weathers.find(obj => obj.cell_id === raid.cell_id).weather ```still NaN
cinder patio
#

Why are you still using weathers[raid.cell_id] ? weathers.find(obj => obj.cell_id === raid.cell_id).weather should be inside the parseInt function

eternal osprey
#

owh fuck

cinder patio
#

Also you might want to use a map instead of an array for storing this stuff

#

makes getting things a lot faster

young flame
#
let filter = message => {
    return message.content.toLowerCase() == message.content.toLowerCase() && // check if the content is the same (sort of)
           message.author == message.author; // check if the author is the same
  }

  message.channel.awaitMessages(filter, {
    maxMatches: 10, // the amout of time it checks
    time: 5 * 1000 // time is in milliseconds
  }).then(collected => {
});
#

would this work?

#

and how do i made it always check?

earnest phoenix
#

dont use awaitMessages

cinder patio
#

you can use the message event and just a simple map to check how frequently a person is sending messages

earnest phoenix
#

use the event

cinder patio
#

you are overcomplicating things

young flame
#

H

earnest phoenix
#

^^

earnest phoenix
#

awaitMessages is just a fat wrapper around the message event

young flame
#

oh

#

i didn't know that

#

welp

#

brb

earnest phoenix
#

I'd link you to the source but im on mobile and that's a pain

young flame
#

ah

#

it's okay

eternal osprey
#

and i have these cases, but it is not changin to the correspondent weather type:js switch (tmpWeather) { case 0: weatherString += "None"; break; case 1: weatherString += "Clear"; break; case 2: weatherString += "Rainy"; break; case 3: weatherString += "Partly Cloudy"; break; case 4: weatherString += "Cloudy"; break; case 5: weatherString += "Windy"; break; case 6: weatherString += "Snow"; break; case 7: weatherString += "Fog"; break; default: weatherString = ""; break; }

cinder patio
#

console log tmpWeather again

eternal osprey
#

after or before the cases?

dapper ocean
cinder patio
#

doesn't matter

eternal osprey
#

2

#

case 2:
weatherString += "Rainy";

#

it should return rainy

#

or wait

#

it should return rainy

#

i should use

#

tmpWeather

#

instead of waetherstring

cinder patio
#

huh?

#

I don't think so

eternal osprey
#

i am never callin weatherString in my embed

#

just tmpweather

cinder patio
#

oh

eternal osprey
#

so i should call weatherString

#

as tmpweather is just a messenger between the parsing and the actual weather call

#

yeah it worked!

#

thanks man!

delicate shore
#
const background = await Canvas.loadImage('./wallpaper.jpg');
    ctx.drawImage(background, 0, 0, canvas.width, canvas.height);

    ctx.strokeStyle = '#74037b';
    ctx.strokeRect(0, 0, canvas.width, canvas.height);

    // Pick up the pen
    ctx.beginPath();
    // Start the arc to form a circle
    ctx.arc(125, 125, 100, 0, Math.PI * 2, true);
    // Put the pen down
    ctx.closePath();
    // Clip off the region you drew on
    ctx.clip();

    const avatar = await Canvas.loadImage(member.user.displayAvatarURL({ format: 'jpg' }));
    ctx.drawImage(avatar, 25, 25, 200, 200);```
#

How to bring logo in center

#

I have never used canvas

molten yarrow
young flame
hollow sedge
cinder patio
#

because maybe they want to post the result on discord?

molten yarrow
hollow sedge
#

if it's a website, it's better to just used HTML and CSS

cinder patio
#

Why would you think they are making a website?

hollow sedge
#

because they've talked about it here before

delicate shore
#

as an image

hollow sedge
#

alright

young flame
#
let filter = message => {
    return message.content.toLowerCase() == message.content.toLowerCase() && // check if the content is the same (sort of)
           message.author == message.author; // check if the author is the same
  }

  message.channel.awaitMessages(filter, {
    maxMatches: 10, // the amout of time it checks
    time: 5 * 1000 // time is in milliseconds
  }).then(collected => {
});
#

i know thats making things over complicated

#

but how would i like log how many times each user sent the same message

molten yarrow
#

save them in a map

young flame
#

so like if its ( 5 < messages) it would like do whatever punishment spesified

young flame
#

someone told me that but i dont know how to make a message map lmao

#

๐ŸŒ๏ธโ€โ™‚๏ธ

molten yarrow
#

you know how to create a new Map() ?

young flame
#

yeah

#

wait no

#

i never use maps

molten yarrow
#

const map = new Map()
and you done xD

young flame
#

oh

#

how is that a message map though

molten yarrow
#

its not a message map, its an empty Map, but u can save messages in it

young flame
#

and how would you do that

molten yarrow
#

map.set(KEY, VALUE)

solemn latch
#

Map.set(key,value)

#

Awh

molten yarrow
#

:3

young flame
#

uh

#

confusion

#

what is they key and value stand for

molten yarrow
#

you can store more than one value aswell
map.set(KEY, {id: userid, message: message})

young flame
#

uh

molten yarrow
#

i would use userids for keys

young flame
#
  1. what is the key for
#
  1. how would i be able to store it in the first place
solemn latch
#

Key is how you get data back

cinder patio
#

to get the value later on

young flame
#

so like quick.db

molten yarrow
#

its stored in memory

young flame
#

how would you use that to set each messages

#

each message sent*

molten yarrow
#

create your Map on Bot start
bind it to your client/bot

you can call it each Time message event is triggered

young flame
#

h-

#

wut

#

you know im slow smh

molten yarrow
#

im using Map to cache all the users i have in my DB to get the Data faster, its like the same

solemn latch
#

What are you trying to do ๐Ÿค”

#

Punish users who spam messages?

young flame
#

ues

#

for my message spam command and mass mention command

#

i have the regexs for the mentions but i dont know how to get ass messages and see if a users has sent a message more then the time the person decided

#

like

#

+message-spam on

#

and then they can do

#

+spam 10m 15s [warn/mute/kick/ban]

#

so it see if they sent the same message or a message 10 times in 15 seconds

#

@solemn latch

solemn latch
#

So I would definitely use a map for that, with a value of an array of Message spam classes.

young flame
#

hOw

#

i have never used maps before smh

#

let alone classes

#

not even sure how to store things in a map

#

or make a class

solemn latch
#

For every user who sent a message youd map.set(id, array)

#

Who isn't already in the map*

young flame
#

how would you intergrate that in the message event

solemn latch
#

Seriously just put it in the message event, after checking if they are in it.

young flame
#

what parT

molten yarrow
#

check if a user is already in the Map with .has() if not add with .set()

young flame
#

map.set() or like

solemn latch
#

It would probably help if you read the docs i sent above. They are super simple once you understand them.

young flame
#

i dont know how to set them in there in the first place

#

i know how to

solemn latch
#

Map.set(id, value)

young flame
#

but in a message event what part do i put it in

#

i dont know there ids

solemn latch
#

Bottom top or even make a seperate event listener

young flame
#

what would be the alue

#

value

molten yarrow
#

can be everything you want ๐Ÿ˜„

solemn latch
#

In the way I was saying, you'd have to make a class and set the value as an array with one instance of that class in it.

molten yarrow
#

like in ur case the message.content and Timestamp maybe

solemn latch
#

But there's a ton of ways to do it.

young flame
#

H

#

is there like an example somewhere i can use?

molten yarrow
#

Woo posted a link above

young flame
#

i already looked at the docs

molten yarrow
young flame
#

i saw those

#

doesnt make since how you would put in a message event

#

._.

#

or atleast get the messages

obtuse jolt
solemn latch
#

You are not getting the messages right now

young flame
#

thats manually setting it

#

they type in what hey want to set

solemn latch
#

You are just setting the users data.

young flame
solemn latch
#

Yeah, so a class will build itself into whatever data format you want.

young flame
#

how

#

h

#

h

molten yarrow
solemn latch
#

^ you can do something as simple as that for now

molten yarrow
#

if you want to save the content

young flame
#

how would you make that like oh they sent this this many times

molten yarrow
#

you can expand it to your needs

young flame
#

and then pull the message author id and spesify a punishment

#

then pull the messages and delete them

solemn latch
#

So, for now I would just worry about mapping the data.

young flame
#

h

#

okay

#

i mapped it

#

i think

#

idk

#

it seems complicated

solemn latch
#

You can just log the map

latent cave
#

Looking for a roblox scripter

#

Know anyone?

solemn latch
#

Not the place to ask

young flame
#

how would you log it

solemn latch
#

Console.log(map)

young flame
#

-freelancer

#

oof

#

it was need dev

solemn latch
#

Uh

latent cave
#

Sorry for asking

solemn latch
#

Not this server

latent cave
#

I really need someone to make me smart board

young flame
#

uh

#

@earnest phoenix

solemn latch
#

@zinc fable

latent cave
#

Are they scripters?

young flame
#

317418087714390016

latent cave
#

For roblox?

solemn latch
#

Actually beans on

#

@oak cliff

latent cave
#

They are scripters?

oak cliff
#

im not bean but yes

solemn latch
#

Fake bean

#

I cant keep track

latent cave
#

Ahaha

oak cliff
#

@earnest phoenix

modest smelt
#
@client.command()
@has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member = None, *, reason=None):
  if member == None:
    await ctx.send("You can't kick nobody.")
  elif member == ctx.message.author:
    await ctx.send('You can\'t kick yourself moron.')
    return
  else:
    await member.kick(reason=reason)
    embed = discord.Embed(title="{} has been kicked by {}".format(member, ctx.message.author), description="{}".format('%s, you have been kicked by %s.  Reason: %s' % (member, ctx.message.author, reason)))
    await ctx.channel.send(embed=embed)
    channel = await member.create_dm()
    await channel.send(
      f'{member.name}, you were kicked in the server by {ctx.message.author}.'
      f' | Reason: %s.' % reason
      )
```why is my kicking function not working
solemn latch
#

Thanks

latent cave
#

Hmm

ivory condor
#

can someone explain to me what's wrong in the code

umbral zealot
#

Please ask on the BDFD server, they'll be able to help you.

#

Or BotGhost, whichever that thing is, I can't tell them apart.

young flame
#

@solemn latch it dont worK

molten yarrow
#

Map is empty after a restart tho

ivory condor
#

Ok thanks

young flame
#

h

#

then why

#

whut

ivory condor
#

but I don't know how to get in

umbral zealot
#

I'm sure you can google for that, I don't have the invite.

#

probably on their front page

young flame
#

i so confuseddddd

safe creek
#

how do i add an 0auth2 login for my discord bots site? ive got the redirect link after authorising but it wont log me in... which idk how to do, is there any sources to help me with this as im really confused

umbral zealot
#

if you're on JS and use express, look at passport and passport-discord modules, they're real helpful for that.

earnest phoenix
safe creek
#

i can use js on my site

#

oh ok

umbral zealot
#

I mean, the back-end. You need a back-end to use oauth2 easily.

sterile lantern
#

so, i tried require("better-sqlite3"); but i still get that db.backup is not a function

safe creek
#

oh

#

whats a backend im using dscord py

sterile lantern
#

let db = require("better-sqlite3")

#

thats what i have it set to

umbral zealot
safe creek
#

mmk

umbral zealot
safe creek
#

ill look into the docs

sterile lantern
#

yes it does

umbral zealot
#

oh wait you're right

#

never used that one.

#

But it's not on better-sqlite3 it's on your initialised database.

sterile lantern
#

wdym

#

i havesqlite

#

oh

#

whats verbose?

quartz kindle
#

you need to open your database file

umbral zealot
#

ignore that it's just a client option. they're all documented on that page

quartz kindle
#

db = new Database("your file here)

umbral zealot
#

Good idea to read the docs before starting to program ๐Ÿ˜‰

sterile lantern
#

oh

#

that worked

#

thanks

#

but

#

how do i set an interval

#

so that

#

it gets a copy of the db

#

every week

#

or something

dense void
#

Anyone know how to make a snipe command?

sterile lantern
#

because right now, its making a backup everytime i run the bot

opal plank
dense void
umbral zealot
#

look at node-schedule or cron for time-based intervals (on NPM)

opal plank
#

need more info

#

which language? what library?

dense void
#

I'm making a multipurpose bot. It's going to be apart of the misc command category

#

Discord js

opal plank
#

simply use a map

#

listen to messageDelete events and simply map them based on channelid

#

whenever someone issue the command, simply see if theres an entry on your map with the channelid

#

thats about it

#

its legit 6 or 7 lines

sterile lantern
umbral zealot
#

no, on npm

#

they are separate modules

earnest phoenix
#

sam

sterile lantern
#

i found it, but i dont get how the time works

earnest phoenix
sterile lantern
#
var rule = new schedule.RecurrenceRule();
rule.dayOfWeek = [0, new schedule.Range(4, 6)];
rule.hour = 17;
rule.minute = 0;
 
var j = schedule.scheduleJob(rule, function(){
  console.log('Today is recognized by Rebecca Black!');
});```
#

i found this example

#

but it does on 3 days

#

i only want it on one day however

#

also, wouldnt this not work if its in a index.js file

umbral zealot
#

So keep looking at the docs? it should be there somewhere

sterile lantern
#

because what if my bot goes offline

#

at the time its set

#

oof

umbral zealot
#

then make sure it doesn't ๐Ÿ˜›

sterile lantern
#

oh uh i set it to 12:50

#

but

#

it didnt work

midnight blaze
#

@sterile lantern get a vps, that is basics, you need a vps

sterile lantern
#

u do realize theres still a possibility of it going down

#

its like

#

possible

#

so

#

im just bein safe

#

so ill run it 2 times per week

restive furnace
#

simple as use systemD or pm2 (not native, ewwwwwwwwwwwwwwwwwwwwwwwwwwwww)

sterile lantern
#

actually

#

ill just

#

make a command

#

to backup

#

and ill run it every week

#

ez

restive furnace
#

??

#

not ez

#

actually annoying

proud pond
#

anyone got exp with long running voice connections (discordjs)? bot sometimes stops responding to voiceStateUpdates randomly

tardy hornet
#

what should i do

proud pond
#

heroku apps to see what apps u have associated to ur acc

#

assuming u have the cli installed

tardy hornet
#

i do

young flame
#

yt*

tardy hornet
#

@proud pond ^^^

hollow sedge
young flame
#

^^^

#

VPS are hosted 24/7

hollow sedge
#

VPS(es?) do not have downtime

young flame
#

your bot will never be offline unless you make your bot offline

#

or you dont pay the fee

sterile lantern
#

ok well

#

db.backup(`dbbackups/backup-${Date.now()}.db`)

this prints in numbers (theres a name for it i forget idk) but i want it to print like 113020.db

void skiff
#

any meme api?

sterile lantern
#

idk i think there may be

hollow sedge
#

@void skiff you could use the reddit API and get memes from r/memes

sterile lantern
#

maybe

soft ravine
#

u could also use redit

void skiff
sterile lantern
#

oh its called unix time

#

but i just want

#

it to print the date

#

thats all

void skiff
hollow sedge
void skiff
sterile lantern
#

o mb

#

anywho, does anyone know how to print a date instead of unix time

soft ravine
#

I cant help u cuz i code in python

umbral zealot
#

113020 isn't unix time ๐Ÿ˜„

hollow sedge
#

yeah i think that's milliseconds

umbral zealot
#

no

#

guys check what date it is today

hollow sedge
#

oh lol

umbral zealot
#

then look at 113020 again

sterile lantern
#

oof

umbral zealot
#

Now that is a unix timestamp

hollow sedge
#

why would you need to format that anyway?

#

it's just a backup

umbral zealot
#

There are plenty of modules that can help you format it, or direct code that uses Date.getMonth(), getDay() and getYear()

sterile lantern
#

js

#

node.js

umbral zealot
tardy hornet
#

i already have

#

the bot is running

#

but cant update

hollow sedge
umbral zealot
#

clearly the command line is telling you that you have the wrong app name

tardy hornet
#

idk how to change it

#

to the right one

near stratus
hollow sedge
#

wait what

near stratus
#

huh ?

sterile lantern
#

unixtime is not defined

hollow sedge
#

yeah wdym

#

what is UnixTime?

near stratus
hollow sedge
#

to get unix time you use new Date()

#

so what does that even mean

sterile lantern
#

yea

#

^

hollow sedge
#

go to Instance Methods

near stratus
#

UnixTime is actually in seconds
new Date() takes input as milliseconds

#

Both from 1970

sterile lantern
#

i still dont get how it would print

#

113020.db

#

bc its in

#

UTC

molten yarrow
#
Date.now() //1606759761128
new Date() //2020-11-30T18:09:04.937Z
cinder sandal
#

help

#

my comman d handler doesnt work

hollow sedge
cinder sandal
#

discord.js

hollow sedge
#

@near stratus

cinder sandal
#
const fs = require('fs');
const Discord = require('discord.js');
require('dotenv').config();

const client = new Discord.Client();
client.commands = new Discord.Collection();


const prefix = process.env.PREFIX;

const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js'));

for (const file of commandFiles) {
    const command = require(`./commands/${file}`);
    client.commands.set(command.name, command);
}

client.once('ready', () => {
    console.log('logged in');
});

client.on('message', message => {
    if (message.author.bot) return;
  if (message.content.indexOf(prefix.length) !== 0) return;

  const args = message.content.slice(prefix.length).trim().split(/ +/g);
  const command = args.shift().toLowerCase();
});

client.login();```
near stratus
umbral zealot
#

you're not doing anything with the command variable

hollow sedge
#

omg

#

im dumb

#

i wrote it wrong lol

umbral zealot
#

you need to finish copying that code from the source, lol

hollow sedge
#

anyway

#

that doesnt work either @near stratus

tardy hornet
hollow sedge
#

how does this help?

umbral zealot
sterile lantern
#

yea i just want date

#

no timestamps

umbral zealot
#

yep!

tardy hornet
#

still giving this error @umbral zealot

near stratus
hollow sedge
#

cant you do git push heroku master -f

eternal osprey
#

i have had this

tardy hornet
#

?

hollow sedge
near stratus
#

Gimme a minute I'll write the whole code

earnest phoenix
#

where can i find a good place to learn how to make a music bot in dpy ?

hollow sedge
#

no I just don't understand what the point is in multiplying the date by 1000

versed kraken
#

hinkjomkp,l[.;]/'[

#

\

earnest phoenix
near stratus
#
let UnixDate = 110000;
let d = new Date(UnixDate*1000);
let TimeString = `${d.getHours} : ${d.getMinuites};
console.log(TimeString);
#

@hollow sedge

hollow sedge
#

yes, I realize what it is, I just don't understand why it's necessary

sterile lantern
#
       d.getDate(),
       d.getFullYear()].join('/')+' '```
#

it says d is not a function

near stratus
#

UnixTime returns seconds from 1970 to now
Date() uses milliseconds.
1s = 1000 ms

#

Do you get it @hollow sedge ?

hollow sedge
#

but why even convert it to milliseconds

#

this is about formatting the date

#

not conversions

near stratus
#

So I converted and made it my way

hollow sedge
#

but you need to call it

#

with the ()

#

for getHours and getMinutes

near stratus
#

Oh

#

sorry

sterile lantern
#
let UnixDate = 110000;
let d = new Date(UnixDate*1000);
let TimeString = `${d.getMonth} : ${d.getDate};
console.log(TimeString);```
#

would this work

hollow sedge
#

yes

#

you need to call the functions though

#

getMonth and getDate are functions

sterile lantern
#

so wdym

hollow sedge
#

so you would do getMonth() and getDate()

sterile lantern
#

oh

near stratus
#
let UnixDate = 110000;
let d = new Date(UnixDate*1000);
let TimeString = `${d.getMonth() +1} : ${d.getDate()};
console.log(TimeString);
earnest phoenix
#

what's the whole point of this though

sterile lantern
#

to print a date in a file

cinder sandal
#

tf is commando

hollow sedge
#

yeah, make sure to end the string properly though

molten yarrow
near stratus
#

@sterile lantern don't forget month +1

opal plank
#

commando is a shit command handler

earnest phoenix
#

can't you just use Date.now()

opal plank
#

popular, but shit imo

earnest phoenix
#

where can i find a good place to learn how to make a music bot in dpy ?

hollow sedge
near stratus
earnest phoenix
#

thats dumb

#

lol

hollow sedge
#

yeah idk why they're doing that

near stratus
#

Neither do I

#

You asked I replied

sterile lantern
#
let d = new Date(UnixDate*1000);
let TimeString = `${d.getMonth() +1} : ${d.getDate()}`;
  db.backup(`dbbackups/backup-${TimeString()}.db`)```
#

this probably is very wrong

#

time string aint a function

#

but

earnest phoenix
#

file names can't even contain colons

sterile lantern
#

yea

earnest phoenix
#

why are you doing this

sterile lantern
#

ill remove the colon

earnest phoenix
#

literally format it with the unix timestamp

near stratus
opal plank
#

erm

#

why u multiplying unix timestamp by 1000 again?

earnest phoenix
#

if you need to access the data, i.e. the month or something, read the files in another script and convert back the unix timestamp to a Date object

opal plank
#

unix is ms isnt it?

#

ms since epoch

obtuse jolt
opal plank
#

error.stack

#

or trace

sterile lantern
#

oh wow im so dumb

#
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();```
#

this works

#

pog thanks

opal plank
#

stop using var

#

reeeeee

near stratus
cinder sandal
#

var doesn't work for me /shrug

#

so i think it's useless

hollow sedge
#

var does work though?

#

wdym it doesnt work for you

opal plank
#

its not about working with var

#

is var being absurdly stupid for anyone to be using

hollow sedge
#

ik you shouldnt use it but it still works

opal plank
#

vars are hoisted

near stratus
opal plank
#

no

earnest phoenix
#

var isn't stupid, it's just your fault if you use it and don't understand how it works ๐Ÿคทโ€โ™‚๏ธ

earnest phoenix
#

i find it quite useful in some cases, i.e. loops

opal plank
#

vars get hoisted

hollow sedge
#

i think they're saying can you explain what hoisting is for beginners

opal plank
#

let also works in loops

near stratus
#

Var is when you are in the middle of the code and don't wanna scroll up to declare a global variable

opal plank
#

anything you pass onto loops get passed along

#

if you're using var, 99% sure you doing shit wrong

near stratus
#

one thing I agree

hollow sedge
#

"don't wanna scroll up to declare a global variable" lol wth who is that lazy

opal plank
#

who the fuck declares global vbariables?

tired panther
#
let desc = args.shift().join(" ") ;
``` why wont this work?
earnest phoenix
#

the general rule of thumb is
const for variables that won't change their type & value
var for scoped variables
let for transient variables

sterile lantern
#

is args defined

earnest phoenix
#

i believe

tired panther
cinder sandal
opal plank
#

using let inside loops

tired panther
earnest phoenix
#

i'm aware

#

lol

molten yarrow
opal plank
#

like i said, you doing it wrong if you using vars on other loops

#

for passes the value on its own

opal plank
young flame
#

lmao

opal plank
#

becuase they are hoisted and declared, you can call them without them even having a value

young flame
#

that moment you have bongo cat cursor

near stratus
#

let works fine where we should be using var

opal plank
#

var is only still a thing because of backwards compatibility

#

cuz millions of pages and js uses var from back then

#

when we didnt havet let/const

near stratus
opal plank
#

tl;dr, dont use var, regardless

#

wrong

#

var exists because it was the only declaration method before es5 iirc

#

after es5 let/const got added

#

var isnt deprecated yet because nobody is going to be rewriting the millions of pages out there

earnest phoenix
#

i'm aware of all of this, you should use var only if you know what you're doing and how its scoping works ๐Ÿคทโ€โ™‚๏ธ

#

it's useful for top-level variables

#

if you don't understand it just stay away from it

opal plank
#

in very specific cases, yes, which most people wont be using

#

out of everyone here i think theres probably 10 people maximum who could properly use vars

earnest phoenix
#

it's more of something you're going to see as a good pattern in the industry rather than on rookie bot developer code lol

livid lichen
#

fs.readdir("./commands/"), (err, files) => { Callback must be a function and got undefined?

#

I am quite confused.

twilit geode
#

so ive seen some stuff about eval commands? is that something that needs to be implemented ?

earnest phoenix
earnest phoenix
twilit geode
#

or just a neat thing to have

#

for devs

earnest phoenix
#

latter

twilit geode
#

k

earnest phoenix
#

it's just running code on the go

twilit geode
#

mk ty

cinder sandal
#

how do i make a mention prefix if i have a command handler

livid lichen
#

There are a lot of stuff that can help you.

earnest phoenix
#

e

#

hi

cinder sandal
hollow sedge
twilit geode
stable nimbus
#

Is there a js function where even if one thing is false but another is true you do that other thing? Is that just with double pipes?

twilit geode
stable nimbus
#

Ah, thanks.

#

(double pipes)

hollow sedge
#

pretty sure it's called the or operator

twilit geode
twilit geode
#

couldnt think of its technical term for a sec

slate oyster
twilit geode
#

H M M

#

ping go brrrrr

sterile lantern
#
 const user = message.mentions.users.first()
    if (!user) return message.reply("Please mention someone!")```

how do i determine if `user` is a bot or not, i only know message.author.bot
#

user.bot wouldnt work

livid lichen
#

Bot is waiting until humanity is restored

twilit geode
#

message.author.bot @sterile lantern

sterile lantern
#

that wouldnt work would it

#

bc ur pinging

#

someone

#

for the input

livid lichen
#
ownerId = ""

admins = []
support= []``` Would this work for a `Config.env` file?
twilit geode
#

wait what is wrong sam?

#

why do you want to restrict mentioning a bot

sterile lantern
#

bc i dont want them to give their money to a bot

twilit geode
#

oh

sterile lantern
#

its a cmd

twilit geode
#

lol

#

uhm

livid lichen
earnest phoenix
#

lol

sterile lantern
#

well true but

twilit geode
#

i would just say that you shouldnt worry about that

sterile lantern
#

what would da function be

twilit geode
#

if they give bot money, its their loss

livid lichen
twilit geode
#

just exclude bots from leaderboards

sterile lantern
#

is there not a way to just

#

determine if the user is a bot or not

twilit geode
#

im sure there is but i dont know of it rn

#

let me look

#

wait you said user.bot doesnt work?

#

do you get an error?

#

@sterile lantern

sterile lantern
#

yes

twilit geode
#

... would you post it

sterile lantern
#

oh bruh

#

i forgot brackets

#

nvm

twilit geode
#

very good

earnest phoenix
#

samm

livid lichen
#

uhhh

#
ownerId = ""

admins = []
support= []

discord_token = "haha nice try noob"
clientId = "nice try",
support_server_invite = "no",
bot_logo = "no",

Intents = ["GUILDS", "GUILD_MESSAGES", "DIRECT_MESSAGES"],

prefix = "^",
WelcomeEnabled = false,
WelcomeChannel = "welcome",
WelcomeMessage = "Hello {{user}}, welcome to {{server}}!", ```
#

Didn't work.

#

It's in a .env file.

earnest phoenix
#

let user = message.members.mentions.first(); if (user.bot) return;

twilit geode
#

@earnest phoenix your avatar looks more like an angry cyclops then barnie

earnest phoenix
#

lol

pure lion
#

Logged error was video stream unavailable

#

I just wanna vibe

#

Using ffmpeg and ytdl-core

#

Hosting in france

twilit geode
#

but what if the bot doesnt like your music?

molten yarrow
sterile lantern
#

db.delete(`blacklist_${user.id}`, "Blacklisted")

y wont this work

#

if i did blacklist someone

#

its set

#

db.set(`blacklist_${user.id}`, "Blacklisted")

#

as this

earnest phoenix
#

tf

#

have you never heard of booleans

#

or... arrays

sterile lantern
#

oh

#

forgot about those

young flame
#

@solemn latch ty

opal plank
#

Mass Spam is turned on

young flame
#

automod

#

for message spam

hollow sedge
#

yeah you might want to rename though

opal plank
#

spam bot, bean bean

hollow sedge
#

like Anti-Spam instead

young flame
#

i did

hollow sedge
#

also you spelled "want" wrong where it says if you wnat to enable any of the features just do

#

but it looks pretty cool

young flame
#

i just got out the shower

#

i was coding like

#

in the shower

pure lion
#

I don't care give me a hug bish

young flame
#

there

pure lion
#

Yay

opal plank
# young flame in the shower

conding in the shower sounds fun.
mobile/pc getting wet
steam getting inside the fans and frying the circuits
steamy display
wet hands not properly detecing inputs when touched/clicked
mobile/laptop slipping from your hands
soap all over the screen

yeah, overall sounds like fun

pure lion
#

You could say that coding makes you wet

young flame
#

lol

#

I-

opal plank
#

im always wet when coding

young flame
#

yes

opal plank
#

i sweat hard thinking about the possiblity of people looking at my shitty noodle code

young flame
#

i was in the shower my pc was on my desc

#

which i moved into the bathroom

opal plank
#

naked coding seems like a better time tbh

young flame
#

it is

#

imo

young flame
#

but if you live with people and someone walks in its a bruh moment

pure lion
#

But parents

#

Otherwise it'd be relaxing

young flame
#

good thing i live alone SharkDance

opal plank
young flame
#

i'm always naked

#

but now were getting off topic

pure lion
opal plank
#

technically coding

#

just the WAYS we code

#

since its coding its technically development

pure lion
#

I code

  • poorly
  • in 7 languages
opal plank
#

its an important part of coding mmulu

earnest phoenix
#

how do i add ffpmeg to the path on mac

opal plank
#

i also code in various languages

-Camel and snake case mixed
-functions inside functions
-english
-engrish
-MyVarsNamesDontMakeSense

  • random ____x variable names
    -stoopid
    -random html imported int he middle of ts code
    -any's
    -stooped engrish
    -random comments from myself saying WTF HAVE I DONE!?

thats my code 101

pure lion
#

@earnest phoenix nano into /etc/paths

earnest phoenix
#

idk what that means @pure lion

pure lion
#

open the console

earnest phoenix
#

ok

pure lion
#

type sudo nano /etc/paths

earnest phoenix
#

ok

opal plank
#

watch it return an error saying paths dont exist

earnest phoenix
#

it said bash: sudo: command not found

pure lion
#

Hm

#

Poggers

#

Ok just cd into it

pale vessel
#

krista are you trolling

pure lion
#

cd to /etc

#

No

#

Google said so

pale vessel
#

"sudo"

pure lion
#

Sewdoe

#

Just fucking open the file lad

opal plank
#

why even sudo stuff

pure lion
#

Idunno

#

Don't use root

opal plank
#

isnt doing sudo on linux really bad practices?

sterile lantern
#

how would we write and in js like

if this === null *and* this == null

#

i dont remember what exactly it was

pure lion
#

if (!this && !this)

pale vessel
#

if this and that

sterile lantern
#

oh thanks

pure lion
#

if this and that return IDAJOGJSF8WHD8SUSUSHSHSHHSSHSHW8JS8HEIRUEU37R7D7W7D

opal plank
pure lion
#

Ok fine

#

do == null

opal plank
#

bad

pure lion
#

If you're nekoangry

opal plank
#

===

pure lion
#

typeof this === "null"

opal plank
#

bad, === checks for type

#

this === null

pale vessel
#

you mean object kekw @pure lion

pure lion
#

Yes I know

#

This would be an object

#

Current context says it's a null

opal plank
#

what if this is a string

pure lion
#

So stfu

pale vessel
#

wdym

pure lion
#

Anyway typeof returns a string idiot

pale vessel
#

I'm trying to say null is object

pure lion
#

Wait it is?

opal plank
#

nono

#

what if THIS is a string

#

not typeof this

young flame
#

okay so

#

im using maps for the anti spam

opal plank
#

mhm...

#

thats all you wanted to say?

young flame
#

since i have it sending the warning message

#

but i want it to send something else if it has sent the warning message

opal plank
#

what is db?

pure lion
#

@opal plank you're checking if typeof this is null

opal plank
#

most db's need to query and are promises

#

no, you're going way over what they asked

#

@pure lion

young flame
#

uh db is the database i'm pulling the enable command from

pure lion
#

:(

opal plank
#

if(a === null && b === null) doo stuffies

young flame
#

the db.get is seeing if the key is in the database

#

if it is it sends the message

opal plank
#

most db's need to query and are promises

young flame
#

it does

opal plank
#

if(promise) //wotn work

#

if(await promise) // works

pale vessel
#

what db is that even

opal plank
#

hence why i asked

#

most dbs are promised based

young flame
#

ehe te nandayo

#

i'm using 2 different databases

opal plank
#

but.... why.......

young flame
#

im using my db MoonSQL and quick.db

#

because they have 2 different purposes

#

i use quick.db to see if it is enabled ect

opal plank
#

you do know you dont need different databases right?

young flame
#

and moonsql for everything else

#

so i can host prefixes message events and run the bot using quick.db only?

opal plank
#

whats the point of a database if you cant have multiple tables?

#

even stuff like redis which doesnt offer that has ways to avoid it

young flame
#

wym

#

LOOK THAT ISNT THE POINT

#

FOCUS ON THE QUESTION ERWIN

opal plank
#

each one of those is unique

#

but they all inside postgres

young flame
#

istfg erwin

opal plank
#

it makes no sense to split stuff into different databases

young flame
#

it isnt about

opal plank
young flame
#

my freaking database

opal plank
#

and i asked you a question yet you still didnt answer

young flame
#

it's about map

#

THE DB ISNT IMPORTANT TO THE QUESTION

opal plank
young flame
#

NO IM NOT ANSWERING

opal plank
#

if(promise) //wotn work
if(await promise) // works

young flame
#

the db has nothing to do with the functions of the bot

opal plank
#

THIS IS YOUR FIRST LINE FFS

young flame
#

it

#

works

#

i ran the command smh

sterile lantern
#

rn the user argument is not optional

however, how would i make it so if they just did ;profile it would display their own profile and if they mentioned someone it would display the mentioned user's profile (basically making the args optional)

const user = message.mentions.users.first()
    if (!user) return message.reply("Please mention someone!")
    if (user.bot) return message.channel.send(`Bots do not have a profile. Try mentioning an actual user next time.`)```
opal plank
young flame
#

ERWIN LISTEN

opal plank
#

I AM, YOU AINT

sterile lantern
#

ping if u respond

young flame
#

NOO STFU AND LISTEN

opal plank
#

I DID LISTEN

#

ITS YOUR SECOND LINE FOR THE LOVE OF GOD

young flame
#

THE DB ISNT IMPORTANT AT ALL IM USING MAPS

#

THE DB IS LEGIT DOING NOTHING

opal plank
#

IT WILL RETURN ON THE SECOND LINE IF THATS A PROMISE

#

REEE

young flame
#

I CAN REMOVE IT

#

AND THE BOT WILL WORK FINE

pale vessel
#

@sterile lantern Like const user = message.mentions.users.first() || message.author?

opal plank
#

WHY NOT JUST ANSWER IT THEN?!

young flame
#

I NEED HELP WITH THE MAPS

opal plank
#

IS DB A PROMISE?

twilit geode
#

hey how do yall get your code to be colored in the ``` ``` (code block)

sterile lantern
#

oh

#

yea

#

thanks

young flame
pale vessel
#

Yeah that should do the trick

young flame
#

you know what

opal plank
#

THEN WHAT IS THE ISSUE FFS

young flame
#

I TOLD U

#

I WANT TO KNOW

opal plank
young flame
#

IF I CAN HAVE IT SEND TW DIFFERNT MESSAGES

opal plank
#

BASED ON WHAT!?

sterile lantern
#

worked tysm

young flame
#

MAPS

opal plank
#

ITS NOT RELATED TO MAPS

young flame
#

IF IT SENT THE WARNING UR SPAMMING STOP OR GET MUTED U GET MUTES

#

IT IS LITTERALLY MAPS

#

WYM

old latch
#

guys wtf

opal plank
#

IF(MAP.HAS(ME)) {
MESSAGE.CHANNEL.SEND(MESSAGE1);
MESSAGE.CHANNEL.SEND(MESSAGE2);
}

old latch
opal plank
#

UR QUESTION MKES NO SENSE REE

old latch
#

why caps spam?

opal plank
#

shhh

#

we having a civilized conversation

#

excuse us pls

#

ANYWAY

old latch
young flame
opal plank
#

WHAT ABOUT THE MAPS!?

#

YOU ASKED IF IT CAN SEND 2 MESSAGES

young flame
#

I NEED IT

opal plank
#

I SHOWD U HOW TO SEND 2 MESSAGES

#

ASK THE PROPER QUESTION

twilit geode
#

how do yall get your code to be colored in the (code block)

young flame
#

TO SEE IF IT ALREADY SENT THE WARNING MESSAGE

twilit geode
#

heck

earnest phoenix
#

define a language

opal plank
#

AWAIT IT

young flame
#

HOW

#

IF I AWAIT

#

IT WOULD SEND BOTH

pale vessel
opal plank
#

LET A = AWAIT MESSAGE.CHANNEL.SEND('HI');
IF(A) //ALREADY SENT

twilit geode
earnest phoenix
young flame
#

I WANT IT TO SEE IF IT SENT THE WARNING MESSAGE FIRST AND IF THEY KEEP SPAMMING THEN MUTE

#

OH

#

OK

old latch
# twilit geode heck

put the three ` and then the markdown language you want... best is to google "discord markdown" ;)

young flame
#

BRB

earnest phoenix
#

```cs for csharp
```js for javascript
etc

opal plank
#

YOU'D NEED TO SAVE IT SOMEWHERE

young flame
#

I AM

#

RN

opal plank
#

NOT THE USERS, THE WARNING

#

ISWARNED = TRUE

pale vessel
#

Erwin can you chill the fuck out

opal plank
#

ADD THAT TO YOUR USERSMAP OBJECT

young flame
#

lmao

#

okaY

opal plank
pale vessel
young flame
opal plank
young flame
#

my cursor is fucking bongo cat

#

i wanna take a ss of it

twilit geode
#

GUYS GUESS WHAT

young flame
#

but my cursor poofs away

#

WHAT

twilit geode
#

IM GREEEEENNN

young flame
#

AYEEEEEE

opal plank
#

your cursor is banging bongo cat or your cursor IS bongo cat? phrasing matters

young flame
#

it's bongo cat

#

and a piano

#

but hes playing it

old latch
young flame
#

like it moves

opal plank
young flame
#

lol

#

OH

#

EW

twilit geode
#

HA

young flame
#

NO WHY

#

WHY WOULD MY CURSOR FUCK BONGO CAT WTF

opal plank
#

idk, u the one who said it

twilit geode
#

you just now got it lolol

young flame
#

stfu

opal plank
#

fuck idk what to code now

young flame
twilit geode
#

lol

opal plank
#

actually, lies, i do

#

just not sure where should i start from

pure lion
twilit geode
#

yesh

pure lion
#

@opal plank code my music bot

#

Just to help me nekohuh

opal plank
#

thats the one territory i dont fuck with

pure lion
#

Because I keep getting video unavailable thrown from ytdl core

#

Shit

opal plank
#

sharding? fine
mass webscaling? fine
crosschat and multiple platform bots? fine

music bots is a territory no man should wonder

earnest phoenix
#

honestly small scale music bots are fucked

pure lion
#

@slender thistle show yourself

earnest phoenix
#

youtube placed such restrictions that small bots can't afford to go around them

opal plank
#

ipv6 routing
opus
lavalink
ratelimiting
api keys stored and dbs

its all a mess and a half

#

you cant scale music bots easily

earnest phoenix
#

while older bots which grew bigger had enough time to profit enough to be able to efford everything erwin stated

opal plank
#

@pure lion imma probably going to stream code in that other server, feeling like coding for a bit

twilit geode
#

original code:

        if (!message.mentions.users.size) {
        return message.channel.send(`Your avatar: ${message.author.displayAvatarURL({ format: "png", dynamic: true })}`);
    }

    const avatarList = message.mentions.users.map(user => {
        return `${user.username}'s avatar: ${user.displayAvatarURL({ format: "png", dynamic: true })}`;
    });

new code:

    var avtEmbed = new Discord.MessageEmbed
    if (!message.mentions.users.size) {
        avtEmbed.addField('\u200B',`${message.author}'s avatar:`,false)
        avtEmbed.setImage(message.author.displayAvatarURL({format:"png", dynamic: true}))
    }
    else {
const avatarList = message.mentions.users.map(user => {
        avtEmbed.addField('\u200B',`${user.username}\'s avatar:`,false)
        avtEmbed.setURL(`${user.displayAvatarURL({format: "png", dynamic: true})}`)
    });
    
    }
    message.channel.send(avtEmbed)

(im changing all my commands to embeds)
The one that sends your own if you dont mention works, but the mention doesnt

opal plank
#

might get some inspiration

#

stop using var

twilit geode
#

uh

#

why

opal plank
#

@slender thistle ask a mod to put STOP USING VAR in topic pls

slender thistle
#

Somedayโ„ข๏ธ

pure lion
#

Yeah please

#

STOP USING VAR

#

Thanks

obtuse kiln
#

var Discord = require("discord.js")

pure lion
#

Nobody asked

twilit geode
opal plank
#

i think its the third convo ive had in the past hour about var being bad

pale vessel
#

wow toxic

pure lion
#

That's a read-only so const is pog

opal plank
#

anyhw, gonna go code and stream

#

@pure lion join there if you wanna see noodle coding

twilit geode
#

erwin the embed isnt the error

#

it never shows the image

restive furnace
#

var -> when doing stuff what works in IE9
const/let -> when doing stuff everywhere else