#development

1 messages · Page 879 of 1

queen violet
#

i would help out more people in this channel if discord.js wasnt the only language people used

lyric mountain
#

Yeah

clear wraith
#

who is tim?

lyric mountain
#

Scroll up the chat

clear wraith
#

Does anyone know where i can find an example of a Moderation system? Im struggling on creating one for my bot.
@quartz kindle

#

If so... That would be helpful

lyric mountain
#

He's a great djs dev

clear wraith
#

I hope so dblMod

vague kite
#

Kinda of a tos question but how often can I just the status and presences of a bot??

queen violet
#

45 seconds should be fine

lyric mountain
#

Rule of thumb is 60 seconds delay between each update

vague kite
#

Yeah that makes sense I was gonna set it to 2 mins anyways just wanted to make sure

#

Thank you ❤️

earnest phoenix
#

hey, I'm looking for someone who can help me configure nginx. I don't know much about how it works and a friend of mine tried but he couldnt get it to work either. and my website keeps returning error 522

lyric mountain
#

@earnest phoenix sure

#

What was error 522 again?

earnest phoenix
lyric mountain
#

Ah, I see

earnest phoenix
#

It used to work before, but I switched to a new vps and now I cant get it to work anymore... :/

#

recheck your dns configuration

#

I have changed the dns ip settings

lyric mountain
#

Yeah, cloudflare can be a pain sometimes

earnest phoenix
#

what could it be in cloudflare I need to change still?

lyric mountain
#

Probably it's some issue regarding nginx not being able to serve tcp requests

#

Idk how to deal with that, never had that issue

earnest phoenix
#

Would that be ufw allow 80/tcp?

lyric mountain
#

Maybe

#

Try this

earnest phoenix
#

@lyric mountain thanks, but unfortunately it didnt sovle my issue...

snow urchin
#
client.on('voiceStateUpdate', async (oldMember, newMember) => {
  const stream = "http://radio.livida.net/radio/8000/radio.mp3"
  , newUserChannel = client.channels.cache.get(newMember.channelID)
  , oldUserChannel = client.channels.cache.get(oldMember.channelID)
  , { RadioBindings } = require(`${process.cwd()}/src/Structures/Constants/Models.js`)
  , data = await RadioBindings.find({guildID: (newMember.channelID ? client.channels.cache.get(newMember.channelID).guild.id : client.channels.cache.get(oldMember.channelID).guild.id)});
  if((newMember.channelID === data[1].channelID && data.binded) || newMember.channelID === "700486716968009800") {
// THIS CODE WILL NOT RUN... WHY??
   if(newUserChannel.members.size > 2)  return;
      newUserChannel.join().then(connection => {
      connection.playStream(stream,  {bitrate: 96000, volume: 0.1});
    })      
      } else if(oldUserChannel && oldMember.channelID === data[1].channelID){
        if(oldUserChannel.members.size < 2) {
          if(oldUserChannel.members.map(x => x.id).includes(client.user.id)) {
            oldUserChannel.leave();
          }
        }
      }
})
sudden geyser
#

what

snow urchin
#

code in the first if statement is not running, it should be running though

dense sluice
#

Help

indigo folio
#

you kinda have to explain your entire issue to get help

dense sluice
#

@indigo folio

#

Help me

#

?

indigo folio
#

._.

#

what is your issue

dense sluice
#

how does the ship command

indigo folio
#

im gonna cry

dense sluice
#

exampl

#

?ship user1 user2

indigo folio
#

it uses an api

clear wraith
#

why does my bot go offline every time my project is offline?

near ether
#

the code's process needs to stay running

clear wraith
#

do i need a host to keep it online?

dense sluice
#

generates a name based on the two users and places a percentage along with the photo of the two side by side

indigo folio
#

@snow urchin idk if you've figured it out or not because its been a long time since you posted that but try using a console.log() for each of those comparisons in the if statement and see if either is actually true. chances are, they are both false

#

@clear wraith are you using glitch

clear wraith
#

How do i keep the code's process running?

#

Yes

indigo folio
#

disgusting

clear wraith
#

lol

near ether
#

idk about glitch its kinda ass

indigo folio
#

also you need to use something like uptimerobot

#

to continuously ping it so it never goes offline

#

because yes, when the project goes offline, the bot goes offline

clear wraith
#

glitch is all i have

near ether
#

if ur serious abt a bot then get a real hosting service

indigo folio
#

but PLEASE for the love of god if you have like $3 get an actual VPS

clear wraith
#

do you guys use node app to program your bot?

indigo folio
#

you mean javascript?

clear wraith
#

yeah

near ether
#

yes

indigo folio
#

yes, i do, but to answer your question, you need to ping your project on glitch to keep it up

#

if it is not pinged in 10 minutes (iirc) your bot will go down

clear wraith
#

i use uptime robot, but that doesn't seem to work

robust moth
indigo folio
#

@clear wraith what URL are you pinging on uptimerobot

#

should be (glitch project name).glitch.me

clear wraith
#

umm

#

I just deleted the monitor, and am going to make a new monitor.

indigo folio
#

HTTP(s) @clear wraith

clear wraith
#

ok

indigo folio
#

whats ur glitch page

#

i'll tell u what to put

clear wraith
indigo folio
#

yes

#

but you didn't seem to understand

#

should be (glitch project name).glitch.me

snow urchin
#
 RadioBindings.findOneAndUpdate(query, {guildID: msg.guild.id}, {upsert: true}, function(err, doc) {

i have this for mongoose, and whenever it runs, instead of updating the existing document, it creates a new one, why??

clear wraith
#

hm

indigo folio
#

so if ur project is called epic-bot-5000 it should be epic-bot-5000.glitch.me

clear wraith
indigo folio
#

yes

clear wraith
#

ok

balmy lantern
#

Anyone else having a long wait time for verification?

clear wraith
#

yes

snow urchin
#

not the place to ask.

clear wraith
#

what would i do after i create the monitor?
@indigo folio

snow urchin
#

you close the glitch project, wait 5 minutes and make sure it works

indigo folio
#

literally nothing

clear wraith
#

so it just works on its own?

#

And is it supposed to say No Data? @indigo folio

indigo folio
#

bruh it hasn't pinged yet

snow urchin
#

wait 5 mins

clear wraith
#

i set to 10

snow urchin
#

it needs to be 5

clear wraith
#

ok

snow urchin
#

if glitch does not get a ping every 5 minutes, it goes offline

clear wraith
#

Ok

copper cradle
#

@robust moth bc you're checking if data.dispatcher doesn't exist, and if it doesn't then inside the if statement you're setting data.dispatcher to be something, so next time you check it'll be something and the code inside the if statement won't work

#

I meant so not to

robust moth
copper cradle
#

oh shit

#

I didn't see that

#

however your question was why the codeblock inside the if statement wasn't working when you ran the code twice

robust moth
#

Yeap

copper cradle
#

and I answered that question

#

now, lemme look into this

#

what does the end function do

#

besides from ending it

grizzled raven
#

thats probably it

robust moth
#

what does the end function do
@copper cradle stop dispatcher..I mean playing stop

grizzled raven
#

anyway, when you

#

wait nvm i'll just try it and see lol

copper cradle
#

playing stop?

robust moth
#

Yes

low chasm
#

Hi how can I add a link to another channel on the same server?

pale vessel
#

ok

#

use <#id> or just put the channel object inside a template literal

low chasm
#

So for if I want to link it to the general channel I would do what. Sorry

pale vessel
#

get the general channel

#

what library are you using?

low chasm
#

So in my welcome text I want them to click on the link to the rules page

high bough
#

Guys how do i map a member's roles in a guild

pale vessel
#

#map

high bough
#

The docs, yeah, right.

visual zenith
#

any place to ask for feedback if my site is good?

#

make sure to ping me as im bout to sleep

sacred mountain
#

Can someone help me with the discord verification stuff

high bough
#

Your bot has to have over 75 servers using it

#

@sacred mountain

sacred mountain
#

Ik

#

It’s just the things I hav to answer

#

I don’t understand them

#

HOW HAVE YOU SECURED ACCESS TO YOUR SYSTEMS AND INFRASTRUCTURE?

high bough
#

I never tried, my bot only has 28 servers

sacred mountain
#

Oh

restive furnace
#

it means how you have secured your bot from data leaks etc.

#

yeah

sacred mountain
#

What do u mean by data leaks

#

I don’t store any data with it

restive furnace
#

then like how you stored your code and things

sacred mountain
#

Oh

restive furnace
#

and how you secured them

sacred mountain
#

So what would I put

#

I don’t know how I secured them

#

They are just hosted on GitHub

#

Then online with Heroku

restive furnace
#

if you answer like that, then you absolutelly will be declined

sacred mountain
#

That’s why I’m asking what I would put

#

...

high bough
#

I dont think you are allowed to host it on GitHub

sacred mountain
#

Rlly?

high bough
#

Its not secure

sacred mountain
#

But all the tutorials I have seen make u do it on github

high bough
#

So you can't say on how you did not secure it

#

But all the tutorials I have seen make u do it on github
@sacred mountain for testing purposes

sacred mountain
#

Great so what do I host it on

high bough
#

A VPS

#

any vps

#

I'm using GCP

sacred mountain
#

What’s a vps

high bough
#

Virtual Private Server

sacred mountain
#

Umm

high bough
#

Google it

sacred mountain
#

Wait what

high bough
#

What what?

sacred mountain
high bough
#

You can host it on github but is likely 90% decline rate

#

You have to make sure its secure

#

And github usually isnt

#

So is glitch

sacred mountain
#

But I don’t even store data

#

That’s the thing

high bough
#

Free stuff are not that secure

#

Your token IS a data

#

And so does databases etc.

#

Also, my bot is randomly giving stupid errors, such as image url is nit a well built url or whatever. And randomly sends my bot's profpic. Hmmm...

#

Its frigging annoying

earnest phoenix
#

If the url was not made correctly by the bot it gives that error... Or you did the code wrong

high bough
#

Code is proper

mossy vine
#

You can host it on github but is likely 90% decline rate
@high bough what no github is not a host wtf

high bough
#

Url is correct

mossy vine
#

honestly if ur getting errors its your codes fault

high bough
#

@high bough what no github is not a host wtf
@mossy vine Open source hosting, yes it is

earnest phoenix
#

@high bough can i see that image CREATE url code?

mossy vine
#

you are just hosting source code, not the actual bot. glitch hosts both

high bough
#

honestly if ur getting errors its your codes fault
@mossy vine The error is the url of the inage is not well built or smlt

#

@high bough can i see that image CREATE url code?
@earnest phoenix Its just my bots profpic url

#

Here's the url

earnest phoenix
#

Hmm what do do to get the bots url?

#

I mean what code do you use?

high bough
#

I mean what code do you use?
@earnest phoenix Manual entry bruh i juat type it in

earnest phoenix
#

It should be <client>.user.displayAvatarURL({ dynamic: true, size: 1024 or 2048, format: 'png' })

high bough
#

As you can see in my screenshot earlier, the other xommands works juat fine

earnest phoenix
#

You can use that... It's better and doesn't give an error

high bough
#

Why am i getting this error on only half of my commands?!

(node:20150) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.author.icon_url: Not a well formed URL.
embed.footer.icon_url: Not a well formed URL.
#

A sec

earnest phoenix
#

Hmm are you using discord.js? @high bough

high bough
#

Yes

earnest phoenix
#

What the

#

What's even icon_url?

sacred mountain
#

@high bough what no github is not a host wtf
@mossy vine u can’t host on github?

mossy vine
#

a bot no

#

source code yes

high bough
#

You can

#

Actually

#

But it will be plain visible to others

earnest phoenix
#

Huh?

high bough
#
Defining avatarURL
var avatarURL = "https://cdn.discordapp.com/avatars/700935897259966474/35fcc2c2911f111d6de5cee702ee0a9d.webp"

//The code of my command file
module.exports = {
  name: "suc", //command name
  async execute(client, message, args, Discord, config, avatarURL, footer, clientname, NL3Embed, DevEmbed) {
   ///Command Starts Here
    if (message.author.id !== config.ownerID) {
      const NLEmbed = new Discord.MessageEmbed()
        .setAuthor(`${clientname}`, `${avatarURL}`)
        .setColor([173, 216, 230])
        .setDescription("Cannot show `Dev-Special` Commands")
        .setFooter(`${footer}`, `${avatarURL}`);
      message.channel.send(NLEmbed);
    } else if (message.author.id === config.ownerID) {
      const embed = new Discord.MessageEmbed()
        .setAuthor(`${clientname}`, `${avatarURL}`)
        .setColor([173, 216, 230])
        .addField(
          "**Unlisted Developer Commands**",
          "`restart`, `readuser`, `listservers`, `addbalance`, `subbalance`, `setactivity`, `resetactivity`, `getowner`, `listserversid`, `eval`, `op`, `deop`"
        )
        .addField(
          "**Unlisted Experimental Commands**",
          "`purge`, `chat`"
        )
        .setFooter(`${footer}`, `https://cdn.discordapp.com/avatars/700935897259966474/35fcc2c2911f111d6de5cee702ee0a9d.webp`);
      message.channel.send(embed);
    }
  }
}
``` @earnest phoenix @mossy vine
#
//The function that calls the commands
try {
      await command.execute(client, message, args, Discord, config, eco, leveling, db, avatarURL, footer, clientname, NL3Embed, DevEmbed, db2).catch(err => console.log(err))
      Profile.findOne({
        userID: message.author.id
      }, async (err, res) => {
        if(err) console.log(err);

        if(!res){
          const newDoc = new Profile({
            userID: message.author.id,
            username: message.author.username
          })
          newDoc.save().catch(err => console.log(err));
        } else {
          if (res.exp >= res.nextexp) {
                res.level = res.level + 1;
            res.exp = 0;
            res.nextlevelexp = res.nextlevelexp + 100;
            res.maxsanity = res.maxsanity + 5;
            res.sanity = res.maxsanity;
            res.maxexpearn = res.maxexpearn + 10;
            res.arccoins = res.arccoins + (res.level * 10000);
            res.arccrystals = res.arccrystals + 10;
            res.daily = res.daily + 5000;
            res.save().catch(err => console.log(err));
            }
          }
      })
    } catch (err) {
      var owner = await client.users.cache.get(`${config.ownerID}`)
      console.log(err);
    }
  }
#

Crap my PC is not responding niw

mossy vine
#

ok can u like stop with the misinformation

#

you do not host a bot on github, only source code

#

and private repos exist

earnest phoenix
#

Literally looking at the code and Wondering what in the fuck is even that...

high bough
#

Yea, thats my f*ing code

#

Please look at it using pc

#

Its indented

earnest phoenix
#

I literally didn't understand a single thing on that code lmao

high bough
#

XD

#

lmao

earnest phoenix
#

Are you doing all that just to show the bot avatar lol?

mossy vine
#

this is very likely the result of someone not knowing what theyre doing

high bough
#

Yes

#

Apparently

#

Crap my PC is crashing

earnest phoenix
#

They know what they're doing but their brain just had a stroke

high bough
#

It looks smlthis on my PC, which is not wanting to connect to my 10KBps internet

earnest phoenix
#

@high bough you can do

dynamic: true,
size: 1024,
format: 'png'
})``` instead of that tho
high bough
#

Umm thats not what im trying to do

earnest phoenix
#

?

high bough
#

What im talking about is the embed is not letting me embed because the var avatarURL apparently is not a well built URL

earnest phoenix
#

I mean

high bough
#

If you get what i mean

earnest phoenix
#

You are trying to show the bot avatar in the footer right?

#

@high bough

high bough
#

Yes

earnest phoenix
#

Then just remove that url you put in there and replace it with the code i gave you
(Replace the <client> with your client name)

high bough
#

Hmm, lemme try

fresh hatch
#

can someone help me make a ping

#

command

#

since none that i tried worked

earnest phoenix
#

Hmm sure

high bough
#

Its everywhere on google

earnest phoenix
#

Lol true

#

@fresh hatch just a simple ping command that responds back with pong or the one that also checks for the bot latency and API katency?

high bough
#

@earnest phoenix I'm still getting this error tho.```js
(node:20150) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.author.icon_url: Not a well formed URL.
embed.footer.icon_url: Not a well formed URL.

earnest phoenix
#

Hmm can i see your current code?

high bough
#

I've always been getting this error.

earnest phoenix
#

@high bough also you need to put that code i gave you in every Footer of your embeds

high bough
#

Yes i did as you can see

earnest phoenix
#

Hmm that's strange...

high bough
#

I have 5 commands, i changed all of them

earnest phoenix
#

Do you have an eval command?

high bough
#

The rest are copy pastes

#

yes i do

#

But i can't op myself, so i can't use it

#

I'm too lazy to change the codes again

spare goblet
#

your editor is so white

high bough
#

Yes, it is.

earnest phoenix
#

(Brighter than the sun itself) @spare goblet

high bough
#

Do you have an eval command?
@earnest phoenix It's an entire code copy from my first project

earnest phoenix
#

Can you give me your bot's avatar url?

#

Imma test on it

earnest phoenix
#

K lemme test that

high bough
#

It works well on half of all of my commands

#

The rest are broken

#

Idk why

#

I was just wondering if it was my 10KBps internet

earnest phoenix
high bough
#

As i said, it works fine for half of my commands

earnest phoenix
#

Hmm... That's strange

#

Idk about that lol

high bough
#

You can see that on the top it works well, but then the others )suc etc. Didnt reapond and gives me a console error

#

Some others just gives the avatar url

#

--WEIRD--

#

Aint it

earnest phoenix
#

Hmm maybe you're putting the url incorrectly on the help command or the ones that doesn't work?

high bough
#

All the urls are the same

earnest phoenix
#

Hmm I mean put it in a correct format like between: '' or "" ``

high bough
#

)support, )invite, works well, but the others screw up.

earnest phoenix
#

Hmm that's kinda strange

high bough
#

And the )op and )deop sends me the avatar URL entirely

#

Hmm

earnest phoenix
#

Hmm STRANGE AT IT'S FINEST

high bough
#

Yes indeed

#

Or maybe its because im hosting 4 bots on the same VPS

earnest phoenix
#

Bruh

sacred mountain
#

i need help

high bough
#

CPU usage is only at 6%

sacred mountain
#

none of my commands work

high bough
#

I mean, duh

earnest phoenix
#

Code please?

sacred mountain
#

me?

earnest phoenix
#

Yea

sacred mountain
#
    if(!message.content.startsWith(PREFIX)) return;
    let args = message.content.substring(PREFIX.length).split(" ")
    let command = args.shift()



    switch(command){


        case 'help':
            message.reply('```AHH! WHY WOULD U WAKE ME UP?? JUST USE c!c <cursedimagetopic> FOR CURSED IMAGES OR c!m <memetopic> FOR A MEME. NOW JUST LEAVE ME ALONE ALRIGHT?!```');
            console.log(message.member + ' used help prompt');
            break;```
#

thats one of the things

#

but none of them work since adding command instead of using args

earnest phoenix
#

Any errors on the console.log?

high bough
#

none of my commands work
@sacred mountain Didn't you have the same issues yesterday?

sacred mountain
#

yes

#

since adding command

#

which is args.split

#

but now it doesnt work

earnest phoenix
#

@sacred mountain any errors?

sacred mountain
#

no

earnest phoenix
#

Hmm

sacred mountain
#

Wait no

#

I fixed a bit

#

It replies but I can’t do a second args

#

It’s in switch(command)

earnest phoenix
#

Also that message.member needs to be changed to message.member.username

high bough
#

I barely understands the code, hmm..

#

If he wants to mention, message.member is fine i think

sacred mountain
#

The problem is that it doesn’t detect a second word

earnest phoenix
#

I mean... It's showing the whole member info... Not just the username @high bough

sacred mountain
#

Args[1] doesn’t do anything now

#

Bc within the function it’s meant to then say what is args[1] but it says undefined

earnest phoenix
#

(my split and args function and stuff)

high bough
#

Smh

earnest phoenix
#

If you use mine then the first args will be => args[0]

high bough
#

Smh

earnest phoenix
#

uhh...

high bough
#

Alright, someone fix my Can't connect to this network error on my PC.

earnest phoenix
#

Hmm Nice i guess...

high bough
#

When you are managing multiple bots on the same VPS at the same time

#

Yeah, gg.

earnest phoenix
#

I LOVE THE SMELL OF MY BURNING PC IN THE MORNING BECAUSE OF ERRORS

quartz kindle
#

i mean, you could simply use a process manager such as PM2 and see logs for all bots in the same session/window

sacred mountain
#

@earnest phoenix I did the stuff in ur code and now I hav the problem I had before

#

All of my bots are broken

#

I rlly need help

quartz kindle
#

show code

earnest phoenix
#

@high bough use google remote desktop

#

@sacred mountain maybe because discord.js update to v12 ?

quartz kindle
#

how u gonna remote desktop a machine with no desktop?

thorny nymph
#

hey guys, is showing discord usernames against tos?
I have a leaderboard in my website, and I have user ids, I am using the API endpoint to get the names of the users and show them in a table based on some ordering

#

nvm got it

winter hawk
#

Does anyone know why my bot's shards keep disconnecting after several hours online?

#

My bot uses 9 shards in a single server

#

I use digital ocean VPS and the RAM is 8gb

quartz kindle
#

do they disconnect and not reconnect?

winter hawk
#

disconnect, not reconnect

#

the error is socket hung up

sacred mountain
#

I’m having trouble with commands

#

I changed it up but still cant get args[1] to work

#

I literally give up

#

I’ve been trying for hours but either it responds to any prefix or it responds to none

quartz kindle
#

i had similar issues with my bot as well, but im using internal sharding, and i made my own workaround for it (monitor shard activity and force inactive shards to reconnect)

#

@sacred mountain show code

sacred mountain
#

One sec

#

This is some of it:

#
    if(!message.content.startsWith(PREFIX)) return;
    let args = message.content.substring(PREFIX.length).split(" ")
    let command = args.shift()



    switch(command){


        case 'help':
            message.reply('```The current commands available are: cc!pingme - pings you, cc!ping, replys with pong, cc!info version - replys with the current version, cc!info release - replys with the current Github release, cc!clean <amount> - cleans the specified amount of messages from that channel. If you need any help/you find a bug/you have a suggestion for the bot, please contact me on either Instagram or Discord (IG - @sacred mountainyt, DISC - SaltySpamz#7828)```')
            break;

        case 'pingme':
            message.reply('pong!');
            console.log(message.member + ' USED \'cc!pingme\' PROMPT')
            break;

        case 'ping':
            message.channel.send('pong!');
            console.log(message.member + ' USED \'cc!ping\' PROMPT')
            break;

        case 'info':
            if(args[1] === 'version'){
                message.channel.send(version + '. ```In this 0. version - ' + addition0 + '. In this 1. version - ' + addition1 + '. In this 2. version - ' + addition2 + '```');
                console.log(message.member + ' USED \'cc!info version\' PROMPT')}
#

but basically if i do switch args[0] it replys to any prefix but if i do switch command it replys to none

quartz kindle
#

args = [a,b,c]
command = args.shift()

command is now a
args is now [b,c]
args[1] is c

sacred mountain
#

oh

#

so then how would i get my bot working

quartz kindle
#

its pretty self explanatory

sacred mountain
#

so

#

that means

#

the new args is c!

#

instead of cc!

#

and command is c

#

so then i shouldnt do command

#

but if i just use args then it will respond to any prefix

quartz kindle
#

if your command is "!info version"
args is [info,version]
command = args.shift()
command is now info
args is now ["version"]

#

so there is no args[1]

#

args[1] is now args[0]

sacred mountain
#

oh

#

so then how would i allow a second word

#

oh

quartz kindle
#

wdym second word?

sacred mountain
#

ohhh

#

wait but then if that does that i can do cc!info version

#

but i cant do a third word

quartz kindle
#

you can

sacred mountain
#

like cc!info version test

#

why bc args is version test

quartz kindle
#

look at what your code does, step by step

#

message.content .substring(PREFIX.length) <-- remove the prefix .split(" ") <-- split on spaces and create an array of words

sacred mountain
#

Oh

winter hawk
#

i had similar issues with my bot as well, but im using internal sharding, and i made my own workaround for it (monitor shard activity and force inactive shards to reconnect)
@quartz kindle thank you

quartz kindle
#

so if you type cc!info bla bla 1 2 3 4 5 your args will be [info,bla,bla,1,2,3,4,5]

sacred mountain
#

Ohh

quartz kindle
#

then when you do args.shift(), the FIRST item of args is REMOVED, and all items are shifted backwards

#

so info is removed from args

earnest phoenix
sacred mountain
#

But I would have to do if args is version test then do something I can’t do if args is version then if args is test

quartz kindle
#

then your args will be [bla,bla,1,2,3,4,5]

#

then args[0] is bla
args[1] is bla
args[2] is 1
args[3] is 2
args[4] is 3
args[5] is 4
args[6] is 5

sacred mountain
#

Oh

#

Ohhhhhhh

earnest phoenix
#

Lmao

sacred mountain
#

So I would do if args[0] is info then...

quartz kindle
#

yes

sacred mountain
#

Ohhhh

quartz kindle
#

no

sacred mountain
#

Thanks so much

#

What

quartz kindle
#

you put info in your command

#

you did args.shift()

#

so you remove the first word from args

sacred mountain
#

Yh

quartz kindle
#

and give it to command

sacred mountain
#

Ohh

quartz kindle
#

so args no longer has info

#

args only has all the rest

sacred mountain
#

So i would do if command is info then...

quartz kindle
#

if command is info and args[0] is version

#

and args[1] is test

sacred mountain
#

Ohhhh

quartz kindle
#

and whatever else

sacred mountain
#

Thankssss

#

👍👍

earnest phoenix
#

@quartz kindle also any idea about my issue up there?

quartz kindle
#

@earnest phoenix can you even have more than one activity at once?

earnest phoenix
#

Hmm custom status and game?

quartz kindle
#

you check for activities[1] which would be a second activity

#

sounds like your IFs are messed up

earnest phoenix
#

I'm doing it because if the user doesn't have a custom status... It would be [0] and if user has a custom status it would be [1]

quartz kindle
#

instead of js if(activities[0].type === 1) {} else if(activities[0].type === 2) {} you're doing ```js
if(activities[0]) {
if(type === 1) {}
} else if(activities[1]) {
if(type === 2) {}
}

#

you should probably check for all types in activites[0] not immediately give up on it

earnest phoenix
#

I mean... I'm checking if they have the [0] or [1] activity...

#

If not just then don't check

#

@quartz kindle is it possible to check for all types in one go?

quartz kindle
#

there are many ways to do that

#

but i still think your IFs are messed up, i cant understand them since broken indentation and small pic

#

looks like youre checking for activities[0] again from inside activities[1] which will only work if activities[0] doesnt exist in the first place?

earnest phoenix
#

@quartz kindle nevermind i fixed it

#

I just removed the if statement for check if the activities[0] existed or not because if the <userfunctionname>.presence.activities.length is true there will 100% there be a activities[0] right?
IQ === 9 MILLION

quartz kindle
#

yes

#

the rest of your code was only being called if activities[0] didnt exist

earnest phoenix
#

Lmao

#

@quartz kindle but there's also a STREAMING type for activities right?

#

hi

#

When is my bot approved?

#

@earnest phoenix in 2-3 weeks

#

oh

#

very long time

#

let me go and have coffee

#

K have fun

#

is link sharing forbidden?

#

@earnest phoenix link sharing on where?

#

here

quartz kindle
#

idk your indentation is still a mess lol

earnest phoenix
#

Lmao

quartz kindle
#

you could also simplify it a bit

earnest phoenix
#

I might try but I'm still confused about why the listening one isn't working

quartz kindle
#

for example, instead of if(activities[1]) else if(activities[0])
you do if((activities[1] || activities[0]).type === "WHATEVER")

earnest phoenix
#

en français :

Bonjour, jaimerai faire une commande comme a!logs on mais je ne sait pas comment faire le on et le off
je peut avoir un script ?

in English :

#

Hello, I would like to place an order like a!logs on but I don't know how to do the on and off
can i have a script?

fleet chasm
#

uhhhh

#

we cant spoonfeed, but we could help with issues you have while making it

quartz kindle
#

to do on/off things per server you need a database to save server settings

earnest phoenix
#

like mongoDB?

quartz kindle
#

yes

earnest phoenix
#

ok

#

how do we do ? I'm just 13 years old so I'm not too strong in js I make an anti-raid bot

still merlin
#

Hey how do you make your bot s game staus
listening for commands
i cant seem to make it say anything but playing in discord js

earnest phoenix
#

uh

#

game = playing

stream = STREAMING

watch = WATCHING

#

listen = LISTENING

#

@still merlin

quartz kindle
#

@earnest phoenix i suggest you look into studying programming, look for online courses, many of them are free

summer torrent
#

read pins

quartz kindle
#

nobody can see your bot until its approved anyway, but self-advertising is still not allowed

earnest phoenix
#

Sorry for the inconvenience

sacred mountain
#

I have a problem. I made a message delete command but whenever you do it, it is meant to send 1 message saying that it was deleted successfully but for some reason it seems to add it on to like a list each time so whenever u do it, it sends a message for every time you have done it. It’s hard to explain but I think I might be missing a break; thing but I don’t know where. If anyone can help me that would be great

#

the code for it is ``` case 'clean':
//message.channel.send('Clean feature is currently disabled. Sorry for any inconvenience. The support server is in the website https://salty-coder.weebly.com')
if(!args[0]) return message.reply('Please specify how many messages')
else{
message.reply('Are you sure you want to delete ' + args[0] + ' messages? (Y/N)')
bot.on('message', message=>{
if(message.content === 'Y'){
message.channel.bulkDelete(args[0])
console.log('Successful deletion of ' + args[0] + ' messages');
message.reply('Successfully deleted ' + args[0] + ' messages!');};

                if(message.content == 'N'){
                    message.reply('The action has been cancelled!');
                    console.log('Successful cancellation of ' + args[0] + ' messages')};```
#

And it seems it does more than how much I specify

quartz kindle
#

didnt i tell you to remove this

#

because it would destroy your bot

#

thats precisely why

earnest phoenix
#
const Discord = require('discord.js')
const fetch = require('node-fetch');

module.exports = async(message,args) => {
    let countries = args[0];// Your/someone countries prefix.
    fetch(`https://covid19.mathdro.id/api/countries/${countries}`).then(response => response.json())
    .then(data => {
      let confirmed = data.confirmed.value.toLocaleString() 
      let recovered = data.recovered.value.toLocaleString() 
      let deaths = data.deaths.value.toLocaleString() 
      // Add .toLocaleString() to separate 3 numbers into commas.
      
      const embed = new Discord.MessageEmbed()
      .setColor(0x7289DA) // Blurple.
      .addField(`Country: ${countries}`, `Confirmed: **${confirmed}** \nRecovered: **${recovered}** \nDeaths: **${deaths}**`)
      .setTimestamp()
      
      message.channel.send(embed);
      // Let's test it out!
    })
  }```
#

i dont know whats wrong

sacred mountain
#

@quartz kindle I can’t just delete that whole section

#

Then the function will do nothing

quartz kindle
#

you should delete that whole section, because thats not how you do things

#

i already told you how to await for messages

west spoke
#

my eyes tim

sacred mountain
#

I still don’t understand tho bc that is filter and options but how do u wait for a message

quartz kindle
#

@sacred mountain you're adding an event inside an event, that will lead to infinite event creation, because events last forever (unless you manually destroy them) and are global, affected by everything

golden condor
#

Does anyone know anyway to access a local host mongo db on mongo compass on another pc

quartz kindle
#

so every time you run a command, you will have a new event listener processing ALL bot messages

#

you run the command 5 times, and you have 5 event listeners processing ALL bot messages

west spoke
#

They stack up

rustic mica
#

is there a way to let a bot know if the author of the command is on a certain server?

west spoke
#

a lot

#

Yes

golden condor
#

@rustic mica message.guild

west spoke
#

just use an if statement

rustic mica
#

thanks

golden condor
sacred mountain
#

@quartz kindle then how would I re write it

#

Bc I don’t understand that thing u sent

quartz kindle
#

you should use awaitMessages as i said

golden condor
#

Does anyone know anyway to access a local host mongo db on mongo compass on another pc
I really need this

quartz kindle
#

what is it about it that you dont understand?

west spoke
#

@sacred mountain by looking at the docs, and see what Tim just said

sacred mountain
#

But how do u specify the message you are waiting for

west spoke
#

store the id

sacred mountain
#

What

#

I’m still rlly confused

west spoke
#

what do you think I said

golden condor
#

@sacred mountain by using a filter

#

Lemme give an example

sacred mountain
#

I hav no idea what a filter is

quartz kindle
#

you specify what you're waiting for in the filter

golden condor
#

you do this

quartz kindle
#

a filter is a function

#

like this

#

message => message.content === "Y" || message.content === "N"

golden condor
west spoke
#

Cxllm

golden condor
#

yep

sacred mountain
#

But that doesn’t specify the message u are waiting for

west spoke
#

das a spoonfeed

golden condor
#

how is it?

#

I gave an example

west spoke
#

oh my god

#

nevermind

#

I take that back

quartz kindle
#

this specifies the message you are waiting for

west spoke
#

because they didn't pay any attention to we say

sacred mountain
#

But how would I write it tho

west spoke
#

oh my god

golden condor
#

Like what it says in the picture??

west spoke
#

we literally..

sacred mountain
#

But I want to have something to happen for Y and something to happen for N

golden condor
#

Does anyone know anyway to access a local host mongo db on mongo compass on another pc
Is there a mongo command that I have to run or what

west spoke
#

ok I'ma slip before i snap and become a demon, and proceed to get muted for a month HachFacePalm

#

@sacred mountain you check with a second if statement

#

that's just to make sure "anything after this, yeah process it."

#

otherwise it skips into your else statement

golden condor
#

@sacred mountain define the result with const blabla and say if(blabla == ???) {}

quartz kindle
#
message.channel.send()
message.channel.awaitMessages(response => response.content === "Y" || response.content === "N", { max:1, time:30000 }).then(answers => {
  if(answers.first().content === "Y") { answer was Y }
})
``` @sacred mountain
west spoke
#

tim

golden condor
#

Don't

#

Say

#

It

#

we all know

west spoke
#

whY

sacred mountain
#

but where do i write what happens if it is y

west spoke
#

make the human struggle a bi--

#

ok I'm leaving

#

this is too much

quartz kindle
golden condor
#

LMFAO

sacred mountain
#

do i write the finction in that

west spoke
#

Y E S

golden condor
#

Write what you want to happen in that

sacred mountain
#

okkkk

golden condor
#

oml

sacred mountain
#

please chill

#

im new to this

west spoke
#

please learn JavaScript

#

now

sacred mountain
#

u cant expect me to be a genius

west spoke
#

before coding a bot learn the language

sacred mountain
#

now just leave me alone

golden condor
#

How can you connect to a localhost mongodb from another pc

quartz kindle
#

@golden condor using the computer's ip address and port

golden condor
#

I tried

quartz kindle
#

and port forwarding in the router

golden condor
#

It times out

quartz kindle
#

you need to unblock it in your router then

golden condor
#

so port 27017 needs to be forwarder

#

?

quartz kindle
#

yes

golden condor
#

kk

#

thx

earnest phoenix
#

Does anybody have any idea about why
<useridentificationname>.presence.activities[0].state if it's a custom status and it only has an emoji... It says null?

quartz kindle
#

custom status emojis are stored elsewhere i believe

earnest phoenix
#

Hmm where is it stored?

quartz kindle
earnest phoenix
#

Hmm... activities[0].emoji?

#

Or it's somewhere else?

golden condor
#

probably the first one

quartz kindle
#

yes

golden condor
#

so I need to forward my mongodb port got it

earnest phoenix
#

How's it possible to make a function that gives the bot a special role for itself upon joining a guild? (Just like dank memer or
Other popular bots)

quartz kindle
#

you dont need to do that, discord does it automatically if you specify the required permissions in the invite link

earnest phoenix
#

Hmm oh nice

ruby talon
#

Hey so I got an array of allowed prefixes, this includes the mentions ect. Yet it only responds to non mention prefixes.
Some information:
Library: discord.py - v1.3.3
Image:

#

@ me if you have a solution for this.

slender thistle
#

<@!>

hazy musk
#
code blocks don't look the same
#

neither do these

slender thistle
hazy musk
#

huh?

#

do code blocks just look like that in embeds?

earnest phoenix
#

yes

#

to improve readability

#

since embed backgrounds are darker

hazy musk
#

tysm

past marsh
#

Wher I advertise

earnest phoenix
#

nowhere

#

You don't

past marsh
#

Oof

earnest phoenix
#
if(command === "reset") {
  await message.guild.fetchMembers().forEach(member => {
    coins.set(`${message.guild.id}.${member.id}`, 0)
  })
}```
#
(node:4516) UnhandledPromiseRejectionWarning: TypeError: message.guild.fetchMembers(...).forEach is not a function
warm marsh
#

version?

earnest phoenix
#

v11

warm marsh
#
let members = await message.guild.fetchMembers();
    members.forEach((member) => /* ... */);
earnest phoenix
#
if(command === "reset") {
  let members = await message.guild.fetchMembers();
  members.forEach((member => {
    coins.set(`${message.guild.id}.${member.id}`, 0)
  }))
}```
#
(node:5029) UnhandledPromiseRejectionWarning: TypeError: members.forEach is not a function
warm marsh
#

Nvm.

#
let members = await ...
    members.array().forEach(() => ...);
earnest phoenix
#
if(command === "reset") {
  let members = await message.guild.fetchMembers();
  members.array().forEach((member => {
    coins.set(`${message.guild.id}.${member.id}`, 0)
  }))
}```
#
(node:5218) UnhandledPromiseRejectionWarning: TypeError: members.array is not a function
#

lmao

warm marsh
#

Are you sure you're on V11?

earnest phoenix
#

YES

warm marsh
#

Is the command being called in dms?

earnest phoenix
#

no

#

why would it

warm marsh
#

Idk.

#

Just to narrow down options.

#

message.guild doesn't seem to store anything.

earnest phoenix
#

but i want to get all members and set their coins

#

i dont get why its not working

#

It does, i believe, otherwise it would give you an undefined error

#

It seems to be defined

#

but i am in the server?

warm marsh
#

But it's missing methods.

earnest phoenix
#

Right.

#

what do you think i should do then ?

warm marsh
#

Otherwise fetchMembers would return Promise<Collection>

#

console.log message.guild?

earnest phoenix
#

a lot of stuff

#

send it all ?

#

i guess no

warm marsh
#

No.

earnest phoenix
#
   Collection {
     '336885192490745858' => GuildMember {
#

this is the guild member part

sudden geyser
#

fetchMembers in v11 returns the guild.

#

Not a collection.

earnest phoenix
#

so how can i get all members ?

warm marsh
#

Ah shit, I was looking at the wrong thing lol.

sudden geyser
#

Once you've got the guild, check the guild members collection.

earnest phoenix
#

no idea how to

sudden geyser
earnest phoenix
#

oh use fetchMembers?

sudden geyser
#

well you've been using that

#

At least what I'd assume

warm marsh
#

message.guild.members.array().forEach()

earnest phoenix
#

worked!

#

thank you
i got it now

sudden geyser
#

you don't have to turn it into an array btw

warm marsh
#

Collections didn't include forEach in V11.

#

iirc

sudden geyser
#

it extends map

#

so it has forEach

earnest phoenix
#

oh and btw
how can i check if a db table includes a user id ?

warm marsh
#

What are you using to interact with said db?

earnest phoenix
#

quick.db

warm marsh
#

Idk, you can check the docs see if any of the methods help.

earnest phoenix
#

tried it already, cant find anything

sudden geyser
#

I'd assume it'd be <db>.has

earnest phoenix
#

tried that too

warm marsh
#

How's your database laid out?

earnest phoenix
#

wdym

warm marsh
#

How does data get stored in each "table"?

mossy vine
#

i dont think quick.db does that

earnest phoenix
#

its just being stored ?

#

json.sqlite

warm marsh
#

quick.db stores in an sqlite3 database.

mossy vine
#

i mean, quick.db doesnt provide an interface for database planning afaik

warm marsh
#

I mean. name.identifier

#

Or do you store it some other way?

earnest phoenix
#

let level = new db.table("level")

#

did you mean that?

#

i have no idea what you talking about

warm marsh
#

level.all().find(entry => entry.id == id)?

sudden geyser
#

kind of slow

warm marsh
#

Then use level.has(id)

earnest phoenix
#

but how can i use if on it
so if he is in the db it will return

#

again, it didnt work

Then use level.has(id)
@warm marsh

warm marsh
#

level.set(id, data)?

earnest phoenix
#

yeah

#

thats how it goes

warm marsh
#

Then .has returns true or false.

earnest phoenix
#

but it says its not a function

#
if(blockedusers.has(message.author.id)) return message.channel.send(notallowed)```
#

the db table name is blockedusers btw

warm marsh
#

try console logging blockedusers

earnest phoenix
#
table {
  name: 'blockedusers',
  fetch: [Function],
  set: [Function],
  delete: [Function],
  push: [Function],
  add: [Function],
  subtract: [Function],
  fetchAll: [Function],
  startsWith: [Function] }
warm marsh
#

You're using an older version of quick.db?

earnest phoenix
#

6.3.2

#

is it old ?

warm marsh
#

Yeah

#

7.1.1 is latest

earnest phoenix
#

if i update will i need to change my whole code ?

warm marsh
#

Probably not.

earnest phoenix
#

should i then ?

warm marsh
#

Yes.

earnest phoenix
#

npm install quick.db ?

#

or just change it on package json

warm marsh
#

You'll still need to run npm

earnest phoenix
#

i will do both then

#

ok i installed it

warm marsh
#

Now .has should work

earnest phoenix
#
if(command === "blockuser") {
    let user = client.users.get(args[0])
    blockedusers.add(user)
  }```
#

this command is supposed to add them to the db

#

but it doesnt seem to work

warm marsh
#

console.log

earnest phoenix
#

what

#

(node:8423) UnhandledPromiseRejectionWarning: TypeError: Must specify value to add. Need Help? Check Out:

split hazel
#

I'm guessing that's quick.db

earnest phoenix
#

i console.log(user) and it got me

#

so yeah

split hazel
#

But the error is pretty self explanatory

earnest phoenix
#

i need to add a value tho

split hazel
#

The value you're providing is undefined

#

Can we see some code?

copper cradle
#

why are you adding an entire object?

sudden geyser
#

^ was about to say that

earnest phoenix
#

oh right

ruby talon
#

Hey, I'm trying to create the same mention thing as from last post.
I used the commands.when_mentioned_or() wich works.
I took a look at the array that it posted and used exactly the same for other code.
But it doesn't work...
My code:

main = 699693525104590889
prefixes = [f'<@!{main}>', f'<@!{main}> ', f'<@{main}>', f'<@{main}>']

def get_bot_prefix(bot, message):
    prefix = "!"  # Actually fetches it from a db as a string 2.
                  # but to prevent confusion lets place it here as a string.
    return [prefix, *prefixes]

And called it using: command_prefix=get_bot_prefix
(Lib is discord.py)
Yet it doesn't function:

earnest phoenix
#
if(command === "blockuser") {
    let userid = args[0]
    blockedusers.add(userid)
  }```
#

i tried that

#

but same error

warm marsh
#

add(key, value)

earnest phoenix
#

what should i use as a key ?

warm marsh
#

id

earnest phoenix
#

and value ?

#

i just need it to be in the db

warm marsh
#

true false?

#

anything that isn't undefined.

earnest phoenix
#

oh

#

so just somthing so it will be there

split hazel
#

just anything really

#

true mostly

earnest phoenix
#

well it worked

#

tysm

split hazel
#

so you can run something like if (blocked)

earnest phoenix
#

i already did

#

on the other command

#

tysm guys
@warm marsh ❤️

warm marsh
#

have you tried doing <@!id>

#

nvm

slender thistle
quartz kindle
#

check if the message is received as @late thunderhelp or @shrewd breach help

#

not sure if discord automatically puts a space after a mention

slender thistle
#

You could use when_mentioned_or

earnest phoenix
#
(node:12176) UnhandledPromiseRejectionWarning: TypeError: Cannot target a non-object.

since i updated my quick db im getting this error on a very specific code

#
client.on("message", async (message) => {
    if(message.channel.type === "dm") return;
    let userwarns = await warns.fetch(`${message.guild.id}.${message.author.id}`)
if(!userwarns) userwarns = 0
    if(userwarns > 1000000000000) userwarns = 1000000000000
    warns.set(`${message.guild.id}.${message.author.id}`, userwarns)
  })```
warm marsh
#

fetch doesn't exist anymore.

#

read the docs again.

earnest phoenix
#

what is the new fetch ?

#

get ?

warm marsh
#

try it and see

copper cradle
#

that's not the prblem there

quartz kindle
#

fetch does exist

#

but does the same thing as get

earnest phoenix
#

wait so what is the problem ?

copper cradle
#

if it didn't exist the error would be a reference error

warm marsh
#

Ah it's not documented in their "docs"

quartz kindle
#

their docs have always been bad

earnest phoenix
#

so why do i get an error
when i use get i dont get error

#

their docs have always been bad
right tho

warm marsh
#

Did they always have docs?

#

As when I last used quick.db I had to use the console to figure everything out.

earnest phoenix
#

they did have, but not helpful

#

so why do i get an error
when i use get i dont get error

#

what is the problem with the code then ?

split hazel
#

also you don't need await since it uses better-sqlite3 and is sync

quartz kindle
#

sounds like the database structure is invalid, try deleting that value and setting it again

earnest phoenix
#

the warns ?

quartz kindle
#

yes

earnest phoenix
#

um

#

like delete it from the db ?

quartz kindle
#

yes

earnest phoenix
#

why did it not work tho ?

quartz kindle
#

the data in it got corrupted somehow

earnest phoenix
#

well

quartz kindle
#

quick.db works by storing json objects in sqlite, whenever you set something, it checks if the existing value is a json object (as all values should be)

#

for some reason your's wasnt

#

hence why the error

earnest phoenix
#

i probably did somthing wrong without noticing

#

well, thanks Tim!
atleast its working

vagrant root
#

is that work if no can some1 give me example to do it

$.ajax({
    method: 'POST',
    url: `https://top.gg/api/bots/${client.user.id}/stats`,
    data: {
        server_count: client.guilds.cache.size
    },
    headers: {
        authorization: 'toe_ken'
    }
});

note i want to display my bot servers count in a webpage

quartz kindle
#

you probably need to add to headers: content-type: "application/json"

heavy anchor
#

${msg.id} gets the message id, is there a way to get the message link?

split hazel
#

msg.url

#

@heavy anchor

heavy anchor
#

ok thx

fallow quiver
#

Threading and Such is something I've never really touched, and JS even less so I need help with an A-Sync function. Basically it uses axios to grab a Dad-Joke from a website, but I have to call the pull request before the command is called, which causes issues in that you can't specify joke types, and it looks un-neat. Is there a way to call the a-sync function, and then wait until it is finished to send the joke.

#

something like:

message.channel.send(":load_emoji:")
joke = fetchJoke(joke_type);
message.edit(`${joke[0]} ||${joke[1]}||`);
static sable
#

in an async function you can await async function calls

fallow quiver
#

Does It Go In the function or the function call?

static sable
#
async function doIt(){
  message.channel.send(":load_emoji:")
  await joke = fetchJoke(joke_type);
  message.edit(`${joke[0]} ||${joke[1]}||`);
}
fallow quiver
#

Ah

#

That simple

static sable
#

you can only use await in an async function body

#

that's why doIt should be async

fallow quiver
#

Ok

static sable
#

have fun!

fallow quiver
#

thanks

heavy anchor
#

One more dumb question how do you have the Bot mention a user/role without pinging them?

fallow quiver
#

message.author.username will get the name

#

instead of a mention

#

Most things that you can "mention" in discord contain a name object

#

message.channel => message.channel.name

#

Is that what you were asking?

static sable
#

which library do you use?

heavy anchor
#

discord.js

fallow quiver
#

🤦‍♂️ I don't know why I assumed discord.js

heavy anchor
#

lol

fallow quiver
#

Even though this is a console.log() this will get their name without pinging them. If you want to mention them without ping I'm not sure that is a thing

.then(msg => console.log(`caught ${badWords[i]} fromJ ${message.author.username}, ${message.author.id}`))
earnest phoenix
#

Embed

#

@heavy anchor You mean like thi-- ^^

#

You can mention ppl in an embed without them getting a pong

heavy anchor
#

I'm trying to find an example I've seen a bot that does it

fallow quiver
#

I did not know that

earnest phoenix
#

Even mentioning roles or even @everyone in an embed doesnt ping

heavy anchor
#

ok yes it was in an embed

fallow quiver
#

Does \@ mention work like it used too?

earnest phoenix
#

yep

fallow quiver
#

@Dr.Freeman
#8219

earnest phoenix
#

you can click on the popout and it shows the roles etc

#

but the person doesnt get notified

fallow quiver
#

Interesting

heavy anchor
#

@heavy anchor

earnest phoenix
#

ah yes

#

escaped mention

fallow quiver
#

This is a weird issue that I may as well ask while I'm here

#

I say "weird" but it's more me being an idiot

earnest phoenix
#

go on

fallow quiver
#

I have a "serverConfig.json" file which will contain the settings for each server

earnest phoenix
#

(3gb file incoming) go on

fallow quiver
#

But if I say something like:

client.config[message.guild.id] = {
                "prefix": n_prefix
            }
            fs.writeFile("./serverConfig.json", JSON.stringify(client.config, null, 4), err => {
                if(err) {
                    console.log(`Prefix update failed`);
                    message.channel.send("Error, couldn't set prefix")
                    throw err;
                }else {
                    console.log(`Updated Prefix for ${message.guild.name}, ${message.guild.id} from ${prefix} => ${n_prefix}`)
                    message.channel.send(`Successfully updated prefix for this server to ${n_prefix}`)
                }
            });
#

It deletes everything else in that servers config

pale vessel
#

why are you using json to begin with

earnest phoenix
#

^

#

quick.db, mongodb

fallow quiver
#

I'm not very familiar with Databases. Is it easy to learn

mossy vine
#

yes

earnest phoenix
#

i just took a look at the pokecord site

#

i mean they have a better site ofc because they can use js

#

but still

#

damn

mossy vine
#

im pretty sure its all css

fallow quiver
#

This is the best I can even do HTML/CSS wise

mossy vine
#

ah nvm its not all css

#

there is js for the moving images

earnest phoenix
#

yep

#

they have to detect how far you've scrolled to show the images at the right time

unique nimbus
#

@mossy vine CSS does have animations

#

However for it go down when you scroll down that is most likely JS

mossy vine
#

@unique nimbus im 90% sure that is possible with html and css but looking at source it includes js

pale vessel
#

that's not possible without js

earnest phoenix
#

question how do i make it where the user and bot have to be in the same channel is it
if(!message.client.voice.channel === message.member.voice.channel) is that how its supposed to be

pale vessel
#

that's the bot in the message guild

earnest phoenix
#

ahhhh kk thx

#

const Discord = require('discord.js');

#

oops

#

oh well ill put my question after it i guess im not used to discord pc

#

im getting an error saying something is wrong with that line whenever i try to open index.js. The error looks like this: Line: 1 Char: 1 Error: Syntax error code: 800A03EA Source: Microsoft JScript compilation error

mossy vine
#

dont run the file by double clicking

earnest phoenix
#

still happens when i right click and press open if that answer was directed at me. Sorry if you were answering someone else

mossy vine
#

i was answering you yes

#

that is not how you should run it

#

open cmd or powershell, cd into your bots directory, and run the file with node

pale vessel
#

smh

earnest phoenix
#

what i find strange about it is that whenever i open visual code studio it opens automatically and thats fine. That error only comes up for my index.js but not package-json etc. And whenever i type "node ." into my terminal it just doesnt respond. No error or message saying my bot is online

mossy vine
#

do you have a main file specified in your package.json

earnest phoenix
#

yes i think i do. I wrote the package-json using CMD

#

so when i opened it in Visual Code studio all the code for that file was already written

mossy vine
#

also yes of course it only comes up on index.js and not package.json omegalul json is not something you run

#

can you show the file

#

(plus you can always just use node index.js)

earnest phoenix
#

how much of it? because its about 120 lines

mossy vine
#

the package.json is 120 lines?

earnest phoenix
#

ill show the first 20 or so with the token crossed out with X's

#

no no

#

sorry i thought you were talking about my index

mossy vine
#

i wasnt lol

finite bough
#

what error do u get

mossy vine
#

it was shown above

earnest phoenix
#

{
"name": "discord-bot",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"author": "Ozone",
"license": "ISC",
"dependencies": {
"discord.js": "^12.1.1",
"dotenv": "^8.2.0",
"ms": "^2.1.2"
}
}

mossy vine
#

huh there is a main file specified thats weird idk just use node index.js then

earnest phoenix
#

i also have Package-Lock.json

pale vessel
#

you need some serious programming course

mossy vine
#

this

quartz kindle
#

json is a configuration file that contains basic information about your project. you can open it in any text editor or by double clicking to see its contents
js is the actual code file, you can open it as text to view the code, to but actually execute the code you have to run in with node. microsoft jscript has nothing to do with javascript, its just the default program that windows tries to open js files with, because js files are also used in JScript which is a .net related language, not the javascript that node works with

mossy vine
#

because js files are also used in JScript which is a .net related language
TIL

earnest phoenix
#

Should i try to salvage my bot or just start over? Because the error says its the first character of my first line of the index file. But then if i start over, it might happen again since im new to discord.js

mossy vine
#

read what tim said

#

and just run node index.js

earnest phoenix
#

oh you mean "npm run index.js"? I've tried that and it comes up with an error

mossy vine
#

no

#

node index.js

earnest phoenix
#

ill try that one but it might not work

mossy vine
#

npm run is a different thing, you can specify different scripts in your package.json to run and run them wiht npm run

earnest phoenix
#

PS C:\Users\Laptop\Desktop\discord bot> node index.js

#

it came up with nothing after it

#

no error or "The bot is online" message

mossy vine
#

did it just stop

earnest phoenix
#

which is what confuses me because at least an error would direct me as to whats wrong

mossy vine
#

do you have bot.

#

bot.login or client.login

earnest phoenix
#

Do you have nodejs installed?

pale vessel
#

lmao

earnest phoenix
#

yes

pale vessel
#

the real question

quartz kindle
#

when you do node index.js, does it return to C:\Users\Laptop\Desktop\discord bot> or does it show an empty line?

mossy vine
#

yes otherwise that wouldnt be an issue omegalul

earnest phoenix
#

it just doesn't respond

quartz kindle
#

so an empty line?

pale vessel
#

then the client isn't ready then?

quartz kindle
#

and when you press ctrl+C then it returns to C:\Users\Laptop\Desktop\discord bot> ?

mossy vine
#

@earnest phoenix off topic but i think your status just gave me a stroke

earnest phoenix
#

Every is saying something random

#

Lol

#

bot.login(token);

#

i have my token typed out above correctly so i dont think thats whats wrong

wheat jolt
#

how can I "await" a foreach

#

I mean, console.log something after a foreach

quartz kindle
#

@earnest phoenix can you answer my questions? because what you are describing sounds exactly like what happens when your file is properly running

mossy vine
#

you can promisify it but there is a 90% chance you can do it in another way

wheat jolt
#

I know that

quartz kindle
#

which means everything is fine, and the problem is your code

pale vessel
#

show code

earnest phoenix
#

@quartz kindle i think the problem is the code. I think somewhere in my code is just crashing the bot

mossy vine
#

you can just add the console.log after it??

wheat jolt
#

nope

quartz kindle
#

@earnest phoenix its not crashing, if it was crashing, it would show in the powershell

mossy vine
#

then what do you want to do lmao

quartz kindle
#

if its not outputting anything, it means its working correctly, you just didnt code anything in it to output anything

earnest phoenix
#

@quartz kindle maybe its the code for the message saying "the bot is online" thats not working??? Ill go check if my bot is online

quartz kindle
#

cant help if you dont show your code

earnest phoenix
#

its not online. Sorry if this clutters the chat, ill just paste the code in without my token

pale vessel
#

use that

earnest phoenix
#

ill make an account on it, paste all the code in then link it

pale vessel
#

you don't need an account

quartz kindle
#

it doesnt need an account lol

ripe lantern
#

how do i remove my bot from botghost?

mossy vine
#

reset your token ig

ripe lantern
#

oh

#

lol

#

and ill change the token in the code

earnest phoenix
#

oh i mistook for paste bin sorry

#

but ive got it all ready now

#

i took screenshots so i wont clutter the chat (I used the snipping tool so they're not low quality hopefully)

wheat jolt
#

then what do you want to do lmao
@mossy vine I have to download some files at the same time, so they're downloader.

pale vessel
#

could've used hastebin

earnest phoenix
warm marsh
#

You uploaded to pastebin

#

...

#

Click save and send the link

earnest phoenix
pale vessel
#

can you link the hastebin?