#development

1 messages ยท Page 1594 of 1

outer perch
#

woah

#

sick

#

automatic imports

mellow kelp
#

yes

mellow kelp
#

auto imports are really something huh

fair axle
#

is there a way to do this without os module?

#

and how can I create txt files

outer perch
#

k, now what

cinder patio
#

here's where things get more complex

pale vessel
#

oh boy you can't just do that in ts

outer perch
#

๐Ÿ˜”

mellow kelp
#

you gotta add a .d.ts file

outer perch
#

maybe I should get back to require

mellow kelp
#

something like enviroment.d.ts for example

cinder patio
#

require won't fix that

mellow kelp
#

but you can use pretty much anything

outer perch
mellow kelp
#
declare module 'discord.js' {
  interface Client {
    commands: Collection<string, CommandOrWhatever>;
  }
}
#

in your .d.ts file

outer perch
#

O_O

#

but, why

#

why can't ts do it like js

mellow kelp
#

because Client doesn't have a commands property

outer perch
#

yeah I know

cinder patio
#

Or just this in your main file

declare interface Client {
    commands: ...
}
outer perch
#

the tutorial did that long time I go

mellow kelp
#

you can't just modify stuff that doesn't exist

steel arch
#

How do i do to make an code in HTML who says if my BOT is online or not?

outer perch
mellow kelp
#

yeah that's what the .d.ts file is for

#

to add more properties to existing modules

outer perch
#

const commands = new Collection();

#

rather like this for now

orchid trout
#

How do I get my bot's topgg token

outer perch
#

now instead of calling for bot.commands I'll call for commands

mellow kelp
#

wouldn't recommend that if you already have client.commands

#

it's really simple

outer perch
mellow kelp
#

well you can name it whatever you want as long as it ends with .d.ts

cinder patio
#

Note that you don't really need a .d.ts file to make it work, you can place this in the file where you use Client:

declare interface Client {
    commands: ...
}
outer perch
#

i don't know if it's a good habit creating properties

mellow kelp
#

how do you think @top-gg/sdk adds req.vote?

#

or passport, which adds req.user

outer perch
#

I use bot.commands only in index.js

#

so it can be just commands

pale vessel
#

bru why not just use .get()

mellow kelp
#

well alright

eternal osprey
#

hey guys i need some help:

trainers[targetMember.id].mons = [given1]
                         trainers[targetMember.id].spawnId = [given1.spawnId]
                         trainers[firstmember].mons = [given]
                         trainers[firstmember].spawnId = [given.spawnId]
                         fs.appendFileSync("./trainers.json", JSON.stringify(trainers), "utf8");```this actually doesn't add the trainers to specific trainer in trainers.json, but it actually makes antoher array:
#

how do i fix taht?

pale vessel
#

you don't really need declare, right?

mellow kelp
#

i think you do need it

pale vessel
#

isn't it just to specify that it's existing

mellow kelp
#

hmm

outer perch
#

const command = commands.get(commandName) || commands.find(cmd => cmd.aliases && cmd.aliases.includes(commandName));
cmd also doesn't have .aliases

mellow kelp
#

well add it

outer perch
#

yeah JS is free bad habits everywhere

cinder patio
#

Use an interface to describe a command object

mellow kelp
#

or a class maybe?

mellow kelp
#

probably an interface

crude light
#

This is pain

outer perch
#

TS obliges you to learn the good way

mellow kelp
#

this is the way

outer perch
pale vessel
#

do u no the wae

mellow kelp
#

n0

outer perch
#

just looking at the things before doing anything alone

mellow kelp
#

you could make the api and the bot together

#

or

eternal osprey
#
trainers[targetMember.id].mons = [given1]
                         trainers[targetMember.id].spawnId = [given1.spawnId]
                         trainers[firstmember].mons = [given]
                         trainers[firstmember].spawnId = [given.spawnId]
                         fs.writeFileSync("./trainers.json", JSON.stringify(trainers), "utf8");
                    ```why does this literally overwrite all my pokemons
mellow kelp
#

make a basic api for the bot, and use it in the dashboard

outer perch
#

how do I assign array as type?

#
interface cmd {
  aliases: array[string];
}
#

wasn't something like this?

cinder patio
#

string[]

#

or Array<string>

outer perch
#

but it has to be

#

working like an IDE is better than just free of will

mellow kelp
#

yea

outer perch
mellow kelp
#

your commands variable must have the type Collection<string, cmd>

#

interfaces are Capitalized btw

#

so you would probably want to name it interface Command

blazing umbra
#

Need help in bot

outer perch
mellow kelp
#

nope

#

you're implicitly saying Collection<any, any> i think

outer perch
mellow kelp
#

so you should do

const commands = new Collection<string, Command>()
outer perch
#

ah k

mellow kelp
#

not sure

lament rock
#

interfaces, you can I believe

#

idk about types

outer perch
#
interface Command {
    aliases: string[];
}

const commands = new Collection<string, Command>();
#

way up there

mellow kelp
#

does that work

outer perch
#

yeah, no red lines

mellow kelp
#

aight

outer perch
mellow kelp
#

you need to add execute to command

outer perch
#

but execute is a built-in function

mellow kelp
#
interface Executable {
  run(): void;
}
mellow kelp
outer perch
#
try {
  command.execute(bot, message, command, db, lang, language, prefix, args, serverSettings);
}
catch (err) {
  console.error(err);
  message.reply(lang.error.cmd);
}
#

at least in JS

mellow kelp
#

what do you mean by built-in function

cinder patio
#

it's not built-in, you define it in your command objects

outer perch
#

idfk, weird expressions I use

#

I didn't declare execute anywhere

#

never

#

I grabbed this execute thing, a long time ago, when I was learning how to make a bot

#

for command handling

mellow kelp
#

you need to add an execute method on your command interface

cinder patio
#

you do, as a property of the object you're exporting

outer perch
cinder patio
#

it's in the screeenshot, lol

outer perch
#

from D.JS' guide

mellow kelp
#
interface Command {
  execute(arg1: SomeType, arg2: SomeOtherType): void;
}
blazing umbra
#

Nead help

#

Js

#

The bot is dm ing how to change to channel

#

I search in code to change user to channel

outer perch
#

const db = admin.firestore();, what type is this?

blazing umbra
#

Help bro

mellow kelp
outer perch
#

const admin = require('firebase-admin');

#

admin is this

opal plank
#

cast admin

#

or import it

quartz kindle
#

Returns _firestore.Firestore

opal plank
#

straight up stop using require() unless its json

outer perch
#

import admin from 'firebase-admin';

#

now this

opal plank
#

import will import the types too

outer perch
#

yeah, just did

opal plank
#

require() resolves to any

blazing umbra
#

@quartz kindle help

opal plank
#

so you have to cast it

opal plank
#

but at that point, just import it

quartz kindle
blazing umbra
#

Shill I dm

outer perch
#
index.ts:50:8 - error TS1259: Module '"C:/Users/ragsf/Desktop/Gumball-and-Penny/node_modules/firebase-admin/lib/index"' can only be default-imported using the 'esModuleInterop' flag

50        import admin from 'firebase-admin';
          ~~~~~
opal plank
#

i told ya to add that lul

outer perch
#

how do i cast?

#

it's in

opal plank
#

const admin = require('module') as Type

cinder patio
opal plank
#

or that ^^

compact prairie
#

in discord.js is it possible to make a message like this

outer perch
unkempt ocean
#

are you using body selector to change background?

compact prairie
#

how to do this in discord.js

opal plank
#

yeah of course

#

embed

#

send({embed object})

outer perch
#

* means everything iirc

compact prairie
opal plank
#

what info? those are fields

outer perch
#

yoo, l my bot is working, I fixed everything!

opal plank
#

.send() can take an object

compact prairie
opal plank
#

.send({embed:{/*embed content*/}})

blazing umbra
#

@quartz kindle see dm

compact prairie
opal plank
compact prairie
opal plank
#

erm, i forgot, but theres a webscoket in there

#

api.websocket?

unkempt ocean
#

no

body {
background: color-here !important;
}
.bTmyJW {
background: transparent !important;
}
outer perch
unkempt ocean
#

you're welcome

#

you can DM me if this doesn't work

outer perch
#

now it's time to rewrite the commands and functions

opal plank
#

i need to rewrite my whole reminders system

#

and its massive

#

i really dont want to

#

but i wanna make it dynamic

outer perch
#

ยฏ_(ใƒ„)_/ยฏ

quartz kindle
outer perch
#

Life is a son of a bitch
The bitch is a child of Life
Never seen so many sons of a bitch
I'm my fucking life

#

it's a saying from my country, something like that

#

but in Portuguese sounds better

opal plank
#

@quartz kindle might be the only one to undertsand that proverb

#

anyway, i digress

#

i should go code

quartz kindle
#

xD

outer perch
#

in translator, it goes like

Life is motherfucker
The whore is the daughter of life
Never seen so much motherfucker
In the whore of my life

eternal osprey
#

hey guys

#

i recently installed visual studio to get into c#.

#

However, now vsc gives me problems when installing packages:

gyp ERR! find VS msvs_version not set from command line or npm config     
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt   
gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio  
gyp ERR! find VS including the "Desktop development with C++" workload.   
gyp ERR! find VS For more information consult the documentation at:       
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
gyp ERR! find VS *******************************************
*******************```
quartz kindle
#

code doesnt work like that

eternal osprey
#

hahahah

outer perch
#

he be like

blazing umbra
#

Like wich

quartz kindle
#

The code i have only works for me

blazing umbra
#

Lol

quartz kindle
#

Because code is made specific for each situation

blazing umbra
#

I have one problem only

eternal osprey
zenith terrace
opal plank
quartz kindle
outer perch
eternal osprey
#

nvm i just deleted vs. Works again.

blazing umbra
opal plank
#

dm them, surely they put contact info on their github

eternal osprey
zenith terrace
#

Or just dont take code from github if you dont know how it works

blazing umbra
#

Ok

quartz kindle
eternal osprey
quartz kindle
#

Thats what github issues are for

zenith terrace
#

issues are for*

#

There you go

quartz kindle
#

Im on mobile

#

Pain to edit

zenith terrace
#

So am I

earnest phoenix
opal plank
#

slash commands

zenith terrace
#

Slash commands

earnest phoenix
#

Means

opal plank
#

this

rustic nova
#

There's no meaning, just slash commands

eternal osprey
#

i can'install packages anymore cuz of vs

opal plank
#

remove all node modules

earnest phoenix
#

Thx

opal plank
#

and clear npm cache

#

then reinstall all dependencies

proven lantern
# eternal osprey <a:Cry:809652552269692938>
gyp ERR! find VS including the "Desktop development with C++" workload.   
gyp ERR! find VS For more information consult the documentation at:       
gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows```
eternal osprey
glossy spoke
#

Update vs

opal plank
#

wait they using vs?

#

not vsc?

eternal osprey
eternal osprey
quartz kindle
#

yarn v2 is nice

earnest phoenix
#

@opal plank btw how to avoid / cmd

mellow kelp
#

yarn is cool

opal plank
#

wdym how to avoid it?

#

theres no way to avoid it, you added a bot, its there, it has the commands

#

theres no "avoiding it"

#

remove the bot

#

ยฏ_(ใƒ„)_/ยฏ

earnest phoenix
#

Suppose bot prefix is /

#

And user

#

Need

quartz kindle
#

Dont use / as prefix

opal plank
#

^^

earnest phoenix
#

Yup

glossy spoke
#

Why would you use / as prefix knowing that slash commands works with /??

eternal osprey
#

it worked @opal plank . Thanks!

quartz kindle
#

Maybe they didnt know

opal plank
#

np

#

older bots

#

before we even knew about slash commands

#

though they were talked about for quite a while

earnest phoenix
opal plank
#

i think we got early stuff a bit before d.js v11 got deprecated

glossy spoke
earnest phoenix
#

Reply

#

Msg

glossy spoke
#

wut

earnest phoenix
#

This

glossy spoke
#

What about that?

glossy spoke
#

So why did you ping me replying to that message? Thonk

earnest phoenix
#

For full details

glossy spoke
#

??

opal plank
#

fuck, im in a little bit of a halt

earnest phoenix
opal plank
#

@quartz kindle hilp

earnest phoenix
#

๐Ÿ˜‚

#

Hilp

glossy spoke
earnest phoenix
#

Slash cmd

glossy spoke
#

Ya but why did you mention me replying to that message?

opal plank
#

Need to test webhooks for vote. Topgg token is already being used in main bot. Need to test in beta bot. Cant apply for beta bot cuz its not a production bot, so no reason uploading it to get an extra token, though it'd be nice.
Could pontentially hit the express endpoint with the same request top.gg sends,maybe? to mimic a vote?

glossy spoke
#

I meant that wasn't neccesary

proven lantern
#

can we listen to slash commands without listening to every message? ie without client.on('message', messageListener);

opal plank
#

Like, i cant foward my bots to another ip, since it sbeing used in prod, even if its being used for 20 minutes for testing, anyone in that gap would lose their vote rewards

#

best thing i can think of would be doing a manual post request to my api with the payload top.gg usually sends

rustic nova
opal plank
#

thats what i was thinking of

#

i assume theres no way i can upload a bot thats almost a clone of my other while having extra features right?

rustic nova
#

Do you have atleast something you can host the webhook on?

glossy spoke
#

@rustic nova is there a way to change a bot's page owner? My last acc was disabled

opal plank
#

like, i do have the webhooks running

#

the issue is that i cant test it via the page itself

#

cuz it can only foward to 1 adress

rustic nova
glossy spoke
#

Ok.

opal plank
#

could potentially make a temporary webhook to re-emit the payload back to both the bots

glossy spoke
#

And yes, it's approved.

rustic nova
opal plank
#

its IP, since im using my local ip prob not a good idea, i dont have much setup here

#

What are the odds of uploading my beta bot to the site?

#

having an extra token would come in really handy for developing

rustic nova
#

It wont get approved if it is just the same thing, i generally would say beta bots shouldn't be on the site

latent heron
#

Hope

eternal osprey
#

why is my whole visual studio code set to fucking c#?

latent heron
#

u smelly

opal plank
#

yeah thats what i assumed too

eternal osprey
#

i used it once. Once for fuck sakes.

opal plank
#

hmmmm

#

i might do an axios request based on the request

eternal osprey
#

It removed all my extensions Visual studio removed all my vsc extensions.

opal plank
#

do you happen to have the shape of the request hope?

#

headers, body, etc?

earnest phoenix
#

Anyone know top.gg vote counter package in js

restive furnace
#

webhooks

#

and @topgg/sdk

earnest phoenix
#

Not count

#

Like user have 5 votes etc

restive furnace
#

you have to count it yourself

opal plank
#

not necessarily

#

you can use the API for that

compact prairie
#

okay so i have this in discord.js

let t1 = await client.api.channels(statusChannel).typing.post()```

Makes Discord think the bot is typing

How do i find the ping from that
earnest phoenix
opal plank
#

IF you have a token, which requires an approved bot

#

OOOOOOR

restive furnace
opal plank
#

you could scrape

#

from the website directly

#

fetch the json and parse the count from the bot's page

earnest phoenix
opal plank
#

not bot token, api token

#

but yes

earnest phoenix
#

Similar

opal plank
#

you dont share your bot token to anyone

#

no

#

bot token is your bot itself

#

its your user bot

#

api token allows you to use top.gg's api

#

but i see you dont have a role

#

so im assuming you dont have an approved bot

#

hence you cant use the api, so your options are only scraping

#

but people wont be able to vote yet on ur bot until its approved

#

so, not sure what you trying to acocmplish there

compact prairie
#

okay so i have this in discord.js

let t1 = await client.api.channels(statusChannel).typing.post()```

Makes Discord think the bot is typing

How do i find the ping from that
earnest phoenix
opal plank
#

well, if you dont have a bot, you cant use the api

sterile lantern
#
function cpsTest() {
    click++;
    document.getElementById("something").innerHTML = click;
    counter = setTimeout(function() {cps = click / 10; 
    document.getElementById("totalclicks").innerHTML = `You have ${cps} clicks per second! Noob!`; 
    document.getElementById("something").innerHTML = "Click the button to play again!";
    document.getElementById("cpsbutton").innerHTML = "Restart"
    document.getElementById("cpsbutton").onclick = restart}, 10000)
    }


function restart() {
    click = 0;
    document.getElementById("something").innerHTML = '0';
    document.getElementById("totalclicks").innerHTML = "Clicks";
    document.getElementById("cpsbutton").onclick = cpsTest;
    document.getElementById("cpsbutton").innerHTML = "Check your cps!"
}```

the restart button goes back to cpsTest but then it also keeps clicks at 0
#

it also goes instantly instead of waiting the 10 seconds

eternal osprey
#

UnhandledPromiseRejectionWarning: Error: sqlite: filename cannot be null / undefined what is this?

earnest phoenix
#

This*

sterile lantern
earnest phoenix
#

Problem is basics

eternal osprey
sterile lantern
#

are you sure you're properly directing it to that file

#

can i see how you define filename

#

if theres no other folders that db is in, it should be ./db/mainDB.sqlite

compact prairie
#

okay so i have this in discord.js

let t1 = await client.api.channels(statusChannel).typing.post()```

Makes Discord think the bot is typing

How do i find the ping from that
eternal osprey
#
sql.open(`./db/mainDB.sqlite`);

fs.readdir('./events/', (err, files) => {
  if (err) return console.error(err);
  files.forEach(file => {
    let eventFunction = require(`./events/${file}`);
    let eventName = file.split('.')[0];

    client.on(eventName, (...args) => eventFunction.run(client, ...args, sql));
  });
});```this is all.
sterile lantern
#

uh

#

shouldnt sql.open be a function??

eternal osprey
#

great question

#

nidk

#

idk*

sterile lantern
#
 const {open} = require('sqlite')

 function openDB (){
    return open({
        filename : './mainDB.sqlite',
        driver: sqlite3.Database
    })
}```
#

i think this is how it shoulkd work

#

should*

#

then u can define db as

#
 const db = await openDB();```
eternal osprey
#

oowh

#

i am not using sqlite2

#

sqlite3*

#

but sqlite

#

@sterile lantern

earnest phoenix
#

@opal plank i need package for top.gg

opal plank
#

pong

#

we said

eternal osprey
opal plank
#

@topgg/sdk

sterile lantern
#

hey erwin can u look at this dude's issue above ^^^

#

idk that much sqlite

opal plank
#

me neither

#

im postgres supremasist

#

ยฏ_(ใƒ„)_/ยฏ

sterile lantern
#

a cps test but it doesn't work properly

opal plank
#

no clue either, thats front end

#

which i despise

sterile lantern
#

hmm okay

#

also

#

how did u get ur status thing

opal plank
#

SDK

sterile lantern
#

ooh

#

ok

opal plank
sterile lantern
#

is it possible to do w bots

opal plank
#

no

sterile lantern
#

oof

earnest phoenix
opal plank
#

thats not the one i sent for you

opal plank
#

that one is for @sterile lantern

lucid prawn
#

how do i make my bot send message when it invite to a new server

opal plank
#

that gives you the guild payload of the guild that just added your bot

sterile lantern
#

guildCreate? doesn't that create a guild

#

or is it when it joins a guild

opal plank
sterile lantern
#

ohh

opal plank
#

i assume this means when someone invites(adds) their bot

sterile lantern
#

alr

#

yea

lucid prawn
#

oml
thx

opal plank
#

๐Ÿ‘

lucid prawn
#

im working on custom css for discord

opal plank
#

im working on rewriting my reminders

#

wait what

#

custom css for discord?

#

yeah, thought the same

lucid prawn
#

yeah

eternal osprey
opal plank
#

thats against ToS, shouldnt really be talking about that here

#

well, better than the idiot i saw yesterday

lucid prawn
eternal osprey
lucid prawn
#

i will just go it the discord file and change it their

opal plank
opal plank
#

if theres anything star worthy i posted today, that'd be at the top

#

i cracked when i read that

lucid prawn
lucid prawn
opal plank
#

what exactly you doing again?

#

and what code did you change

lucid prawn
opal plank
#

cant help with mods, sorry

#

you should ask in their support server, not here

lucid prawn
#

uhh

#

i may get ban so no

opal plank
#

wdym get ban?

#

they are the ones who crated betterdiscord

#

why would they ban u?

lucid prawn
#

oh ok

#

good

compact prairie
#

how do you find the amount of messages in the bot's cache

#

d.js

opal plank
#

i might be wrong, but i think they are stored in each channel

#

so you'd have to iterate through all channels or map them

#

<channel>.messages.cache.size ?

#

should be something like that

#

i'd be surprised if d.js doesnt store messages inside channels

compact prairie
opal plank
#

i said, you need to iterate through your bot's channels

compact prairie
#

thats what im having issues with

compact prairie
opal plank
#

what?

#

thats not how any of this works my dude

left nacelle
#

Heya I'm trying to turn on my discord bot but its not working it has worked before

opal plank
#

you know how loops work?

opal plank
left nacelle
#

im using visual studio code and it worked like a week or 2 ago

opal plank
#

thats not a library

#

thats your code editor

#

i assume you're using discord.js then

left nacelle
#

yeha

#

yeah*

opal plank
#

what version?

left nacelle
#

i forgot what it was called lol

#

how do i check lmao

opal plank
#

package.json

#

its inside there

left nacelle
#

12.2.0

#

i probs downloaded the wrong one then

#

its outdated probs

glossy spoke
#

<client>.login("TOKEN");

left nacelle
#

how do i update discord. js

glossy spoke
#

Why would you try to update it? You already has the v12

opal plank
#

npm i discord.js

#

but thats unrelated

left nacelle
#

oh

opal plank
#

show your code

#

DONT forget to remove your token

#

do not share your token with anyone

glossy spoke
#

YEP

left nacelle
#

lmao ik

eternal osprey
#

TypeError: Cannot read property 'client' of undefined at at new MessageEmbed (/app/node_modules/discord.js/src/structures/MessageEmbed.js:13:60). My code: ```js
if (message.author.bot) return;

if (!db[message.author.id]) db[message.author.id] = {
    xp: 0,
    level: 0
  };
db[message.author.id].xp++;
let userInfo = db[message.author.id];
if(userInfo.xp > 100) {
    userInfo.level++
    userInfo.xp = 0
    let embed3 = new Discord.MessageEmbed()
    .setColor("RANDOM")
    .setDescription("Congratulations sensei, you have leveled up")
    .setFooter("Bot is hosted for โธโธ ๐Ÿ’ฟ ห€ laziness myths  โ™ก!")
    .setImage("https://media.giphy.com/media/B6SyssSlTgPXq/giphy.gif")
    .setThumbnail(message.author.avatarURL())
    message.channel.send(embed3)
    
}```
lucid prawn
opal plank
#

what?

lucid prawn
#

sad times

glossy spoke
#

Wut

lucid prawn
opal plank
#

what does zip have anything to do with this

lucid prawn
#

when i try to download it

#

the file

opal plank
#

oh, the .dll files

#

what about them?

left nacelle
#

one min

lucid prawn
#

i cant download it bc of zip

eternal osprey
glossy spoke
#

Does quick.db works like that?

opal plank
#

am i blind or you copied the wrong snippet?

#

theres no client in there

#

TypeError: Cannot read property 'client' of undefined

glossy spoke
#

lmao

opal plank
#

but on ur snippet theres no client

#

at all

lucid prawn
#

or use it

opal plank
#

@lucid prawn you unzip it, extract it with 7zip or winrar

glossy spoke
#

Just download WinRar and extract it

opal plank
#

i think windows explorer can extract it too

glossy spoke
#

Imagine the entire server inside 1 voice channel

opal plank
#

cant, 99 max

glossy spoke
#

It's an hipotetic case

left nacelle
opal plank
#

easy to see, multiple times have i been in 99 capped voice channels

#

usually on raids

#

@left nacelle regenerate your token

left nacelle
#

ok

opal plank
#

and then change the token for the new one

left nacelle
#

ok

eternal osprey
opal plank
#

where?

eternal osprey
#

but heroku seems to be funny

glossy spoke
#

Also, to copy your code without changing the token or doing whatever to hide it, you can put the token inside an external file and the require that file to use the token on the bot's login.

opal plank
#
if (message.author.bot) return; 

   
    if (!db[message.author.id]) db[message.author.id] = {
        xp: 0,
        level: 0
      };
    db[message.author.id].xp++;
    let userInfo = db[message.author.id];
    if(userInfo.xp > 100) {
        userInfo.level++
        userInfo.xp = 0
        let embed3 = new Discord.MessageEmbed()
        .setColor("RANDOM")
        .setDescription("Congratulations sensei, you have leveled up")
        .setFooter("Bot is hosted for โธโธ ๐Ÿ’ฟ ห€ laziness myths  โ™ก!")
        .setImage("https://media.giphy.com/media/B6SyssSlTgPXq/giphy.gif")
        .setThumbnail(message.author.avatarURL())
        message.channel.send(embed3)
        
    }```
there no client here
eternal osprey
#

i know

opal plank
#

then theres no client there

left nacelle
#

ah damn i forgot what the command was to start the bot

eternal osprey
#

How the fuck is heroku being that funny then

opal plank
#

ยฏ_(ใƒ„)_/ยฏ

#

@left nacelle node index.js

eternal osprey
young flame
#

i heard json db

glossy spoke
opal plank
#

yeah awsome is a stubborn one

mellow kelp
#

did i hear json db

young flame
#

woah erwin you using json db's

glossy spoke
opal plank
#

i personally told them to NOT use it dating back november last year. Now they're whining that the code grew too big to port it

#

ยฏ_(ใƒ„)_/ยฏ

young flame
#

so

#

you aren't using a json db

opal plank
#

me, of course i am, json dbs are the best

young flame
#

erwin...

glossy spoke
#

Lmao

young flame
#

you earned my approval

#

i use them to lol

opal plank
#

im using embed builders too

#

rewrote my whole code to use them

young flame
#

nice

opal plank
#

also im doing client.on('message') for every command i have

#

like a pro

young flame
#

i tried jsoning it was pog

left nacelle
young flame
#

i liked node-json db better tho

lucid prawn
young flame
#

cause you can like write your own functions

opal plank
#

RPC is deprecated btw RIka, just fyi

glossy spoke
young flame
#

its const

glossy spoke
#

ยฏ\_(ใƒ„)_/ยฏ

young flame
#

import is ts and c#

#

i think

left nacelle
#

its my token tho

young flame
#

oh and python

opal plank
#

The SDK that this documentation references, Discord-RPC, has been deprecated in favor of our new Discord GameSDK. Replacement functionality for the Rich Presence SDK can be found in the Activity Manager of that SDK. This documentation can be referenced for education but does not entirely reflect the new SDK.
source: https://discord.com/developers/docs/rich-presence/how-to

Discord Developer Portal

Integrate your service with Discord โ€” whether it's a bot or a game or whatever your wildest imagination can come up with.

left nacelle
#

thats why i hid it

glossy spoke
#

And why do you have your token on the main file?

opal plank
#

its es6 syntax

left nacelle
#

wait nvm

young flame
#

o

#

o wiat

left nacelle
#

i didnt read it correctly

#

it looks similar lmao

young flame
#

my mind is still wonky

opal plank
#

welcome to my world

#

though my mind is full of alcohool

left nacelle
#

lmao

opal plank
#

@left nacelle dont

#

thats ur token my dude

#

regen it

glossy spoke
#

Delete that!

#

Regen the toien

opal plank
#

literally told you NOT to share ur token

glossy spoke
#

Token*

young flame
#

oofers

#

man

glossy spoke
#

lmao

left nacelle
#

i already regenerated it

#

lmao im tired af

glossy spoke
#

At login

young flame
#

i have a pro tip: separate your token into 3 different files then call each file in a function so it runs it as one file

blissful coral
young flame
#

very pog

blissful coral
#

When I eval this I get my data back

#

here it is null

lucid prawn
#

this code is bad

import RPC from 'discord-rpc'
import fs from 'fs'

console.log("Attempting to start RPC...");
const client = new RPC.Client({ transport: 'ipc' });
const data = fs.readFileSync('./status.json','utf8');
const activ = JSON.parse(data.replace('"Date.now()"',Date.now()));
console.log(activ);
var pres = activ.presence;
pres.buttons[1] = { label: "โญ Create a Custom Status โญ", url: "https://discord"}
client.on('ready', () => {

    client.request('SET_ACTIVITY', {
        pid: process.pid,
        activity: pres
      }).then(() => {
        console.log("Custom status has started!");
      }).catch(error => {
        console.log("There was an error with your custom status.");
        console.log("Error for nerds:");
        console.error(error.toString())
      })
})
client.login({clientId: activ.clientid}).catch(error => {
  if (error.toString() == "Error: RPC_CONNECTION_TIMEOUT") {
    console.log("There was an error starting your custom status. Please try again.")
    console.log("This is a common error that can be fixed by re-running the program.")
  } else {
    console.log("There was an error with your custom status.");
    console.error(error.toString());
  }
})

it not working

young flame
#

what

glossy spoke
#

U

opal plank
#

just salt your token 21 times and then base64 it, then split every character of the result into different files using the current timestamp as the order

left nacelle
#

so that means theres a error with my token?

young flame
#

i just reverse regex it

opal plank
#

@lucid prawn i literally told you

young flame
#

then regex it again

left nacelle
#

it just says its not defined

blissful coral
#

anyone wanna help me KEKW

young flame
#

wut

left nacelle
#

also i love how i said ik not to share token but then do it lmao

glossy spoke
#

At login you must write the token inside ""/''/``

young flame
#

i gotchu extreme

lucid prawn
young flame
#

chatis full of special snowflakes atm

zenith terrace
#

Lol

opal plank
#

@lucid prawn check what i sent

blissful coral
#

Yes moooon

#

Help my weird problem

left nacelle
glossy spoke
young flame
glossy spoke
#

bot.login("TOKEN");

#

@left nacelle

blissful coral
#

Where?

#

@young flame

zenith terrace
#

U used JSON.stringify in your eval

young flame
#

in the one you said you eval you had JSON.stringify(data)

blissful coral
#

Yeah

young flame
#

in that one its just data

blissful coral
#

I can console.log(data) and it will give the same thing

young flame
#

but its null correct

blissful coral
#

Oh wait

#

It is because I am running it locally

#

And that is from my server

#

LMAO

lucid prawn
blissful coral
#

Don't mind me...

young flame
#

lmfao

#

dw extreme

opal plank
young flame
#

qblobpat i will always adore you

#

#imnotasimp

opal plank
left nacelle
#

um idk what to do @glossy spoke

solemn latch
#

Token goes where it says 'token'

left nacelle
#

it is there

opal plank
#

why you even putting ur token after login()

#

theres 0 need for that

left nacelle
#

oh

blissful coral
#

Should probably learn js before creating a discord bot and fucking with discords API

tiny dune
#

how do I get bot developer role bc i develop bots

blissful coral
#

Your bot^

left nacelle
#

i used to know but i forgot lol

blissful coral
glossy spoke
icy skiff
#

@quartz kindle I installed the SFTP plugin you mentioned and ran a script that updates a certain database on my pc, the database works fine here but on the VPS its all fucked up and its not even recognized as a database anymore, is it the plugin that is not supposed to transfer databases or i fucked up somehow (i had a backup so its fine lol)

tiny dune
blissful coral
tiny dune
#

it doesnt let me type

blissful coral
#

Refresh

tiny dune
#

i did

solemn latch
#

I've never heard of someone having this issue.

#

Try using a diffrent browser? Or reclicking the text box.

stark abyss
#

Don't worry about sanitizing input, yes I already know it's a good habit, and I already took precautions just tell me what I am doing wrong in this line right here.
error: syntax error at or near "WHERE" | setup clan exist query

left nacelle
left nacelle
#

NVM

glossy spoke
left nacelle
#

Fixed it

#

i forgot to save

#

lmao

icy skiff
blazing umbra
#

@quartz kindle the developer is telling change user to channel ware to change also don't know

icy skiff
#

i just ran the database update script on the vps itself using the ssh client and now it works fine too

icy skiff
#

im pretty sure it might be a problem with the way the plugin updates the database to the vps

tiny dune
#

can someone help me code my bot

blissful coral
#

how can I get a users Avatar URL from oauth?

tiny dune
#

im new to coding

solemn latch
solemn latch
tiny dune
tiny dune
blissful coral
icy skiff
#

you should study the language and then try making a bot

blissful coral
#

It is oauth

#

It just shows some sort of code

solemn latch
#

oh?

blissful coral
#

one sec let me pull up my dashboard

#

@solemn latch

solemn latch
#

ah thats a hash

#

you have to construct the url, one sec

blissful coral
#

OH

#

I FOUND IT

#

I got it

tiny dune
#

@blissful coral check DMs

blissful coral
#

Thx @solemn latch lmao

#

@tiny dune no, read the guide.

rancid bramble
#

is there an easy way to code an anti-raid bot or should I ban users according to their account creation date?

solemn latch
tiny dune
#

is this correct

#

if(!message.content.startsWith(prefix)) return;

if(cmd == 'ping') {
    message.channel.send('pong');
cinder patio
#

try it

tiny dune
#

it works

#

but the guide does different

solemn latch
#

the guide isnt the only right way to do a djs bot

rancid bramble
solemn latch
#

I think most anti raid bots have multiple methods for detecting a raid

rancid bramble
#

that's why I asked that

#

I could raise the percentage by detecting certain things

#

then if the percentage is above a specified amount, it would ban the user

solemn latch
#

age is fine, I would also check how many users have recently joined, and compare it to the normal average rate of joining

tiny dune
#

i need it online 24/7

solemn latch
#

for example a server which normally has 100 people join a day suddenly getting 100 in 10 minutes its probably a raid.

solemn latch
tiny dune
#

ok

blissful coral
#

So how exactly should I do this with ejs Thonk

#

Because it won't show up on my dash

solemn latch
#

oh weird, that looks right to me, i dont know if the cdn supports webp however

solemn latch
#

replit is free, but its not good typically.

analog tinsel
#

did anyone know api service that make image effect with member avatar url etc?

earnest phoenix
#
bot.on('guildMemberAdd', newMember => {
    const newMemberEmbed = new Discord.MessageEmbed()
        .setColor('#00FF00')
        .setTitle('New Member')
        .setDescription(`Welcome ${newMember} to * ![heartshake](https://cdn.discordapp.com/emojis/807577259653333032.webp?size=128 "heartshake")`)
    newMember.guild.channels.cache.get('<channelID>').send(newMemberEmbed);
    return;
});

okay so for some reason its not giving me any response when a new member joins my server, i dont see whats wrong and i dont get any errors whatsoever in the console? any ideas? ive tried troubleshooting a little but nothing has worked

icy skiff
solemn latch
tiny dune
solemn latch
#

vsc is a code editor

#

not a host

tiny dune
#

ok

blissful coral
#

It did before I added ``

solemn latch
#

hmmm

#

i havent ejs'ed in awhile

blissful coral
#

now it does

cinder patio
blissful coral
earnest phoenix
#

yes

cinder patio
#

Do you have the members intent turned on?

earnest phoenix
#

i only changed it to <channelID> for the representation here

earnest phoenix
cinder patio
#

yeah

earnest phoenix
#

wdym

solemn latch
blissful coral
#

oh...

tired panther
#

if(revoketime < 345600000)
is this to big for node.js?

icy skiff
solemn latch
#

i could be wrong

cinder patio
#

In order to receive guildJoin/guildLeave events your bot needs the guild members intent enabled. Go to your bot's application page and enable it

earnest phoenix
#

oh ๐Ÿ’€

blissful coral
#

Well

#

When I did =

tired panther
blissful coral
tiny dune
#

can someone please help me code my bot

solemn latch
#

i would suggest reading the entire djs guide

#

actually reading all of it

icy skiff
tiny dune
#

ik but im at school alot and i dont hVE ALOT OF FREE TIME

icy skiff
#

If by "help" u mean code for you

#

No one is gonna do It Bro

solemn latch
#

development of a bot can take weeks

#

its not something you just do in a few minutes

tiny dune
#

ik how

#

i just dont have time

icy skiff
#

Then pay someone to code for u

solemn latch
#

then hire a dev on fiverr

icy skiff
#

No one will do it for free

#

I would totally code a bot for u If u paid me lol

blissful coral
#

I actually got it to work @solemn latch

#

You were correct

solemn latch
#

pog

#

ay

blissful coral
solemn latch
#

sweet

tiny dune
icy skiff
#

Bru

solemn latch
#

dms if you want to discuss that

#

please not here

icy skiff
#

Ok If u really want it dm me

#

Ye ik

outer perch
tiny dune
solemn latch
#

I wouldnt worry about it unless it causes issues.

outer perch
#

TS btw

cinder patio
#

You could use the import syntax to make your code more consistent

earnest phoenix
#

who cares if it wakes multiple weeks maybe even months

#

the process is more fun than the finished product for me

outer perch
#

I still need to understand how import works

cinder patio
#

Oh it's a json file, yeah using require for json files is fine

outer perch
#

aight

#

I have "allowJS": true

#

maybe that's why I can use require

stark abyss
cinder patio
#

I'm pretty sure "allowJS" just allows the compilation of javascript files

summer torrent
#

i can use require without "allowJS"

outer perch
#

aight

#

btw, what about this one?

require('dotenv').config();
cinder patio
#

here you should use import

#
import {config} from "dotenv";
config();
outer perch
#

so for every module I had for JS, I now have to install their types for TS

pure lion
#

cant you import() in ts?

cinder patio
pure lion
#

oh right

tiny dune
icy skiff
#

triple `

cinder patio
#

code blocks

tiny dune
#

hey

#

ok

#

bet

#

w

honest perch
#

so i know this is probably the worst and laziest implementation but i have the following code in a command

client.tools.checkPerms(message, client);
``` and then in the checkPerms util i have
```js
const GuildConfig = require('../models/guildConfig');
  GuildConfig.findOne({guildID: message.guild.id}, function(err, doc) {
    if (err) throw new Error(err);
    if (!doc.djOnly) return;
    if (Boolean(message.member.roles.cache.find((r) => r.name.toLowerCase() === 'dj'))) {
      return;
    } else {
      return message.channel.send({embed: {
        title: 'You are not the DJ, you can\'t use this command',
        author: {name: 'Music Boat', icon_url: client.config.embed_author_img},
        color: client.config.embed_color,
      }});
    }
  });

then it works it just does this though

outer perch
#

so, how do I import functions?

tiny dune
#

    if(cmd == 'ping') {
        message.channel.send('pong');

    }```
outer perch
#

is this the way?

import removeVIP from './src/functions/removeVIP';
import giveVIP from './src/functions/giveVIP';
tiny dune
honest perch
#

markdown

tiny dune
honest perch
#

3 back ticks with the language

cinder patio
outer perch
tiny dune
tiny dune
#

i got

#

    if(cmd == 'ping') {
        message.channel.send('pong');

    }```
honest perch
outer perch
earnest phoenix
#

then it isn't the way

cinder patio
tiny dune
#

do i send js then the msg @honest perch

outer perch
#

wow

midnight blaze
#

@tiny dune you are sure you defined cmd properly?

earnest phoenix
#

ask dumb questions get dumb answers, why are you acting surprised

#

does anyone here know how to make headless chrome/firefox do stuff? i can see its visiting the page but idk where the ss is going

honest perch
tiny dune
#

ok

outer perch
#
function convert(value: number) {
    let valueString: string;

  if (value >= 1000000) {
    valueString = (value / 1000000) + 'M';
  }
  else if (value >= 1000) {
    valueString = (value / 1000) + 'k';
  }
  return valueString;
}

module.exports = convert;
#

module.exports

cinder patio
#

Use export

outer perch
#

๐Ÿ˜ฎ

mellow kelp
#

or export default in this case

tiny dune
#

when i put

cinder patio
#

yeah, if you're only exporting one thing you can use export default

tiny dune
#

    if(cmd == 'ping') {
        message.channel.send('pong');

    }```
#

it dont work

cinder patio
#

But I recommend either doing one or the other for consistency reasons

tiny dune
#

it is still grey

midnight blaze
#

@tiny dune you need to learn basic stuff for sure

earnest phoenix
#

the language goes in the same line as the first set of backticks

tiny dune
#

ur confused

tiny dune
midnight blaze
#
console.log("sry for being confused")```
tiny dune
midnight blaze
#
"you are confused?"```
tiny dune
#

see

tiny dune
#

it isnt colors

earnest phoenix
#

holy fucking shit

earnest phoenix
#

the way you did it before was right

#

the language was just in a new line

#

when it isn't supposed to be

#

it's supposed to be in the same line as the backticks

tiny dune
#


console.log("thanks")
#

ok

#

i see

honest perch
# cinder patio The function sends the message, but the flow of the program continues. You shoul...

so now im not 100% sure what im doing wrong but i have this in the util

module.exports = (message, client) => {
  const GuildConfig = require('../models/guildConfig');
  GuildConfig.findOne({guildID: message.guild.id}, function(err, doc) {
    if (err) throw new Error(err);
    if (!doc.djOnly) return true;
    if (Boolean(message.member.roles.cache.find((r) => r.name.toLowerCase() === 'dj'))) {
      return true;
    } else {
      return false;
    }
  });
};
#

shift enter

#

ffs

tiny dune
#
hey
honest perch
#
  if (!client.tools.checkPerms(message, client)) {
      return message.channel.send({embed: {
        title: 'You are not the DJ, you can\'t use this command',
        author: {name: 'Music Boat', icon_url: client.config.embed_author_img},
        color: client.config.embed_color,
      }});
    }
``` and this in the command but it will return the message either way
tiny dune
#

how do i keep my bot online 24/7 bc i have vsc and it is only online when i type node .

#

but i need t online 24/7

midnight blaze
#

never turn off your pc

#

it is cheaper than a vps

tiny dune
#

lol

modest maple
#

its not

tiny dune
#

i have a mac

modest maple
#

but what ever

tiny dune
#

and

modest maple
#

just buy a vps

tiny dune
#

it turns off

earnest phoenix
#

rent a vps

tiny dune
earnest phoenix
midnight blaze
#

5 euros per months 1GB

tiny dune
#

ok

outer perch
#

args is undefined on purpose so if(!args) or if(args !== undefined)?

earnest phoenix
#

you can definitely find cheaper than 5eur/mo

#

you just have to find the right providers

outer perch
#

he told you to make batch script

tiny dune
#

where do i place

const Discord = require('discord.js')
const bot = new Discord.Client();

bot.on('ready', () => {
    console.log('Bot online')
})

bot.on('message', (message) => {
    if(message.author.bot) return;
    let prefix = `!`;
    // hello there ['hello' 'there']
    let MessageArray = message.content.split(` `);
    let cmd = MessageArray[0].slice(prefix.length)
    let args = MessageArray.slice(1)

    if(!message.content.startsWith(prefix)) return;

    if(cmd == 'ping') {
        message.channel.send('pong');

    }



})
outer perch
#

that's not a batch script xD

tiny dune
#

o

outer perch
#

ah let me tell you a way @tiny dune

#

I use this one, it's free

solemn latch
#

id recommend repl over heroku

tiny dune
#

what i do

midnight blaze
#

repl

#

it is easier

#

for beginners

solemn latch
#

and has a better upgrade path if you dont want to transfer to a vps down the line

tiny dune
#

what i do @outer perch

outer perch
#

I uploaded my code to GitHub, privately

midnight blaze
#

ask woo..repl is the answer and in your script add the client.login(token) function

earnest phoenix
#

Don't use any of that, heroku, repl or even Glitch is not made for hosting bots

outer perch
#

and then I created an account on Heroku

midnight blaze
#

yes but good for beginners vx

earnest phoenix
#

No, they're only there for testing, not actually hosting it all the time, and no they're not 24/7

tiny dune
midnight blaze
#

you can ping your bot on a port with express js

midnight blaze
#

if that is still possible

outer perch
#

if you provide your debit card

solemn latch
#

heroku actually only provides 500 hours a month on their free plan

#

which is 24 days ish

earnest phoenix
#

Repl restarts your application every 10 minutes

Heroku has dyno hours which if it ends, your application is fucked

Glitch can host it but it'll require payment soon enough

solemn latch
#

750 if you have a credit card

outer perch
#

and I did

solemn latch
#

which he does not

outer perch
#

that's the only exception

solemn latch
#

which, if you have a credit card, i would suggest not using heroku still, and would suggest a google f1 micro

tiny dune
#

I NEED MY BOT ONLINE 24/7 AND I HAVE NO MONEY WHAT DO I DO

outer perch
blissful coral
outer perch
#

just read what they said

blissful coral
outer perch
#

HAHA

blissful coral
#

Is it bad if this is on my suggestion list

#

LMAO

cinder patio
tiny dune
#

im confused

outer perch