#development
1 messages · Page 476 of 1
update
how do you set the first 8 letters after a command?
and as a separate var, the characters after the command and 8 more letters
uh
wut
can anyone tell me how can i make a rectangle using pillow library for a progression bar
Anyone have an example for canvas-constuctor? [Tag Me]
I dont know how to send the thing
const Discord = require("discord.js");
const { RichEmbed } = require('discord.js')
module.exports.run = async (bot, message, args) => {
let helpEmbed = new Discord.RichEmbed()
.setTitle("Basic Commands")
.setColor(0x00ff00)
.setDescription("These are the basic commands for all users!", true)
.addField("8ball", "o/8ball {Question}", true)
.addField("Joke", "o/joke | Displays a joke for you", true)
.addField("Ping", "o/ping | Displays the ping time of the bot api", true)
.addField("Is", "o/is {@[name] adjective}", true)
.addField("Should", "o/should {@[name] verb}", true)
.addFieldield("", "", true)
.addField("Bot invite:", "https://discordapp.com/oauth2/authorize?client_id=476609928023244801&scope=bot&permissions=8", true);
let helpEmbedsub1 = new Discord.RichEmbed()
.setTitle(" ")
.setColor(0x00ff00)
.addfield("Purge", "o/purge {amount} | deletes {amount} messages", true);
let helpEmbedend = new Discord.RichEmbed()
.setTitle(" ")
.setColor(0x00ff00)
.setFooter("Created by: Pineapplefan1234 & 👌😂👌");
message.delete()
message.author.send(helpEmbed)
if(message.member.hasPermission("MANAGE_MESSAGES"))
message.author.send(helpEmbedsub1)
message.author.send(helpEmbedend)
message.channel.send("Sent to your dms! :mailbox:").then(msg => msg.delete(5000)
)
}
module.exports.help = {
name: "help"
}```
this doesnt do anything
no error
no message
discord.js
please help
addFieldield is not a method of RichEmbed
https://pastebin.com/tGD6UKns
@loud salmon
also @gilded blaze it still doesnt work
Is it actually running?
the whole thing
so descriptive
check if the command is actually running
Log to the console at the start of the command just to make sure it is actually running that command.
so you cant do .setDescription(string, true)
^
Why do u have ```js
const { RichEmbed } = require('discord.js')
destructing
const Discord = require("discord.js");
const { RichEmbed } = require('discord.js')
const embed = new RichEmbed();
const embed = new Discord.RichEmbed()
these 2 equal the same thing
so if u send that its gonna send 2 embeds?
no
no
its just a shortcut
Ohhh
const Discord = require("discord.js");
const { RichEmbed } = require('discord.js')
module.exports.run = async (bot, message, args) => {
let helpEmbed = new Discord.RichEmbed()
.setTitle("Basic Commands")
.setColor(0x00ff00)
.setDescription("These are the basic commands for all users!", true)
.addField("8ball", "o/8ball {Question}", true)
.addField("Joke", "o/joke | Displays a joke for you", true)
.addField("Ping", "o/ping | Displays the ping time of the bot api", true)
.addField("Is", "o/is {@[name] adjective}", true)
.addField("Should", "o/should {@[name] verb}", true)
.addField("Bot invite:", "https://discordapp.com/oauth2/authorize?client_id=476609928023244801&scope=bot&permissions=8", true);
let helpEmbedsub1 = new RichEmbed()
.setTitle(" ")
.setColor(0x00ff00)
.addField("Purge", "o/purge {amount} | deletes {amount} messages", true);
let helpEmbedend = new RichEmbed()
.setTitle(" ")
.setColor(0x00ff00)
.setFooter("Created by: Pineapplefan1234 & 👌😂👌");
message.delete()
message.author.send(helpEmbed)
if(message.member.hasPermission("MANAGE_MESSAGES"))
message.author.send(helpEmbedsub1)
message.author.send(helpEmbedend)
message.channel.send("Sent to your dms! :mailbox:").then(msg => msg.delete(5000)
)
}
module.exports.help = {
name: "help"
}```
now it is this
try it
np
.toBuffer()
like how do u send it tho because I tryed let buffer = Canvas.toBuffer() and it said that isnt a thing
const { Canvas } = require('canvas-constructor');
new Canvas(300, 300)
.setColor('#AEFD54')
.addRect(5, 5, 290, 290)
.setColor('#FFAE23')
.setTextFont('28px Impact')
.addText('Hello World!', 130, 150)
.toBuffer();
from the docs
^
what lib are u using
D.Js
message.channel.send({ files: [{attachment: canvas.toBuffer()}] }) should work
const { Canvas } = require('canvas-constructor');
let foobar = new Canvas(300, 300)
.setColor('#AEFD54')
.addRect(5, 5, 290, 290)
.setColor('#FFAE23')
.setTextFont('28px Impact')
.addText('Hello World!', 130, 150)
message.channel.send({ files: [ foobar.toBuffer() ]})
oh wait
im too late
sad face
wait
lol I just did that
i put it wrong
const { Canvas } = require('canvas-constructor');
let canvas = new Canvas(300, 300)
.setColor('#AEFD54')
.addRect(5, 5, 290, 290)
.setColor('#FFAE23')
.setTextFont('28px Impact')
.addText('Hello World!', 130, 150);
let buffer = canvas.toBuffer();
message.channel.send({files: [buffer]});
Is that right>
Try it
^
oh kewl it worked
except mee6 is a meme bot
you could probably do something where you check to see if the definition mentions the word "NSFW" in the beginning
and redact it if the channel is not a NSFW channel
and mention something like definitons of words not safe for work are only visible in the #nsfw channel
or something similar
Or
just check if the channel is NSFW marked?
and if it is not the command won't work
thats what i do
Yea
I use a method
that they say shouldn't work
but for some reason it does
¯_(ツ)_/¯
if (!msg.channel.nsfw) return msg.channel.send('You can only use this in NSFW channels')```
thats what i do
/r/leagueoflegends
Yea that is what I also do @west raptor People told me that shouldn't work :/
I don't see how
but EH
it does tho, who told you that?
Can't remember their Users
but it was in this server
I asked about it like a month or two ago
Someone said that shouldn't work
Oh well
dont really care
it works
so
XD
it wouldnt work if it were some old version lib
like older discord.py versions dont have a check for nsfw
whats the problem
thats not how it works
then?
the html description does not replace the entire page
so what should i do to fix?
your html is inserted inside the description field of the page
didnt get it
everything you put in the html description will only show inside the description field
so how can i fix?
u cant
oh
css doesnt work in there?
it does
but css works together with html, and the discordbots page has its own html
i did
so your css has to be coded specifically for the discordbots page
oh
you have to analyze the structure of discordbots and code css specific for it
so there is a syntax or other stuff for discordbots
use the dev tools / element inspector / page source
to see how the discordbots page works
aha
and then you can use css on the discordbots page
you cant remove everything, but you can hide it with css
but iirc you're not allowed to hide certain buttons
im using bootstrap
if you hide the vote/invite/website/report/support server/etc with css
they will delete your bot if they find out
why would i lol
ye
alright, then just adapt your css to account for the discordbots structure
Lol
xD

is there a list somewhere that contains every CSSable element on the bot page
too lazy to dig through source xd
CSSable element = literally everything in the page
so basically, the source code is the list you're looking for

Lol

how do I get member count with jda?
im assuming the jda client doesn't have a members collection
ok so this is a little sketch but you can loop through your guilds and += the members in each guild
Question: In discord by when you use
total_users = len(server.members)
it gives you the total amount of members in the server
So is there a way to make it say the total amount of Humans in the server?
i already tried
total_humans = len(server.humans)
but it gave me this error
AttributeError: 'Server' object has no attribute 'humans'
by that logic server.americans will tell you the number of american members?
no. the error is clear. 'Server' object has no attribute 'humans'
rip then its not possible, i guess
you need to count how many members are not a bot
im assuming members have a "bot" attribute in python
you can filter through all the members and not count any that are bots

create an int
for each member in a guild, if they're not a bot increment that int
return that int
ez
in js its message.guild.members.filter(m => !m.user.bot)
How do I link my bot's website to the discordbot list how others do it?
i know nothing about html rip
@bitter sundial can u help with html?
cant seem to get the stuff working correctly
@craggy fox SMH don't mention admins
i know
This channel is for bot development
But you can learn a lot of html in https://w3schools.com
html is easy lul
^
but html isnt really a "language"
its complexity and power is orders of magnitude smaller than any other programming language
i know html but idk why its not working for discordbots.org
what cant you figure out abonix?
show the css
<style>
.cat {
text-align: left;
}
body {
height: 1080px;
}
.content {
color: white;
background-image: linear-gradient(to bottom right, black,red);
font-size: 70px;
text-align: center;
}
.content img {
float: left;
width: 50px;
height: 50px;
}
.content ul{
overflow: hidden;
}
</style>
body is the body element of the page
oh wait old one
rip
remember what i told you before? you need to code css specific for the discordbots website
can u help?
meaning you have to adapt to its structure
just inspect element to find the query selectors
discordbots already has a body, and a lot of other elements
yeah i know, i tried but didnt work out
you need to target the specific element that contains the description
yes
see? the content you want to affect is all the way down inside the div class content
so you have to create a css to target that specific element, all the way down
the more specific the better
if you just use body, it will go to discordbots body
as a general rule, always start with the nearest ID, which in discordbots's case is id="details"
Tim can i ask u smth
so your css should be #details .container .longdescription .content
<head><link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"></head>
<body>
<div class ="content">
<h1>Abonix Bot</h1>
<h5>
<p>
Abonix Bot is a multi purpose discord bot that gets updated constantly, the bot also has music and many many new features get added every week<br />
Abonix Bot is specialised in friendly staff and constant updates.
</p>
</h5>
<a class="btn btn-outline-light btn-lg" href="https://invite.abonixbot.ga" target="_blank" role="button">INVITE BOT TO YOUR SERVER</a>
<ul style="list-style-type: none">
<li class="cat"><strong>Commands Categories</strong></li>
<li class="cat"><img src="o" alt="logo" />Moderation</li>
<li class="cat"><img src="httl" alt="logo" />Utilities</li>
<li class="cat"><img src="httlpng" alt="logo" />Music</Li>
<li class="cat"><img src="httlpng" alt="logo" />Fun</li>
<li class="cat"><img src="httplng" alt="logo" />Privacy</li>
<li class="cat"><img src="httpllg" alt="logo" />Game Stats</li>
</ul>
</div>
<style>
.cat {
text-align: left;
}
.content {
color: white;
background-image: linear-gradient(to bottom right, black,red);
font-size: 70px;
text-align: center;
}
.content img {
float: left;
width: 50px;
height: 50px;
}
</style>
</body>
jesus
you dont need the body tag
you cant use <head>
afaik
nor <body>
head just to link stylesheet
head and body only exists once per page
you are working inside an existing page
not creating a page
you're working inside something that already has a head and a body
removed that
what you're working on, is an element called class=content
yes
all your html code is inserted inside the class content
so all your css should be based on that element
.btn-like.btn.is-flex img {
content:url("https://media.turtle-bot.com/f/MMZ72.png");
width: 11px;
height: 7px;
}
how come dbots gets the resoponse of 403 while other people can access it fine?
In discord.js, how do you dm (bUser) (message)?
~~ you should take some html and css courses ~~
so like
.content h1{
shit here
}
.content h5{
shit here
}
etc?
@topaz fjord i did but didnt learn how to write over an existing page
@topaz fjord idk, maybe that url has cross origin disabled
@quartz kindle In discord.js, how do you dm (bUser) (message)?
bUser is the first ping in the command, and message is the part after
its my image server so idk
yes, but
as i said
you should navigate the page
because .content is inside many other elements
@wide ruin
- get the user mention from the message
- get the message content after the mention
- fetch the user
- send the message to the user
gotcha
if your page was <body><div class="content"><h2>
@topaz fjord how do I do the last 2
so i should also use
#content
so you should navigate the entire existing structure
#content {
css here
}
no...
rip me
can u give an example with my situation plez
#details .container .longdescription .content h2 {
css here
}```
I think I have that code
and then when you fetch the user send the message
Just wait a minute
why all these .container .longdescription etc?
because thats the existing structure of the page
is it because its inside the existing html code?
next time before you ask you should check out https://discord.js.org/#/
aha starting to make sense now
if you do only .content {}
ALL elements containing the class content will be affected
on the ENTIRE page
yeah
so you want to be specific, and target ONLY what you want
?
makin sense now
@topaz fjord I added that code, now how do I DM reason?
for example you could do #details .content and ignore the longdescription, etc.. but only if you know that there is no other element with the same class in that scope that you dont want to accidentally traget
you literally get the content after the message mention and send it to them
you fetch the user and use .send()
So mentionID.send(reason)
btw @topaz fjord if you wanna use that image in dbl, you can base64 encode it xd
i could
gotcha
What are you trying to do @wide ruin ?
DM a user
the user who used the command, or a user you mention in the command?
what does bUser contain?
Oh you doing the DM ban thing
in what format?
Lemme get the code
the user object? the user id? the mention string?
const { RichEmbed } = require('discord.js')
module.exports.run = (client, message, args) => {
let perms = new RichEmbed()
.setTitle("Error")
.setDescription("You do not have permissions to do that, you need **ban members**")
.setColor(0xff0000)
.setThumbnail("create-custom-emojis-for-discord-and-twitch.jpe");
const nobody = new RichEmbed()
.setTitle('please give the name of the user you would like to ban')
.setThumbnail("create-custom-emojis-for-discord-and-twitch.jpg")
if(!message.member.hasPermission("BAN_MEMBERS")) return message.channel.send(perms)
let bUser = message.guild.member(message.mentions.users.first() || message.guild.members.get(args[0]));
if(!bUser) return message.channel.send("uhh, i can't find that user sorry");
let kReason = args.join(" ").slice(22)
const mentionID = bUser.id;
message.guild.members.get(mentionID)
}```
@quartz kindle
Your format is so weird
i smell copy pasted
oh hey
That probably because it is
anyhow, bUser seems to be the user object already, so just do bUser.send("message")
can i use #container is-widescreen then other things here?
@quartz kindle
oh wait its not a user object, its a member object
can you dm a member object?
wait..
yes
ah alright then, then yeah, it should be bUser.send()
yeah @craggy fox
but container is a class, not an id
So bUser.send(reason)
also
bUser.send(kReason);
and id is #
the best way to get the reason
is
message.content.split(' ').slice(2).join(' ') @wide ruin
Since you define reason as kReason
so .container.is-widescreen = must have both classes
I need da help, I get an error that says commandfile.run is not a function and I tried doing what the people told me yesterday but it didn't work
aha
ok
so i need #details then other things after it
Ok let's look at it @lusty dew
and .container .is-widescreen = is-widescreen must be inside container
Okie
notice the space
gotcha
bot.on("message", async message => {//What are we going to do now?//All that is left for the unfinished commands are Nitro, I have to do the pages
if(message.author.bot) return;
if(message.content.startsWith(`@brisk fern `)){
var command = message.content.slice(`@brisk fern `.length).toLowerCase();
var cmd = command.split(" ")[0];
var args = command.replace(cmd+" ", "");
var commandfile = commands.get(cmd);//my way of checking the command
console.log(commandfile)
if(commandfile) commandfile.run(bot, message, args).catch((e)=>console.error(e));
}
});
So what does your error exactly look like?
Ok
what does console.log(commandfile) result in
what does the console log give you?
if it results in undefined, there's your problem
{ names: [ 'feet', 'f' ] }
(node:5440) UnhandledPromiseRejectionWarning: TypeError: commandfile.run is not
a function
at Client.bot.on (C:\Users\User\Desktop\LoverBot v3\index.js:42:31)
at Client.emit (events.js:182:13)
at MessageCreateHandler.handle (C:\Users\User\Desktop\LoverBot v3\node_modul
es\discord.js\src\client\websocket\packets\handlers\MessageCreate.js:9:34)
at WebSocketPacketManager.handle (C:\Users\User\Desktop\LoverBot v3\node_mod
ules\discord.js\src\client\websocket\packets\WebSocketPacketManager.js:103:65)
at WebSocketConnection.onPacket (C:\Users\User\Desktop\LoverBot v3\node_modu
les\discord.js\src\client\websocket\WebSocketConnection.js:333:35)
at WebSocketConnection.onMessage (C:\Users\User\Desktop\LoverBot v3\node_mod
ules\discord.js\src\client\websocket\WebSocketConnection.js:296:17)
at WebSocket.onMessage (C:\Users\User\Desktop\LoverBot v3\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\LoverBot v3\node_modu
les\ws\lib\websocket.js:137:47)
at Receiver.dataMessage (C:\Users\User\Desktop\LoverBot v3\node_modules\ws\l
ib\receiver.js:409:14)
(node:5440) 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(). (rejection
id: 1)
(node:5440) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre
cated. In the future, promise rejections that are not handled will terminate the
Node.js process with a non-zero exit code.
hastebin
not working
thats why
this is your console.log: { names: [ 'feet', 'f' ] }
Idk if this is the probably but would it be because you use var on the commadfile, instead of let
Yes
commandfile has no attribute run in that console.log
OwO
show your code
Hastebin?
pastebin?
Really?
#details .container is-widescreen .longdescription .content {
color: white;
background-image: linear-gradient(to bottom right, black,red);
font-size: 70px;
text-align: center;
}```
sometimes I would go onto it try use it of it dont work I would try again in 5m or so
@lusty dew send code in pastebin
#details .container.is-widescreen
#details .is-widescreen .longdescription .content {
color: white;
background-image: linear-gradient(to bottom right, black,red);
font-size: 70px;
text-align: center;
}
module.exports.help
@craggy fox when you see class="container is-widescreen" that means the element has 2 classes, container and is-widescreen, not one class with a space in the name
You forgot .help
huh?
@lusty dew change
module.exports = {
names: ["feet","f"]
}
to
module.exports.help = {
names: ["feet","f"]
}
When I try and use the .help
it brings up new error
That is why I don't use it
fs.readdir("./commands/", (err, files) => {
if(err) console.log(err);
let jsfile = files.filter(f => f.split(".").pop() === "js")
if(jsfile.length <= 0){
console.log("Couldn't find commands.");
return;
}
jsfile.forEach((f, i) =>{
let props = require(`./commands/${f}`);
props.names.forEach((name)=>commands.set(name,props));
console.log(`${f} loaded and ${inspect(props.names).replace("[","").replace("]","")} are the available aliases`);
});
has soemthing to do with that
if you want to target that element ONLY if it has both classes, use .class1.class2, or if you want to target it if it only contains one of them, use .class1
What is the error when you use .help?
.forEach
then you can access commandfile.names using commandfile.help.names @lusty dew
here
let me just show the errro
error*
C:\Users\User\Desktop\LoverBot v3\index.js:18
props.names.forEach((name)=>commands.set(name,props));
^
TypeError: Cannot read property 'forEach' of undefined
at jsfile.forEach (C:\Users\User\Desktop\LoverBot v3\index.js:18:15)
at Array.forEach (<anonymous>)
at fs.readdir (C:\Users\User\Desktop\LoverBot v3\index.js:16:9)
at FSReqWrap.oncomplete (fs.js:171:20)
'bot.guild.size' is not recognized as an internal or external command,
operable program or batch file.
That is what I get when using .help
change props.names to props.help.names
https://media.turtle-bot.com/f/oGICL.png same for here
change props.names to props.help.names
np
np
https://kitsu.io/api/edge/anime?filter[text]= Could I use this for a anime search command?
I want to be able to do an anime search command
if anyone knows a better website
I would be happy to know it
I have this:
async def on_message(message):
if message.author.bot:
return
await bot.process_commands(message)
But it still responds to bots.
(discord.py lib.)
according to the docs (i dont use python), .bot is a property of User, while .author gives you a Member
so you have to convert Member to User somehow
idk how d.py works
'k, I'll look into it tommorow tho, gotta speel first rn.
myanimelists api is gone/disabled though 
@lusty dew waiting for a new announcement https://i.imgur.com/vOq7Bc2.png
welp
well read the docs 
It says who reviewed your bot in #mod-logs
Please ping them instead of the /whole/ team
please dont ping us all for something like this
@earnest phoenix okay so i tried a few commands and f.ex. the connect one didnt work and the geninvite one didnt work either. Apparently the dm one worked but also what I forgot to mention in the decline message was that your bits dm commands allows it to dm others anonymously,that isnt allowed aswell
so you should fix that
then there is something wrong with the way you made it
didnt work for me
const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
``` the bot responds to incorrect prefixes when you use the say command
does it need special permissions???
Discord.js
lmao

Pls can I have help
@wide ruin you're checking for prefix length
meaning any prefix with the same length will work
^
@earnest phoenix also like I said,u gotta change that dm command. dming people anonymously isnt allowed
hey guys i was wondering if any1 knows how tatsumaki detects botting or has a suggestion on how i can detect it in my own bot
my bot has a resource that they gain every 5 minutues that users can spend and caps at 20
what kind of botting?
@wise sable do you mean selfbots?
like scripts that auto type commands
the only thing you can do is put commands on a timer
or macros that type commands with the user not typing it himself
I think it something based on spamming
Also, it's obvious of somebody is selfbotting
Like number of msgs per second
So it should be easy to add into code
something more advanced that can theorically be done, is to listen to the "user is typing"
there problem is that my bot has a resource that u gain every 5 minutues
that caps at 20
and users need to spend that resource to get stats
so its not the issue of spamming
yes
why not remove the cap?
yea that is a solution i would like to avoid since there would be no boundary separating casual and dedicated players
but yea that may be the only solution to avoid botters
but if you wanna try something more advanced, check if user is typing happens before the message was sent. although that would require you to listen to loads info coming from the api. you could limit the check to people who have reached the cap, but then people can adapt their code accordingly. also, selfbots can also simulate the user is typing event
you can have a lasttyped field in your database for example that gets updated everytime someone starts typing
and then check if user has typed in the last few seconds before sending the message
but this is all theoretical, and probably costs a lot of resources
i see that is an option that might be worth exploring
Or you could try and detect patterns in how long they have been typing
If they never make a typo in a large amount of commands, that's rare
it's hard to prevent botting of commands
the best way would be checking if it's periodic for a long period of time
^
If I do: if(!message.guild.name = Discord Bot List) { will that disable it for this server?
better use ID
i think it would be hard to base if a user is self botting based on time interval that they execute commands since they can just randimize that interval
server id: 264445053596991498

lol
Mobile
Turn on dev mode
why are you coding on mobile
I'm disabling one command for this server
User Settings -> Behavior
Oops
<.< I guess Android is more handy
it should, but you forgot quotes around the name
O yea
inb4 oliy/tonk change the server name to screw with your bot
Enmaps
?
What lib?
Discord.js
They are vars that don't reset with the bot, they are always saved
You can set these per server, and store the log channel ID with it
Understand?
It's fine if you dont
K
But won't Winston work better?
Winston is an actual logger,
Yea
Oh ok
msg.channel.send({embed: {
title: result.word,
description: `**Definition:** *${result.definition}*\n\n**Example:** *${result.example}*`,
fields: [
{
name: 'Author',
value: result.author,
inline: true
},
{
name: 'Rating',
value: `Upvotes 👍 ${result.thumbsup} | Downvotes 👎 ${result.thumbsdown}`,
inline: true
}
]
}})``` http://prntscr.com/kptp64
result is defined above
so in order to make a message deletion logs, you would have to make a message cache
some libraries cache messages, others dont
it really depends
There are libs that don't cache messages? 👀
Ok
jda doesnt 😎
Oh wow, and rythm is using jda
I wouldn't recommend using JDA to make a message logger, it's a pain to store messages. Sure, it's possible, but it's not fun to do
I speak from experience
I've had several crashes related to message cache memory leaks
guess the point is, don't use JDA for this
although if you really want to, go ahead
How so you add a role to a member in discord.js#master? I've looked through the docs and found nothing on it
<GuildMember>.roles.add() https://discord.js.org/#/docs/main/master/class/GuildMemberRoleStore?scrollTo=add
should work
thank you
if (!['pc', 'xbl', 'psn'].includes(args[0])) return message.channel.send('**Please Include the platform: `@LoverBot v3#00701 fortnite/ftn/f [ pc | xbl | psn ] <username>`**');
if (!args[1]) return message.channel.send('**Please Include the username: `@LoverBot v3#00701 fortnite/ftn/f [ pc | xbl | psn ] <username>`**');
For some reason
this keeps asking for the Platform
even though I give it the platform
@sullen path you just need to not store JDA objects
although with newer builds you can store message objects
since they won't leak massive amounts of memory anymore
I store message objects
in old builds that's bad
define "old"
🤷 too lazy
rip
class CachedUser(username: String, discriminator: String, id: Long)
class CachedMessage(author: CachedUser, content: String)```
Natan
anlox why the bot removed
@lusty dew are you using capitals?
no
then idk, maybe args[0] is wrong
Hmm
I will just rewrite the code
another way
Here is the error I got
Using my new way of writing out the command
let data = ft.getInfo(username, platform).then(data => {
}).catch(e => {
console.log(e)
message.channel.send("Could not find User in Database!")
});
here is the code
ft.getInfo is not a function
what is ft and where does it come from?
lmao
XD
Literally
I did npm I fortnite
I hope I did it in the right folder o.O
Ok what
I just looked in my folder and node_modules
it is there in the folder
but it doesn't show up on VScode
did you try requiring it?
if it doesnt throw module not found then its properly installed
and there is your problem
you named it Fortnite not ft
AH shit
No wonder
Oh wait
const Discord = require("discord.js");
const config = require("../config.json");
const apikey = require("../keys.json");
const ft = require("fortnite");
const ft = new Fortnite(apikey.fortnite);
here are the things I required
I can't require ft more then once
o.O
I just remembered about the
const ft = new Fortnite(apikey.fortnite);
hmm
Ima read the docs one more time
AH
I see
fortnite.user('Number1Swifty', 'xbl').then(console.log);
it is no longer
getInfo anymore
Or at least I no longer see that as an option
thats all your requires?
shouldnt new Fortnite(apikey.fortnite); be new ft(apikey.fortnite);
No
Cause
it is defined as ft
so the fortnite package
can not be defined as ft
or else that will not work
cause it has already been defined
but Fortnite is not defined anywhere
It is
well
I changed it back
to Fornite
cause ft didn't work
but
(node:1560) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toLowerCase' of undefined
at new User (C:\Users\User\Desktop\LoverBot v3\node_modules\fortnite\src\User.js:13:73)
at C:\Users\User\Desktop\LoverBot v3\node_modules\fortnite\src\Client.js:61:24
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:1560) 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(). (rejection id: 1)
(node:1560) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
new error
and I always get that one
idk why
everytime I try and make the fortnite command
I always get that error
either a problem with fortnite itself, or you're forgetting a parameter
its expecting to receive something, it its receiving nothing
Args...
args?
I have args defined
const Discord = require("discord.js");
const config = require("../config.json");
const apikey = require("../keys.json");
const Fortnite = require("fortnite");
const ft = new Fortnite(apikey.fortnite);
module.exports.run = async (bot, message, args) => {
let username = args[0];
let platform = args[1] || 'pc';
let data = ft.user(username, platform).then(data => {
}).catch(e => {
console.log(e)
message.channel.send("Could not find User in Database!")
});
}
module.exports.help = {
names: ["fortnite", "ftn", "f"]
}
Can you please send the code
this is my full code
Its something to do with arguments handler in your main file
Oh.
try to manually insert a valid value into username and platform
to see if it still errors
yes
Ok
because the fortnite module is saying that it received "undefined" as a value
either from ft.user or from new Fortnite()
OH
I remember now
last time I tried making the command
it was an authorization problem
But I could never figure out how to fix that
cause my API-key is good
if you want you can open C:\Users\User\Desktop\LoverBot v3\node_modules\fortnite\src\User.js
and check line 13
to see what they want
By any chance that username refers to members mention?
does anyone here either live or have a vps in Australia if so can you dm me plz
having dns resolving errors and need someone to see if they encounter it still
nope, im from south america
(node:6376) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toLowerCase' of undefined
at new User (C:\Users\User\Desktop\LoverBot v3\node_modules\fortnite\src\User.js:13:73)
at C:\Users\User\Desktop\LoverBot v3\node_modules\fortnite\src\Client.js:61:24
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:6376) 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(). (rejection id: 1)
(node:6376) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Even
manually putting in a User and platform
brings that error
also @uneven rover no its not that
check you are using the right data tags that it wants?
this.url = `https://fortnitetracker.com/profile/${data.platformName.toLowerCase()}/${this.username}`;
``` @quartz kindle
Try defining the arguments again
Or just don't rely on the main files arguments
so the problem is with the platform
Yea
.toLowerCase returns undefined
add a console log or somthing before you call module and check those values are actually valid
Wait huh?
is it something in that scrn?
@lusty dew seems relevant https://github.com/Jake-Ruston/fortnite/issues/13
im trying to figure it out, but it seems to be a problem with the package
it is
what I got in console log
im starting to remember i tried that module
but as said in the issue opened on github they say that
they run through something else
Hmmm
this is the problem with the package
getPlatform(platform) {
if (platform in this.platforms) {
return platform;
} else {
for (const plat in this.platforms) {
if (this.platforms[plat].includes(platform)) {
return Object.keys(this.platforms).find(key => this.platforms[key] === this.platforms[plat]);
}
}
}
return undefined;
}```
was looking at that it so jank
its not finding the platform in its platforms array, and returning undefined
what is the platform your handing in btw?
me?
yeah
in uppercase?
try handing in computer

its either retuning an array OR that condition can never return anything
try maybe just in first line of get platform jsut return platform
the User constructor is expecting data to contain platformName
and data is received from result = await fetch(`${this.url}/profile/${platform}/${username}`, this.headers); data = await result.json();
so either it doesnt contain because the url being fetched is wrong
or the api changed and it no longer returns a platformName
its the reply body though
Get Fornite BR Player Stats
GET https://api.fortnitetracker.com/v1/profile/{platform}/{epic-nickname}
Platforms: pc, xbl, psn
Get Fornite Match History
GET https://api.fortnitetracker.com/v1/profile/account/{accountId}/matches
Account ID: A Guid, found in the Get BR Player Stats Endpoint.
Get Current Fortnite Store
GET https://api.fortnitetracker.com/v1/store
Get Current Active Challenges
GET https://api.fortnitetracker.com/v1/challenges
Documentation
Hit those endpoints, it's self documenting. :)
try adding a console log in there, and debug that package lmao
the lib so small should be easy to trace and fix 😛
exactly
But
you could even trash it and make your own
just ditch the package and make your own http requests
I will have to get my friend ot help me with that
you dont even need half the shit that lib is doing
just make your own array of valid platforms to compare against the input
and make the http request to the api yourself
wonder how this even has 700+ downloads a week
npm.postDownloadPerWeekCount(1000000000000000)
wot?
plus that package hasnt been updated in 4 months, and there are many other fortnite packages in npm
fortshit
bullnite
@lusty dew https://www.npmjs.com/search?q=fortnite
Ah
thank you
HTTP Error: 403 Forbidden
I get this
as an error with a new npm package
did you put ur auth key
yes
const Discord = require("discord.js");
const config = require("../config.json");
const Fortnite = require("fortnite.js");
const client = new Fortnite("apikeyhere")
module.exports.run = async (bot, message, args) => {
let username = args[0];
let platform = args[1] || 'pc';
let data = client.get(username, platform).then(data => {
}).catch(e => {
console.log(e)
message.channel.send("Could not find User in Database!")
});
}
module.exports.help = {
names: ["fortnite", "ftn", "f"]
}
as you cans ee
I have where the apikey will go
and I removed it to show
Can someoen help meh?
I even tried making a new account
and getting another API key
after deleting my old one ofc
and even that API key no work
do you really need to send every conversion? why not make the command take currency codes to convert to?
Yea like do !convert 1USD to 1CAD
!convert 1USD CAD
or even take multiple if you insist on having the ability to
!convert 1USD CAD JPY BRL
Hmm
I was trying to do a clock command r timezone command
but the clock command I made
only showed my date and time
and when someone used it, it didn't show theirs
does the clock account for other time zones?
shhhh
the date/time in most languages iirc is the date/time of the system it is run in
so what you need to do is shift the time depending on what gmt offset is given
are you familiar with the acronym GMT?
also discord doesn't provide an user's timezone
^^^
so you'll need to have them register it/provide to the command
I know that now
also why you delete ;n;
I want to do it now so you can do
the time in a certain timezone
or place
like
!time London
city name is iffy, if i made the command, i would make the user input a gmt offset
or a zone id
yea that would work too
so you could account for DST
erm
@earnest phoenix myArray.sort(function(a, b) {return a - b}); is the best way to go about it according to w3s
myArray being the array of the amount of currency that $1USD amounts to
a cheap and easy way to do local time for a user is to do an embed with a timestamp. it auto converts it to the local time for the user
That's only in the footer though, isn't it?
right
that's a good way to go about it, but text small 
also I don't think you can send an embed with only a footer
whatever you're doing otherwise can go in it, with a timestamp for the footer
Does anyone know how to make a command like to disable a leveling system for a guild or something like that? I just need a example because I don't know where to start
the characters your bot will look for to make sure a command is being run @carmine elk
@loud salmon Could I use https://timezonedb.com/api
im sure it would be easier
@carmine elk prefix is the thing that goes before the command, if you to t!profile, then the prefix is t!, if you do >items, then the prefix is >, etc.
Thx
np
Could someone show me an example of what I need?
you need to track a variable in each guild whether the leveling system is on or off
and if it's off to not execute any level-based functionality

that's up to you
but you still need to have a variable in the bot itself to determine if a guild has leveling enabled or disabled
if you read from a file to check every time you're going to have a bad time
I mean like I dont need like leveling and stuff like that I really need a way to set channels for like logging, Welcome/Leave messages, etc
@loud salmon Do you know how I can do the code all in one file but have different things like, !list, !time, !convert?
not really



