#development

1 messages · Page 324 of 1

earnest phoenix
#

oops

#

Same

#
const game = new Discord.MessageCollector(message.channel, m => m.author.id === message.author.id, { time: 1000 })
        game.on("end", (Collection, reason) => {
            if (game.options({time: 0})) {
                reason = "Test"
            }
            message.channel.send(reason)
        })
            if (game.options({time: 0})) {
                     ^

TypeError: game.options is not a function

Where am I going wrong here?

vital lark
#

.options isn't a function.

earnest phoenix
#

Ronin

#

can u approve bots?

#

I see that. I don't get how to do such a thing lol

vital lark
#

@earnest phoenix bitch I am not the real Ronin

#

@karmic parcel is the real Ronin

earnest phoenix
#

...

#

ik...

#

i was just asking..

vital lark
earnest phoenix
#

He isn't even a Staff member

vital lark
#

FUCk

earnest phoenix
#

Good job

#

how can I cause a notification for myself through a selfbot?

vital lark
#

ask the @earnest phoenix

earnest phoenix
#

How can I mention myself and ping meself
strongthink
jk

#

@earnest phoenix I made some improvements to the selfbot if you want it...

#

wat did u do

#

if you click the notification it will open the server

#

o

vital lark
earnest phoenix
#

I'll send it to you one sec

#

not sure how I can make it notify me in discord yet...

#

There probably is a way but I don't know if anyone has done it yet strongthink

#

loli

#

loli

#

yay

#

cool

topaz fjord
#

how would i make it so my clever bot only responds when its mentioned

#
bot.on("message", async message => {
    if(message.author.bot) return; 
    if(message.channel.type === "dm") {
    clbot.write(message.content, (response) => {
      message.channel.startTyping();
      setTimeout(() => {
        message.channel.send({embed:{
            title: response.output,
            color: 654456
        }}).catch(console.error);
        message.channel.stopTyping();
      }, Math.random() * (1 - 3) + 1 * 1000);
    });
    }
})
earnest phoenix
topaz fjord
#

if this pm2 doesnt install imma

#

😦 🔫

earnest phoenix
#

Or without id. Using .author

topaz fjord
#

at least it worked after half an hour of fucking up

vital lark
#

@topaz fjord npm i pm2 -g

topaz fjord
#

it worked

vital lark
#

🍰

silver juniper
#

Hi

keen anvil
#

is there a jimp method for changing the z index? I can't seem to find one.

low niche
#

i'm getting this memey error:

(node:11460) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: undefined is not a function
(node:11460) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Nod
e.js process with a non-zero exit code.

from this code

const ytdl = require('ytdl-core')
exports.run = async (bot, message, args) => {
    const vc = message.member.voiceChannel;
    if(!vc) return message.channel.send("You have to be in a voice channel to play music!");
    const perms = vc.permissionsFor(message.client.user);
    if(!perms.has('CONNECT')) {
        return message.channel.send("I can\'t connect to your voice channel, might need to edit my permissions!");
    }
    if (!perms.has('SPEAK')) {
        return message.channel.send("I\' suppressed here, make sure I get the right perms!");
    }

    try {
        var connection = await vc.join();
    } catch(error) {
        console.error(`I couldn\'t join the voice channel: ${error}`);
        return message.channel.send("I couldn\'t join the voice channel!")
    }
    const dispatcher = connection.playStream(ytdl(args.join(" ")))
        .on('end', () => {
            console.log("Playback ended.");
            vc.leave();
        })
        .on('error', error => {
            console.error(error);
        });
    dispatcher.setVolumeLogarithmic(5 / 5);    
}
earnest phoenix
#

@low niche What does the code do

low niche
#

Plays music

earnest phoenix
#

With user input?

low niche
#

the play command

#

ppplay [youtube-link]

earnest phoenix
#

I believe it might be the User Input that's 'undefined'

low niche
#

i used a YouTube link

#

To test

#

Returned that

earnest phoenix
#

Returned what?

low niche
#

The error

earnest phoenix
#

Thought so

earnest phoenix
#
game.on('collect', message => {
            if (message.content.toLowerCase() === "redeemables" || message.content.toLowerCase() === "r") {
                start = "redeem"
                game.stop()
            } 
        });
if (start === "redeem") {
            message.channel.send("yep")
        }

Does the collector continue the code after it ends? For me it doesn't and I don't know if it's because I'm doing something wrong

languid dragon
#

async await works fine with my local version but whenever i upload to linux and try run my app there i get this

#

any fixes or workarounds that dont require me rewriting my entire code adding extra brackets?

tawny lava
#

node is probably outdated on your server Thonk

languid dragon
#

hmm

low niche
#

but how is async correct?

languid dragon
#

fuck knows

#

fixed it

tawny lava
#

nice

languid dragon
#

i updated it properly 😉

earnest phoenix
#

😉

low niche
#

@earnest phoenix so, what was the answer to my previous question?

earnest phoenix
#

¯_(ツ)_/¯

#

I don't have a Music Player so I wouldn't really know. I just figure it could be user input

#

Doing it

karmic parcel
#

@languid dragon what version of node are you running on them?

languid dragon
#

is fixed 👀 i was running some super outdated crap

karmic parcel
#

Lol sounded like it

languid dragon
#

yeah lmfao, noob me forgot to update it 👀

#

thanks anyway x

karmic parcel
#

Mhmm

solemn oyster
#

Hey people

#

The website shows my bot is offline

#

Do i need to POST the status too?

tawny lava
#

no luca is just broken

solemn oyster
#

lol

#

install uws

vital lark
#

@low niche Use my code pls

#

uws all the fucking way <3

tawny lava
#

Why does it even happen anyways

#

Still don't understand the error

vital lark
#

¯_(ツ)_/¯

solemn oyster
#

neither do the devs

tawny lava
#

Hmm

#

Any idea on how to recreate it?

vital lark
#

¯_(ツ)_/¯

tawny lava
#

Hmm

shrewd field
#

hey i get an error for that says await is reserved.
the code:

if(message.content.startsWith(prefix + "ping")) {
  
    const m = await message.channel.send("Ping?");
    m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(client.ping)}ms`);
  }
#

can someone help plz

tawny lava
#

It needs to be in an async function

bitter sundial
#

await has to be inside an async function

vital lark
#
bot.on('message', async(message) => {
    if (message.content.startsWith(prefix + "ping")) {
       await message.channel.send("Ping?").then(m => m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API latency is ${Math.trunc(client.ping)}ms!`));
   }
});
bitter sundial
#

but

#

why are you awaiting

#

if you have the then there

#

@vital lark

uncut slate
#

@vital lark that doesn't make alot of sense

vital lark
tawny lava
#

I agree

prime cliff
#

await tonkku.nudes()

radiant plover
#

i think it threw a timeout exception

shrewd field
#

so

#

is the code above correct

#

from @vital lark

vital lark
#

if its wrong

#

¯_(ツ)_/¯t

#

I don't use async/awai

shrewd field
#

what do u mean

#

wrong or right'

vital lark
#

¯_(ツ)_/¯

shrewd field
#

what does that mean

abstract mango
#

you don't know what a shrug means?

fluid fable
#

-help

#

-bots @fluid fable

gilded plankBOT
#
GamerCodes#0257
Bots

@timid bolt

fluid fable
#

-botinfo @timid bolt

gilded plankBOT
#
Bot info
ID

338030057010364419

Username

HydroBot

Discriminator

8735

Short Description

Hello, Meet HydroBot

Library

discord.js

Prefix

h!

Upvotes

2

Server Count

No server count

Owner(s)

@fluid fable
@dull oxide
@verbal root
@verbal root

Links
umbral pelican
#

smh

low niche
#

i'm getting this error:

TypeError: undefined is not a function
    at Map.forEach (native)
    at Client.bot.on (c:\Users\no-username-here\Stuff\PowerPlug\bot.js:33:35)
    at emitOne (events.js:115:13)
    at Client.emit (events.js:210:7)
    at MessageCreateHandler.handle (c:\Users\no-username-here\Stuff\PowerPlug\node_modules\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (c:\Users\no-username-here\Stuff\PowerPlug\node_modules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:102:65)
    at WebSocketConnection.onPacket (c:\Users\no-username-here\Stuff\PowerPlug\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:325:35)
    at WebSocketConnection.onMessage (c:\Users\no-username-here\Stuff\PowerPlug\node_modules\discord.js\src\client\websocket\WebSocketConnection.js:288:17)
    at WebSocket.onMessage (c:\Users\no-username-here\Stuff\PowerPlug\node_modules\ws\lib\EventTarget.js:103:16)
    at emitTwo (events.js:125:13)

from this code: https://hastebin.com/dasihekofa.js

heady zinc
#

basically

#

undefined is not a function

#

¯_(ツ)_/¯

low niche
earnest phoenix
#

@tawny lava npm i uws

#

@low niche it’s this

#

const dispatcher = connection.playStream(ytdl(args[1]))

low niche
#

oh ok

earnest phoenix
#

the “connection” variable is trying to be used, but it’s being defined in a block scope

topaz fjord
#

i have a question

#

can someone help me

winged monolith
#

what is it

umbral pelican
#

pft, saying what the question is would be too easy.

potent harness
#

~help

earnest phoenix
#

Yes?

earnest phoenix
#

@vital lark

#
  msg.channel.send(msg.content.replace (prefix +
'say ', '');
},```
#

Why does it crash my bot?

slow idol
#

You're using d.js?

earnest phoenix
#

node.js

slow idol
#

Yes discord.js

#

-_-

earnest phoenix
#

Ye

slow idol
#

you have unneeded spaces

earnest phoenix
#

Where

slow idol
#
msg.channel.send(`${msg.content.replace(prefix, '')} say`)
#

That's all the info I can get from your snip

earnest phoenix
#

We will see if it works now

#

It crashed

slow idol
#

What's the error message?

earnest phoenix
#

Websocket stuff

#

It dont say it crashes it just shows kike all the true and null atuff

slow idol
#

Can you copy it here?

earnest phoenix
slow idol
#

Not really helpful screenshot bloblul

earnest phoenix
#

Well i dont have discord on my laptop

slow idol
earnest phoenix
#

I might make a chat bot

#

Just cause

#

Like a @neat pawn Chat

slow idol
#

<help

indigo notch
#

anyone knows what i did wrong? it just logs undefined and when i remove the filters its data of undefined

  snekfetch.get('https://www.reddit.com/r/emojipasta.json?sort=top&t=day&limit=500').then(response => {
    let pastas = response.body.data.children.filter(post => post.data.is_video === false && post.data.over_18 === false);
    let pasta  = pastas[(Math.floor(Math.random() * 400) + 10)]
    console.log(pasta)
});```
shrewd field
#

anyone knows how to make a command that edits a message after it is sent

#

huh

uncut slate
#

await

shrewd field
#

ok

#

let msg = "hello" msg = Bye

#

this u mean

uncut slate
#

no

shrewd field
#

no

#

then what

uncut slate
#
const msg = await msg.channel.send('...');
msg.edit('...');

(depending on your library)

shrewd field
#

i have discord.js

#

ok thx

#
const msg = await msg.channel.send("hello");
msg.edit("bye");```
#

this

uncut slate
#

yeah?

shrewd field
#

ok thx

#

and

earnest phoenix
shrewd field
#

wait i

#

wati

#

wait

earnest phoenix
shrewd field
#
if(command === "ping") {
    // Calculates ping between sending a message and editing it, giving a nice round-trip latency.
    // The second ping is an average latency between the bot and the websocket server (one-way, not round-trip)

    const m = await message.channel.send("Ping?");
    m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(client.ping)}ms`);
  }```
#

do u know why this doesnt work

uncut slate
#

css codeblock for js

shrewd field
#

what

#

what is css codeblock for js

#

??

earnest phoenix
#

You're using the wrong Codeblock for your code

uncut slate
shrewd field
#

what is codeblock

earnest phoenix
#

Should be that ```js

#

```javascript
code
```

#
#this is codeblock
shrewd field
#

ok

#

what is wrong with the code

#

it doesnt work

earnest phoenix
#

It's written by an autsitic

shrewd field
#

who is he

earnest phoenix
#

ok

shrewd field
#

ok what

#

why it doesnt work

#

can u plz answer

earnest phoenix
shrewd field
#

what u mean

tawny lava
#

same

uncut slate
#

You need to be in an async function

shrewd field
#

how

umbral pelican
#

🤦

earnest phoenix
#
/*stuff*/ level + 1)

Sometimes outputs

Forbidden ℨBOT - Today at 10:04 PM
@Can I change my variable?, Correct! Leveled Up To: 31
#

and only sometimes

umbral pelican
#

Use parseInt, it will be adding strings.

earnest phoenix
#

Yep just did that

shrewd field
#

hey

#

how do i make an async function

tawny lava
uncut slate
earnest phoenix
#

/stuff/ level + 1)

#

kek

#

/stuff/ level + 1)

#

:/

shrewd field
#

hey

#

i get this error dont know why ```js
Parsing error: The keyword 'await' is reserved (Fatal)

tawny lava
#

it's still not in an async function

shrewd field
#

ok

#

hey

#

wait

#

u know why this no work

#
client.on("message", async message => {
  
  if(message.author.bot) return;
  
 if(message.content.indexOf(config.prefix) !== 0) return;
  
  const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
  const command = args.shift().toLowerCase();
#

anyone know why this doesnt work

bitter sundial
#

what's the error

wanton nova
#

o

shrewd field
#

wait

#

i will get it

#
    Parsing error: Unexpected token message (Fatal)```
#

code

#
const Discord = require("discord.js");
const client = new Discord.Client();
const config = require("./config.json");

client.on("ready", () => {
  console.log("I'm Online'");
});
client.on("message", async message => {
  
  if(message.author.bot) return;
  
 if(message.content.indexOf(config.prefix) !== 0) return;

  const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
  const command = args.shift().toLowerCase();
)};
client.login(config.token);```
#

@bitter sundial

tawny lava
#

update your node

#

also you're not closing off your message event

shrewd field
#

i am updated

#

closing my message event

#

lizard

#

lizard can u check it

#

liz

tawny lava
#

what

shrewd field
#

can u check it plx

#

plz

tawny lava
#
if(message.content.indexOf(config.prefix) !== 0) return;
  )<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // what in gods name is this
shrewd field
#

this is telling u where did i put the bracket

#

if its place is wrong tell me then

tawny lava
#

I told you to close your message event lol

#

and ye it is wrong

shrewd field
#

ok

#

where should i put it

#

the closing

tawny lava
#

above client.login but under const command

shrewd field
#

ok

#
  const command = args.shift().toLowerCase();
)};
client.login(config.token);```
#

like this

tawny lava
#

});

shrewd field
#

now.

#

object lizard

#

@tawny lava

#

i have unexpected token message

#

error

#

parsing error

tawny lava
#

update

#

your node

shrewd field
#

to what version

#

i have version v6.11.2

abstract mango
#

update it to the latest

tawny lava
#

you need anything above 7

shrewd field
#

8.5.0 is latest

abstract mango
#

ye

#

just use that

shrewd field
#

ok will it solve the problem

#

i am downloading it now

#

will it fix the error

tawny lava
#

yes...

shrewd field
#

ok

#

without me doing anything

#

just installing node

earnest phoenix
#

is it safe to get upvotes every 10 minutes or should I change that to more?

prime cliff
#

Yea its ok to do that as most people post stats to the website every 5/10/15/30 mins atleast its not 10 seconds lol

earnest phoenix
#

okay

rapid musk
#

i need help kindsa

#

so right now my bot

#

checks if u have a certain perm

#

in order to do a command

#

and the perm is like logically linked

#

but i dont knew if thats any good

#

as far as customizing the bot

uncut slate
#

kek

earnest phoenix
#

ok

#

gfy

earnest phoenix
#

aye

fleet epoch
#
const Discord = require("discord.js");
const settings = require("../settings.json");
const serverroles = require("../groups.json");
module.exports.run = (client, message, args) => {
    const noperms = new Discord.RichEmbed()
    .setTitle('You need at least one of the following Roles.')
    .setDescription(serverroles.purge)
    .setColor(0xFF0000)
    if(!message.member.roles.some(r=>`${serverroles.purge}`.includes(r.name)) ) return message.channel.send(noperms);
    if (!message.guild.member(client.user).hasPermission('MANAGE_MESSAGES')) return message.reply('I cannot delete messages.');
    var messagecount = message.content.substring(`${settings.prefix.length + 8}`,999)
    if (messagecount == '') return message.reply(`Wrong usages, use **${settings.prefix}purge <amount>**`);
    if (messagecount < 2) return message.reply(`It need to be at least 2 messages.`);
    if (messagecount > 100) return message.reply(`I cannot delete more then 100 messages.`);
    message.channel.fetchMessages({limit: messagecount}).then(messages => message.channel.bulkDelete(messages));
    message.reply(`I have deleted ${messagecount} messages.`)
    
    }


module.exports.help = {
    name: "purge"
}```
earnest phoenix
#

error?

fleet epoch
#

@fleet epoch, Wrong usages, use %purge <amount>

#

no error in console

earnest phoenix
#

LIB error would be nice

#

¯_(ツ)_/¯

#

catch it then

fleet epoch
#

throw.err?

#

idk how to catch a erro

#

error*

ebon apex
#

You shouldn't have to fetch messages anymore

earnest phoenix
#

^^

#

message.channel.bulkDelete(${args});

#

.channel.bulkDelete(messages)

#

Solace, you okay?

fleet epoch
#

???

earnest phoenix
#

.channel.bulkDelete(args)

#

wat

#

You okay?

#

args being w/e you want

#

as in, a number

ebon apex
#

You don't need inline variable

earnest phoenix
#

why put it in a inline string

#

lol

#

😂

#

I just pasted my old code

#

lmao

#

lmao

#

but ya

#

just put w/e

#

template literals for everything

#

is a habit of mine

#

I still do it today

#

tbh

fleet epoch
#

this work, part of the code if (messagecount > 100) return message.reply(`I cannot delete more then 100 messages.`); message.channel.bulkDelete(messages)); message.reply(`I have deleted ${messagecount} messages.`)

earnest phoenix
#
cmds.purge = {
  name: 'purge',
  help: 'allow staff to purge chat',
  func: (msg, lc, prefix, raw, manager, embedPerms, serverManageRole) => {
    if (manager || msg.guild.members.get(msg.author.id).hasPermission('MANAGE_GUILD')) {
      let amount = Number(msg.content.split(" ")[1]);

      if (amount && !isNaN(amount)) {
        if (msg.guild.members.get(client.user.id).hasPermission('MANAGE_MESSAGES')) {
          if (amount >= 2 && amount <= 100) {
            msg.channel.bulkDelete(amount)

OFC CLOSING

#

lol

#

You should be able to work with that

fleet epoch
#

no imma stay with the code i have

earnest phoenix
#

removing stuff like the manager line etc...

#

😂

#

Can help ignorant

ebon apex
#
module.exports.run = (client, message, args) => {
    const noperms = new Discord.RichEmbed()
    .setTitle('You need at least one of the following Roles.')
    .setDescription(serverroles.purge)
    .setColor(0xFF0000)
    if(!message.member.roles.some(r=>`${serverroles.purge}`.includes(r.name)) ) return message.channel.send(noperms);
    if (!message.guild.member(client.user).hasPermission('MANAGE_MESSAGES')) return message.reply('I cannot delete messages.');
    var messagecount = message.content.substring(`${settings.prefix.length + 8}`,999)
    if (messagecount == '') return message.reply(`Wrong usages, use **${settings.prefix}purge <amount>**`);
    if (messagecount < 2) return message.reply(`It need to be at least 2 messages.`);
    if (messagecount > 100) return message.reply(`I cannot delete more then 100 messages.`);
    message.channel.bulkDelete(NUMBER);
    message.reply(`I have deleted ${messagecount} messages.`)
    
    }

#

Should work

#

That is your code

#

just modified

fleet epoch
#

thx

ebon apex
#

I edited it

#

I left the messages part in there

#

So where it says NUMBER you can change that to what your number is from your command

fleet epoch
#

you took out the const part on top

ebon apex
#

I just gave the module.exports part

earnest phoenix
#

then put it back

ebon apex
#

that's why

earnest phoenix
#

lmao

fleet epoch
#

ahh kk

ebon apex
#

I only copied the command run exports

fleet epoch
#

kk

earnest phoenix
#

Loo

#

Lol

fleet epoch
#

comes up as a error

earnest phoenix
#

Boiii

ebon apex
#

What is the error?

fleet epoch
#

wait thats on me

ebon apex
#

Okay

fleet epoch
#

me and my friend use diffrent things for json files, he uses confi, i use settings

ebon apex
#

All good

fleet epoch
#

oh still error let me screenshot it

#

thats now in index though

earnest phoenix
#

That's another issue

ebon apex
#

That's your command handler

earnest phoenix
#

^^

fleet epoch
#

yea it should work though lol

#

it was working

earnest phoenix
#

Common error, that

#

Works but doesn't now

ebon apex
#

It seems that props.help is not defined

#

So check into that

fleet epoch
#
  let props = require(`./commands/${f}`);
  //console.log(`${i + 1}: ${f} loaded!`)
  client.commands.set(props.help.name, props);
  });
  console.log('-------------------------------')
  console.log(`Loaded ${jsfiles.length} commands!`)
});
#

right here

#

is where the problem is

earnest phoenix
#

Oh dear

ebon apex
#

So you need to check on all your commands to make sure help is defined

fleet epoch
#

oh

ebon apex
#

Somewhere it's not

earnest phoenix
#

I'm gonna need a beer with this rahman

fleet epoch
#

i see

#

i forgot to add that at the end of purge folder

ebon apex
#

You probably forgot to add the module.exports.help back into your purge command

fleet epoch
#

mhm

ebon apex
#

👍🏻

fleet epoch
#

👍

#

testing feature now

earnest phoenix
fleet epoch
#

dosent work

ebon apex
#

Error?

fleet epoch
#

no error but nothing comes out

#

GOD

#

im so stupid

ebon apex
#

What version of discord.js are you using btw?

fleet epoch
#

latest

#

8.5

#

wait

#

thats node

#

um, not sure i would have to check

ebon apex
#

Discord.version

fleet epoch
ebon apex
#

console.log that somewhere

#

That is your checks

#

The checking you're doing before purging

#

Let me look over them

fleet epoch
#

what?

#

im confused xD

ebon apex
#

Let me look over your code you sent before again, give me a second.

#

It seems that's on your checking for the messagecount == ''

#

So maybe your messagecount variable is not defined?

#

You might wanna log that to console to test and see if it is getting the number you want

fleet epoch
#

how would i do that

ebon apex
#

So in your code right above your if statement for the if (messagecount == '') add console.log(messagecount)

earnest phoenix
#

It you don't know how to log to console why are you tryna make a bot

#

¯_(ツ)_/¯

#

Its called debugging

fleet epoch
#

ik how to log console i dident know what he wanted me to log i was confused

ebon apex
#

Your messagecount variable

#

Before that if statement that says Wrong usages

fleet epoch
#

nothing gets logged

ebon apex
#

Then you're splitting your varaiables wrong to get the number

earnest phoenix
#

fml

ebon apex
#

this is the part you need to see if you're doing right.

var messagecount = message.content.substring(`${settings.prefix.length + 8}`,999)
fleet epoch
#

hmm

#

i dont notice anything wrong

ebon apex
#

I mean probably the 8

#

Because purge is only 5 letters

#

and a space

#

so probably 6

fleet epoch
#

ahh

#

bot crashed on that

ebon apex
#

What was that error?

fleet epoch
#

messages is not defined

ebon apex
#

Did you change the 8 to a 6?

fleet epoch
#

yes

ebon apex
#

Okay

#

Let me see your bulkdelete line again

fleet epoch
#

message.channel.bulkDelete(messages);
message.reply(I have deleted ${messagecount} messages.);

ebon apex
#

change the messages to messagecount

fleet epoch
#

it worked

#

and it logged it in console, sweet

ebon apex
#

Okay now you can remove the console.log if you want, that is a good thing to do for debugging.

fleet epoch
#

kk

#

ok i got a question, what should i add in my info command?

ebon apex
#

Hold on look in #commands and i'll show you mine

fleet epoch
#

@ebon apex how did you make the total commands

ebon apex
#

Everytime a command is run I add one number to a field in my database. Same with message.

fleet epoch
#

oh a database

#

dangit

#

i gtg but if someone could tell me how to make a toggle command for join/leave msges that would be great, cause i know not everyone likes that

#

tell me in dms

shrewd field
#

i get an error Parsing error: Unexpected token => (Fatal) for this code:

client.on("message", async(message) => {
    if (message.content.startsWith(prefix + "ping")) {
       await message.channel.send("Ping?").then(m => m.edit(`Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API latency is ${Math.trunc(client.ping)}ms!`));
   }
});
#

can someone help

earnest phoenix
#

Why are you using “await” if you’re using .then on it

#

remove the “await “ in front of msg.channel.send

#

Other than that, you’re good

shrewd field
#

ok i will try it

#

it has the same error @earnest phoenix

#

still

earnest phoenix
#

¯_(ツ)_/¯

shrewd field
#

what do u mean by ¯_(ツ)_/¯

#

dev

earnest phoenix
#

It means it is unsure

shrewd field
#

it is?

#

what is unsure

uncut slate
#

@shrewd field run node -v

shrewd field
#

ok

earnest phoenix
#
Forbidden ℨBOT - Today at 10:43 PM
Pong! Latency is 236ms. API latency is 235ms!(edited)

You must have done something wrong somewhere else. It looks fine to me

shrewd field
#

how

uncut slate
#

how what

shrewd field
#

i removed await

uncut slate
#

just run node -v in a terminal

shrewd field
#

ok

tawny lava
#

that usually means your node is outdated

shrewd field
#

i got this v8.5.0

earnest phoenix
#

hmm

#

🤔

#

lol

tawny lava
#

thonk

earnest phoenix
#

Well somewhere else is probably causing the Error. God knows where. What does the error specifically say?

shrewd field
#

Parsing error: Unexpected token => (Fatal)

#

from atom linter

earnest phoenix
#

Does it say the line it's coming from

shrewd field
#

50:37

earnest phoenix
#

And that code you sent is from that line

shrewd field
#

no

earnest phoenix
#

What is the line it's coming from

shrewd field
#

it is 50 to 54

uncut slate
#

dude

#

run

#

node -v

earnest phoenix
#

He did Aeth

shrewd field
#

this is line 57

#

client.login(config.token);

earnest phoenix
#

Deni - Today at 10:45 PM
i got this v8.5.0
shrewd field
#

i did aeth

uncut slate
#

o

earnest phoenix
#

I should probably update my node.js lol

uncut slate
#

send the full bot script

shrewd field
#

to ur dms

#

or here

earnest phoenix
#

don't send tokens

shrewd field
#

of course

uncut slate
#

hastebin it and send it here

shrewd field
#

i have it covered ok

earnest phoenix
#

Remove Async. You won't need it

uncut slate
#

oh no 🤦

shrewd field
#

where

uncut slate
#

you have like 3 message events

#

and 3 ready events

languid dragon
#

lel

shrewd field
#

yep

earnest phoenix
#

You only need 1 of each

shrewd field
#

that is the only way to make multiple commands

#

right

earnest phoenix
#

No

shrewd field
#

no

languid dragon
#

👀

shrewd field
#

what is the other way

earnest phoenix
#

Put it in the same event

languid dragon
#

if(command = "command"){

}
if(command = "othercommand"){

}`

earnest phoenix
#
if (command) {
} else if (other command) {
} else /*not command*/ {
}
languid dragon
#

its like coders basics man

uncut slate
#

else ()

#

..no?

shrewd field
#

ok

#

why no aeth

earnest phoenix
#

@uncut slate Better?

uncut slate
#

sure

#

ideally you want modularity

#

but that might be too advanced for this one

shrewd field
#

so

#

what is the problem

earnest phoenix
#

Most likely the multiple amounts of the same event

shrewd field
#

so i need to change them

earnest phoenix
#

Yep

uncut slate
#

that shouldn't be an issue in theory

#

well I mean

earnest phoenix
#

But you never know

uncut slate
#

it's kind of really dumb

earnest phoenix
#

It said the Error was the ping command. So whatever it is. It's probably caused by it

languid dragon
#

its common sense and logic

shrewd field
#

ok

#

the client guild things can be in the ready using what

#
if(command = "command"){

}
if(command = "othercommand"){

}```
earnest phoenix
#

You just move it to the same Event. Nothing needed really

shrewd field
#

like how

earnest phoenix
#

That's for your message event. That's how you make more commands.

shrewd field
#

ok

languid dragon
#

client.on("message", message => {
  if (message.author === client.user) return;

  if (message.content.startsWith(prefix + "ping")) {
    message.reply("pong!");
  }
  if (message.content.startsWith(prefix + "OTHERCOMMAND")) {
    message.reply("another command!");
  }
});
shrewd field
#

for the gulid

earnest phoenix
#

client.on("ready", () => {
  console.log("I\'m Online\nI\'m Online");
});

client.on("ready", () => {
  client.user.setGame("In 10 servers | 4/10 guilds| use ..help");
});

client.on("ready", () => {
  // This event will run if the bot starts, and logs in, successfully.
  console.log(`Bot has started, with ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`);
  // Example of changing the bot's playing game to something useful. `client.user` is what the
  // docs refer to as the "ClientUser".
  client.user.setGame(`on ${client.guilds.size} servers`);
});

This should all be in the same Ready event

shrewd field
#

ok

#

thanks

earnest phoenix
#

👍

shrewd field
#

and the remove gulid in the same

earnest phoenix
#

What do you mean?

shrewd field
#

i mean

earnest phoenix
#

oh

tawny lava
#

@earnest phoenix why the two on ready events lol

earnest phoenix
#

that

#

What?

shrewd field
#
client.on("guildCreate", guild => {
  // This event triggers when the bot joins a guild.
  console.log(`New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`);
  client.user.setGame(`on ${client.guilds.size} servers`);
});

client.on("guildDelete", guild => {
  // this event triggers when the bot is removed from a guild.
  console.log(`I have been removed from: ${guild.name} (id: ${guild.id})`);
  client.user.setGame(`on ${client.guilds.size} servers`);
});
earnest phoenix
#

@tawny lava Not my code?

shrewd field
#

guild create and delete in one ready

languid dragon
#

no

#

they're seperate events

shrewd field
#

ok

languid dragon
#

'ready' 'guildCreate' 'guildDelete' 'message' etc are different events

earnest phoenix
#
"guildDelete"

That's the name of the event

languid dragon
#

each only need one call

shrewd field
#

ok

#

thanks

#

doing edits now

languid dragon
#

ok

shrewd field
#

guys

languid dragon
#

👀

shrewd field
#

this code ```js
client.on("message", (message) => {
if (message.content.startsWith(prefix + "ping")) {
message.channel.send("Ping?").then(m => m.edit(Pong! Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API latency is ${Math.trunc(client.ping)}ms!));
}
});

#

where can i place js const m = message.channel.send("Ping?");

languid dragon
#

no need?

shrewd field
#

how

languid dragon
#

`message.channel.send("Ping?").then(m => m.edit(``

shrewd field
#

message.channel.send("Ping?").then(m => m.edit(`Pong! Latency is ${m.createdTimestamp -

languid dragon
#

you already have it

shrewd field
#

what is m

#

m undifined

bitter sundial
#

m is the message

languid dragon
#

m is the message created by message.channel.send("Ping?")

shrewd field
#

ohh

#

not the variable

languid dragon
#

you're probably reading two different examples

shrewd field
#

yes

#

u where right i had it again above

#

😅

#

lol

#

hey

#

Unnecessary escape character: \'. (no-useless-escape)

#

u know what is this

uncut slate
#

that's eslint

shrewd field
#

ya

uncut slate
#

you can remove the \

shrewd field
#

i have it

uncut slate
#

it's not necessary

shrewd field
#

ok

#

and

#

Expected linebreaks to be 'CRLF' but found 'LF'. (linebreak-style)

languid dragon
#

what on earth

shrewd field
#

how do i turn this rule off

#

it is for eslint

shrewd field
#

ur in Australia

#

ken

languid dragon
#

yes i am

uncut slate
#

.au is australia, isn't it

languid dragon
#

same google shouldn't make adifference

#

yeah

shrewd field
#

know how did i know it

languid dragon
#

its not rocket science

shrewd field
#

what aeth said is correct

languid dragon
shrewd field
#

i know

#

thx btw

#

all of you

shrewd field
#

Does anyone know how to disable the es-lint rule of line breaks or make it CRLF I could figure it out.
Thank you

languid dragon
#

did ya google it?

shrewd field
#

yes

languid dragon
#

welp im out of ideas

shrewd field
#

ok

opaque bison
prime cliff
#

You are missing that header?

bitter sundial
#

no

#

you're out of luck

#

twitter api should be providing the header

#

but they aren't

#

so you cant do that from a browser

shrewd field
#
PS C:\Users\toshiba\Desktop\MyBot> node mybot.js
module.js:646
    throw err;
    ^
 
SyntaxErrorC:\Users\toshiba\Desktop\MyBot\config.jsonUnexpected string in JSON at position 133
    at JSON.parse (<anonymous>)
    at Object.Module._extensions..json (module.js:643:27)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\toshiba\Desktop\MyBot\mybot.js:3:16)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)```
#

does anyone know why is this error

inner jewel
#

invalid json

shrewd field
#

json what

inner jewel
#

on your config

#

you're trying to parse config.json as json but it's invalid

shrewd field
#

ok getting screen of json

#

i am trying to make the quotes into a comment

#

how

inner jewel
#

...

shrewd field
#

@inner jewel

#

... what

inner jewel
#

what are you even trying to do

#

those random strings

#

are invalid json

shrewd field
#

i know trying to make them comments

inner jewel
#

why are them there then?

#

they won't execute at all

shrewd field
#

ok i dont want them to execute

inner jewel
#

why

#

are

#

they

#

there

#

?

#

they're completely invalid json

shrewd field
#

how can i make a comment in json

#

just tell me

#

it will solve the problem

inner jewel
#

some parsers use // but it's not in the spec and is not supported

shrewd field
#

i am testing a command

#

so what is supported

inner jewel
#

you shouldn't use comments in json

shrewd field
#

ok

#

thx figured it out

#

btw

#

do u know what is discordie

#

@inner jewel

gaunt dune
#

A Node.js module providing a set of interfaces to interact with Discord API.

inner jewel
#

i guess it's a discord lib

shrewd field
#

nope

#

like discord

gaunt dune
#

but it is

#

a discord lib

shrewd field
#

how

#

idk what it is

#

just found it out by random

#

does it work with discord api

#

the docs commands do they work with discord.js lib

gaunt dune
#

yes....?

#

no, it's a different library

shrewd field
#

ok

gaunt dune
#

than discord.s

shrewd field
#

thx

rapid musk
#

i am trying to install djs-collection-persistent but i do it and i require it but it still cannot find module

#

const PersistentCollection = require("djs-collection-persistent");

earnest phoenix
#

You definitely ran
npm install --save djs-collection-persistent

#

and you had the Directory as the bot's

#

@rapid musk

rapid musk
#

const Discord = require('discord.js');
const moment = require('moment');
const Enmap = require('enmap');
const PersistentCollection = require("djs-collection-persistent");
const { bot } = require('../../..');
bot.ecoTable = new Enmap({name: "ecoTable"});
exports.run = (member) => {

}

earnest phoenix
#

What OS are you on

rapid musk
#

like node versoin or discord.js version? isnt OS like iphone related

#

sorry i honsetly dont knew what OS is

#

Windows?

earnest phoenix
#

OS is Operating System

rapid musk
#

i am using Windows

#

the node version is v8.1.4

earnest phoenix
rapid musk
#

it does

earnest phoenix
#

Try uninstalling and reinstalling. Make sure that everything you input is correct.

rapid musk
#

ok

#

its still doing it

#
const moment = require('moment');
const Enmap = require('enmap');
const PersistentCollection = require("djs-collection-persistent");
const { bot } = require('../../..');
bot.ecoTable = new Enmap({name: "ecoTable"});
exports.run = (member) => {
  const defaultMember = {
    peanuts:0
  }
  bot.ecoTable.set(member.id,defaultMember)
  const mValue = bot.ecoTable.get(member.id)
  console.log(mValue)
}
#

thats the code i am trying to run

earnest phoenix
#

You might be using it wrong. I don't know what your using it for but in this code I don't see it being used.

#
bot.ecoTable = new Enmap({name: "ecoTable"});

What is bot.ecoTable
And isn't
new Enmap()
suppose to be

const configs = new PersistentCollection({name: 'configs'});

Looking at the site

rapid musk
#

ok let me try and change my code

earnest phoenix
#

Ok

#

Also looking at Enmap. Enmap does the almost same as Discord.js Collections

rapid musk
#
const moment = require('moment');
const Enmap = require('enmap');
const PersistentCollection = require("djs-collection-persistent");
const peanuts = new PersistentCollection({name: 'peanuts'});
const { bot } = require('../../..');
exports.run = (member) => {
  const defaultMember = {
    peanuts:0
  }
peanuts.set(member.id,defaultMember)
  const mValue = peanuts.get(member.id)
  console.log(mValue)
}
#

it still giving an error

#

module.js:487
throw err;
^

Error: Cannot find module 'djs-collection-persistent'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\dylanberman29\Desktop\index.js:1:92)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)

earnest phoenix
#

I wouldn't really know. It come not have installed correctly, installed in the right directory. Or what

rapid musk
#

fixed it

#

i made a silly mistake

#

like really silly

earnest phoenix
#

What did you do?

rapid musk
#

const { bot } = require('../../..'); that is used for commands in events i need to doconst { bot } = require('../..');

earnest phoenix
delicate zephyr
#

how do you get messages from a certain user, after a week ago using message.channel.fetchMessages
API: d.js

earnest phoenix
#

looking for another person to join the development team for my SMS/phone call bot

#

need to have a third person working with us so that we can expand the features and integrations faster

#

DM me if you're interested

#

(using Discord.js & and JS duh)

#

If I knew how, I would.

#

knew how to waht?

#
[antlers Moose] - Today at 10:19 AM
looking for another person to join the development team for my SMS/phone call bot
#

don't know JS?

#

I do. I just wouldn't be reliable

#

ah

#

well, its not just sms stuff

#

its js in general

#

because we're expanding it to whatsapp, facebook messenger, and some other platforms

#

and just need help

#

Nice. Well, I hope you find someone better than me 😄

topaz fjord
#

guys

earnest phoenix
#

Yes?

topaz fjord
#

can i have help with js

#
const unban1 = new Discord.RichEmbed()
      .setAuthor(""+message.guild.name+" | "+message.guild.id+"", message.guild.iconURL)
      .setColor(654456)
      .setFooter('bot.log', bot.user.avatarURL)
      .setThumbnail(user.avatarURL)
      .setTimestamp()
      .setDescription('**Username:** '+user.username+'#'+user.discriminator+'\n**UserID:** '+user+'\n**Action:** Was Unbanned\n**Unbanned By:** '+message.author.username+'\n**Reason:**' +(reason || ' N/A'));
#
let user = args[0];
#

the user.useraname and user.discriminator keeps appearing as undefined

#

this is for my unban command

earnest phoenix
#

use

#

user.tag

#

and just that

topaz fjord
#

ok ty

#

ill try it

#

still undefined

#

@earnest phoenix

#

would it be able to detch the user

#

fetch

earnest phoenix
#

What is args[0]?

topaz fjord
#

the id of the user to unban

earnest phoenix
#

user.mention ?

delicate zephyr
#

@topaz fjord are you sending this when a user uses the command?

topaz fjord
#

?

delicate zephyr
#

as in

#

is it in response to the command

topaz fjord
#

when the user does ttb!unban (id) (reason)

delicate zephyr
#

if it is, try use message.author.tag

topaz fjord
#

it unbans the user then sends the embed

delicate zephyr
#

try that

topaz fjord
#

then that just tags me

delicate zephyr
#

nope

#

that gives the tag

topaz fjord
#

yes but i want the users tag

delicate zephyr
#

yea

#

.tag gives the username#discrim

#

thats what @earnest phoenix was saying

topaz fjord
#

I WANT THE FUCKING USERS TAG

delicate zephyr
#

oh then just use user.mention

topaz fjord
#

WHEN I DO THAT IT GIVES UNDERFINE#UNDERFINED

delicate zephyr
#

jesus

earnest phoenix
#

That's because User is undefined

#

args[0] isn't returning anything

delicate zephyr
#

you need to use message.author

topaz fjord
#

its trying to get the username from the id

delicate zephyr
#

yea, user is undefines

earnest phoenix
#

message.author for an Unban command thonk

#

lol

delicate zephyr
#

Because hes trying to say who Unbanned I assumed

topaz fjord
#
const Discord = require("discord.js");
const fs = require("fs");

module.exports.run = async(bot, message, args) => {
    let modlog = message.guild.channels.find('name', 'mod-log') 
    if (!modlog) return message.channels.send({embed:{
      title: "You do not have a mod-log channel!",
      color: 654456
    }})

    let user = args[0];
    let reason = message.content.split(' ').slice(2).join(' ');

    if (!message.guild.member(bot.user).hasPermission("BAN_MEMBERS")) return message.channel.send({embed:{
      title: "Permissions Invalid",
      color:654456
    }});

    if(!reason) return message.channel.send({embed:{
      title: "You must provide a reason!",
      color:654456  
    }});

    if (!user) return message.channel.send({embed:{
      title: "User is not valid!",
      color:654456
    }});
    
    const unban1 = new Discord.RichEmbed()
      .setAuthor(""+message.guild.name+" | "+message.guild.id+"", message.guild.iconURL)
      .setColor(654456)
      .setFooter('bot.log', bot.user.avatarURL)
      .setThumbnail(user.avatarURL)
      .setTimestamp()
      .setDescription('**Username:** '+user.username+'#'+user.discriminator+'\n**UserID:** '+user+'\n**Action:** Was Unbanned\n**Unbanned By:** '+message.author.username+'\n**Reason:**' +(reason || ' N/A'));

    if (message.member.hasPermission("BAN_MEMBERS")) {
        console.log(""+message.author.username+" unbanned "+user+"");
        modlog.send({embed: unban1}).catch(console.error);
        message.guild.unban(user);
      }
}

module.exports.help = {
  name: "unban"
}
delicate zephyr
#

oh

#

nvm

topaz fjord
#

thats it all

earnest phoenix
#

and wheres args[0] at

#

I don't see it defined anywhere

topaz fjord
#

the top

delicate zephyr
#

you need to fetch the user first

topaz fjord
#

let user = args[0];

#

wait

earnest phoenix
#

I know. But args[0] doesn't exist. args is always undefined if you don't define it as
let args = //code

delicate zephyr
#

message.guild.users.get(<id>).unban

topaz fjord
#

there

#

now its edited

#

theres the args at the top

delicate zephyr
#

yea, we see that, but are they actually being given as a value

#

as in like this
let args = message.content.split(" ").splice(2)

topaz fjord
#

so like this

#

message.content.split(' ').slice(1);

#

and let args at the front

delicate zephyr
#

i mean that would include unban

#

but you get the idea

#

also, as for getting the user

#

are you trying to tag the user

#

or are you requesting the userID for the unban

topaz fjord
#

im am unbanning them with their user id

delicate zephyr
#

ok gimme a sec to type up an example

topaz fjord
#

i did fetch user to get their info but i dont know where to go from there

delicate zephyr
#
bot.fetchUser(userID, function(user) {
    message.guild.unban(user)
    message.channel.send({embed})
})```
#

thats literally just an example, it might or might not work

topaz fjord
#

how would i also get the username

delicate zephyr
#

user.username

#

basically the same way you were before

#

user.tag would work better

#

since you wouldnt have to do user.username + "#" + user.discriminator

topaz fjord
#
    bot.fetchUser(user, function(user) {
    const unban1 = new Discord.RichEmbed()
      .setAuthor(""+message.guild.name+" | "+message.guild.id+"", message.guild.iconURL)
      .setColor(654456)
      .setFooter('bot.log', bot.user.avatarURL)
      .setThumbnail(user.avatarURL)
      .setTimestamp()
      .setDescription('**Username:** '+user.username+'#'+user.discriminator+'\n**UserID:** '+user+'\n**Action:** Was Unbanned\n**Unbanned By:** '+message.author.username+'\n**Reason:**' +(reason || ' N/A'));

    if (message.member.hasPermission("BAN_MEMBERS")) {
        console.log(""+message.author.username+" unbanned "+user+"");
        modlog.send({embed: unban1}).catch(console.error);
        message.guild.unban(user);
      }
})
#

i did this

#

but it doesnt work

#

@delicate zephyr

delicate zephyr
#

+user+'

#

the user variable there is an object

#

its over 2000 chars

topaz fjord
#

where?

#

oh wait i see

#

no i mean that it does nothing

#

doesnt unban doesnt send

delicate zephyr
#

i did say it wouldnt work since it was an example

topaz fjord
#

@delicate zephyr

#

how would i fetch a username and the discriminator using fetchUser();

delicate zephyr
#

user.tag

#

oh

#

i got it wrong

topaz fjord
#

wert

delicate zephyr
#
bot.fetchUser(userID).then(user => {
    user.id
    user.username
    user.tag
})```
#

there

topaz fjord
#

oh ty

delicate zephyr
#

did it work

topaz fjord
#

no

#

it still says undefined

#

if this help im one 11.0.0 discord.js

#

@delicate zephyr

delicate zephyr
#

bruh

#

update'

topaz fjord
#

why

#

does that have anything to do with it

#

i fixed it

#

@delicate zephyr

faint cedar
#

.

earnest phoenix
#
var args = message.mentions.users.first()

If I wanted to find all mentioned users. I would use findAll?

#
var args = message.mentions.users```
#

should work

#

@earnest phoenix

#

Ok 👍

shrewd field
#

hello

#

how do u make an async function

tawny lava
shrewd field
#

thank you

#

jk

#

objectlizard

#

i didn't get what this meant

#

@tawny lava

karmic parcel
#

why you ping lizard like that

uncut slate
#

typical help vamp behaviour 🤷

bitter sundial
boreal jasper
#

helo

#

someone that uses discord.js there

uncut slate
#

Nah. No one. Just you bub 💙

heady zinc
#

i mean

#

discord.js in 2017

#

gud meme

earnest phoenix
#

@heady zinc i use discord.js -_-

heady zinc
#

i do too

earnest phoenix
#

@uncut slate may i please have the bot developers role ffs

heady zinc
#

if your bot is not approved you"re not gonna have it 👀

uncut slate
#

which bot is yours

karmic parcel
#

put it on last with that shit attitude

boreal jasper
#

-bots @earnest phoenix

gilded plankBOT
#
Elito#2653
Bots

@thorn pivot

earnest phoenix
#

Your bot was made in Discord Bot Maker, right

uncut slate
#

not accepted

#

LUL

heady zinc
#

discord bot maker bloblul

karmic parcel
uncut slate
#

welcome to the modteam bubba

earnest phoenix
#

LOL

#

lmao

boreal jasper
#

its not aproved

earnest phoenix
#

@boreal jasper admin says otherwise

#

XD

heady zinc
#

i want the certified bot role

boreal jasper
#

the question its: that role does really haves priviliges?

#

🤔

heady zinc
#

no

#

ofc

#

xD

karmic parcel
#

it's a special mute role

inner jewel
#

@uncut slate give me admin too :^)

uncut slate
#

hmmmmmmmmmmm

earnest phoenix
#

@inner jewel i say no

uncut slate
#

nah gotta keep the meme exclusive

earnest phoenix
#

@uncut slate i am a bot developer though -_-

uncut slate
#

you are not a bot dev

#

until your bot is approved

boreal jasper
heady zinc
#

well

#

i mean

#

some bots got approved

#

even though their devs wasnt really one

#

including myself

boreal jasper
#

r u sure about that

uncut slate
#

(for the others)

#

(lib talk = development)

#

(hm yeah we should actually move to general too, talking between parentheses doesn't count)

tribal geode
#

Hello

topaz fjord
#
    let ban = JSON.parse(fs.readFileSync('./Storage/bans.json', 'utf8'));
    let modlog = message.guild.channels.find('name', 'mod-log') 
    if (!modlog) return message.channels.send({embed:{
      title: "You do not have a mod-log channel!",
      color: 654456
    }});

    if (!message.guild.member(bot.user).hasPermission("BAN_MEMBERS")) return message.channel.send({embed:{
      title: "Permissions Invalid",
      color:654456
    }});

    if (message.mentions.users.size < 1) return message.channel.send({embed:{
      title: "Must specify a user!",
      color:654456
    }});

    let banmember = message.guild.members.get(message.mentions.users.first().id);
    let user = message.mentions.users.first();
    let reason = message.content.split(' ').slice(2).join(' ');

    if (user !== '.Storage/bans.json') {
      if (!ban[user.id]) ban[user.id] = {}
      if (!ban[user.id].bans) ban[user.id].bans = 0;
      if (!ban[user.id].username) ban[user.id].username = user.username;
    }      

    if(!reason) return message.channel.send({embed:{
      title: "You must provide a reason!",
      color:654456
    }});

    if (!banmember) return message.channel.send({embed:{
      title: "User is not valid!",
      color:654456
    }});
    
    const ban1 = new Discord.RichEmbed()
      .setAuthor(""+message.guild.name+" | "+message.guild.id+"", message.guild.iconURL)
      .setColor(654456)
      .setFooter('bot.log', bot.user.avatarURL)
      .setThumbnail(user.avatarURL)
      .setTimestamp()
      .setDescription('**Username:** '+user.username+'#'+user.discriminator+'\n**UserID:** '+user.id+'\n**Action:** Was banned\n**Banned By:** '+message.author.username+'\n**Reason:**'+(reason || ' N/A'));

    if (message.member.hasPermission("BAN_MEMBERS")) banmember.ban().then(member => {
        console.log(""+message.author.username+" banned "+user.username+"");
        modlog.send({embed: ban1}).catch(console.error);
    })
#

anyone see whats wrong here

inner jewel
#

saving data in json files

topaz fjord
#

it wont send the ban embed

cosmic plover
#

saving data in json files

topaz fjord
#

you guys are no help

inner jewel
#

saving data in json files backfires

topaz fjord
#

well it works on my pc

#

but not my ubuntu vps

hollow abyss
#

Saving data in JSON files is always an issue.

topaz fjord
#

if you wanna help then help, otherwise just stay out of it

#

there i fixed it myself

#

with no help from you guys

slate patrol
#

g4u

earnest phoenix
#

@topaz fjord Instead of if (!message.guild.member(bot.user).hasPermission("BAN_MEMBERS")), use if (!message.guild.me.hasPermission("BAN_MEMBERS"))

rapid musk
#
exports.run = (msg, args) => {
  const srole = args.slice(0).join(' ');
  if(!msg.author.id == msg.guild.owner.id) return msg.channel.send("This command is only avalible to the guild owner and people who he/she adds to a list")
  if(!srole) return msg.channel.send("Please provide a role you would like to have set has the mod role")
  sql.get(`SELECT * FROM gconfig WHERE guildID = "${msg.guild.id}"`).then(row => {
    if (!row) {
      sql.run("INSERT INTO gconfig (guildID,srole) VALUES (?, ?)", [msg.guild.id,`${srole}`]);
    } else {
      sql.run(`UPDATE gconfig SET srole = ${srole} WHERE guildID = ${msg.guild.id}`);
    }
  }).catch(() => {
    console.error;
    sql.run("CREATE TABLE IF NOT EXISTS gconfig (guildID TEXT,srole TEXT )").then(() => {
      sql.run("INSERT INTO gconfig (guildID,srole) VALUES (?, ?)", [msg.guild.id,`${srole}`]);
  });
})
sql.get(`SELECT * FROM gconfig WHERE guildID ="${msg.guild.id}"`).then(row => {
     if (!row) return msg.reply("No mod role is set");
     msg.reply(`**${row.srole}** is now the mod role for this server`);
   });
}
``` its saying  Error: SQLITE_ERROR: no such table: gconfig
#

i dont get that cause i see the file

#

in the bot folder

earnest phoenix
#

The file itself isn't the table

#

The file is the database

#

Re-run the script, because I see a sql.run("CREATE TABLE IF NOT EXISTS gconfig (guildID TEXT,srole TEXT )")

rapid musk
#

it worked this time..

#

why did it work the second time?

#

Also if i run it again after i set the srole once it doesnt update the srole.(this is my first time using SQL. sorry)

topaz fjord
#
bot.user.setPresence({ game: { name: prefix + "help" + " | " + bot.guilds.size + " Guilds", type: 0 }});
#

how would i change this so it streaming the game

#

so it says streaming"" not playing""

carmine berry
#

type 1

topaz fjord
#

k

#

@carmine berry doesnt work

carmine berry
#

you need to include a link too

#

ust do

topaz fjord
#

so like

carmine berry
#

just do that

topaz fjord
#

so how would i do it

#

type 1 (link?)

carmine berry
#

url: link

topaz fjord
#

but i mean how would i format it

#
bot.user.setPresence({ game: { name: prefix + "help" + " | " + bot.guilds.size + " Guilds", type: 1 }});
#

where would i put the link in there

jagged plume
#

url

topaz fjord
#

im asking where in that line of code

carmine berry
#

inside game obj i think

#

if not outside game obj

topaz fjord
#

still makes absolutely no sense to me

#

anyways i gtg sleep

solemn oyster
#
game: { name: "", type: 1, url: "https://www.twitch.tv/"}
restive silo
#

why you setPresence instead setGame Think

#

setGame format it for you

#

and call setPresence