#development
1 messages Β· Page 455 of 1
im talking to Aetheryx
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
did you put that line in the error event
yes
wait no
is event.js a file you wrote?
replace error in the console.log with err
No
bot.on("error", err => {
console.error('Caught error', err);
})
idk what event.js is
like this
ye
ted. 11 error listeners added. Use emitter.setMaxListeners() to increase limit```
i got that already
i've never seen mine throwing a "throw err" lol
Idk whats going on
but it is effecting my bot
This has never happend till today
events.js is the events 
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
yes
but i choose not to do it
missing perms just add a try catch
s
or just check permissions instead
i dont know how to make the bot online
oh yea lul
bot.login
so for some reason people can access my website from my vps's ip
is there a way i can prevent this
@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).
like, if you type in the vps's ip it will redirect to your webserver?
@misty pawn you are right but never give up
yes
@quartz kindle ye
you can detect the requested address and redirect or block
are you using a webserver like apache/nginx or using node+express?
nginx with express
they will always be able to do that
lel
there's no way of knowing how it was accessed besides the Host header
which can be faked
I have a website on a VPS.
The issue I am having is that when I enter the IP of the server, it links to the website.
Even when entering mail.domain.com, it does the same thing.
How do I disable t...
if you're using a reverse proxy for node, set node to only accept connections from localhost
i cannot know the error can you say it
waite
What's the error lol
Ummmm
My errors
are going crazy
https://www.hastebin.com/kocorosabo.cs <--- error
it goes way beyond that
but i can't see them
how do i get my giveaway bot online
rn mine is offline
You have to code it and then host it
Tune in every Wednesday & Friday for Discord.js Videos! Go easy on Ned as it's his first coding tutorial in a while! :D SourceCode: https://github.com/The-So...
Here is a simple tutorial video on getting a very basic bot up
TSC nice
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
What is the thing i need to install so i can use this with python 3.6+
this what
also is timeObj defined @earnest phoenix
Kk awesome
let timeObj = ms(cooldown - (Date.now() - lastDaily))
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
let timeObj = ms(cooldown - (Date.now() - lastDaily))
@knotty steeple
it is
and so is
cooldown
and lastdaily
@glossy talon
I have a discord.py bot
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
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
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
Eh, I've never really used discord.js
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
No
That is not for you
xD
That is for me it is a problem I am having with my code
Then why was i pinged
I'm talking about my code block
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
Afaik /check doesn't return when a user can vote again
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?
No
That would be cool if that was possible
It's also not allowed to upvote on a users behalf
Cause then i could make my upvote command have the user upvote on discordbots.org automatically
I get that, but it's not allowed since it would open up tons of abuse potential
you mean add an image into an embed?
no over it
π€ π€
Is it possible to make a bot move a user to a different voice channel?
I don't know the code for it but move members is a thing yeah
Okay cool. Cheers
I'd reckon it's possible
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
});
^
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
put in some extra brackets and see if they close to anything your ide should highlight them
thing you code in
Yo, discordbots.org should have a feature that automatically grabs the guilds with the most members that are on discordbots.org
That the bot is in
You can just run that code yourself you know
wouldnt you need to crawl every server page to get those stats?
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
it clearly says whats wrong
@earnest phoenix how do you make a bot
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
How do you get a message author as a guild member for discord.js?
in discord.net is it possible to have server/channel specific prefixes
short answer: yes
probably could put it into a xml file using the xdoc but how exactly would i retrive the id of the channels or server
what
well i would need somehow to get and set the prefix specific for that channel/server
how would i customize my discord bot page on the website?
using @earnest phoenix html
@earnest phoenix you can use the style tag in your long description to add custom css
ahhh
@dense coral
- read upon IDE's
- figure out what language you wanna use
- study that language for a few moths/years
- write your bot
XD
const List = message.guild.emojis.map(e => e.toString()).join(" ");
can someoen tell me why this is not getting the servers emotes?
@earnest phoenix https://media.turtle-bot.com/f/N4tSS.png ?
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
Thanks @heady zinc
@earnest phoenix wut version of d.js
"discord.js": "^11.3.2",
https://media.turtle-bot.com/f/aValg.png im on master and i just replace RichEmbed with MessageEmbed and it seems to work for me
but idk if its something with 11.3.2
@topaz fjord Weird...
@austere sedge time module should do what you are looking for
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
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
does it send an empty message?
β Emoji's
LoverBotv2 Official Support Serverβ’Today at 7:46 PM```
sends that
along with the server icon
but no emotes ><

Do you have custom emojis
try add a console log of the List and see if anything is even in it
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 β€
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?
(i only get this)
if you set the max parameter to 1, awaitReactions should end before the timer
Alright, I'll try that. π
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
if they react with the wrong emoji I just make it error and mention a role
also, to get the emoji that was reacted with: https://discord.js.org/#/docs/main/master/class/MessageReaction?scrollTo=emoji
TOO MUCH COMMADNS
got it, thanks β€
One other thing though, how do you remove all reactions on a message?
(including the bots and users)
help
a
@austere sedge re: your cooldown question: there's a argument you can pass in the command decorator if you use ext.commands
hi, my bot is not showing a online status on the bot list, would you have any idea why?
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`))
}
}
})
did you mean message.author.id == "id"
No message was send ;-;
Is message.guild.reigon correct
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?
Yeah ofc its in the docs if you would try to find it
Well it said unidentified
discord.js
lol region is spelled wrongly xD
@high tinsel message.member.joinedAt
When does one consider sharding a database ? 
How do i send a image file using eris?
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?
whats the error?
@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...
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
Can someone help me make a settings/config file so like =logchannel (channel)
xD
yea
the command works
kinda
I want it to set log channel
and log when messages are deleted and stuff
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>',
};
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
@earnest phoenix
?
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
Wanna work together?
Ummm
Maybe
I will consider it
I just woke up
xD
I woke up to an email and too my bot offline
Oh.
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
I think I can help.
ok?
Did you get any errors?
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
Yeah
So, give me your code.
But im using a already made image url
Okay,
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")
Of a certain user?
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"
}
What do you use?
._.
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
Are you using canvas
Send code
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"
})
});```
no it was always body for me
Also I think Discord requires a user agent
?
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 + "")
u need a header basically for that url
Hmm
just try an imgur link
thanks embeds
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
- it's a copy of the actual fetch api, so if you've ever done modern browser stuff you're probably familiar with it
edited
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
you're not sending anything in the command
Hmmm
Yes
It would be smart to put
message.channel.send(embed)
π
I keep getting
cannot read property file of undefined
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
remove the bot's read and send messages permissions in that specific channel
unless you want to still use it there
that's impossible
note that channel-specific permissions will be ignored if the bot is admin
Ok, thanks
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
is it in the root directory?
it can't find your config file
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',
};
lol idk
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
I apologise I am dining. Did you put the line before defining quoteUser
Please do this. quote user is your issue
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?
yeah
that's your problem
to confirm what is wrong with it
Ok
I apologise if my way isn't working for you.
its basic debugging anyways @night imp
Console log quotesToChoose and quoteIndexChosen before let quote
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?
Yeah
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
quotestochose is empty
which means JSON.parse(json); is either empty or wrong
Hmmm
I have
{
}
that in the file
my
quote.json file has
{
}
that in it
{
}
Well you need data
quotestochose.length doesnt work because .length is for arrays, not objects
oh
You could make it an array of objects and use that length
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
The way to bot automatically chatted when new members
Is that english?
he not engrish
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
@violet narwhal
bot.on('guildMemberAdd', member => {
member.guild.channels.get('channelID').send("Welcome user dud please np engrish");
});
guildCreate*
thats easy
spoonfeeding much?
help without spoonfeeding the code, not that I'm against it but it's the server rules here
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
if you spoonfeed once, then they will always rely on someone's help rather than looking for solutions
i will
@ruby dust agree
I have not asked for someone to do my code for me once
I am just asking for assistance
that wasn't about you
oh well he didnt speak English i guess its what ever
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
you asked for help?
BOY
offtopic..
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?
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()
.filter(c => c.type === "text" &&
c.permissionsFor(guild.client.user).has("SEND_MESSAGES"))
would this work?
Why don't you try it :^)
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
channel is undefined
means it wasnt found, the id is wrong, or something else is wrong
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
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
python errors are reversed compared to js errors, read them from the bottom to the top
syntax error on asyncio.async
Which seems to be in the lib 
cant help you more than that, never used python
its fine; thanks anyways
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
@buoyant oak does your bot detect edits?
nope
buy they can do
-buy <>
-buy <>
and it'll just
give the confirmation screen
and they can explot it
then you may have two message handlers or an event inside an event
k so ik why i get this
but i wana make it so it waits for connection
how can i achieve this:?
I have a question
how can you make it like a ship command
tells you the compatibility on random
how can I do that?
Math.random
its not just that btw
I know
I am trying to get it
to look something like this
wait
can I send images here?
yes
of
I am trying to get it to do something like that
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
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
wait
what do you mean
so
basically
Math.floor((Math.random() * 100) + 1);
this will give me my bar
yes and thats the bar
yes
so
Math.floor((Math.random() * 100) / 10);
like that?
Sorry if I am being dumb here
yea
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
Wait what?
Math.floor((Math.random() * 100) / 10)
whatever you get here you repeat the red heart by
do i have to tell you everything
let bar = (":yellow_heart:", ":black_heart:", Math.floor((Math.random() * 100) / 10));
something like that?
or did I do it all wrong
what is that
<
thats not how it works
js doesn't let you have tuples like that
Oh
black hearts are 10 / num where num is the formula for the bar
then you repeat by the number you get here
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?
you can add the hover text in quotes
e.g. [normal text](https://click-this.link "hover text")
Thanks!
i didnt know that either
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?
you know you have to make the bar yourself
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
Do JS functions implicitly return null if you dont explicitly return anything
undefined
yes, they return undefined
wait what?
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
@earnest phoenix https://ken.is-into.men/66f086.png
@violet siren what's going wrong when you try?
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
@violet siren, you need to make a request to the API to get the user and/or their guilds
/api/users/@me/guilds iirc
Oh I got it, this only allows it but doesn't actually do it
You probably solved my problem @sick cloud , ty very much
ok
np
i got the Math.floor fixed
the API is annoying like that
But i still can't figure out the bar ><
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]?
[object Map]is because you cast the error object to a string- show code
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. π
try logging the error properly I guess
console.error(err)
should give you a proper stack instead of just [object Map]
cant you make a message collector
alright
and idk, i've always used await messages
this is what the catch (err) thing logged when i added a console.error
@uncut slate 
are you sure the code you sent me is the code you're running?
it is, yeah.
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
try using () => true as a filter
ohk, will try it then
@uncut slate so that did nothing, the catch still logged the m1 contents after the 1min
alright
or maxProcessed
depends on what you really need
Random question: How would i go about putting 580 seperate text files into a mysql table?
i have no idea
thats a great answer
why would you want to do that tho
i mean its possible to import a csz (i think the format is) to a table
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
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
yes, use the dbl api #topgg-api
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
}
}
do msg.author.send({ embed: embed }).catch() instead
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
Your bot has to be approved
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.
@median olive what do you mean by online/offline status badge?
you mean like those?
oh, no, on the discordbots.org listing
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
π thanks



i didnt know that