#development
1 messages · Page 488 of 1
Even if I try I'll have to do it on the lavalink side
lavalink doesn't support audio filters
so gl
you'd need to patch it to support them
anyone got a quick way to check if a string contains a number and only a number
isNumeric(args[1]) && Number.isInteger(parseInt(args[1]) ?
or can i just use one of them 🤔
args[1] is a string like '1' '2' or '3' etc but i want to make sure its a number and nothing but
parseInt will actually get number from first part of a string e.g. '123asdf' -> 123
oh really?
huh TIL
yea
"a number and notiing but" so no decimals?
for non-decimal you could use a simple regex like:
/^\d$/.test(args[1]) test for a single digit integer
/^\d+$/.test(args[1]) test for any digits integer
Can somebody tell me why
});
don’t work now?
lib is discord.js
having to write a library for bot
its getting l a r g e
the lib file at least
Why is ) at }); an unexpected token if I need it to end a script?
send the full block of code
that is errorign it
ok
Any errors that cost the last }); to not work?
I can’t send it in cuz it’s too long. Imma google it myself
you're probably missing some other bracket before that
check for missing } from if statements and whatnot
^
Can someone help me?
Idk whats wrong
If someone know how to fix it please mention me!
@wicked summit try re-downloading all the packages
Why I get logged out?
wut
Gitch reeee
Is discord.js broken, cuz making a kick command is impossible.
impossible or the fact that you cant code?
I asked the person who made a kick command using the exact same way I did it and has a bot named CBot that is used alot.
does the bot have permission to kick?
Oh maybe you forgot something, to add to the script.
You even tried it.
ye, but it is not working on your bot
The kick members permission needs to be set...
Manage server only can change the overview settings in the server settings
How do I check if user is in a specific guild? (Discord.js)
loop through the guild's members looking for the user
How lol?
guild.members is a collection of all the members in the guild indexed by id, just check if the user's index is defined
i haven't used discord.js but theres no reason that it shouldnt work
worst case you can convert guild.members into an array of keys and check each element, seeing if it's the users id
actually ye
out of curiosity, what do people use to store data for their bots? im using mongodb
mongodb isn't bad
I don't like SQLite but I'm using that anyway
and I don't want to rewrite my entire codebase just because I want to move to a different db system
i'd never used mongo before i started doing discord bots, but using SQL in python just felt wrong to me
too structured
that's exactly what I'm using
well, SQLite at least is very staightforward
I don't have any problems with it other than the fact that it wasn't made to be used for something like "discord bots"
it's more for a single user thing
ah right
How do you check your bot's permissions in a guild with Discord.js?
var permissions = bot.canHasPerms ? kthx : bye;
Guys, how can I fix this error for kick code?
Ima just leave this here and see tommorow if there is any help, I might just wait a bit cuz someone is typing.
Include the parenthesis so JS knows you are calling the constructor
RichEmbed()
ok
^
^
It'll help you so much in the long run
I am beginner, sorry if I was a nuisance.
ok
But thank you guys for the help.
It works now.
You actually need to lookup the info yourself
It's understandable but you shouldn't work with a web application until you know the basics
@earnest phoenix no u
Guys, it went online but it will not work.
This is what the command prompt says.
'
Look, if it says cannot read of undefined, then you need to look the layer before .first()
oh ok
Try to console it
i dont understand. rip me
Console.log
oh ok
how do i make a taxi command for fortnite
i keep getting (npm ERR!) in cmd
that means a module failed to install for some reason. it should say in the error why
I could highkey use help setting up a currency system in my bot, dm me if you're willing to lend me some of your expertise.
just post your questions here
index.js doesnt have anything to keep it running
probably you didnt set up the discord event listener correctly
^
show your index.js code
// Load up the discord.js library
const Discord = require("discord.js");
const client = new Discord.Client();
const config = require("./config.json");
client.on("ready", () => {
console.log(`Bot has started, with ${client.users.size} users, in ${client.channels.size} channels of ${client.guilds.size} guilds.`);
client.user.setActivity(`Serving ${client.guilds.size} servers`);
});
client.on("guildCreate", guild => {
console.log(`New guild joined: ${guild.name} (id: ${guild.id}). This guild has ${guild.memberCount} members!`);
client.user.setActivity(`Serving ${client.guilds.size} servers`);
});
client.on("guildDelete", guild => {
console.log(`I have been removed from: ${guild.name} (id: ${guild.id})`);
client.user.setActivity(`Serving ${client.guilds.size} servers`);
});
client.on("message", async message => {
if(message.author.bot) return;
if(message.content.indexOf(config.prefix) !== 0) return;
const args = message.content.slice(config.prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
if(command === "kick") {
if(!message.member.hasPermission("KICK_MEMBERS")) return errors.noPerms(message, "KICK_MEMBERS");
let member = message.mentions.members.first() || message.guild.members.get(args[0]);
if(!member)
return message.reply("Please mention a valid member of this server");
if(!member.kickable)
return message.reply("I cannot kick this user! Do they have a higher role? Do I have kick permissions?");
let reason = args.slice(1).join(' ');
if(!reason) reason = "No reason provided";
await member.kick(reason)
.catch(error => message.reply(`Sorry ${message.author} I couldn't kick because of : ${error}`));
message.reply(`${member.user.tag} has been kicked by ${message.author.tag} because: ${reason}`);
}
});
client.login(config.token);```
hmm weird
...?
try removing everything and adding it back one at a time, to see if it works
example```js
const Discord = require("discord.js");
const client = new Discord.Client();
const config = require("./config.json");
console.log("test")```
see if "test" shows up
What the problem with your ping?
.addField(`Pong!`, `Bot ping: **${Math.round(client.ping)}ms**, Your ping: **${Math.abs((new Date().getMilliseconds()/1000+new Date().getSeconds() - (dk.getMilliseconds()/1000+dk.getSeconds)))*1000+"ms"}** `)
?
what is dk?
what doesnt work? error or wrong ping?
dk.getSeconds is missing parenthesis
Ok thx.
🤔
He doesn't know how to set it for 24/7
Can u help me?
He's not in the server yet
Sorry mine isnt 24/7 so i cant help :(
but i eanna knoe that too
-botinfo @lunar sentinel
440511248371810315
Gruppe Sechs Security
6488
Gruppe Sechs Security; The bot that will solve all of your security problems... Automatically!
discord.js
g6! (Customizable)
173
144 Servers
@midnight widget
again lmfao
i saw this bot before
his name is hillarious
anyway, to have a bot running 24/7, you need a computer running it 24/7
so either leave your computer always on, or put your bot in a VPS (virtual private server)
Ikr
or you could buy a raspberrypi or something similar for cheap and host it off that
would a pi be cheaper than a vps considering power/internet costs?

depends on who the host is
and if you pay for power and internet
its definitely less power comsumption than leaving your pc on all day
Depends on how much power consumption and internet ur using
O
I would say a vps would be cheaper if you opt for the cheaper ones
a pi would be comparable to a cheap vps, since its hardware isnt that great. whats the avergae ram a pi runs on?
512mb to 1 gig afaik
Why does this bot keep dming me
ive seen some with 2
You can get a high end version for some more
it all depends on which one you get
Money
im opting in to get a $50 pi
Pi?
Jonny r u blind 
😂
cus I'm Asian
no
Oof
Anyone know a great website for new pple who want to learn java, python etc?
O
M
L
I can't really do anything about that bot unless 2 more people tell me they're getting DMs too
@blazing gorge block the bot
^^^
Block the bot
-botinfo @lunar sentinel
440511248371810315
Gruppe Sechs Security
6488
Gruppe Sechs Security; The bot that will solve all of your security problems... Automatically!
discord.js
g6! (Customizable)
174
146 Servers
@midnight widget
Djdbdbdbd
i got a dm from him once, but that was like 2 months ago
also move to #memes-and-media this isn't development related
^^^
Omg
I will lose it 😂
Lol
I hate bots messaging me
My friend got s Russian bot
#memes-and-media my dude
it says who the owner is, you can message the owner and complain xD
jonny I'm literally doing your job
move to shitpost
or mutes
Dude
Sorry
move to #memes-and-media about that
ask in #memes-and-media REEEEEEEEEEEEEE
else I'll have to mute
-botinfo @cenkenernetwork
Please include a bot mention
o
run Luca in #memes-and-media
how do you do a watching status in d.py nowadays?
I feel like this shit keeps changing
this is the value
Rainbow Six Commands
%help (Give's you all the commands)
%ash (Show's you information about Operator Ash)
%thermite (Show's you information about Operator Thermite)
%fuze (Show's information about Operator fuze)
%kapkan (Show's information about Operator Kapkan)
%ela (Show's information about Operator Ela)
%botinfo (Show's Information About The Bot)
%invite (Show's you a link to add the bot to you're server)
but on the bot page. it shows it like that
Rainbow Six Commands %help (Give's you all the commands) %ash (Show's you information about Operator Ash) %thermite (Show's you information about Operator Thermite) %fuze (Show's information about Operator fuze) %kapkan (Show's information about Operator Kapkan) %ela (Show's information about Operator Ela) %botinfo (Show's Information About The Bot) %invite (Show's you a link to add the bot to you're server)
any idea why?
btw ```html
<div class="container">
<div class="row">
<div class="card card-body">
<div class="mx-auto" style="width: 1100px;">
<h3 class="card-text">
<%- botinfo.desc -%>
</h3>
</div>
</div>
</div>
</div>
await client.change_presence(discord.Activity(type=discord.ActivityType.watching, name='blah blah')) @ruby dust
yeah I realized that you have to use Activity for that now, cause I was using Game all the time
or use elements with display:block like <p> or <div>
const { RichEmbed } = require('discord.js')
module.exports.run = async (bot, message, args) => {
args = (args[0] + 1)
const success = new RichEmbed()
.setTitle(`Cleared ${args[0]} messages!`)
.setColor(0x00ff00);
const successmax = new RichEmbed()
.setTitle(`Cleared 100 messages, ${args[0]} `, "<= 100")
.setColor(0x00ff00);
const min = new RichEmbed()
.setTitle(`No messages cleared, ${args[0]} < 1 `, )
.setColor(0x00ff00);
if(!message.member.hasPermission("MANAGE_MESSAGES")) return message.reply("You don't have the required permission to use this command!");
if(!message.content.includes("-")) {
if(args[0] < 1) {
message.delete()
message.channel.send(min).then(msg => msg.delete(5000))
} else if(args[0] > 100) {
message.delete()
message.channel.bulkDelete(100).then(message.channel.send(successmax).then(msg => msg.delete(5000)))
} else {
message.delete()
message.channel.bulkDelete(args[0]).then(message.channel.send(success).then(msg => msg.delete(5000)))
}} else message.channel.send(min)
}
module.exports.help = {
name: "purge"
}
``` discord.js
This only works with 1 digit amounts
o/purge 1000 just does 1
you're setting args = (args[0] + 1) and then you're using it as args[0] again
you can just do like args[0] = parseInt(args[0]) to convert the string parameter to an integer (rather than doing "" + 1) and then use args[0] (like you do), but also would be a good idea to make sure args[0] is an integer in the first place
args[0] + 1 is wrong in the first place. if args[0] is a string, then the +1 will add a digit to the string
meaning purge 1 will become purge 11
yes
So parseInt(args[0])
you dont need to do anything to args[0] tbh, i believe discord takes strings as well
its wise to do so tho since he already performs some numerical checks to args[0]
and all arithmetic operators except + work as intended with strings
I just find it odd to do stuff to a supposed number while its a string, maybe its just me xD
yeah its odd, but its not that complicated lmao
like, there are many performance comparisons about converting strings to numbers, and one of the most popular solutions surprisingly is simply string*1 lmao

So can I do amount = parseInt(args[0])
yes
And can I just do amount = amount + 1
there is also Number(string) if you dont need to round it
but why do you need the +1?
oh to delete the delete command
Yeah
module.exports.run = async (bot, message, args, admins) => {
if(message.author.id !== admins) return;
let sUser = message.mentions.users.first();
if(err => console.log(err));
message.channel.send(`<@${sUser.id}>`)
message.channel.send(`<@${sUser.id}>`)
message.channel.send(`<@${sUser.id}>`)
message.channel.send(`<@${sUser.id}>`)
message.channel.send(`<@${sUser.id}>`)
message.channel.send(`<@${sUser.id}>`)
message.channel.send(`<@${sUser.id}>`)
message.channel.send(`<@${sUser.id}>`)
message.channel.send(`<@${sUser.id}>`)
message.channel.send(`<@${sUser.id}>`);
}
module.exports.help = {
name: "spam"
}```
The console says it can’t send an empty message
jesus why are you sending the same message so many times
Reasons
spam commands are considered api abuse and against discord's tos
also your if is wrong
Wdym
if(expression) {
//code
}
Oh
also, where is that err coming from?
Looks to be undefined to me
Are unprefixed commands allowed on other servers?
By this I mean if somebody says @dawn lagoon, it says :angeryping:
its not allowed in this server
Can bots react with :angeryping:
they can
instead of asking if "allowed", think how those servers will react to that, many communities that will use your bot will treat it as some sort of spam that can not be toggled
Like if(message.content.includes("@BagelBot#3472") { message.react(:angeryping: }
Would that work in js?
not how reactions work
I used the emoji id
<: angeryping:490231147658215424>
That's what I used
But can they react with emojis from servers?
Right
So from that link, it uses message.guild
Wouldn't that just look in that server?
yes
It's an example you can change it
How can I make it for its emoji server?
you can use <Client>.guilds.filter() to get the guild with the emoji
I don't fully understand filter
u can use .get() also
Just use get() on client.emojis
Very much no
you can also use client.emojis.get('id') like Keenser said
If you have the id of the emoji, you don't need to find a guild
<: angeryping:490231147658215424>
ok
How would I use it then
client.emojis.get("490231147658215424")
const hfweafgdbuqjhn = client.emojis.get('490231147658215424')
const angeryping = client.emojis.get('490231147658215424')
Yes
message.react(angeryping)
Yes
yes
Thanks
you do know you can try it before writing it piece by piece and asking us if its right
how do you use .mentions
I have if(message.mentions()) {
What goes inside () @topaz fjord?
Mentions Isn't a method
also not how you use .mentions()
Please look at the docs before asking
No, I don't know what to put inside the ()
There are no ()
So what to I use for of mentions bot
If*
if(message.mentions() ) {
message.react(angeryping)
}
not how you use it
do you even know what .mentions even does?
look at the docs
oh god
.mentions returns https://discord.js.org/#/docs/main/stable/class/MessageMentions
I'm also amused after seeing message.nonce
oh yeah, I've been willing to ask what is nonce even is
This is nonce
random string used for checking that the message was delievered
So why nonce
yeah well I don't really get that one, or how it can be useful to me ¯_(ツ)_/¯
.user isnt a property for .mentions
I thought it said it was
you typed .user
and also .id() isnt a thing for a collection
if(message.mentions.users.id(476609928023244801)) {
message.react(angeryping)
}
Oh
So just remove .id?
no
What do I put instead
.get('id')
yes
Ok thanks
literally idk how many times we can tell you to read the docs
then why dont you just read them
Well I do, but sometimes I don't get it
then google is a friend
Nothing
const angeryping = client.emojis.get('490231147658215424')
const token = process.env.TOKEN;
const dbl = require("dblposter")
const DBLPoster = new dbl(`Yep, this is something I shouldn't share`, client);
DBLPoster.bind();
const fs = require('fs');
const commands = {}
fs.readdirSync('./commands/').forEach(file => {
commands[file.substring(0, file.length - 3)] = require('./commands/' + file);
})
const prefix = "o/";
client.on('message', async (message) => {
if(message.mentions.users.get('476609928023244801')) {
message.react(angeryping)
}```
log angeryping to see if it exists
Looking at the logs, it doesn't
undefined?
It makes me mad that you load commands synchronously 
With node.js, of all things
pls
how do you check if anyone from @everyone have the permission to see channel 
library?
in d.js you could probably do something like channel.permissionsFor(guild.defaultRole).hasPermission("VIEW_CHANNEL")
In d.js, what is nonce for?
"a random number or string used for checking message delivery"
What does that even mean
@earnest phoenix ty d.js yes
loading stuff synchronously isn't bad
when done properly
no issue with loading command ssynchronously
they're needed for the bot to work anyway
natan super cool coding guy
^
@inner jewel You don't get it lol
Node.js was built around asynchronous operations
using synchronous I/O really isn't the Node way
then why is that function a thing?
there's nothing wrong with that usage
the process won't be doing anything besides the bot
no issues with waiting for commands to load before proceeding
synchronous methods are made for times when asynchronous I/O isn't optimal
this situation does not fit that case
anyone know how to fix this with my stats command
(node:11416) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'size' of undefined
what are you trying to get the size of
channels and roles in a server
code?
Channels: ``" + `${message.guild.channels.size}` + "`` \nUsers: ``" + `${message.guild.users.size}` + "``\nRoles: ``" + `${message.guild.roles.size}` + "``
guild doesnt have the property users iirc
how can i make it work then
guilds have members, not users
members
ok
^^
module.exports.run = async (bot, message, args) => {
let mUser = message.guild.member(message.mentions.users.first() || message.author);
let uEmbed = new Discord.RichEmbed()
.setTitle(`User information for ${mUser.tag}`)
.setDescription(`Account created on ${mUser.createdAt}`)
.setAuthor(`Requested by ${message.author.tag}`)
.addField('User ID: ', mUser.id, true)
message.channel.send(uEmbed);
}
module.exports.help = {
name: "user"
}``` This outputs mUser as undefined
???
message.guild.member(message.mentions.users.first() || message.author);
the frick
message.guild.member isnt a thing

it is
@bright spear
oh oof
its in the old version
but you can just use message.mentions.members.first() || message.member
member doesnt have the property tag
It outputs the exact same thing
it would be member.user.tag
it shouldnt
Fixed
no
nope
NO?
member and user are different
member = a user in a guild, has information about that user relating to the guild
user = a discord user in general, not related to guilds
So member is about users in general and user is a specific user?
Ohhh ok
if you want to get user properties from a member it would be <member>.user
What is wrong with this?
let argo = arg[i]
for (z = 0; z < words.length; z++) {
let word = new RegExp (words[z], 'gi')
if(argo.match(word)) {
const array = arrays[words[z].toLowerCase()]
for (b = 0; b < array.length; b++) {
let sio = new RegExp (array[b], 'gi')
if(argo.match(sio)) break;
stopped();
break;
}
}
}
}```
it works the first part but when b comes into play it doesnt do
those indents 👀
well idk whats happening there so i cant help :<
we need some context and also contents of words / arrays
that code alone out of the blue really hard for anyone to tell what's wrong
if the b part doesnt work, probably array is getting an empty/undefined array
its some problem with the for
I asked in TCD and i ended up with this code
let argo = arg[i]
for (z = 0; z < words.length; z++) {
let word = new RegExp (words[z], 'gi')
if(argo.match(word)) {
const array = arrays[words[z].toLowerCase()]
for (b = 0; b < array.length; b++) {
let sio = new RegExp (array[b], 'gi')
if(argo.match(sio)) break;
stopped();
if(isstop) break;
}
}
}
}```
and still, it doesnt seem to give sio a match on the argo EXCEPT on the first part of array
so is it something like for keeps definitions of things and you overwrite
what is arrays?
maybe tell us what you're trying to do
perhaps you dont need triple nested for loops nor regexes
for example, if you want to see if argo matches a word in the words array, you can use indexOf or includes instead
Im trying to search the array array, (which is based on the word sent) and itll go thru everything and if it matches it stops the loop
just finished my rewrite transitioning all my data storage and such to mongodb :D
happy times
now time to work on web ui 😢
if you post an example of what arg, words and arrays contain, it will be much easier to help
const words = swears.var
const arrays = byp
var byp = new SelfReloadJSON('./byp.json');
const swears = new SelfReloadJSON("./swears.json")
it doesnt do you much good
but here
i mean
the actual contents
like what you see if you do console.log(arg)
doesnt need to be everything, specially if is a big array
const arg = RemoveAccents(message.content.replace(/[.]/g, '').replace(/\u200b/g, '')).slice().trim().split(/ +/g)
thats arg
that byp.json
thats swears.json
words is an array of they keys to arrays
so words is the matched phrase in arg and then used as word as a key to arrays
check your dms
swears contains all the words then byp contains all the words as keys and used to find the responsible array for bypasses
but like
you get a word from message, you see if it exists in the swears array, if it exists you see if the same word exists in the bypasses?
can the same word be both a swear and a bypass?
idk, but it works how it is im just switching from forEach to for and its all just oof
if i understood correctly, you want to see if the rest of the message contains a bypass if a swear is found?
yes exactly and i achieved this before by using this horrible mess
because what the code is doing right now makes no sense, you're matching a key and then matching the same key again to the content of the key
it will only ever work if your byp.json is something like {"swear":["swear"]}
the same swear for both key and value
It works obviously because it works fine in the old version, but its just not working how it is which the only difference is it uses for instead of foreach
arg.forEach(arg => {
words.forEach(words => {
let word = new RegExp (words, 'gi')
if(arg.match(word)) {
const array = arrays[words.toLowerCase()]
if(array[0]) {
let sio1 = new RegExp (array[0], 'gi')
if(arg.match(sio1)) return;
}
^ repeated a shit ton
thats the old version
So, whats happening is im matching the content to an array of words, and depending on which word is picked up as a match, it uses that word as a key to find the array in byp.json that corresponds to the word
im seeing if the argument also matches any of whats in the array and if it does it returns
its to stop mishaps like the bot picks up "ass" but then one of the words in the array in byp.json is "assum" so if someone types "assume" its not censored
but its individual, so say like "fuck" one of the words in its array is "fuch" but if you type "assumefuck" it'll do a check for "ass" which will return negative because it contains "assum" and continue, then it finds "fuck" and it doesnt find anything in the array because its not there so then it continues and runs the censor function etc.
if that makes sense?
hmm i see
couldn't you have something like?
{
"words":[
"fuck": {"ignore":["..."]}
]
}```?
probably, but im not in need of changing that whole system
it works how its supposed to but i really would just liked to switch to for statements
my idea would work well with for statements
it'd probably work the same- its just array with keys
its the same concept and output just a different organization
yeah, it would be a lot better if you stored the bypassers with the word they override so that they don't screw with other things
well still the problem im having here, whatever it is would sitll be present
because its a problem with for or the match or something im not even sure
thats the worst part i have no clue what's wrong with this:
for (b = 0; b < array.length; b++) {
let sio = []
sio = new RegExp (array[b], 'gi')
if(argo.match(sio)) return;
stopped();
if(isstop) break;
//My indents are the best dont make fun of me
}```
have you tried to removing the RegEx for normal .includes(...)?
to make sure its not a RegEx problem
i need the match tags idk
i would do something like this if i had to use that structure
for(var a = 0, l = arg.length; a < l; a++) {
for(var a2 = 0, l2 = words.length; a2 < l2; a2++) {
if(arg[a].match(words[a2])) {
for(var a3 = 0, l3 = arrays[words[a2]].length; a3 < l3; a3++) {
if(arg[a].match(arrays[words[a2]][a3])) { break; }
}
}
}
}```
well i said "something like this", not "copy and paste this"
Ik i made my changes to it
i mean, what i usually do to debug problems like this is to just put a bunch of console.log() in relevant places
see if all the values are the expected ones
or if you're me, use console.debug for no reason lmao
lmao
and when i cursed and told it to console.log sio, and it only sent the first part of the array (array[0])
so like if i typed wass, which is the first part of the array
(
"ass": ["wass", etc.........
)
and only the first one and it would actually break and not censor like its supposed to
the problem is that the code flow is kinda weird, like first check if true, then check again if false, and change true to false if so
yeah
so you can for example, add a variable in the second for, like var matched = true; and then the third for will say matched = false, if an ignore is found
and then after the third for, evaluate matched and censor if true
I see what you're tryna say
ok i was thinking, what if i just drop the other for statements and keep them foreach and just change the 3rd to for
because the 3rd always changes if i add a bunch of bypasses to one of the array in byp.json
for(var a = 0, l = arg.length; a < l; a++) {
for(var a2 = 0, l2 = words.length; a2 < l2; a2++) {
if(arg[a].match(words[a2])) {
var matched = true;
for(var a3 = 0, l3 = arrays[words[a2]].length; a3 < l3; a3++) {
if(arg[a].match(arrays[words[a2]][a3])) {
matched = false;
break;
}
}
if(matched) { censor(); return; }
}
}
}```
so id like it to loop based on how many times its actually there
(still the same problem btw)
then idk, console.log everything
try again later
Ill just drop it its not like necessary
For the time being, you probably could find an API that will evaluate messages for swearing
i cant count the amount of times i solved programming problems by going to sleep and waking up with an answer
lmao
I like to keep things hand programmed
Well, it might happen
Imma just shleep
gn guys
cya
anyone able to help with this?
TypeError [REQ_RESOURCE_TYPE]: The resource must be a string, Buffer or a valid file stream.
@sick cloud looks like ur trying to use something thats not a string, buffer, or valid file stream 
i am tho
@bright spear i'm making a MessageAttachement with a buffer and trying to send it
const { body } = await get(` a u r l o w o /overlays/discord`)
.set('Authorization', auth_key)
.query({ avatar: user.user.displayAvatarURL({ format: 'png', size: 512 }), house: 'bravery' });
if (!body || !body.data) return msg.reply(`I was unable to generate that image for you right now, sorry.`);
return msg.channel.send(`Image generated, here you go!`, { files: [new MessageAttachment(body.data, 'bravery_avatar.png')] });
if you console.log body.data is it a buffer?
it says <Buffer ?
no, its an array 
then... its not a buffer?
its the idiotic api
I was looking in the testing channels and i saw an embed without the color bar
is it an embed?
and how do you do that
It's an embed, but the color is set to the background color for Discord chat. If you were to turn on light theme you would see it.
Look at https://discordapp.com/branding for the colors Discord uses.
Someone please help me, I am making this kick command, but when I run the command prompt, it just looks normal with only saying it goes online, but when I try the command, it does not work. Can someone tell me what is going on?
any errors
nope
look in command prompt.
nothing
nothing at all
but if i do run it
i think error comes out
look at the top when i first ran it
where did you define kMember
fyi, in order to kick you need KICK_MEMBERS not manage messages
i didnt
oh
your trying to use something that doesn't exist
no
i just beginner
you should learn instead of using example code
not like spood feed me, but in steps.
steps === spoonfeeding still
oh ok
google exists, the discord.js docs exist, use them.
@rapid marsh
if your bot is in said server you could use an eval. for example in Discord.JS:
bot.guilds.find('name', SERVER_NAME).channels.find('name', CHANNEL_NAME).createInvite({maxUses:1}).then(invite => msg.say(invite.code));
(example code, adjust for your bot etc etc)
Yes that’s what I was trying to ask
I hope it works
So In the eval cmd where do I put the server name?
there are some caveats
- discordJS master uses different
.findsyntax - You may need to get your
bot(client) differently - you may need to return the invite code differently, for example
msg.channel.send(invite.code)
at SERVER_NAME ofc 😮
but again, this only applies to DiscordJS. If you don't use that then you'll have to read your lib's own docs
you could also make a fresh new command and just make it check if you are using it so no one else can if you like that more. At the end of the day eval is the same as writing the regular code
afaik, no. They did add y our bot after all...
Kk
My bots the lockdown bot it’s been in this server before and it’s my first day back after being banned for who knows how long close to two years I’ve been banned
tbh I did "invade" other servers that way in the past. I log all my bot errors to a channel on my server and sometimes the server owners never reply to DM's so I have no other option if I want to fix a consistently occurring error '_>'
like when a server forgot to change my prefix and everytime they used some commands in Mee6 my bot threw an error 
Yeah my bot does that and people don’t join our support server to fix it they just kick the bot cause they too stupid to get it set up in the first place
we need an expanding intellect meme for this convo right here ^
Yeah
-> fixing the bug
-> using bot to create invite in their server without their auth, joining and asking what they did

u should not do that
if user doesnt do a command, bot shouldnt do anything
especially making invites to other peoples server
that's not the thing tho...
or rather
I don't know exactly what bjbrown's issue is but for me it was they were using a command for my bot but that was also a command on another bot and the syntax was only right for the other one
If this is gonna end up getting me banned cause it’s put down as API abuse I’m not gonna do this
i think it was !warn as command
Problem is with my bot it doesn’t work until you do l! create
i.e. my bot has has !warn user points reason and mee6 has like !warn user reason something or other. They are both commands but the argument syntax differs.
I put a space between that so it wouldn’t create channel
well I would firsst try to get the owner to invite you @rapid marsh
if you cant DM them yourself try to add friend them or DM them with your bot and tell them to add friend you
again the same concept, find the guild object. A guild object has the Owner object which is a User
Guild.owner.send('text_here');
How you get the Guild part is up to you really coz I don't know your code :v
oh ye true i forgot GuildMember.send() is a thing
Can somebody tell me how can I make my bot randomly select a message and send it ?
make an array of possible answers and chose a random one using Math.random()
@earnest phoenix Do you understand what Tim means? If not, I could elaborate.
So..
let replies = [“hello”, “hola”]
let result = Math.random(replies)
like that?
Erm... No.
almost
Then how?
but Math.random() returns a random number between 0 and 1
^
so you have to adapt it into returning something valid for the array
for an array of 2 items, all you need to do is round it into an integer
for more than 2 items you need to multiply it by the amount of items and then round it into an integer
https://www.npmjs.com/package/random-number
Is an easy library for random numbers. You can specify the min/max and force it to use integers.
let result = Math.floor((Math.random() * result.length));
True.
Math.random() exists for that
Highy recommend against using an extra module for this
So uh... how should I change the code in order to make it work?
I use it because it saves loads of time when using a random number in 50 commands.
you select an item from an array like this
array[number]
math.floor gives you the item number
so... what should I type in the result line?
SunOG it would be even easier to have an actual ping command rather than preset ones.
Wait is there an actual ping command?
🤔
partially yes lmao
How can I use it?
client.ping = average websocket latency
lmao
oh
as for message roundtrip, you have to use new Date() minus message.timestamp
you thought everyone did random pings like that? lmao
@quartz kindle isn't there an actual thing for ping... Date minus message.timestamp can be inaccurate.
there is client.ping, but its the websocket heartbeat, not the message roundtrip
There isn't one for message round trip
expensive
I mean
It's either that or I could make a dominos bot
!order regular
👍
Good thing we have a dominos module
genius
@topaz fjord i could get a number for $1/mo
but some apis charge for calls
Is anyone familiar with the An Idiot's Guide API and know how to get a key?
what key?
cant find it anywhere, ask in their discord server
Okay.
how do I fix it? 
make the api token stay in the modal borders
https://mrsheldon.me/files/918232.png
Anyone here good with Lavaplayer? I'm trying to figure out how to use the Youtube Search function but nothing I found was really helpful
I'm using the JDA btw
how can I set the number of server on my discordbot.org bot profile ?
np
hy
post to their API 
se which was not handled with .catch(). (rejection id: 8)
(node:17704) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
at item.request.gen.end (/rbd/pnpm-volume/1c20d6ad-77cf-4a2d-a304-cf5bd0cca464/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/rest/RequestHandlers/S
equential.js:79:15)
at then (/rbd/pnpm-volume/1c20d6ad-77cf-4a2d-a304-cf5bd0cca464/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/node_modules/snekfetch/src/index.js:215:21)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
(node:17704) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promi
se which was not handled with .catch(). (rejection id: 10)
(node:17704) UnhandledPromiseRejectionWarning: DiscordAPIError: Missing Permissions
at item.request.gen.end (/rbd/pnpm-volume/1c20d6ad-77cf-4a2d-a304-cf5bd0cca464/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/src/client/rest/RequestHandlers/S
equential.js:79:15)
at then (/rbd/pnpm-volume/1c20d6ad-77cf-4a2d-a304-cf5bd0cca464/node_modules/.registry.npmjs.org/discord.js/11.4.2/node_modules/discord.js/node_modules/snekfetch/src/index.js:215:21)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
(node:17704) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promi
se which was not handled with .catch(). (rejection id: 12)```** what is this?**
Looks to me a like an unhandled promise rejection warning
happens by throwing inside an async function without a catch block or a rejected promise that u didnt .catch()
And caused by doing something that you didnt have permissions for
I understand, I'm learning everything through this place, thanks
to avoid errors such as that, you should implement an if statement or check if your bot has permissions before doing a certain action which will require such permissions.
manager.loadItem("ytsearch: memes", handler)
lastResult = eval(code);
message.channel.send("**Result:** \n${util.inspect(lastResult, { depth: 0 })}");
catch(err) {
message.channel.send(`Error while evaluating: ${err}`);
};
anything wrong here?
message.channel.send(`**Result:** \n${util.inspect(lastResult, { depth: 0 })}`);``` you was using " not `
@earnest phoenix http://we-are-proud-to-be-develope.rs/5d616a.png from where lul
Can't tell u 
@earnest phoenix
(Its actually free)
tell meee
😦
Just lookup NodeJS Outbound Call API
@earnest phoenix
thx
(node:6996) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined
anyone able to help
read the error
I think I'm too stupid to get how ytsearch works on lavaplayer
@sullen path im new to coding, i dont know how to fix it
const Discord = require('discord.js'),
db = require('quick.db');
exports.run = async (client, tools, message, args) => {
const status = new db.table('AFKs');
let afk = await status.fetch(message.author.id);
const embed = new Discord.MessageEmbed()
.setColor(0xffffff)
if (!testafk) {
embed.setFooter('You are now AFK.');
status.set(`${message.author.id}`, args.join(' ') || `Sorry, ${message.author.username} is AFK.`);
} else {
embed.setFooter('You are no longer AFK.');
status.delete(`${message.author.id}`);
}
message.channel.send(embed);
}
thats the code
status.fetch(message.author.id); either message or author is undefined
I don't do js, can't be sure
author is
look at the code i sent, do you see any thing that could be wrong?
No, I don't see anything wrong there, so it's more likely that you're invoking the function you posted with bad parameters, in case I missed something
well, it only gives the error when i go to use it, and, it doesnt come up with errors on vsc
Check if the third argument you're passing is the message object you need
Well, it's JavaScript, you won't get many warnings
i tried using the command after restarting the bot, it gave no errors but didnt do anything
if the guild id is 264445053596991498 skip
that if cascade
😂
First of all, its from stack overflow
third, why copy-paste from stackoverflow
Friend's code from SO? 
You can filter a Collection, such as guilds using the filter method to only include some items
In your case, that would be client.guilds.filter(g => guild.id !== enter id here).map(..., if you want to hardcode it
Filter takes a function as its argument and returns an array of the items on the collection it was invoken on, which the said function returned true on
In the example I provided, all items except the one whose id is equal to the given id will pass
Keep it in mind, since you might want to filter more guilds in ifferent ways using this in the future
Also, map is used for creating a new array of modified items, you shouldn't use it if you just want to iterate through a collection
use tap instead
discord.js' Collection class has lots of other similar methods, which you should check https://discord.js.org/#/docs/main/stable/class/Collection
const Discord = require('discord.js'); const client = new Discord.Client(); client.on("ready", async => { setInterval(function(){ client.channels.find('id', '435814918651117579').setName("♡Δ");}, 500); client.channels.find('id', '435814918651117579').setName("♡ΔN");}, 500); client.channels.find('id', '435814918651117579').setName("♡ΔNI");}, 500); client.channels.find('id', '435814918651117579').setName("♡ΔNIM");}, 500); client.channels.find('id', '435814918651117579').setName("♡ΔNIMΞ");}, 500); client.channels.find('id', '435814918651117579').setName("♡ΔNIMΞ Ꮆ");}, 500); client.channels.find('id', '435814918651117579').setName("♡ΔNIMΞ ᎶΔ");}, 500); client.channels.find('id', '435814918651117579').setName("♡ΔNIMΞ ᎶΔM");}, 500); client.channels.find('id', '435814918651117579').setName("♡ΔNIMΞ ᎶΔMΞ");}, 500); client.channels.find('id', '435814918651117579').setName("♡ΔNIMΞ ᎶΔMΞR");}, 500); client.channels.find('id', '435814918651117579').setName("♡ΔNIMΞ ᎶΔMΞRs");}, 500); client.channels.find('id', '435814918651117579').setName("♡ΔNIMΞ ᎶΔMΞRs♡");}, 500);
is this righ me
first time use
js
use the right code block kthx
why do I have a bad feeling about what you are up to
There are several issues with your code
that's called API abuse
const client = new Discord.Client();
client.on("ready", async => {
setInterval(function(){
client.channels.find('id', '435814918651117579').setName("♡Δ");}, 500);
client.channels.find('id', '435814918651117579').setName("♡ΔN");}, 500);
client.channels.find('id', '435814918651117579').setName("♡ΔNI");}, 500);
client.channels.find('id', '435814918651117579').setName("♡ΔNIM");}, 500);
client.channels.find('id', '435814918651117579').setName("♡ΔNIMΞ");}, 500);
client.channels.find('id', '435814918651117579').setName("♡ΔNIMΞ Ꮆ");}, 500);
client.channels.find('id', '435814918651117579').setName("♡ΔNIMΞ ᎶΔ");}, 500);
client.channels.find('id', '435814918651117579').setName("♡ΔNIMΞ ᎶΔM");}, 500);
client.channels.find('id', '435814918651117579').setName("♡ΔNIMΞ ᎶΔMΞ");}, 500);
client.channels.find('id', '435814918651117579').setName("♡ΔNIMΞ ᎶΔMΞR");}, 500);
client.channels.find('id', '435814918651117579').setName("♡ΔNIMΞ ᎶΔMΞRs");}, 500);
client.channels.find('id', '435814918651117579').setName("♡ΔNIMΞ ᎶΔMΞRs♡");}, 500);```
@frigid bone tell me
i never used js
before
so
i'm
first off, your arrow function syntax is wrong on the third line, it should be ...async () => ..., if there are no parameters passed
or use lib for a language you already know
well js is lighter to run
i need help with shards
throw new TypeError('The shardCount option must be a number.');
^
TypeError: The shardCount option must be a number.
I'm the one running 8 java bots on a single-core host 🤷
also, everything after line 3 is just plain terrible and wrong
anyways
in how many servers you bot is in? @earnest phoenix
why are you changing the channel name every 500 ms?
@ruby dust Not That Much, i just want to have it prepared for the future
don't worry about sharding until you'll get to at least 1500 servers
If you have any programming knowledge, you should know that something is broken when you have more closing curly braces than opening ones...
then ask again
true
const client = new Discord.Client();
client.on("ready", async => {
setInterval(function(){
client.channels.find('id', '435814918651117579').setName("♡A");
client.channels.find('id', '435814918651117579').setName("♡An");
client.channels.find('id', '435814918651117579').setName("♡Anime");
client.channels.find('id', '435814918651117579').setName("♡Anime G");
client.channels.find('id', '435814918651117579').setName("♡Anime Ga");
client.channels.find('id', '435814918651117579').setName("♡Anime Gam");
client.channels.find('id', '435814918651117579').setName("♡Anime Game");
client.channels.find('id', '435814918651117579').setName("♡Anime Gamer");
client.channels.find('id', '435814918651117579').setName("♡Anime Gamers♡");}, 10500);```
this seems to work
but there is one issue
API abuse
yes
that's the issue
i want to send messages after that amount of time
Try to put all those channel name strings into an array and only use one setTimeinterval function to iterate through said array and change the name every couple of miliseconds, until it reaches the last element
ik how much everyone wants to do these little animations, but the api abuse is what we all have in common that limits us from doing it ¯_(ツ)_/¯
and yes, that's API abuse and can get you banned
I mean the library you're using will most likely deal with ratelimits, but that doesn't mean there won't be any consequences
I'm trying to make an animation to fade out some text on a site, replace the text and then fade it back in with the new stuff in place
I can make it fade out, but once I change the text it just jumps back to full opacity
Got something
Thanks for the help all
i am having an issue with the music part of my bot, it says
I could not join the voice channel: Error: FFMPEG not found
but ffmpeg is installed
you need to make an envirment variable %PATH% to it
and you need to restart your IDE
thats what I did
What oS?
i use windows
and my bot is javascript
wait, i know what u mean
ye, i know that, but i want it so i can use the ffmpeg thats in modules folder, so i when i upload my bot to its hosting site, it will run off that
┬─┬ ノ( ゜-゜ノ)
¯_(ツ)_/¯
It should just run
if you install it with --save
im not sure
i did that
lol, i might have fixed it
gotta test
yup, fixed
i used npm i ffmpeg-binaries ffmpeg
noice
webhook
what webhook
off
What
Where
i can find
the webhook
password?
what webhook tho
you define it
Weebhook 
Ur a weeb
Is there a free place to code discord.js, and collaborate with others?
glitch 
Well yeah
The bot had too many requests and shut down
Glitch couldn't handle all the commands
So we need a better site
Any*
And recommendations?



