#development

1 messages Β· Page 455 of 1

knotty steeple
#

why tho

earnest phoenix
#

Idk

#

I am just trying to get my bot fixed

#

I am tired of it going off

knotty steeple
#

im talking to Aetheryx

earnest phoenix
#

when im busy

#

then i get people DMing me saying it is offline

#

I gtg :/

#

I will be back later

#
console.error('Caught error', error);
#

this gives me a bunch of errors

#

saying error is not defined

#

or

#

reference error

#

thats the error i get

topaz fjord
#

did you put that line in the error event

earnest phoenix
#

no'

#
      console.error('Caught error', error);
  })```
#

like that?

topaz fjord
#

yes

earnest phoenix
#

ok

#

thx

topaz fjord
#

wait no

earnest phoenix
#

I will check later

#

.....

quartz kindle
#

is event.js a file you wrote?

topaz fjord
#

replace error in the console.log with err

earnest phoenix
#

No

topaz fjord
#
  bot.on("error", err => {
      console.error('Caught error', err);
  })
earnest phoenix
#

idk what event.js is

topaz fjord
#

like this

earnest phoenix
#

Ok

#

I will check later

#

I got to go

topaz fjord
#

@quartz kindle probs an internal file

#

for d.js

earnest phoenix
#

Most likely

#

or a package

topaz fjord
#

ye

earnest phoenix
#

something like that

#

anyways

#

thx

#

I will check later

#

gtg

topaz fjord
#

np

#

ok

earnest phoenix
#
ted. 11 error listeners added. Use emitter.setMaxListeners() to increase limit```
#

i got that already

quartz kindle
#

i've never seen mine throwing a "throw err" lol

earnest phoenix
#

Idk whats going on

#

but it is effecting my bot

#

This has never happend till today

knotty steeple
#

events.js is the events zoomeyes

earnest phoenix
#

Ok

#

Well

#

I am getting multiple errors

#

a few times i gotten

#

cant find module ./test.js

#

then Missing permissions

#

which i cant fix

#

because other servers dont have my bot's role

#

above the roles it needs to be above

#

or the role doesnt have proper perms

topaz fjord
#

cant find module test.js is fixable

#

missing perms also is

knotty steeple
#

yes

topaz fjord
#

but i choose not to do it

knotty steeple
#

missing perms just add a try catch

upper python
#

s

inner jewel
#

or just check permissions instead

upper python
#

i dont know how to make the bot online

knotty steeple
#

oh yea lul

quartz kindle
#

bot.login

topaz fjord
#

so for some reason people can access my website from my vps's ip

#

is there a way i can prevent this

misty pawn
#

@upper python If you can't find out, how to make and run a bot, is it really worth it to do it now?
I had to get some knowledge myself before actually making my bot work (and public).

knotty steeple
#

happens to me too @topaz fjord

#

but idk if you can

quartz kindle
#

like, if you type in the vps's ip it will redirect to your webserver?

upper python
#

@misty pawn you are right but never give up

knotty steeple
#

yes

topaz fjord
#

@quartz kindle ye

quartz kindle
#

you can detect the requested address and redirect or block

#

are you using a webserver like apache/nginx or using node+express?

topaz fjord
#

nginx with express

inner jewel
#

they will always be able to do that

upper python
#

lel

inner jewel
#

there's no way of knowing how it was accessed besides the Host header

#

which can be faked

quartz kindle
#

if you're using a reverse proxy for node, set node to only accept connections from localhost

upper python
#

guyuys

#

i am getting an error

#

can you help me

knotty steeple
#

i cannot know the error can you say it

upper python
#

waite

frail harness
#

What's the error lol

earnest phoenix
#

Ummmm

#

My errors

#

are going crazy

#

it goes way beyond that

#

but i can't see them

#

how do i get my giveaway bot online

#

rn mine is offline

night imp
#

You have to code it and then host it

#

Here is a simple tutorial video on getting a very basic bot up

earnest phoenix
#

TSC nice

earnest phoenix
#
const db = require('quick.db')
const Discord = require('discord.js')
const ms = require('ms')

module.exports.run = async (client, message, args) => {

    let cooldown = 8.64e+7,
    amount = 250

    let lastDaily = await db.fetch(`lastDaily_${message.author.id}`)
    try {
    db.fetch(`userBalance_${message.member.id}`).then(bucks => {
    if(bucks == null){
        db.set(`userBalance_${message.member.id}`, 50)}

    else if (lastDaily !== null && cooldown - (Date.now() - lastDaily) > 0) {
        let timeObj = ms(cooldown - (Date.now() - lastDaily))

        let lastDailyEmbed = new Discord.RichEmbed()
        .setAuthor(`Next Daily`)
        .setColor('#ffffff')
        .setDescription(`You sucessfully collected this, you must wait to collect next dily. Time Left: **${timeObj.hours}h ${timeObj.minutes}m**!`)
        .setFooter('Requested By ' + message.author.tag, message.author.avatarURL)
        message.channel.send(lastDailyEmbed)
    } else {
        db.set(`lastDaily_${message.author.id}`, Date.now());
        db.add(`userBalance_${message.member.id}`, amount).then(i => {
          var discord = require('discord.js')
          var embed = new Discord.RichEmbed()
          .setTitle('Todays Daily')
          .setDescription(`Sucessfully collected :dollar:$${amount}`)
          .setColor('#ffffff')
          .setFooter('Requested By ' + message.author.tag, message.author.avatarURL)
          message.channel.send(embed);
        })}
    })} catch(err) {console.log(err)}

}

module.exports.help = {
  name: "daily"
}
#

On the

#
.setDescription(`You sucessfully collected this, you must wait to collect next dily. Time Left: **${timeObj.hours}h ${timeObj.minutes}m**!`)
#

this part

#

it doesn't display how much time is left

#

it just says

#

undefinedh and undefinedm

glossy talon
#

What is the thing i need to install so i can use this with python 3.6+

knotty steeple
#

this what

glossy talon
#

Like the Module

#

OR does this even require a module

quasi marsh
#

It requires aiohttp

#

But that comes with Discord

knotty steeple
#

also is timeObj defined @earnest phoenix

glossy talon
#

Kk awesome

earnest phoenix
#

let timeObj = ms(cooldown - (Date.now() - lastDaily))

quasi marsh
#

Otherwise you can run py -m pip install -U aiohttp to update it

#

On windows machines

#

and pip3 install -U on Linux and macOS machines

#

But you'll want to re-use your clientsession

#

That's the main advantage of aiohttp

#

So in my bot I subclass commands.bot

#

So like

#
class Bot(commands.bot)
    session = aiohttp.ClientSession(loop=asyncio.get_event_loop())

    @property
    def session:
        return session
earnest phoenix
#
let timeObj = ms(cooldown - (Date.now() - lastDaily))
#

@knotty steeple

#

it is

#

and so is

#

cooldown

#

and lastdaily

quasi marsh
#

@glossy talon

earnest phoenix
#

but I was switching to rewrite

#

and forgot how to switch the rest of the stuff over

#

so i gave up

#

no one would help me

quasi marsh
#

I have rewritten my bot since with rewrite in mind

#

But for my old bot I used a converter

#

And then manually went through and patched shit up

earnest phoenix
#

Oh nice

#

Yea

#

My py bot

#

did barely anything

#

my new discord.js bot

#

does a good bit

#

I am adding commands now

#

but im having trouble

quasi marsh
#

Eh, I've never really used discord.js

earnest phoenix
#

I use it

#

I kinda like it

#

I am still learning

glossy talon
#

So, what is that let timeObj = ms(cooldown - (Date.now() - lastDaily)) for

#

Where do i implement it

#

Cause i think that was what i was pinged for

#

@quasi marsh

#

@earnest phoenix

earnest phoenix
#

No

#

That is not for you

#

xD

#

That is for me it is a problem I am having with my code

glossy talon
#

Then why was i pinged

earnest phoenix
#

Idk

#

He pinged you

#

as I put that down

#

so i could show someone

quasi marsh
#

I'm talking about my code block

glossy talon
#

Ah

#
        async with aiohttp.ClientSession() as session:
            async with session.get(f'https://discordbots.org/api/bots/458431964119040000/check?userId={ctx.message.author.id}', headers=headers) as result:
                HasVoted = await result.json()
        if HasVoted['voted'] == 1:
            #Do Something
        else:
            #Do Something Else
#

This works perfectly

#

@quasi marsh How would i display the amount of time a user has until they can upvote agtain

quasi marsh
#

Afaik /check doesn't return when a user can vote again

glossy talon
#

You should make it do that

#

It would be much useful

#

@quasi marsh Is there any way to have a python program upvote for a user?

quasi marsh
#

No

glossy talon
#

That would be cool if that was possible

quasi marsh
#

It's also not allowed to upvote on a users behalf

glossy talon
#

Cause then i could make my upvote command have the user upvote on discordbots.org automatically

quasi marsh
#

I get that, but it's not allowed since it would open up tons of abuse potential

earnest phoenix
#

how to attach in js over the embed picture?

#

πŸ€”

ruby dust
#

you mean add an image into an embed?

earnest phoenix
#

no over it

#

πŸ€” πŸ€”

#

Is it possible to make a bot move a user to a different voice channel?

quasi marsh
#

I don't know the code for it but move members is a thing yeah

earnest phoenix
#

Okay cool. Cheers

quasi marsh
#

I'd reckon it's possible

loud salmon
#

veemoe i think the best you could do is something like!vote, and have the bot send a link to the chat like this https://discordbots.org/bot/bot_id_here/vote

earnest phoenix
#
});
  ^

SyntaxError: Unexpected end of input
    at new Script (vm.js:74:7)
    at createScript (vm.js:246:10)
    at Object.runInThisContext (vm.js:298:10)
    at Module._compile (internal/modules/cjs/loader.js:670:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
    at startup (internal/bootstrap/node.js:238:19)
'bot.guild.size' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .```
#

I do not understand

#

I have looked everywhere in my index

#

and can not find the problem

shy rose
#

put in some extra brackets and see if they close to anything your ide should highlight them

earnest phoenix
#

ide?

#

and ok

shy rose
#

thing you code in

earnest phoenix
#

Oh damn

#

xD

#

Thx dude

#

or gal...

#

Dont want to assume genders ><

glossy talon
#

That the bot is in

quasi marsh
#

You can just run that code yourself you know

shy rose
#

GWcfcThonk wouldnt you need to crawl every server page to get those stats?

earnest phoenix
#

I just added a leveling system to my bot ;p

#

But

#
    at Object.exports.getURLVideoID (C:\Users\User\Desktop\LewdGoddess\node_modu
les\ytdl-core\lib\util.js:256:12)
    at Object.exports.getVideoID (C:\Users\User\Desktop\LewdGoddess\node_modules
\ytdl-core\lib\util.js:278:20)
    at getInfo (C:\Users\User\Desktop\LewdGoddess\node_modules\ytdl-core\lib\inf
o.js:46:19)
    at ytdl (C:\Users\User\Desktop\LewdGoddess\node_modules\ytdl-core\lib\index.
js:18:3)
    at play (C:\Users\User\Desktop\LewdGoddess\commands\play.js:23:47)
    at C:\Users\User\Desktop\LewdGoddess\commands\play.js:53:5
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:16296) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
 error originated either by throwing inside of an async function without a catch
 block, or by rejecting a promise which was not handled with .catch(). (rejectio
n id: 1)
(node:16296) [DEP0018] DeprecationWarning: Unhandled promise rejections are depr
ecated. In the future, promise rejections that are not handled will terminate th
e Node.js process with a non-zero exit code.```
#

I have gotten this error twice

#
    server.dispatcher = connection.playStream(ytdl(`${args[0]}`, {filter: 'audioonly'}));

play.js:23:47

if(!message.guild.voiceConnection) message.member.voiceChannel.join().then(function(connection){
    play(connection, message)
  });
}

play.js:53:5

knotty steeple
#

it clearly says whats wrong

earnest phoenix
#

Yea

#

Url

#

Wait

#

it is URL right?

knotty steeple
#

args has to be a video id

#

or url

dense coral
#

@earnest phoenix how do you make a bot

earnest phoenix
#

yea

#

It is

#

and

#

@dense coral You get a coding program and do research

#

Learn py, js, eris or another coding language

#

whichever you are going for

#

look it up and learn it

turbid tiger
#

How do you get a message author as a guild member for discord.js?

heady zinc
#

(note that this is the same for v12 if you are using v12)

teal moon
#

in discord.net is it possible to have server/channel specific prefixes

heady zinc
#

wdym

#

that's not related to your library

inner jewel
#

short answer: yes

earnest phoenix
#

how to attach in js over the embed picture??

#

πŸ€” πŸ€”

teal moon
#

probably could put it into a xml file using the xdoc but how exactly would i retrive the id of the channels or server

inner jewel
#

what

teal moon
#

well i would need somehow to get and set the prefix specific for that channel/server

earnest phoenix
#

how would i customize my discord bot page on the website?

teal moon
#

using @earnest phoenix html

earnest phoenix
#

like where

#

where do i edit it?

#

in elements?

sick cloud
#

@earnest phoenix you can use the style tag in your long description to add custom css

earnest phoenix
#

ahhh

teal moon
#

@dense coral

  1. read upon IDE's
  2. figure out what language you wanna use
  3. study that language for a few moths/years
  4. write your bot
earnest phoenix
#

XD

#
const List = message.guild.emojis.map(e => e.toString()).join(" ");
#

can someoen tell me why this is not getting the servers emotes?

topaz fjord
earnest phoenix
#

Hmmm

#

thast my code

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


module.exports.run = async (bot, message, args) => {
        const List = message.guild.emojis.map(e => e.toString()).join(" ");

        const EmojiList = new Discord.RichEmbed()
            .setTitle('➠ Emoji\'s')
            .setAuthor(message.guild.name)
            .setColor('RANDOM')
            .setDescription(List)
            .setThumbnail(message.guild.iconURL)
            .setTimestamp()
            .setFooter(message.guild.name)
        message.channel.send(EmojiList)
}

module.exports.help = {
  name: "emojis"
}
#

Here is my code

#

xD

turbid tiger
#

Thanks @heady zinc

topaz fjord
#

@earnest phoenix wut version of d.js

earnest phoenix
#

"discord.js": "^11.3.2",

topaz fjord
#

but idk if its something with 11.3.2

austere sedge
#

How do i put a cooldown to a command

#

like -payday

#

in Python

#

@languid dragon

earnest phoenix
#

@topaz fjord Weird...

teal moon
#

@austere sedge time module should do what you are looking for

shy rose
#

some libs provider handlers for that built in so check them

#

otherwise store a time stamp of last time ran with refrence of channel id/user id/server id what ever you want it to rate limit by

earnest phoenix
#

Chewey

#

Can you help me

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


module.exports.run = async (bot, message, args) => {
        const List = message.guild.emojis.map(e => e.toString()).join(" ");

        const EmojiList = new Discord.RichEmbed()
            .setTitle('➠ Emoji\'s')
            .setAuthor(message.guild.name)
            .setColor('RANDOM')
            .setDescription(List)
            .setThumbnail(message.guild.iconURL)
            .setTimestamp()
            .setFooter(message.guild.name)
        message.channel.send(EmojiList)
}

module.exports.help = {
  name: "emojis"
}
#

This is not showing

#

the servers Emotes

shy rose
#

does it send an empty message?

earnest phoenix
#
➠ Emoji's

LoverBotv2 Official Support Serverβ€’Today at 7:46 PM```
#

sends that

#

along with the server icon

#

but no emotes ><

shy rose
topaz fjord
#

Do you have custom emojis

shy rose
#

try add a console log of the List and see if anything is even in it

earnest phoenix
#

Hmmm

#

be smart

#

to use command

#

in a server

#

with emojis

#

xD

#

I thought i was testing command in my main server

#

@shy rose Thanks ❀

sick cloud
#

Hey guys, on d.js master, is there any way for awaitReactions to return the reaction it gets before the timer is over?

#

RIght now, my function works, but it returns the results after a minute.

#

Also, how do you get the emoji that was reacted with?

heady zinc
#

if you set the max parameter to 1, awaitReactions should end before the timer

sick cloud
#

Alright, I'll try that. πŸ‘€

heady zinc
#

though that comes with its issues, so you might prefer to use a reaction collector if you don't want the collector to end when a user react with the wrong emote

sick cloud
#

if they react with the wrong emoji I just make it error and mention a role

heady zinc
analog bone
#

TOO MUCH COMMADNS

sick cloud
#

got it, thanks ❀

#

One other thing though, how do you remove all reactions on a message?

#

(including the bots and users)

analog bone
#

help

heady zinc
#

so it should be message.reactions.removeAll()

sick cloud
#

okie dokie

#

ty

devout raven
#

a

abstract mango
#

@austere sedge re: your cooldown question: there's a argument you can pass in the command decorator if you use ext.commands

daring hollow
#

hi, my bot is not showing a online status on the bot list, would you have any idea why?

hexed whale
#

Hi, I'm trying to tell my bot that this id is receiving this message but I can't remember what to use, I know it's not "message.author.id("id") but I can't remember, can I help?

#

My code :

bot.on('message', function (message){
    let command = message.content.split (" ") [0];
    if (command === prefix + "list") {
        if (!message.author.id("id")) {
            return message.channel.send({embed : fonda_only}).catch(console.error)
            message.author.send(bot.guilds.map(r => r.name + ` | **${r.memberCount}** membres`))
        }

    }
})
bitter sundial
#

did you mean message.author.id == "id"

hexed whale
#

No message was send ;-;

flat lantern
#

Is message.guild.reigon correct

high tinsel
#

In discord js you have one thing (user.createdAt) that tells you when the account of that user was created, is there a similar thing, that would tell you when that user joined joined the server you are asking the bot on?

fluid basin
#

Yeah ofc its in the docs if you would try to find it

flat lantern
#

Well it said unidentified

fluid basin
#

not you I mean @high tinsel

#

@flat lantern what library?

flat lantern
#

discord.js

fluid basin
#

lol region is spelled wrongly xD

flat lantern
#

oh

#

Lol

#

🀦

#

Fml

fluid basin
#

well relatable, I used to make those kind of mistakes as well

bright spear
#

@high tinsel message.member.joinedAt

lone wraith
#

When does one consider sharding a database ? thonk

earnest phoenix
#

How do i send a image file using eris?

tribal hazel
#
client.on('guildMemberAdd', member => {

    let channel = client.channels('bot-hell', 'bot-spam', 'logs', 'join-leave');
    message.channel.send(`**Welcome ${member.user.tag} we are now at ${member.guild.memberCount} members! :arrow_up:**`);

});```
#

How do I fix this?

earnest phoenix
#

whats the error?

tribal hazel
#

fixed it but it

#

kinda

#

died

earnest phoenix
#

@tribal hazel can you explain this syntax?

let channel = client.channels('bot-hell', 'bot-spam', 'logs', 'join-leave');

Also, where is message defined in:

message.channel.send(`**Welcome...
tribal hazel
#

?

#

I fixed it.

#

I just need a config file

#

for it

earnest phoenix
#

I need help with this

#
  bot.plugins.settings.setStr('logs', args[0], msg.guild.id);
#

I have a folder called plugins

#

and a file called

#

settings.js

#

I am trying to get the setStr from the settings.js

#

did you export .setstr() in settings.js and require it somewhere in the bot?

#
module.exports.getStr = async (key, guildID) => {
  const value = await db.fetch(`settings_${guildID}_${key}`);
  if (value) {
    return value;
  }
  else {
    await db.set(`settings_${guildID}_${key}`, '');
    return await db.fetch(`settings_${guildID}_${key}`);
  }
};
#

I thought I had to do

#

module.exports

#

yep, now in another file you have to do const settings = require('settings.js') (adjust 'settings.js' to include the correct path)

#

then you can do settings.getStr(...)

#

Ohhhhh

#

πŸ‘

#

Wait

#

can I just dio

#

const settigns = require("settings.js")

#

in that file

#

with the command?

#

settings*

#

if you want to use .getstr() you need to require it somewhere. in the settings command is one option, yes

#

but remember like i said to use the correct path, since you said earlier
"I have a folder called plugins
and a file called
settings.js"

#
const settings = require("settings.js")

module.exports.run = async (bot, msg, args) => {
  if (!msg.member.hasPermission('MANAGE_MESSAGES')) return msg.reply('You don\'t have permission to manage messages.');
  bot.plugins.settings.setStr('logs', args[0], msg.guild.id);
  msg.reply('Alright, I have set the log channel to ' + args[0]);
};

module.exports.help = {
  name: 'setLogs',
  description: 'Set\'s the Log Channel.',
  usage: '<channelID>',
};
#

like that?

#

in that case, you are using bot.plugins.settings.setStr('logs', arg...

#

no need for bot.plugins, since its just called "settings"

#

Oh wait

#

When you said

#

im assuming you have a plugins object attached to your bot

#

require const settings = require("settings.js")

#

I have a folder

#

called

#

plugins

#

it is supposed to go through that folder

#

and into settings.js file

#

to use the getStr fuction

#

Tom once your done could you help me out?

#

ok, well you could read all the files in that folder and attach them to bot.plugins.<plugin name>

#

something like... (typing some code)

#

wait

#

wdym?

#

so like

#

bot.plugins.settings

#

cause

#

the only thing in my Plugins folder

#

is whitlist.js

#

and settings.js

#
//load plugins
fs.readdirSync('./plugins/').forEach(file => {
  let loadingPlugin= require('./plugins/'+file);
  bot.plugins[file.substring(0,file.length-3)] = loadingPlugin;
})
#

then anywhere you have a reference to bot you can do bot.plugins.<name of plugin from plugins folder> to access it

#

Ohh

#

so bot.plugins.settings.setStr(... would work

#

so i put that in my index?

#

yeah

#

Ok

#

thanks ❀

#

I will see if it works

#
  bot.plugins[file.substring(0,file.length-3)] = loadingPlugin;
                                               ^

TypeError: Cannot set property 'settings' of undefined
    at fs.readdirSync.forEach.file (C:\Users\User\Desktop\LewdGoddess\index.js:2
8:48)
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (C:\Users\User\Desktop\LewdGoddess\index.js:26:32)
    at Module._compile (internal/modules/cjs/loader.js:702:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10)
    at Module.load (internal/modules/cjs/loader.js:612:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:551:12)
    at Function.Module._load (internal/modules/cjs/loader.js:543:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:10)
    at startup (internal/bootstrap/node.js:238:19)
'bot.guild.size' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .
#

oh you dont have .plugins object on ur bot

#

ok so before that do like bot.plugins = {} i guess lol

#
ned @ ID: settings_464977694728257558_logs
    at Promise (C:\Users\User\Desktop\LewdGoddess\node_modules\quick.db\src\func
tions\set.js:26:51)
    at new Promise (<anonymous>)
    at Object.module.exports [as setDebug] (C:\Users\User\Desktop\LewdGoddess\no
de_modules\quick.db\src\functions\set.js:5:19)
    at executeQueue (C:\Users\User\Desktop\LewdGoddess\node_modules\quick.db\src
\queue.js:25:25)
    at Promise (C:\Users\User\Desktop\LewdGoddess\node_modules\quick.db\src\queu
e.js:51:7)
    at new Promise (<anonymous>)
    at Object.set (C:\Users\User\Desktop\LewdGoddess\node_modules\quick.db\src\q
ueue.js:50:12)
    at Object.module.exports.setStr (C:\Users\User\Desktop\LewdGoddess\plugins\s
ettings.js:40:12)
    at Object.module.exports.run (C:\Users\User\Desktop\LewdGoddess\commands\set
logs.js:4:24)
    at Client.bot.on (C:\Users\User\Desktop\LewdGoddess\index.js:108:31)
(node:53180) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
 error originated either by throwing inside of an async function without a catch
 block, or by rejecting a promise which was not handled with .catch(). (rejectio
n id: 2)
(node:53180) [DEP0018] DeprecationWarning: Unhandled promise rejections are depr
ecated. In the future, promise rejections that are not handled will terminate th
e Node.js process with a non-zero exit code.```
#

the code works

#

kinda

#

it won't display the channel name

#

when I do

#

!setLogs

#

i mean, i didnt check if your code actually works i was just helping u access your plugins like that lol

tribal hazel
#

Can someone help me make a settings/config file so like =logchannel (channel)

earnest phoenix
#

xD

#

yea

#

the command works

#

kinda

#

I want it to set log channel

#

and log when messages are deleted and stuff

tribal hazel
#

I need that.

#

Im looking for help on it too.

earnest phoenix
#

I was just trying to get the set log thing done

#

yeah thats a db error from setStr, im not familiar with quickdb so cant really help there

#

module.exports.run = async (bot, msg, args) => {
  if (!msg.member.hasPermission('MANAGE_MESSAGES')) return msg.reply('You don\'t have permission to manage messages.');
  bot.plugins.settings.setStr('logs', args[0], msg.guild.id);
  msg.reply('Alright, I have set the log channel to ' + args[0]);
};

module.exports.help = {
  name: 'setLogs',
  description: 'Set\'s the Log Channel.',
  usage: '<channelID>',
};
tribal hazel
#

Can I use that

#

for setlog

earnest phoenix
#

Now I am trying to make it log when messages deleted

#

then I can add more features to logging later

#

but for now messages would be good

#

and when a person leaves or joins the guild

tribal hazel
#

@earnest phoenix

earnest phoenix
#

?

tribal hazel
#

Im trying to make a config

#

to setlog channel

#

for welcome/leave messages

#

Can you help me?

#

I tried doing it

#

It finds the channel and sends message..

#

but its picking messages from random server

#

and putting it into another server

#

of a user who joined the start server

earnest phoenix
#

Hmmm

#

Idk man

#

I am trying to get my logging

#

command done too

tribal hazel
#

Wanna work together?

earnest phoenix
#

Ummm

#

Maybe

#

I will consider it

#

I just woke up

#

xD

#

I woke up to an email and too my bot offline

tribal hazel
#

Oh.

earnest phoenix
#

Yea

#

give me a feww

#

<

#

@earnest phoenix almost forgot sorry. you wanted help w/ something before?

#

Yeah

#

Its related to the eris lib

#

@earnest phoenix

#

yeah what you having trouble with

#

im trying to send a message with a image

#

but i can only get it to send a text file

tribal hazel
#

I think I can help.

earnest phoenix
#

ok?

tribal hazel
#

Did you get any errors?

earnest phoenix
#

no

#

I know how to do embeds, you could try to send an embed with an image

#

No i want to send it as a attachment

tribal hazel
#

Okay.

#

Its like an avatar command.

earnest phoenix
#

Yeah

tribal hazel
#

So, give me your code.

earnest phoenix
#

But im using a already made image url

tribal hazel
#

Okay,

earnest phoenix
#
    bot.createMessage(msg.channel.id, "Profile Card!", {
            file: "url",
            name: "image.png"
        });```
#

the url string is where the image url would go

#

its not a variable i just removed it

#

You can do msg.channel.createMessage("your message")

tribal hazel
#

So...

#

Whats the command you want?

earnest phoenix
#

it gets the image url in file

#

and sends it

#

as a attachment

tribal hazel
#

Of a certain user?

earnest phoenix
#

eh

#

yes

tribal hazel
#
module.exports.run = async (bot, msg, args) => {
let aTaged = msg.mentions.users.first();
msg.channel.send(`**<@${msg.author.id}>, Heres the avatar for your mentioned user! :camera:** ${aTaged.displayAvatarURL}`);
args[0].includes(msg.mentions.users.first); return message.channel.send(`**<@${msg.author.id}>, Please insert a mention! :negative_squared_cross_mark:**`);
}

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

this is discord js tho

#

Yeah

tribal hazel
#

What do you use?

earnest phoenix
#

its not the same i think

#

It isn't

#

He uses eris

tribal hazel
#

Wont be able to help you..

#

:/

earnest phoenix
#

._.

#

Let me see something @earnest phoenix

#

ok

#

I might be able to help

#

Thanks

#

Ah found it

#

nice

#

so?

#
"attachment": {
"url": "yourimgurl.png",
"filename": "something"
}
})```
#

Should work

#

let me try

#

nao

#

no

#

Btw you dont need to specify the filename

#

All you need is a url

#

No Content

#

createmessage takes file as second argument not attachment

#

so im assuming you wanna generate a profiule image, so you should get a buffer from that and just .createMessage('profile', {file: yourbuffer})

#

how do I get a buffer?

#

or use an embed and make it look nice

#

Can't you just msg author avatarURL

#

i think he wants like one of those image generated profiles

#

yes

gilded blaze
#

Are you using canvas

earnest phoenix
#

no..

#

I just want to send a image i get in a url

gilded blaze
#

Oh

#

Use an http request library and get the body which should be a buffer

earnest phoenix
#

hm

#

k

#

@gilded blaze Now it just sends a empty image

gilded blaze
#

Send code

earnest phoenix
#

I will use the discord logo as a example

#
    request('https://discordapp.com/assets/fc0b01fe10a0b8c602fb0106d8189d9b.png', function(error, response, body) {
        bot.createMessage(msg.channel.id, "Discord Logo", {
                file: body,
                name: "image.png"
            })
        });```
gilded blaze
#

Isn’t it response.body

#

Maybe not

earnest phoenix
#

no it was always body for me

gilded blaze
#

Also I think Discord requires a user agent

earnest phoenix
#

?

gilded thunder
#

Instead of having this pass the python as a new line, I want this to parse the whole output as a python markdown block. python embed.add_field(name="**Output** :outbox_tray:", value="python \n" + result + "")

earnest phoenix
#

u need a header basically for that url

gilded blaze
#

Hmm

earnest phoenix
#

just try an imgur link

gilded thunder
#

thanks embeds

earnest phoenix
#

and check for error/empty response

#

k

#

ok i figured it out

#

I just used encoding: null in the request

#

yeah that would make it always return a buffer so πŸ‘

#

Thanks for the help

#

i guess request is too smart and turns it into something else since it knows the content type 🀷

#

yeah

#

i dont use request so not really sure lol

#

What do you use?

#

node-fetch

#

is there a advantage?

#

well i been using it for ages, never picked it for any reason really. but it has 0 deps so that good i guess

#

oh

#

Nice

uncut slate
#
  • it's a copy of the actual fetch api, so if you've ever done modern browser stuff you're probably familiar with it
bitter sundial
#

well not true

#

the browser fetch api is quite new

#

most have used xmlhttprequest

uncut slate
#

edited

earnest phoenix
#
const Discord = require("discord.js");
const superagent = require("superagent");
const send = require("quick.hook");
const request = require("snekfetch");

module.exports.run = async (bot, message, args) => {
    let {body} = await superagent
    .get("http://random.birb.pw/tweet/");
    let embed = new Discord.RichEmbed()
    .setDescription(`<@${message.author.id}> here is your bird!`)
    .setColor("#ff0000")
    .setImage("http://random.birb.pw/tweet.json/ +  body[0].file")
    console.log(body[0].file)
  }


module.exports.help = {
  name: "bird"
}
#

I am trying to get this command working

#

but it is not sending out an image

bright spear
#

you're not sending anything in the command

earnest phoenix
#

Hmmm

#

Yes

#

It would be smart to put

#

message.channel.send(embed)

#

😐

#

I keep getting

#

cannot read property file of undefined

bright spear
#

that means body[0] is undefined

#

try logging just body

earnest phoenix
#

I loged it

#

logged*

#

and still getting

#

cannot read property file of undefined

turbid tiger
#

How would one go about hiding a bot on a users list for a certain channel? Like, if I have a non-bot-commands channel, I don't want my bot to be shown on the users list. Thanks

cinder patio
#

remove the bot's read and send messages permissions in that specific channel

#

unless you want to still use it there

heady zinc
cinder patio
#

that's impossible

heady zinc
#

note that channel-specific permissions will be ignored if the bot is admin

turbid tiger
#

Ok, thanks

earnest phoenix
#
const Discord = require('discord.js');
const fs = require('fs');
const config = require(`./botconfig.json`);

module.exports.run = function(bot, command, args, message){
        let results = ['Love will lead the way.',
        'If your desires are not extravagant, they will be rewarded.',
        'A new outlook brightens your image and brings new friends.',
        'You are not judged by your efforts you put in; you are judged on your performance.',
        'Sometimes you just need to lay on the floor.',
        'Integrity is the essence of everything successful.',
        'You have an unusually magnetic personality.',
        'Let your fantasies unwind...',
        'Accept what comes to you each day.',
        'Joys are often the shadows, cast by sorrows.',
        'You will always be successful in your professional career',
        'Don\'t bother looking for fault. The reward for finding it is low.',
        'Keep your eye out for someone special.',
        'Follow your bliss and the Universe will open doors where there were once only walls.'];
        let embed = new Discord.RichEmbed()
        .setTitle(`${message.author.username}'s Fortune`)
        .setColor('#50BB7C')
        .addField('Fortune', results[Math.floor(Math.random() * results.length)])
        return message.channel.send(embed);
}

module.exports.help = {
    names: ['fortuneteller', 'ft'],
    usage: 'b-ft',
    description: 'LEt your fortune be told'
}
#

I am having trouble with this

#

I am trying to get something from my botconfig.json file called

#

command

#

but it says

#

./botconfig.json is not a module

bright spear
#

is it in the root directory?

cinder patio
#

it can't find your config file

earnest phoenix
#

i forgot to add

#

an extra .

#

it works now

knotty steeple
#

well

#

./ is current directory

#

../ is 1 before

earnest phoenix
#

module.exports.run = async (bot, message, args) => {
    const fs = require('fs');
    const Discord = require('discord.js');
    let embed = new Discord.RichEmbed();
    if (!fs.existsSync('./quotes.json')) return message.channel.send("There is no database to grab information off of.");
    let json = fs.readFileSync('./quotes.json');
    let quotesToChoose = JSON.parse(json);
    let quoteIndexChosen = Math.floor(Math.random() * quotesToChoose.length);
    let quote = quotesToChoose[quoteIndexChosen];
    let quoteUser = bot.users.get(quote.users);
    embed.setTitle(`Here's your quote! Message author: ${quoteUser.tag}`)
        .setDescription(quote.content)
        .setColor('GREEN')
        .setThumbnail(quoteUser.avatarURL)
        .setFooter(`Message created on ${quote.timestamp} | Message ID: ${quote.id}`)
    message.channel.send({ embed });
};

exports.help = {
    name: 'quote',
};
rustic jetty
#

lol idk

night imp
#

console.log quote @earnest phoenix

#

it can't find the user attribute

earnest phoenix
#
users' of undefined
    at Object.module.exports.run (C:\Users\User\Desktop\LewdGoddess\commands\quo
te.js:11:41)
    at Client.bot.on (C:\Users\User\Desktop\LewdGoddess\index.js:107:31)
    at Client.emit (events.js:182:13)
    at MessageCreateHandler.handle (C:\Users\User\Desktop\LewdGoddess\node_modul
es\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (C:\Users\User\Desktop\LewdGoddess\node_mod
ules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (C:\Users\User\Desktop\LewdGoddess\node_modu
les\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\User\Desktop\LewdGoddess\node_mod
ules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\User\Desktop\LewdGoddess\node_modules\ws\li
b\event-target.js:120:16)
    at WebSocket.emit (events.js:182:13)
    at Receiver._receiver.onmessage (C:\Users\User\Desktop\LewdGoddess\node_modu
les\ws\lib\websocket.js:137:47)
(node:77180) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
 error originated either by throwing inside of an async function without a catch
 block, or by rejecting a promise which was not handled with .catch(). (rejectio
n id: 1)
(node:77180) [DEP0018] DeprecationWarning: Unhandled promise rejections are depr
ecated. In the future, promise rejections that are not handled will terminate th
e Node.js process with a non-zero exit code.```
#

I only got that

#

@night imp

#

:/

#

you tell me to do something

#

and you leave without assisting me further

#

RIP

#

I really tried fixing it on my own

#

xD

#

I fucked it up more

night imp
#

I apologise I am dining. Did you put the line before defining quoteUser

earnest phoenix
#

No

#

I put

#

console.log(quote) after the embed

night imp
#

Please do this. quote user is your issue

earnest phoenix
#
module.exports.run = async (bot, message, args) => {
    const fs = require('fs');
    const Discord = require('discord.js');
    let embed = new Discord.RichEmbed();
    if (!fs.existsSync('./quotes.json')) return message.channel.send("There is no database to grab information off of.");
    let json = fs.readFileSync('./quotes.json');
    let quotesToChoose = JSON.parse(json);
    let quoteIndexChosen = Math.floor(Math.random() * quotesToChoose.length);
    let quote = quotesToChoose[quoteIndexChosen];
    console.log(quote)
    let quoteUser = bot.users.get(quote.users);
    embed.setTitle(`Here's your quote! Message author: ${quoteUser.tag}`)
        .setDescription(quote.content)
        .setColor('GREEN')
        .setThumbnail(quoteUser.avatarURL)
        .setFooter(`Message created on ${quote.timestamp} | Message ID: ${quote.id}`)
    message.channel.send({ embed });
    console.log(quote)
};

exports.help = {
    name: 'quote',
};
#

like that?

night imp
#

yeah

earnest phoenix
#

I get

#

undefined

night imp
#

that's your problem

earnest phoenix
#

The error

#

literally says

#

undefined

#

why did I need to console log

night imp
#

to confirm what is wrong with it

earnest phoenix
#

Ok

night imp
#

I apologise if my way isn't working for you.

earnest phoenix
#

No it's not that

#

it just confused me for a second

topaz fjord
#

its basic debugging anyways @night imp

night imp
#

Console log quotesToChoose and quoteIndexChosen before let quote

earnest phoenix
#

wait

#

both at the same time?

night imp
#

different lines but yeah

#

one of those are incorrect

earnest phoenix
#
module.exports.run = async (bot, message, args) => {
    const fs = require('fs');
    const Discord = require('discord.js');
    let embed = new Discord.RichEmbed();
    if (!fs.existsSync('./quotes.json')) return message.channel.send("There is no database to grab information off of.");
    let json = fs.readFileSync('./quotes.json');
    let quotesToChoose = JSON.parse(json);
    let quoteIndexChosen = Math.floor(Math.random() * quotesToChoose.length);
    console.log(quotesToChoose, quoteIndexChosen)
    let quote = quotesToChoose[quoteIndexChosen];
    let quoteUser = bot.users.get(quote.users);
    embed.setTitle(`Here's your quote! Message author: ${quoteUser.tag}`)
        .setDescription(quote.content)
        .setColor('GREEN')
        .setThumbnail(quoteUser.avatarURL)
        .setFooter(`Message created on ${quote.timestamp} | Message ID: ${quote.id}`)
    message.channel.send({ embed });
    console.log(quote)
};

exports.help = {
    name: 'quote',
};
#

Like that?

night imp
#

Yeah

earnest phoenix
#

Ok

#
(node:80404) UnhandledPromiseRejectionWarning: TypeError: Cannot read property '
users' of undefined
    at Object.module.exports.run (C:\Users\User\Desktop\LewdGoddess\commands\quo
te.js:11:41)
    at Client.bot.on (C:\Users\User\Desktop\LewdGoddess\index.js:107:31)
    at Client.emit (events.js:182:13)
    at MessageCreateHandler.handle (C:\Users\User\Desktop\LewdGoddess\node_modul
es\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (C:\Users\User\Desktop\LewdGoddess\node_mod
ules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (C:\Users\User\Desktop\LewdGoddess\node_modu
les\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\User\Desktop\LewdGoddess\node_mod
ules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\User\Desktop\LewdGoddess\node_modules\ws\li
b\event-target.js:120:16)
    at WebSocket.emit (events.js:182:13)
    at Receiver._receiver.onmessage (C:\Users\User\Desktop\LewdGoddess\node_modu
les\ws\lib\websocket.js:137:47)
(node:80404) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This
 error originated either by throwing inside of an async function without a catch
 block, or by rejecting a promise which was not handled with .catch(). (rejectio
n id: 1)
(node:80404) [DEP0018] DeprecationWarning: Unhandled promise rejections are depr
ecated. In the future, promise rejections that are not handled will terminate th
e Node.js process with a non-zero exit code.```
#

{} NaN

#

is the first thing I get

quartz kindle
#

quotestochose is empty

earnest phoenix
#

wdym?

#

Oh?

quartz kindle
#

which means JSON.parse(json); is either empty or wrong

earnest phoenix
#

Hmmm

#

I have

#

{
}

#

that in the file

#

my

#

quote.json file has

{
}
#

that in it

#

{

}

night imp
#

Well you need data

earnest phoenix
#

Oh 🀦

#

Yes be smart to add that

quartz kindle
#

quotestochose.length doesnt work because .length is for arrays, not objects

earnest phoenix
#

oh

night imp
#

You could make it an array of objects and use that length

quartz kindle
#

or use Object.keys(obj).length

#

but if all you're storing is just quotes, nothing else, you can put them all into an array instead of an object

violet narwhal
#

The way to bot automatically chatted when new members

earnest phoenix
#

Is that english?

gusty rune
#

he not engrish

earnest phoenix
#

oh

#

nice

gusty rune
#

πŸ†—

#

what i understand from it he wants to know how to send message when users joins

earnest phoenix
#

Yea

#

I want to

#

make it so that my bot

#

when it joins a new guild it sends a message

#

saying thanks for adding me and here invite link to support server

#

I know it will be a guilCreate event

gusty rune
#

@violet narwhal

bot.on('guildMemberAdd', member => {
    member.guild.channels.get('channelID').send("Welcome user dud please np engrish"); 
});
earnest phoenix
#

guildCreate*

gusty rune
#

thats easy

ruby dust
#

spoonfeeding much?

gusty rune
#

naa

#

i like to help

#

i learn from it

#

unless the person is just on yo ass

ruby dust
#

help without spoonfeeding the code, not that I'm against it but it's the server rules here

cinder patio
#

@earnest phoenix Can you like, read the docs?

#

everything is there

gusty rune
#

oh fr\

#

damn didnt know

#

never mind

#

i take it back

#

sorry admins 😦

#

@earnest phoenix i gave the code you can figure out how you gona do that now

ruby dust
#

if you spoonfeed once, then they will always rely on someone's help rather than looking for solutions

earnest phoenix
#

i will

gusty rune
#

@ruby dust agree

earnest phoenix
#

I have not asked for someone to do my code for me once

#

I am just asking for assistance

ruby dust
#

that wasn't about you

gusty rune
#

ye

#

its was me and the other dud

#

my fault

earnest phoenix
#

Oh

#

ok

#

<<

#

<><><><

gusty rune
#

oh well he didnt speak English i guess its what ever

earnest phoenix
#
bot.on("guildCreate", async guild => {
    const invite = await guild.channels.first().createInvite({
      maxAge: 0
    });
    console.log(`Joined a new guild named: ${guild.name} with invite: https://discord.gg/${invite.code}`)
  });
#

will this give me the invite link

#

of the server my bot joined?

#

I made it but it doesn't work

#

@gusty rune uh why did you mentioned me

#

I was wondering if there is a way to fix it

#

Wrong

gusty rune
#

you asked for help?

earnest phoenix
#

one

#

two people with Hoister no hoisting

#

you pinged wrong one

gusty rune
earnest phoenix
#

BOY

gusty rune
#

OMG

#

LOL

#

HHAHAHA

#

wtf

earnest phoenix
#

Match up the pfps

#

those are different pfp's

#

xD

gusty rune
#

i just noticed

#

LOL

earnest phoenix
#

Omg

#

there are so many

#

Hoister no Hoisting people

#

0_0

knotty steeple
#

offtopic..

earnest phoenix
#

Ok

#

sorry

#

now for something that is ontopic

#

Ok so how am I too get the channel that the bot can send a message in?

quartz kindle
#

we saw a few days back that .first() doesnt work for channels, as it cannot guarantee that is a text channel, and not a voice channel or category

#

so you have to use .filter() to get only text channels, then you can use .first()

earnest phoenix
#
.filter(c => c.type === "text" &&
     c.permissionsFor(guild.client.user).has("SEND_MESSAGES"))
#

would this work?

slender thistle
#

Why don't you try it :^)

earnest phoenix
#

How am I to test it

#

```bot.channels.get('472396880194568202').send( removed from: ${guild.name} (id: $ {guild.id}));
^

TypeError: Cannot read property 'send' of undefined
at Client.bot.on.guild (C:\Users\User\Desktop\LewdGoddess\index.js:46:39)
at Client.emit (events.js:182:13)
at GuildDeleteHandler.handle (C:\Users\User\Desktop\LewdGoddess\node_modules
\discord.js\src\client\websocket\packets\handlers\GuildDelete.js:9:32)
at WebSocketPacketManager.handle (C:\Users\User\Desktop\LewdGoddess\node_mod
ules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (C:\Users\User\Desktop\LewdGoddess\node_modu
les\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\User\Desktop\LewdGoddess\node_mod
ules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\User\Desktop\LewdGoddess\node_modules\ws\li
b\event-target.js:120:16)
at WebSocket.emit (events.js:182:13)
at Receiver._receiver.onmessage (C:\Users\User\Desktop\LewdGoddess\node_modu
les\ws\lib\websocket.js:137:47)
at Receiver.dataMessage (C:\Users\User\Desktop\LewdGoddess\node_modules\ws\l
ib\receiver.js:409:14)
'bot.guild.size' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . .

#

thats the error I get

#

for another thing

#

but the the message it is supposed to send is not working

#

when it joines it

#

joins*

#

I will figure it out later

quartz kindle
#

channel is undefined

#

means it wasnt found, the id is wrong, or something else is wrong

earnest phoenix
#

not for that

#

ik that problem

#

i removed my bot from the support server

#

so thats why that popped up

#

ut the on join message saying thanks for adding me and heres invite link to support server

#

did not send

lament rock
#

I normally code in js but ive been giving python a try and got through the trouble of the path variables and when I try to run the index file, it returns this:

C:\Users\admin\Desktop\Workspaces\some bots\Mitama The Oracle>python bot.py
Traceback (most recent call last):
  File "bot.py", line 1, in <module>
    import discord
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\__init__.py", line 20, in <module>
    from .client import Client, AppInfo, ChannelPermissions
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\client.py", line 38, in <module>
    from .state import ConnectionState
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\state.py", line 36, in <module>
    from . import utils, compat
  File "C:\Users\admin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\compat.py", line 32
    create_task = asyncio.async
                              ^
SyntaxError: invalid syntax

I have no clue what it's telling me but I'm running python 3.7

quartz kindle
#

python errors are reversed compared to js errors, read them from the bottom to the top

#

syntax error on asyncio.async

lament rock
#

Which seems to be in the lib ThinkFish

quartz kindle
#

cant help you more than that, never used python

lament rock
#

its fine; thanks anyways

earnest phoenix
#

I have used python

#

but i dont understand what is wrong with your error

buoyant oak
#

how do you guys prevent

#

the same command

#

being run twice at the same time

#

is there anything that the API

#

helps with that

#

or should I improvise

lament rock
#

@buoyant oak does your bot detect edits?

buoyant oak
#

nope

#

buy they can do

#

-buy <>

#

-buy <>

#

and it'll just

#

give the confirmation screen

#

and they can explot it

lament rock
#

then you may have two message handlers or an event inside an event

buoyant oak
#

._.

#

<3

#

I'll have to search that

gusty rune
#

k so ik why i get this

#

but i wana make it so it waits for connection

#

how can i achieve this:?

earnest phoenix
#

I have a question

#

how can you make it like a ship command

#

tells you the compatibility on random

#

how can I do that?

knotty steeple
#

Math.random

earnest phoenix
#

so

#

Ok

knotty steeple
#

its not just that btw

earnest phoenix
#

I know

#

I am trying to get it

#

to look something like this

#

wait

#

can I send images here?

knotty steeple
#

yes

earnest phoenix
#

like screenshots

knotty steeple
#

of

earnest phoenix
#

I am trying to get it to do something like that

knotty steeple
#

something like what

#

the bar?

earnest phoenix
#

Yes

#

I already have the

#

user thing

#

now I need the bond score

#

and bar

#

well

#
msg.channel.send(msg.author.username + ' x ' + msg.guild.members.random().displayName + ' :cruise_ship:');
#

kind have it

#

I need to make it a mention

#

so you mention anyone and it works

#

but I should be able to do that

#

the score and bar are giving me trouble

knotty steeple
#

Math.floor((Math.random() * 100) + 1); - Return a random number between 1 and 100, this is your score

#

whatever you get here divide by 10

#

and thats the bar

analog bone
#

coddes

#

codes*

#

😫

#

too hard

earnest phoenix
#

wait

#

what do you mean

#

so

#

basically

#

Math.floor((Math.random() * 100) + 1);

#

this will give me my bar

knotty steeple
#

no

#

that is the score

earnest phoenix
#

Oh

#

yeye

#

sorry

#

xD

#

I am a bit tired >,<

#

did you say

#

divide by 10?

knotty steeple
#

yes and thats the bar

earnest phoenix
#

Oh

#

so like

#

wait

#

how do you make it divide?

#

isn;t it

#

/ <--- that

knotty steeple
#

yes

earnest phoenix
#

so

#

Math.floor((Math.random() * 100) / 10);

#

like that?

#

Sorry if I am being dumb here

knotty steeple
#

yea

earnest phoenix
#

ok thx ><

#

Oh also

#

how do I do reactions?

#

like the black heart and the red heart

#

the more the red heart covers the black is the higher compatibility

#

and the less it covers the black hearts is lower compatibility

knotty steeple
#

so you get the formula for ur bar

#

and repeat the red heart by the number you get

earnest phoenix
#

Wait what?

knotty steeple
#

Math.floor((Math.random() * 100) / 10)

earnest phoenix
#

yes

#

that i get that

knotty steeple
#

whatever you get here you repeat the red heart by

earnest phoenix
#

I know

#

but how do I implement the hearts?

knotty steeple
#

do i have to tell you everything

earnest phoenix
#

No

#

I am just a bit confused

knotty steeple
#

ok

earnest phoenix
#
let bar = (":yellow_heart:", ":black_heart:", Math.floor((Math.random() * 100) / 10));
#

something like that?

#

or did I do it all wrong

knotty steeple
#

what is that

earnest phoenix
#

<

knotty steeple
#

thats not how it works

uncut slate
#

js doesn't let you have tuples like that

earnest phoenix
#

Oh

knotty steeple
#

black hearts are 10 / num where num is the formula for the bar

#

then you repeat by the number you get here

earnest phoenix
#

I'm still learning about markdown, particularly links, I know how to make a link inside an embed, with [title][http://..], but I tried searching the internet and I have no idea how to edit the text that you get when you hover over said link.. Does anyone know how I do this?

uncut slate
#

you can add the hover text in quotes

#

e.g. [normal text](https://click-this.link "hover text")

earnest phoenix
#

Thanks!

knotty steeple
#

Thonk i didnt know that

#

well

#

you learn something everyday

quartz kindle
#

i didnt know that either

earnest phoenix
#
const Discord = require("discord.js")

module.exports.run = async (bot, message, args) => {

  let user = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
  let score = Math.floor((Math.random() * 100) + 1);
  let bar = Math.floor((Math.random() * 100) / 10);

  let shipEmbed = new Discord.RichEmbed()
  .setDescription(`<@${message.author.id}> x ${user}`)
  .setColor("#ff0000")
  .addField(score)
  .addField(bar)
  .setFooter(`Replying to ${message.author.username}#${message.author.discriminator}`)
  message.channel.send(shipEmbed).then(message => {
      message.delete(9000)
  });
};


module.exports.help = {
  name: 'ship'
};
#

so like this?

knotty steeple
#

you know you have to make the bar yourself

earnest phoenix
#

Yea I know

#
t a function
    at Object.module.exports.run (C:\Users\User\Desktop\LewdGoddess\commands\shi
p.js:6:52)
    at Client.bot.on (C:\Users\User\Desktop\LewdGoddess\index.js:112:31)
    at Client.emit (events.js:182:13)
    at MessageCreateHandler.handle (C:\Users\User\Desktop\LewdGoddess\node_modul
es\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
    at WebSocketPacketManager.handle (C:\Users\User\Desktop\LewdGoddess\node_mod
ules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
    at WebSocketConnection.onPacket (C:\Users\User\Desktop\LewdGoddess\node_modu
les\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
    at WebSocketConnection.onMessage (C:\Users\User\Desktop\LewdGoddess\node_mod
ules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
    at WebSocket.onMessage (C:\Users\User\Desktop\LewdGoddess\node_modules\ws\li
b\event-target.js:120:16)
    at WebSocket.emit (events.js:182:13)
    at Receiver._receiver.onmessage (C:\Users\User\Desktop\LewdGoddess\node_modu
les\ws\lib\websocket.js:137:47)
(node:105520) UnhandledPromiseRejectionWarning: Unhandled promise rejection. Thi
s error originated either by throwing inside of an async function without a catc
h block, or by rejecting a promise which was not handled with .catch(). (rejecti
on id: 1)
(node:105520) [DEP0018] DeprecationWarning: Unhandled promise rejections are dep
recated. In the future, promise rejections that are not handled will terminate t
he Node.js process with a non-zero exit code.```
#

I am getting this error

hushed berry
#

Do JS functions implicitly return null if you dont explicitly return anything

earnest phoenix
#

undefined

uncut slate
#

yes, they return undefined

earnest phoenix
#

wait what?

violet siren
#

Can I ask you guys ideas ? I'm currently implementing Oauth2 to basically get the guilds a user is in. Thing is, I have the user ID but I can't seem to get a list containing the guilds (or the IDs of the guilds)
Scopes are identify & guilds , but I can't get any guild-related info

uncut slate
#

@violet siren what's going wrong when you try?

violet siren
#

Nothing is really going wrong, but the response I get is an array only containing the user ID, mail, av hash, and a few other things, but nothing guilds-related

sick cloud
#

@violet siren, you need to make a request to the API to get the user and/or their guilds

#

/api/users/@me/guilds iirc

violet siren
#

Oh I got it, this only allows it but doesn't actually do it

#

You probably solved my problem @sick cloud , ty very much

earnest phoenix
#

ok

sick cloud
#

np

earnest phoenix
#

i got the Math.floor fixed

sick cloud
#

the API is annoying like that

earnest phoenix
#

But i still can't figure out the bar ><

sick cloud
#

Hey guys, little question here.. why is awaitMessages not collecting my response, then after the minute it has time set to, it errors with [object Map]?

uncut slate
#
  1. [object Map] is because you cast the error object to a string
  2. show code
sick cloud
#

that's the area where it's erroring.

#

I haven't done the rest of it, since really it's just nesting another awaitMessages inside the .then, but it won't get past that at all. πŸ‘€

uncut slate
#

try logging the error properly I guess

#

console.error(err)

#

should give you a proper stack instead of just [object Map]

knotty steeple
#

cant you make a message collector

sick cloud
#

alright

#

and idk, i've always used await messages

#

@uncut slate this

uncut slate
#

are you sure the code you sent me is the code you're running?

sick cloud
#

it is, yeah.

uncut slate
#

because that would only go through to the .catch if you're throwing the messages

#

e.g. throw m1

#

or if d.js is doing something very stupid internally

sick cloud
#

but ouch πŸ‘€

uncut slate
#

nope, shouldn't

#

which version of d.js are you using

sick cloud
#

v12, the latest master

#

the hydrabolt/discord.js one

uncut slate
#

try using () => true as a filter

sick cloud
#

alright

#

that means that the filter will allow anyone to answer tho right?

uncut slate
#

for testing

#

yeah

sick cloud
#

ohk, will try it then

#

@uncut slate so that did nothing, the catch still logged the m1 contents after the 1min

uncut slate
#

try max instead of maxMatches

#

that's probably it, only seeing that now

sick cloud
#

alright

uncut slate
#

or maxProcessed

#

depends on what you really need

sick cloud
#

yay using max worked

#

thanks ❀

raw horizon
#

Random question: How would i go about putting 580 seperate text files into a mysql table?

earnest phoenix
#

i have no idea

raw horizon
#

thats a great answer

sick cloud
#

why would you want to do that tho

raw horizon
#

I have

#

Very good reasons i swear

earnest phoenix
#

i mean its possible to import a csz (i think the format is) to a table

spring wharf
#

How in C# would I detect if the bot has a permission in an if statement?

#

please mention me in your response. I have this server muted so that will help

earnest phoenix
#

Is it possible to do a command that checks which users have upvoted for your bot

#

or make it so it sends a message to a channel when a user has upvoted

quartz kindle
sick cloud
#

anyone able to help me with this error i get?
(node:24825) UnhandledPromiseRejectionWarning: DiscordAPIError: Cannot send messages to this user

#

i added a try catch but it still console errors

#
        try {
            msg.author.send({ embed: embed });
        } catch (err) {
            if (err === 'DiscordAPIError: Cannot send messages to this user') {
                return msg.channel.send(`I was unable to send you a Direct Message, make sure they are open to everyone and that you don't have me blocked.`);
            } else {
                // other stuff
            }
        }
quartz kindle
#

do msg.author.send({ embed: embed }).catch() instead

sick cloud
#

okay

#

cheers

median olive
#

Is there a secret to getting the "online/offline" status badge vs "???" for a bot? I tried to google around, but couldn't find anything

flat lantern
#

Your bot has to be approved

median olive
#

I believe I went through that process, but its been a while. Is there a way to check?

#

I did get the confirmation from "Luca" that it was approved.

slim heart
#

@median olive what do you mean by online/offline status badge?

#

you mean like those?

median olive
slim heart
#

Oh that's using the dbl api

#

get a token for your bot and post every 180000ms or something like that

#

if you have any questions about that ask in #topgg-api

median olive
#

πŸ‘ thanks