#development
1 messages · Page 749 of 1
all i understand is that since i started dealing with discord botallo i started to study this language
but there would be another problem I just ran into
all prefixes are detected by the bot
if(message.author.bot) return;
if(message.channel.type === "dm") return;
let prefix = botconfig.prefix;
let messageArray = message.content.split(" ");
let cmd = messageArray[0];
let args = messageArray.slice(1);
let commandfile = bot.commands.get(cmd.slice(prefix.length));
if(commandfile) commandfile.run(bot,message,args);
});```
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}`);
console.log(`${f} loaded!`);
bot.commands.set(props.help.name, props);
});
});```
I gave it to - to have the prefix
but it senses everything else and I think well written
you can request that the command run on any server logs it on my server to a designated room, and how much it loads the server machine?
I know I have a lot of questions, but I'm curious 😉
Hey all, so I tried using this to determine whether or not the reaction is animated or not, when I do this on a message with three reactions (normal, normal, animated) it returns (undefined, false, undefined)
msg.reactions.forEach(reaction=>{
var emoji = reaction.emoji;
console.log(emoji.animated)
});
Anyone know why it reacts this way?
Do you mean adding a thumbnail of a YouTube video to an embed
The thumbnail is build like:
http://img.youtube.com/vi/[video-id]/0.jpg
So get the video ID of a video an use that
show your code
Dm me
Just paste it here...
prefix bug only + 1 line if (!message.content.startsWith(PREFIX)) return undefined;
what
I assume you just pasted the code from The BelguimGames
No copy @twilit rapids
@twilit rapids video.id miss
Video .title or video .url
Sir help me
Please
😭
But sir
Video id miss
Video id info video URL or video title
@twilit rapids sorry ping you
just google
"how to get video ID of youtube url javascript"
@dusk cargo mods are human please wait for your bot
???
Not a clue.

As Dany said they're human and there are plenty of other bots to go through first. They can't rush these things.
I don't understand your last message Name Boy
http://pls-fuck.me/57SB5Wi.png
does someone know why this query doesn't delete the row?
ignore that expiresAt is different
Can someone tell me how do I get a server's member count excluding bots? I tried the code below but it just returns an empty list.
let finfo = await db.collection("factions").findOne({_id: "info"});
let list = "";
let members = 0;
for(var i = 0; i < finfo.count; i++){
db.collection("factions").findOne({_id: i}).then(fsinfo => {
let fserver = client.guilds.get(fsinfo.serverID);
fserver.members.array().forEach(m => {
if(m.user.bot === false) members = members + 1;
});
list += `**[${parseInt(i)+1}]:** \`${fsinfo.name}\` (${members} members)\n`;
});
var memberCount = await guild.members.filter(m => !m.user.bot).size
console.log(memberCount) //should print the member count excluding the bots
oh ok thanks
np
- add
.sizeat the end to get the number and not every member object
ah, yes
if(args[0] === "all"){
let finfo = await db.collection("factions").findOne({_id: "info"});
let list = "";
for(var i = 0; i < finfo.count; i++){
db.collection("factions").findOne({_id: i}).then(fsinfo => {
let fserver = client.guilds.get(fsinfo.serverID);
list += `**[${parseInt(i)+1}]:** \`${fsinfo.name}\` (${fserver.members.filter(m => {!m.user.bot}).size} members)\n`;
});
}
let embed = new Discord.RichEmbed()
.setTitle("List of factions.")
.setDescription(list)
.setColor("#ffa500");
message.channel.send(embed);
}
``` the list is still empty. Can someone tell me if I wrote anything wrong? The console didnt output anythin
uhm
hold on
if(args[0] === "all"){
let finfo = await db.collection("factions").findOne({_id: "info"});
let list = "";
for(var i = 0; i < finfo.count; i++){
db.collection("factions").findOne({_id: i}).then(async fsinfo => {
let fserver = await client.guilds.get(fsinfo.serverID);
let memberCount = await fserver.members.filter(m => !m.user.bot).size
list += `**[${parseInt(i)+1}]:** \`${fsinfo.name}\` (${memberCount} members)\n`;
});
}
let embed = new Discord.RichEmbed()
.setTitle("List of factions.")
.setDescription(list)
.setColor("#ffa500");
message.channel.send(embed);
}
use this @earnest phoenix
lemme try
feel free
its still an empty list
it sends ( members) ?
Can i ask help
of course
no list is empty
give me a screenshot
I was trying to add Cosmos bot to my server
of the embed
And i was linked here..
O
this server is a bot list
it's basically a hub
the embed is above, alex
search on https://top.gg
what does finfo return
{
_id: "info",
count: 1
}
not sure i can improve my table appearance any further with the limited abilities of discord markdown. thoughts?
thats insanely creative
its unicode box drawing characters and ```diff
certified
Why is it that whenever I try to change the font of text on my bot's dbl page, it goes to Times New Roman
or serif but times new roman is more popular so im calling it that
@import url('https://fonts.googleapis.com/css?family=Roboto&display=swap');
span.bot-name {
color: white;
font-family: 'Roboto' !important;
}```
Is Roboto a HTML/CSS safe Font
Well did you call on the start up client.on('ready') etc... event (not sure the exact format from memory.
As well as login the token to the bot.
i'm using this
exports.start = (client, options) =>
@mossy vine WHY?
we just said 2 good reasons why not
I'd suggest getting VSCodium / Visual Studio Code for development with discord (from personal experience).
do you have some client mods installed that only display messages with code blocks or glitch mentioned in them?
i dont have my own nodejs supported hosting
so i'm using free hosting
no reason not to develop locally
That's not free hosting
@wheat jolt there is a free plan also
Free hosting can be heroku
^
@wheat jolt heroku is not trusted by my experience
Heroku has much a much better tool chain compared to glitch
this convo makes me want to jump out the window but im in school and i would only fall a couple meters
Even better
at least youd get hit by a car then
@compact raft what's your experience, sir
It's best to do stuff locally before it's published to a live edition of a server, I personally have found that a good method for me but from the reviews of glitch and from what everyone has said here but I can't comment on that site.
@wheat jolt heroku try to ha*k my discord server
because my friend's server has got ha*ked by heroku
okay no, that couple meters will be enough
=)))))
That's...
That is probably not likely...
Plus bot tokens can be refreshed with ease.
Yes sure
Which is why you use env vars or an actual proper host like a vps.
If your friend supposedly got hacked by Heroku, then they don’t know how to use it
^
nice status that violates tos 
But yes Heroku has a truly great toolchain, especially for a free platform
@opaque eagle it will be
Plus I'm 100% sure that Heroku as a legitimate business wouldn't compromise accounts since it would violate the law of compromising user's data.
Why they give's Free hosting
@late hill I just noticed theirs lmao

@compact raft because free trials are extremely profitable
they give
I mean my VPS hosting I'm with had a free hosting for 7 days and I'm still with them after 4 months.
@lilac wharf my suggestion don't use any free VPS hosting...
i have paid shared hosting but nodejs not supported..
Oh really
the hypocrisy is intense
@compact raft Well I had a free trial and been with them for 4 months so far, about $9/month but it's worth it.
maybe do research on the hosting before buying it 
Then why do you use glitch
@lilac wharf Wait for Twist
What
There isn't a twist...
oh shut up youre the one claiming that heroku hacked your friend
^
I have to agree with Cyber on that.
im pretty sure saying bullshit like that instantly devalues your contributions to future conversations about a similar topic
^
Honestly just get an actual vps, they have so many more use cases
I have one for $3/month
I host multiple websites and bots from it
If you’re a student, you can get VPSes free for months
I had a minecraft server on it at one point
Through GitHub Student Education Pack
You just need to show like a school id or a report card
My VPS is 5 euros a month and is powerful enough for what I need
Also I’m pretty sure GCP has a free forever plan
^
@wheat jolt Are you sure your hi doesn't contain extra space(s) at the end
i just evaled message.guild and saw features but it was empty array. Anyone knows what the array has in it
It contains stuff from the boost rewards
and probably also verified servers
For example

That's Eris
But it should be the same for whatever you're using as it's just an implementation of https://discordapp.com/developers/docs/resources/guild#guild-object-guild-features
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
Ok ty
does d.js derive from eris, or vice versa, or are they totally separate codebases?
e.g. was one originally a fork of the other
Eris was made because of downfalls in d.js stable, it wasnt being worked on
It wasnt a fork afaik
It's completely different
D.js master fixes a lot of it's stable counterpart issues.
ah ok
one day i might have a play with discord.js or eris
to see what the fuss is about
isnt there a third one discord.io?
scratch that, thats something else
discord.io is single file discord bot lib for js
how would one go with making djagno website communicate with d.py bot 
what would be the simplest to connect those 2, that isn't blocking the bot 
Just need keywords to look it up
Is there an async version of django
Try to search for one and run it as a background task
If you know what you're doing you wouldnt need to expose endpoints
I never did django I'm on the bot part
I know how to do common prefix for my bot, but what is the easiest way to manipulate databases using js?

@cobalt umbra personally i'd find a non-blocking sql library
and connect the bot to the website that way
simply because that worked well for me
YMMV
treat the db as write-only in the bot, and read-only on the website, depending on the table, you can reverse that flow
yes plan is to have api tunnel handling database in the middle. But for example one can verify itself on the website and I need to send that to the bot so the bot can add role that that member. Your suggestion is good I guess but I would have to manually trigger bot to lookup the database
depends what you want to do
i have role assignment based on webhooks, and yes the bot checks the db table for new rows on a 30 second timer
its fast enough that nobody really notices the delay: by the time theyve made their way back to discord they have their role
ah timer are simplest but I'm not sure that's the best way
and slow enough to not hammer discord
its the simplest way and easiest to maintain
there's been talk about websockets but never done them and I think they block 
you could go around the houses and make some kind of web service within your bot with a listening port and https etc, and then query it from your website and have an internal api but... thats a lot of work when occams razor always wins out
everything only blocks if you let it block, for most languages, you can put blocking stuff into its own thread and marshall requests to it via a mutex
ye but threads 
i cant tell you how to do that in python as i've not coded in python but i do know its possible
oki thanks for advice
np 🙂
also i dont know how expensive threads are in python
im coming from a C++ mindset where a thread is a trivial thing, once you get to grips with the concurrency issues
Threading with async is the worst thing to ever put yourself through for no reward
Stick with async's tasks system and just have the wait for a request or response
threading with async works well if its done for you, no need to try and reinvent that razor sharp wheel with your bare hands. see ASIO.
can't say the same for JS
some things work great as thread and others work great event driven
if youre going to crunch numbers for 300 milliseconds... put it in a thread queue. if youre waiting for a socket to say its got data, use events.
horses for courses.
I'm referring to using python's threading module and processes module
They're basically for threading sync tasks to dedicate more reasorces and processes for async processing
Just upgrade your cpu and get a higher clock speed, problem solved 
But async has its own way of doing threading
By using tasks
Allows you to have more things going on one thread
I have to learn sqlite ;-;
good luck
sqlite is trash 
One message removed from a suspended account.
fuck sqlite
basically
or you can use an ORM
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
well any real database is better than JSON tbh
One message removed from a suspended account.
One message removed from a suspended account.
smh
Anyone know how to detect when a user is banned and get who banned them? (Discord.js)
@sage bobcat Never but NEVER use Json as Database
One message removed from a suspended account.
you could use it to store text
One message removed from a suspended account.
One message removed from a suspended account.
Its CP again
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
if youre willing to configure redis it's a pretty good choice ngl
might as well just use a map
you can host it off of ur main vps so it doesnt die along with your bot if something happens to the vps/process
i think
but hey loki is a good choice too so you know
and i assume you know the whole gist that redis shouldnt be used as a db for permanent data like booleans n whatnot
well no one said you couldnt
just that you wont be able to restore any last changes/latest changes to it after it dies or whatever
wait that came out wrong
i mean for larger amounts of data for example economy and stuff
hmm if you do have that amount of ram and cpu
maaaaybe
the glorious part about programming: if you have the resources to do x, do it
Anyone know how to find out who banned a user in js?
it should be fine for non realtime stuff such as logging or perma caching
guildBanAdd event
yeah, and for already banned users, use the audit logs
Ok
but not so epic for long term data like user ids and whatever else people store in actual dbs
json can be usable as a db if you use it correctly
while you can, why would you
suffering
fair
its all preference really
though maps are basically objects
these are just our opinions
One message removed from a suspended account.
wdym?
One message removed from a suspended account.
Uh sure I guess
Is it ok if a bot edits a message each second?
nope
API abuse
think its like 12 edits a minute
somthing like that if i remember
thanks
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
what
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
You already have that right
One message removed from a suspended account.
same directory as your bot's main file
One message removed from a suspended account.
Well ofc you need to require it
One message removed from a suspended account.
Look in kongou where Saya requires it
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Epic
One message removed from a suspended account.
uh one sec
onst emoji = 'regional_indicator_t'
message.reply(emoji.url) how to let emoji work?
ik const
@sage bobcat if you don't include that anywhere, does it connect or?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
can u read errors?
One message removed from a suspended account.
What are you doing here?
One message removed from a suspended account.
One message removed from a suspended account.
Just remove that part
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
shoukaku.build(LavalinkServers, { id: client.user.id });
replace LavalinkServers with whatever you named it as
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
You have it defined somewhere right
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Uh
Shouldn't make a difference for sharding
Just move the building outside of the ready event, before it
One message removed from a suspended account.
One message removed from a suspended account.
You mean
command handler then
Just move it to your main file then
before you load all the commands or events
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Move it to your main file
One message removed from a suspended account.
Before you load any commands or events
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Have you placed it above defining your client
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Define Shoukaku there 
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
It's 1am for him
Im new to Python. How can i update Python via Console?
One message removed from a suspended account.
One message removed from a suspended account.
please
One message removed from a suspended account.
One message removed from a suspended account.
no idea then
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
Let me just look at his github once more
One message removed from a suspended account.
const { Client } = require('discord.js');
const { Shoukaku } = require('shoukaku');
const MyLavalinkServer = [{
name: 'Lewd Server',
host: 'localhost',
port: 6969,
auth: 'do not guess my password'
}];
const client = new Client();
// In this example, I will assign Shoukaku to a carrier variable. Options are the default options if nothing is specified
const Carrier = new Shoukaku(client, {
moveOnDisconnect: false,
resumable: false,
resumableTimeout: 30,
reconnectTries: 2,
restTimeout: 10000
});
// Listeners you can use for Shoukaku
Carrier.on('ready', (name) => console.log(`Lavalink Node: ${name} is now connected`));
// Error must be handled
Carrier.on('error', (name, error) => console.log(`Lavalink Node: ${name} emitted an error.`, error));
// Close emits when a lavalink node disconnects.
Carrier.on('close', (name, code, reason) => console.log(`Lavalink Node: ${name} closed with code ${code}. Reason: ${reason || 'No reason'}`));
// Disconnected emits when a lavalink node disconnected and will not try to reconnect again.
Carrier.on('disconnected', (name, reason) => console.log(`Lavalink Node: ${name} disconnected. Reason: ${reason || 'No reason'}`));
client.on('ready', () => {
// Connecting Shoukaku to Lavalink Nodes.
Carrier.start(MyLavalinkServer, { id: client.user.id });
console.log('Bot Initialized');
})
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
what if
One message removed from a suspended account.

One message removed from a suspended account.
@sage bobcat
Good question sorry only to me
help me how to make the bot look for the user on all servers available to the bot and kick it from the servers?
loop through servers, check if the user is in it, if yes kick
that is a dangerous feature to have
if your kicking a user from every server the bot is in
One message removed from a suspended account.
I understand, but it’s not in malicious intent.
One message removed from a suspended account.

I don't think this is api abuse
it is
One message removed from a suspended account.
its also a bad idea in general
One message removed from a suspended account.
const emoji = 'regional_indicator_t'
message.reply(emoji.url) // How to make "emoji" work?```
good way to piss alot of people off if one user gets kicked in one server gets kicked in all
hello?
the the docs
ok
how then
Read the docs
okokokok
I did something like a blacklist, which will include a person with evil intentions, maybe a spammer, maybe server destroyers. Something like.
One message removed from a suspended account.
actually i dont think thats gonna be in docs
One message removed from a suspended account.
it is
same
send the raw unicode string
const emodji = client.emojis.find(s => s.name === 'regional_indicator_t');
ooooof
\🇹
copy that
and send that
@late latch that wont work
emojis only contains custom emojis
Why?
and regional_indicator_t isnt a custom emoji
One message removed from a suspended account.
escape it with a backslash to get the unicode version of it
\🇹

nice fix))
😂
i love how the one time i actually try helping you, you just respond with an emoji
congrats thats what ive been saying
do you just not care about your question at all
hmmmmm
Y'all just ever have a computer so slow the bot doesn't even want to load data correctly. 🙂 (using an rpi to host lmao)
my bots would kill any RPI
I need to find somewhere else to host this thing or it's going to shit on the pi lmao
Time to by a pi4 with 4GB of ram
Website.find_element_by_xpath(
f"/html/body/div[1]/div/div[1]/main/section/div/div/ol/li[{Day + 1}]/section/div/ol/li[{Counter}]/article/div[1]/h1/a").get_attribute('datetime')```
i have
no idea why
its returning none
when
<time datetime="2019-12-17T11:25:00+00:00" class="available-time">11:25am</time>
One message removed from a suspended account.
One message removed from a suspended account.
tfw your internet's too shit to selfhost anything 😭 ✌️
One message removed from a suspended account.
The solution was to just make it async/await a million task :)))
node async is weird
One message removed from a suspended account.
node async is cancer
One message removed from a suspended account.
Command handler loads commands but they don't actually run? Reconstructed and used 3 different command handlers, all for none of them to actually run commands yet loading them all.
Example command ``` exports.run = async(client, message, args) => {
let msg = await message.channel.send("Generating avatar...");
if(!message.guild.iconURL) return msg.edit("No icon.");
await message.channel.send({files: [
{
attachment: message.guild.iconURL,
name: "icon.png"
}
]});
msg.delete();
};
handler
if (err) return console.log(err);
files.forEach(file => {
if (!file.endsWith(".js")) return;
let props = require(`./commands/${file}`);
console.log("Successfully loaded " + file)
let commandName = file.split(".")[0];
client.commands.set(commandName, props);
});
});```
Can someone tell me why I'm getting this https://hastebin.com/odulotanop.js
noblox.js said you're not logged in
Great just just great
@tepid hedge how are you running them?
In that case it would be !icon
i mean, in the message event
Hey all, why is it when dealing with reactions, reaction.emoji has no animated property?
What lib?
discord.js
What's the code
message.channel.fetchMessage(args[0]).then(msg=>{
msg.reactions.forEach(reaction=>{
console.log(reaction.emoji);
});
});
The objects that brings back has no animated property
@quartz kindle still nothing, Im using if (message.content.startsWith(prefix + "findusers")) { Since I switched to a new command handler
Like all I am trying to do is tell if the reaction is animated or not. @modest maple It's giving me a lot more trouble then I would have expected from something like this.
Oh if your just doing that
Why not just do reaction.animated
Which I believe is a bool
Then do as you will with it
Ignore that command
Incorrect information I have give
reaction doesn't have an animated property either
emoji should though
which is why I am confused it doesn't
.emoji just returns the emoji hash / string
If you do .url maybe idk
I'd check the discord.js docs on the object reaction and object emoji
And see what properties they have and what you can do with it
In the docs it says there is an animated property for emoji :1
Wait surley reaction.emoji gives a sting? Or a hash
Can you try print out the emoji string
@quartz kindle Sorry to bother you if I am, but I changed the cookie because it got changed so I put the new cookie in the code, but now it says this, https://hastebin.com/ugohusecog.css
reaction.emoji is an object
Yes I can get the emoji ID
Couldn't you do what ever js version of guilds.emojis.get(Emoji ID) which gives you the actual emoji property which does have animated as a property
Just kinda shooting ideas out there xD
@modest maple When you get the chance can you help me out? Problem above
@modest maple doesn't that require the bot to be in that guild?
@slender mountain it would but why wouldnt it be in the guild
Well yh, bots can't get emojis that is doesn't get from guilds
Like the bot has to be in a guild with that emoji for it to be able to get it
And @tepid hedge are you getting an error?
no error, just the commands wont run
the other developer who works in the server hasnt seen anything like it
Have you tried printing out what message content is and seeing if it's what you're expecting
confused
its not just on this command it is on all commands
it was working fine until I accidentally ALT-Zed a few things last night
and it wouldnt undo that
Even if it was caps sensitive I make sure everything is lowercase
at this point I think its a problem with the command handler not loading the prefix correctly
Well on the message event just print out:
Message.content (what your checking)
Prefix
@atomic quarry that is not an error, that is literally the discord client
you get that if you do console.log(client)
Tim thank god youre here xD
wut
if(message.author.bot) return;
if(message.channel.type === "dm") return;```
yes...
if(message.author.bot) return;
if(message.channel.type === "dm") return;
let messageArray = message.content.split(/\s+/g);
let command = messageArray[0];
let args = messageArray.slice(1);
if(!command.startsWith(prefix)) return;
let limit = bot.ratelimits.get(message.author.id);
let now = Date.now();
let timeLimit = 2000;
if(limit != null) {
if(limit >= now - timeLimit) {
message.delete();
return message.channel.send("You are being ratelimited. Try again in `" + (Math.abs((now - limit) - timeLimit) / 1000).toFixed(2) + "` seconds.").then(m => m.delete(2000));
} else {
bot.ratelimits.set(message.author.id, now);
}
} else {
bot.ratelimits.set(message.author.id, now);
}
let cmd = bot.commands.get(command.slice(prefix.length));
if(cmd) cmd.run(bot, message, args, con);
});
thats better, lemme see
are you using bot or client? in your previous messages you set your commands in client, but now you're using bot
So what am I supposed to do with console.log?
show code
@quartz kindle bot, switched back to a different command handler because the other one didn't work and this was the original one
The whole code or just index.js?
you cant just be switching things around because they dont work lol. if it doesnt work it means you did something wrong
yeah I realized
whats the code for the current command handler?
if(err) console.error(err);
let jsfiles = files.filter(f => f.split(".").pop() === "js");
if(jsfiles.length <= 0) {
console.log("No commands to load!");
return;
}
console.log(`Loading ${jsfiles.length} commands!`);
jsfiles.forEach((f, i) => {
let props = require(`./cmds/${f}`);
console.log(`${i + 1}: ${f} loaded!`);
bot.commands.set(props.help, props);
});
});```
@atomic quarry index should be fine
Ok
check how you're setting it
Yes
module.exports.run = async (bot, message, args) => {
let msg = await message.channel.send("Generating avatar...");
if(!message.guild.iconURL) return msg.edit("No icon.");
await message.channel.send({files: [
{
attachment: message.guild.iconURL,
name: "icon.png"
}
]});
msg.delete();
}
module.exports.help = {
name: "icon"
}
thats one problem
you're setting the command key as prop.help
meaning the key to the command is {name:"icon"} not icon
So what should I change to make it use icon?
props
@quartz kindle https://hastebin.com/kiqazomebo.pl
after props is defined duh
oops
@atomic quarry where is the index?
oof
i see config, package and package-lock
I forgot to put that
Even when its after
where did you add it?
if(err) console.error(err);
let jsfiles = files.filter(f => f.split(".").pop() === "js");
if(jsfiles.length <= 0) {
console.log("No commands to load!");
return;
}
console.log(`Loading ${jsfiles.length} commands!`);
jsfiles.forEach((f, i) => {
let props = require(`./cmds/${f}`);
console.log(`${i + 1}: ${f} loaded!`);
bot.commands.set(props.help.name, props);
});
});
console.log(props)
/facepalm
🤦♂️
@tepid hedge you're supposed to add it on the line after you define it
let props = require(...)
console.log(props)
@atomic quarry your client.login() is inside your purge command lol
One message removed from a suspended account.
@tepid hedge that command doesnt have a help field
oof
are your handlers also in the cmds folder?
do you mean like this?
yes
thats been in there
did you save it? because its not detecting it
yes
they all have it in there as well
weird
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
not that lol
One message removed from a suspended account.
anyways @tepid hedge comment out the bot.commands.set line
One message removed from a suspended account.
that has nothing to do with the issue lol
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
what did the console show
with the console.log(props)
without
ok, so ban and icon have help fields
the others dont
when it reaches a file without a help field, it throws an error because of it
they do though
let users = bot.users;
let searchTerm = args[0];
if(!searchTerm) return message.channel.send("Please provide a search term.");
let matches = users.filter(u => u.tag.toLowerCase().includes(searchTerm.toLowerCase()));
message.channel.send(matches.map(u => u.tag).join(", "));
}
module.exports.help = {
name: "findusers"
}```
This is findusers.js
and it has it
So I'm having trouble fixing the "client.login" thing
well, for some reason its not finding it
make sure its properly saved
and in the correct folder
did and still the same
did it show up in the console at least?
fixed it
I didnt have const Discord = require("discord.js"); const client = new Discord.Client(); at the top
even though that wasnt there for icon but it still worked
but it fixed it for find users
nvm thats not why
thats not needed
they all have the help now right?
so go ahead and uncomment the commands.set line
if(message.author.bot) return;
if(message.channel.type === "dm") return;
let messageArray = message.content.split(/\s+/g);
let command = messageArray[0];
let args = messageArray.slice(1);
if(!command.startsWith(prefix)) return;
let limit = bot.ratelimits.get(message.author.id);
let now = Date.now();
let timeLimit = 2000;
if(limit != null) {
if(limit >= now - timeLimit) {
message.delete();
return message.channel.send("You are being ratelimited. Try again in `" + (Math.abs((now - limit) - timeLimit) / 1000).toFixed(2) + "` seconds.").then(m => m.delete(2000));
} else {
bot.ratelimits.set(message.author.id, now);
}
} else {
bot.ratelimits.set(message.author.id, now);
}
let cmd = bot.commands.get(command.slice(prefix.length));
if(cmd) cmd.run(bot, message, args, con);
});
whats line 98?
line 98 is second to last line
👍
Tim how do I fix the problem I'm having
@quartz kindle one last thing, the ban command im using is a modified mute command, how do I know if the time is working properly? Everything is a day plus so I used this: time: Date.now() + parseInt(args[1]) * 1000*60*60*24 originally it was 1000 alone for seconds, but i've been told doing 60(minute) another 60(hour) and 24(day) will work. Is that correct?
Can somone please help me I cannot figure out what tf is wrong with my code
Can you send it again?
Well the Bot won't sign in
have you made sure your token is correct?
And that you are copying a token and not ID
Yes I'm pretty sure
Is your token number or numbers and letters
Where is it not logging into, discord or rblx
The discord bot itself isn't logging in
Which lib do you use? You can enable logging to see why it's not logging in
make sure you're actually using the token and not the client secret
The problem is the way it's formatted
There's even a message listener inside a message listener for the purge command (unless I'm missing something)
oof
Yea why do you have 2 on message events anyway 
have one
Well I don't know which one I have to delete
ok
does anyone know how to make a cooldown that shows how long is left when you try the command again? (discord.js)
please ping me if you respond
@dense patio save a map or some key-value pair as userID: timeLeft then format it.
For example,
let cooldown = new Map();
cooldown.set("264811613708746752", 3000); // 3 seconds for this command.
if (cooldown includes user ID) {
// Make your better version of this
respond(`Try again in ${(Date.now() + getCooldowntime - Date.now()).toFixed}`)
}```
oh I see, thanks a lot
discordjs.guide goes over this pretty well: https://discordjs.guide/command-handling/adding-features.html#cooldowns
i'm new to bots, and i have a pretty beginner question, if anyone would be so kind as to let me know what i'm doing wrong. i'm using basically boilerplate code:
var auth = require('./auth.json');
// Initialize Discord Bot
var bot = new Discord.Client({
token: auth.token,
autorun: true
});
console.log("test")
bot.on('ready', function (evt) {
console.log('Connected');
console.log('Logged in as: ');
console.log(bot.username + ' - (' + bot.id + ')');
});
bot.on('message', function (user, userID, channelID, message, evt) {
// Our bot needs to know if it will execute a command
// It will listen for messages that will start with `!`
if (message.substring(0, 1) == '!') {
var args = message.substring(1).split(' ');
var cmd = args[0];
args = args.splice(1);
switch(cmd) {
// !ping
case 'ping':
bot.sendMessage({
to: channelID,
message: 'Pong!'
});
break;
// Just add any case commands if you want to..
}
}
});```
for some reason when i run it on node it just opens and closes right away:
```$ node bot.js
test
$ ```
i'm clearly missing something obvious. anyone wanna tell me what it is?
I recommend referring to that if you're having trouble
Please use a code block
use ```
not just one `
aye aye
thank you
the message event only emits message
with the message object
function (...) should be function (message)
oh wait
this is discord.io
please dont use discord.io

it's extremely outdated
oh
I recommend https://discord.js.org/
It has a good getting started guide
No problem
lol something was wrong with my token so a new token fixed it. i did switch over to discord.js tho and it seems much better so far!
alright cool
how do you update status?
{op: 3, d: {game: {name: 'test', type: 0}}, t: 'UPDATE_STATUS', s: shard.s} i was doing this but it doesnt work
because im dumb and do not have the smarts how do you shard a bot
@slim heart raw dapi?
yeah
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
{
"since": 91879201,
"game": {
"name": "Save the Oxford Comma",
"type": 0
},
"status": "online",
"afk": false
}
missing status info
what should I type to shard my bot
i tryed and it broke
yeah just learned it wasnt optional lol
@scenic kelp wanna freestyle?
sir this is #development
so I have a question
and I have an answer
lol
hopefully
ok so when I try to change the status and try to make it say KB!
I use this line do not know if it is right
client.user.setActivity("KB!");```
is client defined in your code?
can I see your code
copy and paste what
codin
just copy and paste the definitons and ready event
k
I feel wrong when i look at this so much
console.log('Keko bot online!!!!!');
client.user.setActivity("KB!");
});```
im using discord.js
master (12.x) or stable (11.x)
11.x
so you're using discord.js v11.5.1?
just check your package.json in the dependencies object
is that all?
wrong thing srry
i will just show this whole thing to you
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "O So",
"license": "ISC",
"dependencies": {
"discord.js": "^11.5.1",
"ms": "^2.1.2"
}```
so you are using discord.js v11.5.1
yes
is the code you provided (https://canary.discordapp.com/channels/264445053596991498/272764566411149314/656705143030415390) all you have?
in the entire package json?
hmm
rip for your brain rn
@analog roost client =/= bot
okk
@vital lark add me so I can send you this
/home/runner/index.js:105
return message.channel.send({
^^^^^^
SyntaxError: Illegal return statement
?
That is something I need help with
ohhhh
Yeah
I am still trying to fix something to
hangon think I just fixed it
Ok
/home/runner/index.js:105
return message.channel.send({
^^^^^^
SyntaxError: Illegal return statement
yes i saw
is your if statement a valid if statement though
to me it looks like you're missing {}
hmm
you can omit brackets if it's on one line
like if(cond) func()
otherwise you need the {}, which i assume you don't have so add it and see what happens
ok
what do i need to do to make the bot say as its custom status "watching you"
func(params) {}
?
I don't even know
What is that planning/outline website people use to plan their projects and the steps they need to accomplish?
trello™️
Yeah I give up
How does the Invite Manager finds out who invited a new member in a guild
It checks the created invites and when a new user joins it finds the invite that was just increased
which is how it got api banned when api bans for an hour were introduced loool
what
Invite manager the normal one pushes API rate limits alot
Discord.js-commando is more simple or more complex than discord.js?
But commando has a built-in one
No language is subjectively better
@earnest phoenix but its mehh... i rn have better one than commando
aliases, msg collecting, reaction collecting, etc.
commando is d.js
commando is legit a command handler
hey
client.on('messageReactionAdd', async (reaction, user) => {
console.log("yes")
if (user.bot) return;
if (reaction.message.channel.id !== "656680566481092608") return;
if (reaction.emoji !== "❌") return;
console.log(reaction.emoji)
if (reaction.message.reactions.get("❌").size === 2) {
reaction.message.delete()
client.channels.get("626198959924183040").send("Message was deleted.")
client.channels.get("626198959924183040").send(reaction.message.content)
}
});```
im tryna delete a message after 2 reactions
well not really 2 but for an example
any error?

