#development
1 messages · Page 841 of 1
js```
how do i set those colors on the code?
liek this
bot.on('messageReactionAdd', (reaction, user) => {
let starmsg = message;
let starembed = new Discord.MessageEmbed()
.setAuthor(message.author.tag)
.setColor("#FFFC00")
.addField(":star:", starmsg)
let limit = 4;
if (reaction.emoji.name == '⭐' && reaction.count >= limit) bot.channels.cache.find(channel => channel.name === 'starboard').send();
ok
ok to test, delete the if (reaction.emoji.name == ':star:' && reaction.count >= limit)
and try it
it should work on any reaction
what's your issue in the first place
the embed doesn't send?
i use a vps so i could just backup all my files except something named .cache
and reset my server
what's your code, as of this very moment
I will be honest, a lot of that seems to be a bit strange
ila rewrite is how I would do mine
bot.on('messageReactionAdd', (reaction, user) => {
let starmsg = message;
let starembed = new Discord.MessageEmbed()
.setAuthor(message.author.tag)
.setColor("#FFFC00")
.addField(":star:", starmsg)
let limit = 4;
if (reaction.emoji.name == '⭐' && reaction.count >= limit) bot.channels.cache.find(channel => channel.name === 'starboard').send();
i use this
and you're saying it isn't sending anything
...because you aren't providing any arguments to send
what
i need to know the code you have right now
😳
let args = message.content.substring(PREFIX.length).split(" ");
bot.on('messageReactionAdd', (reaction, user) => {
let starmsg = message;
let starembed = new Discord.MessageEmbed()
.setAuthor(message.author.tag)
.setColor("#FFFC00")
.addField(":star:", starmsg)
let limit = 4;
if (reaction.emoji.name == '⭐' && reaction.count >= limit) bot.channels.cache.find(channel => channel.name === 'starboard').send(starembed);
also yes are you sure you're even sending it to the right channel
do you have the messageReactionAdd event within the message event.
your code looks for the first channel named starboard out of all guilds, are you sure you're sending it to the right channel
gimme the id of that channel
i tried with the id's
yes
Lol
if its just for testing, I would hardcode an ID
aaaaaaaa
bruh
wot
you know the way you set it, you would need 4 reacts for it to work
fs is notorious for corrupting data
what i used was from the website was called discordjs-guide
@wet iron ```js
bot.on('messageReactionAdd', (reaction, user) => {
if (reaction.emoji.name !== 'star') return;
let starmsg = message.content;
let channel = reaction.message.guild.channels.find(c => c.name == 'starboard');
let starEmbed = new Discord.MessageEmbed()
.setAuthor(message.author.tag)
.setColor("#FFFC00")
.addField(":star:", starmsg);
// let limit = 4;
let limit = 1;
if (channel && reaction.emoji.name == '⭐' && reaction.count >= limit)
bot.channels.cache.find(channel => channel.name === 'starboard').send(starEmbed);
});``` test this
k
yeah but fs is only for either small bots or for files that never get touched
because it loads the entire file into ram
most people use it for logs
ok
alright idk then
FOR FUCK SAKE IM GOING CRAZY
try adding : and : to the star
because I made name == star not :star:
will that work?
const fs = require('fs') //importing file save
var xpPath = 'file path to json here'
var xpRead = fs.readFileSync(xpPath);
var xpFile = JSON.parse(xpRead); //ready for use
var userId = message.author.id //user id here
if (!xpFile[userId]) { //this checks if data for the user has already been created
xpFile[userId] = {xpp: 0, xppr: 0, currentRole: ""}; //if not, create it
fs.writeFileSync(xpPath, JSON.stringify(xpFile, null, 2));
} else {
//as an example, I will give the owner of the id 50 xp and the role "Awesome Role"
var xppVar = Number(xpFile.xpp) + 50 //add 50 to their original xp
var xpprVar = Number(xpFile.xppr)
var roleToGive = "Awesome Role"
xpFile[userId] = {xpp: xppVar, xppr: xpprVar, currentRole: roleToGive};
fs.writeFileSync(xpPath, JSON.stringify(xpFile, null, 2));
console.log(`Changed that player's xp to ${xppVar} and gave him the role ${roleToGive}`)
}
found it in stack overflow
ew json db
ew json db
ok so there are 3 or 4 things I would do differently, on top of not using fs
the first 3 statments can be combined in order to make one
also most people prefer to use let and const rather than var
I have not used reactions yet so idk sorry
what did you change?
just had to add for
let channel = reaction.message.guild.find
it had to be
guild.cache.find
v12
ok I see what I did
yes because there is no channel, it returns
ik
wait no
it might say TypeError: cannot read property send of undefined
the most annoying error of all errors to existr
no
besides module_not_found
I hate the ones that dont show up
🤢
module_not_found is because you are in the wrong dir
I need help for Sharding, when I start Shard correctly, bot says "Error: Shard 0's Client took too long to became ready". I'm trying in my VPS. But when I try in Glitch, bot works correctly.
I'm using Discord.js
My discord.js version is 11.6.3
kinda looks like copy n paste buck0
thank you for showing a lot about what you are doing
ye
whats the stats of your VPS?
lol
SpeedTest or smh?
Shard 0's Client took too long to became ready I'm getting this :/
how many times have you tried to restart?
Lots
But when I try lots of, says error 429 too many requests x)
yea
and
why i'm getting bot is undefined error sometimes
this is the code.
const ayarlar = require('../ayarlar.json');
module.exports = async message => {
let client = message.client;
if (!message.guild || message.author.bot) return;
const db = require('quick.db');
let prefix = ayarlar.prefix
if (!message.content.toLowerCase().startsWith(prefix)) return;
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
const cmd = client.commands.get(command) || client.commands.get(client.aliases.get(command));
if (cmd) cmd.run(client, message, args);
};```
events/message.js
what line?
whats your event handler look like?
Here:
client.aliases = new Discord.Collection();
const init = async () => {
await fs.readdir("./commands/", (err, files) => {
if (err) console.log(err)
console.log(`${moment().format("HH:mm:ss YYYY/MM/DD")} | ${files.length} komut yükleniyor.`)
files.forEach((f, i) => {
let pull = require(`./commands/${f}`);
console.log(`${moment().format("HH:mm:ss YYYY/MM/DD")} | ${pull.config.name} adlı komut yüklendi.`)
client.commands.set(pull.config.name, pull);
pull.config.aliases.forEach(alias => {
client.aliases.set(alias, pull.config.name)
});
});
});
await fs.readdir('./events/', (err, files) => {
if (err) console.error(err);
console.log(`${moment().format("HH:mm:ss YYYY/MM/DD")} | ${files.length} olay yükleniyor.`);
files.forEach(f => {
const eventName = f.split(".")[0];
const event = require(`./events/${f}`);
client.on(eventName, event.bind(null, client));
console.log(`${moment().format("HH:mm:ss YYYY/MM/DD")} | Yüklenen olay: ${eventName}.`);
});
});
client.login(ayarlar.token);
}
init()```
Ight
ik your issue
const Discord = require("discord.js");
const ayarlar = require('../ayarlar.json');
module.exports = async (client, message) => {
let client = message.client;
if (!message.guild || message.author.bot) return;
const db = require('quick.db');
let prefix = ayarlar.prefix
if (!message.content.toLowerCase().startsWith(prefix)) return;
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
const cmd = client.commands.get(command) || client.commands.get(client.aliases.get(command));
if (cmd) cmd.run(client, message, args);
};```
that should work
What about shard error?
im not sure
yes
const Discord = require("discord.js");
const ayarlar = require('../ayarlar.json');
module.exports = async (client, message) => {
let client = message.client;
if (!message.guild || message.author.bot) return;
const db = require('quick.db');
let prefix = ayarlar.prefix
if (!message.content.toLowerCase().startsWith(prefix)) return;
const args = message.content.slice(prefix.length).trim().split(/ +/g);
const command = args.shift().toLowerCase();
const cmd = client.commands.get(command) || client.commands.get(client.aliases.get(command));
if (cmd) cmd.run(client, message, args);
};```
@crimson vapor not works
when i use let client = message.client
error?
ok
idk then tbh
(message.author && message.author.bot)
node : The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name,
or if a path was included, verify that the path is correct and try again.
At line:1 char:1
- node run index.js
+ CategoryInfo : ObjectNotFound: (node:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
@earnest phoenix
help
did you install node?
@earnest phoenix
also learn to read
if node wasn't found then check your node installation
but I'll guess you didn't even install it
ok i'll try
restarting your computer or checking it's variable path would likely help
Anyone know what I’m doing wrong
msg.channel.send('Pong!').then(msg => {
msg.edit('Pong! ' + (msg.createAt - msg.createdAt) + `ms`);
});```
It just returns this
error?
you need to format it
you're using the wrong property and you shouldn't be doing that anyways
so much about that is wrong tbh
either do it in an embed or format the string with ${}
subtracting createdAt timestamps isn't accurate - use Date.now() before and after sending the message and subtract that instead
change the 2nd msg to m
Voidus, that's not the issue
it was for mine
lol
and it worked.
it isn't here.
it returned NaN
the issue is that they're using a nonexistant property
how?
createAt does not exist
fair
but still
Date.now() - msg.createdAtTimestamp
it wont work
use Date.now() before and after sending the message and subtract that instead
in the way he is doing it
So use date.now instead?
How can i use regex with discord.js v11 to search a message for roles which arent mentionable
if a role isnt mentioned, you cannot use message.mentions.roles
you would have to do it a different way
also you cant
wut?
a regex would be looking for a match, you can make a role with any name
@crimson vapor ID mate
you're all being very wrong about this
Why me?
you don't need regex - d.js does it for you
he is saying by ID
million, mentions for roles are in a <@&id> format
I know
Yes
and yes it does
but he is saying just an ID
Nope just try it
no <@&>
just the id king?
let role = message.guild.roles.get(args[x]);
if(!role) return;```
a'ight tell me any other way then
this is what you want
just take the id straight out of the argument
......
Asking about your attempted solution rather than your actual problem
-dotpost
what do you actually want to do
you cant then
what about it
i still want to get the role mention
Role mention like... <id> or just @RoleName
it's IN THE mentions property
it doesn't matter if it's mentionable or not since it is a regex lookup
not if the role isnt mentionable
jesus fucking christ
case "ping":
console.log(${msg.author.username} + ": " + msg.content);
msg.channel.send('Pong!').then(msg => {
msg.edit('Pong! ' + (Date.now() - msg.createdAtTimestamp) + ms);
});
console.log(bot.user.tag + ": " + "Pong!");
break;
it still says the same
why did you copy paste code
idk how im a noob
i don't care, why did you copypaste code
yes but matching a regex every message is inefficient and completely useless
instead just check if there are role mentions
ok so @heavy anchor you are using msg and msg
it wont work
If you mean copied someone else code I didn’t
you need to replace the msg in the .then to m or message or edit or something
tbh, I prefer using let x = await message.send()
looks cleaner
@small prairie , the docs state ```roles
Any roles that were mentioned Order as received from the API, not as they appear in the message content</
which is probably your issue, there's a prebuilt regex in the lib for role mentions (<https://discord.js.org/#/docs/main/v11/class/MessageMentions?scrollTo=s-ROLES_PATTERN>) so you can use it to get ids and then get the role object out of the guild allowing you to check if it's mentionable or not
ig
So like this?
case "ping":
console.log(`${msg.author.username}` + ": " + msg.content);
msg.channel.send('Pong!').then(m => {
m.edit('Pong! ' + (Date.now() - msg.createdAtTimestamp) + `ms`);
});
console.log(bot.user.tag + ": " + "Pong!");
break;
Sorry the codes a mess
close
It’s formatted in my document
change the msg to m
which one
the one after Date.now()
Ok thx
msg.channel.send('Pong!').then(m => {
m.edit('Pong! ' + (Date.now() - m.createdAtTimestamp) + `ms`);
});
Still showing
i told u
format
:p
the most accurate would be
Date.now() in a variable
send message
then
edit with Date.now() - the Date in the variable
or
const time = Date.now() - m.createdAtTimtestamp
m.edit(`Pong! ${time}`)
might not be right
since i put it in a const
again using messge timestamps isn't accurate
What better way is there to do it then?
Ok I’ll stop bothering you thx
you expect me to spoonfeed you
which i won't do
i'm giving you a brain exercise to get your cogs going
I have some issues with ytdl, @discordjs/oups &/or ffmpeg-static : sometimes the music currently playing stops playing, sometimes it don't skip to next song when one is finished. I can't figure how it happens, as they are no error at all in the log.
All of my code can be found at https://github.com/lumap/PichuRewrite
Not song dependant, happens sometimes, sometimes not
if (message.author.bot) return;
if (message.content === "$rhelp") {
message.channel.send(`
**Role Help Menu**
** $role all [Role Mention] **
** $role bots [Role Mention] **
** $role humans [Role Mention] **
`);
}
});
client.on("message", message =>
client.on("guildMemberAdd", member => {
let id = member.user.id;
let m = member.user;
var embed = new Discord.RichEmbed()
.setThumbnail(m.avatarURL)
.setImage(
""
)
.addField(
`:NW::NE::NL::NC::NO::NM::NE:`,
`<@${id}>`
)
.setImage(message.guild.iconURL)
.addField("Welcome To**", `**${member.guild.name}**`)
.addField("Don't Forget To Follow DiscordTOS")
.addField("Enjoy ")
.setFooter("C-Bot By Mentux")
.setColor("RANDOM");
var channel = member.guild.channels.find("name", "Welcome"); //تعديل مهم اسم روم الولكم
if (!channel) return;
channel.send({ embed: embed });
});```
Someone Help?
It Say The Last Line Syntax Error
How would I do this, without getting "lastMessage" in the response?
@earnest phoenix channel.send(embed)
Ok
@snow urchin why would you do that
you should just be able to add .lastMessage to it
I Did Close All
Well no
yep
Check The Code
I see
Everything Is Right
?
Wat
I made it so simple for you
@tight plinth, cause when I send it over express, I get a circular structure error
Thanks ❤️
@earnest phoenix it won't work
It Works

LOL
LMFAO
I didnt see that
correct me if im wrong but it should be this ```js
client.on("message", message => {
if (message.author.bot) return;
if (message.content === "$rhelp") {
message.channel.send(`
Role Help Menu
** $role all [Role Mention] **
** $role bots [Role Mention] **
** $role humans [Role Mention] **
); } }); client.on("guildMemberAdd", member => { let id = member.user.id; let m = member.user; var embed = new Discord.RichEmbed() .setThumbnail(m.avatarURL) .setImage( "" ) .addField( :NW::NE::NL::NC::NO::NM::NE:, <@${id}> ) .setImage(member.guild.iconURL) .addField("Welcome To**",${member.guild.name}`)
.addField("Don't Forget To Follow DiscordTOS")
.addField("Enjoy ")
.setFooter("C-Bot By Mentux")
.setColor("RANDOM");
var channel = member.guild.channels.find("name", "Welcome"); //تعديل مهم اسم روم الولكم
if (!channel) return;
channel.send({ embed: embed });
});```
var guild = client.guilds.get("551070196958363648");
let mmembers = [];
guild.members.forEach(m => {
mmembers.push({username: m.user.username, avatar: m.user.avatarURL})
})
res.json({
server: {
name: guild.name,
id: guild.id,
member_count: guild.memberCount,
boost_count: guild.premiumSubscriptionCount,
boost_level: guild.premiumTier,
boosters: guild.roles.get('585543799673978891').members.map(m => m.user),
members: mmembers
}
https://panelapi.boun.cc/v1/serverinfo?pretty
TypeError: Converting circular structure to JSON
--> starting at object with constructor 'User'
| property 'lastMessage' -> object with constructor 'Message'
--- property 'author' closes the circle
at JSON.stringify (<anonymous>)
msg.channel.send('Pong!').then(m => {
var time = Date.now()
m.edit('Pong! ' + (Date.now() - time) + `ms`);
});
so i did this it reply 0ms
like <5000MS cooldown spam, is changing the bot's status <5000MS bannable or suspendable? I couldn't find any information.
move var time = up
is that right?
What are you doing that you need it all converted to json
i dont
^Callum
And no, your ping calculation isn't right
@heavy anchor You're sending a message, once that message has been sent, you grab the current time and edit the message to the current time minus the current time
If you understand what .then() does, you should be able to fix your logic flaw
whats the code for send with id
if (message.content.startsWith(prefix + "issue")) {
let messageArgs = message.content
.split(" ")
.slice(1)
.join(" ");
let messageReason = message.content
.split(" ")
.slice(2)
.join(" ");
if (!messageReason) return message.reply("**# Specify The Issue!**");
let Rembed = new Discord.RichEmbed()
.setTitle("`Issue!`")
.setThumbnail(message.author.avatarURL)
.addField("**# - Reason:**", messageReason, true)
.addField("**# - Channel:**", message.channel, true)
.addField("**# - Time:**", message.createdAt, true)
.setFooter("If You Are Joking Around You Will Get BlackListed From Bot");
message.channel.send(Rembed);
message.channel
.send("__Are you sure you want to send this to the Mentux??__")
.then(msg => {
msg.react("✅");
msg
.react("❌")
.then(() => msg.react("❌"))
.then(() => msg.react("✅"));
let reaction1Filter = (reaction, user) =>
reaction.emoji.name === "✅" && user.id === message.author.id;
let reaction2Filter = (reaction, user) =>
reaction.emoji.name === "❌" && user.id === message.author.id;
let reaction1 = msg.createReactionCollector(reaction1Filter, {
time: 12000
});
let reaction2 = msg.createReactionCollector(reaction2Filter, {
time: 12000
});
reaction1.on("collect", r => {
message.guild.owner.send(Rembed);
message.reply("**# - Done! 🎇**");
});
reaction2.on("collect", r => {
message.reply("**# - Canceled!**");
});
});
}
});```
I Want It To Send To Me Not The Guild Owner
Like With Id
put var time = Date.now() before then?
Egypt
any1 can help me pick settings for ytdl and the discord.js music?
my music getting lagged and im trying to fix it.
i have 4gb ram and 4vcores vps
with 200mbit/sec download
and 25mbit/sec upload
my code is: let dispatcher = connection.play(ytdl(link, {filter: 'audioonly',quality: 'lowestaudio', highWaterMark: 1024 * 1024 * 10}),{ volume: 0.5, passes: 3 });
and its lagging. any idea why and how can i fix it?
why did you set it to lowest audio
i thoguht itll fix the lags
that defeats the whole purpose of a music bot
It reduces the quality
Ye
or the .play
ok
ill try
its way better with the highwatermark
trying to bring back the highestaudio
format opus making it to lag i think
ye its lagging
it was better without it
Try things and look at the best settings for you
ok
I finally got Eclipse Rich Presence to work correctly
Nice, BTW what command framework/handling you use, or you did one?
?
My Discord library is Discord4J
The commands are just simple interfaces
I've moved to using annotations for metadata
Hi guys 🙂
I've created an open-source music bot with voice commands. Maybe useful to some of you: https://medium.com/@ilyanevolin/speech-bot-for-discord-c46fed9c1fe5
That's pretty kewl. I saw that it has Machine Learning (at least in the post)
Did you train a neural network or using an api?
Is that ad
@fringe bane I didn't train any NN for this, using a free API. But might start training own NN in the future for this, depends ofc 🙂
who help me with bot status command?
@tight plinth well he did just post a blog post and the source code, not the bot url itself so
I guess it's more of an example code of how to use this functionality
There is no official/live bot of this version at the moment, so not an "ad" per se
I mean this functionality is awesome but IDK if I myself would use it because I only know how to code bots in Java and Elixir
Though it would be fun sometime in the future to use this
Not an ad by itself
I use it personally when gaming with friends. But depending on the popularity I might turn it into an official bot
who help me with bot status command? My command is bugged.
Is it CPU-intensive? I can't read JS so I don't know how it works. Do you detect the voice and then store the base64 and sent it to the api, or live-streaming it to the api?
Why not use heroku, you can start a bot for free 24/7 there
the github install instructions are just copy & paste, I even have a dockerfile , so you dont need to do anything :p
if it uses an API its probably needs more network than cpu
@crimson vapor correct
How's the 'backend' of the bot to send the data to the api? Base64 encoding then sending chunks or a stream?
who help me with bot status command? My command si bugged.
I man, I'm just curious
no encoding, just raw audio data converted to .wav & submitted to the api
api responds with text
woah
So 'caching' it and sending chunks?
smthn like that
I plan to write bots in Elixir and there's a thing there that you can integrate parts of multiple Elixir apps in one big Elixir app
There's a webapp framework for it which has NodeJS a part of it so I might make a mix of Elixir and NodeJS
Because Elixir is BLAZINGLY fast, lightweight and safe for errors
does the bot listen to the voice command then send a command based on that, because in the video it looks like it would respond to bots
who help me with bot status command? My command si bugged.
@fierce path woah, that's actually pretty cool
@crimson vapor the bot handles both voice and text commands. Voice commands are parsed and if there's a match, it just replies with the text command for further execution; it's just a design thing
messages.forEach(msg => {
let user = client.users.cache.get(msg.user)
let member = message.guild.members.cache.get(user.id)
embed.addField(member.displayName, msg.content)
})
I am trying to add a field for each user stored in my database but it doesn't seem to work
the msg.user property includes the id of the user
Error: TypeError: Cannot read property 'id' of undefined
The user and member should be in the cache
But like does the database have the ID in the table?
a better way would be to create an api with the commands and what it should do because sending it as a message would probably allow bots to respond
but I could be confused
no its not lilke that
@crimson vapor well yah, that would be the stricter cleaner way of doing it. I might refactor it later
@crimson vapor my initial code was to send commands from my bot to Groovy (the music bot) , but almost all other music bots dont accept messages from other bots
so I had to implement my own music player
ahahah @copper cradle will sudo rm -rf / destroy the system? Try it and see!
yeah bots here get muted if they respond to other bots
You could as well add TTS to your bot
if (!snipes.has(message.channel.id)) snipes.set(message.channel.id, [])
snipes.push(message.channel.id, {
user: message.author.id,
message: message.content
})
this is what I am storing in my database upon message deletion
so you can control it with voice but as well get the audio of a response
user is not the user object just the id
idk if there are free tts apis for JS (probably are)
@fringe bane yah :):
so I don't understand why it can't get the user
Honestly I don't like JavaScript, like the code itself looks like a cluster when reading
Or rather the default syntax of JS
I'm gonna use the snippet Link provided
if (!snipes.has(message.channel.id)) snipes.set(message.channel.id, [])
snipes.push(message.channel.id, {
user: message.author.id,
message: message.content
})
if (!snipes.has(message.channel.id)) snipes.set(message.channel.id, [])
snipes.push
(
message.channel.id,
{
user: message.author.id,
message: message.content
}
)
Like for me the second one is easier to debug and stuff
who help me with bot status command? My command si bugged.
discord.js
But for syntax overall in languages (I've done C-like and non-C-like languages), #1 is the Elixir (kinda Ruby) syntax:
@doc """
Creates a random embed
"""
def create_random_pic_embed(message) do
%Nostrum.Struct.Embed{}
|> put_title("Some title!")
|> put_description("Some description!")
|> put_image("link-to-image")
|> put_color(7000)
end
looks a bit like python
I know almost all languages except ruby and the like
I actually prefer JS for many things
I've tried python but didn't like it
who help me with bot status command? My command si bugged.
@earnest phoenix maybe try debugging manually ?
Like JS is okay because it's popular, but like performance-wise isn't the best I guess
and it's single threaded
@fierce path my comamnd send server -2 and users -3 and my bot is in 650 servers
so
I might try lua because I have a couple of microcontrollers
which are lua-compatible
Elixir is/isn't single threaded
I hate those langs where u don't use {}
Like you write it as if it's single threaded
feels weird to me
I had the same feeling but like elixir is
well I mean I just watched a video about elixir
and I like the fact you can call functions without ()
ofc if you pass in an arg
else then u need those ()
If you don't pass an arg, it will give warnings btw
😔
Is it better to have dark mode by default or an option to switch and use light mode by default?
Dark mode lmao
either way you should have the option to switch
What if someone opens your page at 3am
why is your monitor at full brightness come 3am
Does anyone sell Google Play Gift Cards?
I mean most apps are darkmode, even if the light is not 100% your eyes are like used to a dimmer color
like it's okay to be lightmode if your app has some dark parts
but if it's like 80% white and other bright colors, try dark mode by default
It's neutral colours fairly washed out.
They become slightly more vibrant when in dark mode.
could you send me a screenshot?
I mean idk how it looks like
send it in the dms if you want
dw, my webpages are 90% html barebone ahahahaha
Because I don't know frontend at all
discord should add a solarized theme tbh
Eh I just use betterdiscord for themes
Will have to give me a second, Cloudflare likes caching everything.
against the ToS is anything with using the apis and revealing stuff which shouldn't be
I think just css edits are okay
they also state that client mods are agains the ToS
I remember being a custodian in dfeedback and a lot of ppl were getting reported due to client mods, also #memes-and-media
@fringe bane as I said barebones and doubt the hover color will stay. It's just there as an indicator of website primary colour.
Same for light.
I don't feel to much like working on my translation or reminder commands right now
Let's check out this new library I added to gradle
Will also have to write MemberCase, which I have procrastinated on
okay
TypeError: fields.flat is not a function
at Function.normalizeFields (/rbd/pnpm-volume/13dc7619-49b0-4cc3-8e07-6aae909afd7f/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/structures/MessageEmbed.js:436:8)
at MessageEmbed.setup (/rbd/pnpm-volume/13dc7619-49b0-4cc3-8e07-6aae909afd7f/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/structures/MessageEmbed.js:70:91)
at new MessageEmbed (/rbd/pnpm-volume/13dc7619-49b0-4cc3-8e07-6aae909afd7f/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/structures/MessageEmbed.js:11:10)
at embedLikes.map.e (/rbd/pnpm-volume/13dc7619-49b0-4cc3-8e07-6aae909afd7f/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/structures/APIMessage.js:164:40)
at Array.map (<anonymous>)
at APIMessage.resolveData (/rbd/pnpm-volume/13dc7619-49b0-4cc3-8e07-6aae909afd7f/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/structures/APIMessage.js:164:31)
at TextChannel.send (/rbd/pnpm-volume/13dc7619-49b0-4cc3-8e07-6aae909afd7f/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/structures/interfaces/TextBasedChannel.js:141:62)```
d.js v12
never used that fields.flat
you need to update the node version
update node
( Node.js 12.0.0 or newer )
is message.guild.roles.some's args the role's ID or the roles name? if not the rolename how would i find .some with the rolename?
Hi
hey
What is the value client.users.cache.size returns?
dbl.getStats("456204863320227861").then(stats => {
console.log('DBL ye gerekli verileri girdim.')
});``` I Don't Understand , What İs The Problem?
at Object.<anonymous> (/app/index.js:2297:8)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
(node:8688) 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: 3)
(node:8688) [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.```
try catching it
is there a limit for getting member list?
no
const DBL = require("dblapi.js");
const dbl = new DBL(client.ayarlar.dbltoken, client);
client.on('ready', () => {
setInterval(() => {
dbl.postStats(client.guilds.size);
}, 1800);
});
dbl.getStats("693551232635240558").then(stats => {
console.log('DBL ye gerekli verileri girdim.') //{"server_count":2,"shards":[]}
});
client.login('')```
my member count is 35k, but the bot creates just 14k user files
dbl.getstats ? id ?
how do I get the full member list then?
if it's possible
fucking files!?
Nah but can trigger some people
this kids is why you use a database

i mean it works
To answer your question though it's probably caching
hasn't gotten all users yet
With ytdl
Should I use thi
const dispatcher = serverQueue.connection.play(ytdl(song.url, {filter: 'audioonly', quality: 'highestaudio', highWaterMark: 1<<25 }))
Or how else do I make high quality?
@golden condor If you are trying to download the music I would recommend downloading it as an mp4 then converting it to an mp3 from youtube
Hello.
I would like to know if it is possible to get a channel ID by his name
you want to get the last channel name a user posted in?
"his name" is throwing me off
No, I want to send a message in any channel
you want to just grab a random channel? Well in d.js channels are stored in a modifiable object
so you could Array.from(the object) and select randomly
Not a random one, I want to grab a specific channel

lmao
if(message.guild.roles.some("muterole")==false){
is this valid
My english not that good I guess
its returning fn is not a function as a TypeError
"fn" is not a function? Then I don't think that code snippet is the issue
if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) {
const playlist = await ytpl(url);
const videos = await playlist.items;
const embed = new Discord.MessageEmbed()
.setTitle("Playlist Added to Queue")
.setDescription(`${playlist.title} has been added to the queue. It has ${videos.length} songs`)
.setColor("#00aaff")
msg.channel.send(embed);
for (const video of Object.values(videos)) {
const result = await yts(video.title)
var video2 = result[0]
return handleVideo(video2, msg, voiceChannel, true); // eslint-disable-line no-await-in-loop
} ``` What is wrong with this
ytpl = ytpl
yts = yt-search
Thanks ! 😄
wait member list doesn't count bots right? @zenith terrace
@amber delta wym
if member list retrieves bots too
No, there is 2 different codes for bots and members
Np
async function DownloadChunkFile(manifest, file, progress) {
var fileUrls = GetFileURLs(manifest, file);
var filename = file.Filename.split('/').pop();
var fd = fs.openSync('./paks/' + filename, 'a');
for (var i=0; i < fileUrls.length; i++) {
var buf = false;
var chunkPath = './chunks/' + fileUrls[i].hash + '_' + fileUrls[i].guid + '.chunk';
if (fs.existsSync(chunkPath)) {
buf = fs.readFileSync(chunkPath);
} else {
var req = await fetch(fileUrls[i].url, {
method: 'GET',
headers: {
'Accept-Encoding': 'br, gzip, deflate',
}
});
var buf = await req.buffer();
fs.writeFileSync(chunkPath, buf);
}
progress(i, fileUrls.length);
var resBuf = ParseChunkHeader(buf, fileUrls[i]);
fs.writeSync(fd, resBuf);
}
fs.closeSync(fd);
return filename;
}
is there something that I can do to make this function "faster" ?
Hello, I have been wondering for some time but I do not find the solution, you know how to transform permissions of this type:
104189632
On permissions of this type:
"MANAGE_GUILD", "ADMINISTRATOR",
I would absolutely like to know if the user has permission MANAGE_GUILD, on a bot panel
I haven't forced yet
@rapid geyser check if the bit of those perms is set to one
Ok
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
perms_int & 0x00000008 > 0 would be a check for ADMINISTRATOR
Ok, thank you
Hi
Who’s bot gets discord users information? Like usernames, tags etc.
Userinfo?
Yeah sure
Just pushed this giant commit
It's not evem the initial commit
78 files changed though
What you trying to do
Oh
The DM channel is likely not cached. Fetch it.
nevermind
@slow steeple use the parent object https://discord.js.org/#/docs/main/stable/class/GuildChannel
Thank you
How Do I Make A Premium System
Like Is It Possible
It's pretty easy if you know how to implement it
Do You Have Any Guid
nope
unless you code in java
javacord
nope
ahhhh anyone else
There are problems with this dblapi.js
When it installs it says "too many request"
How can I solve it?
@crimson shuttle too many requests means you're spamming the api
Anyone have a dashboard guid
And how do I make after a certain time the bot leaves the server
you didnt even tell the language
discord.js
so js and library is d.js, so just do setTimeout bruh
is there an example of a command which would tell me the shards that are online and offline?
@hollow granite what lib and lang
discord js
I have a question
about function :: toLowerCase()
Discord.js | Node.js | npm | using Atom.io to program dadada... Windows 10
how would I make my command reader, "toLowerCase" so that any/all commands can be used with messed up spelling like hElp heLP etc
add toLowerCase
@hollow granite client#broadcastEval, and if some shard doesnt respond, its offline/paused
in the command itself or in one of those lines tho excuse spelling lol
how do i asynchronously make a directory if it doesn't exist?
is there a way to make fs.appendFile also create folders if they don't exist like it does with files?
@obtuse wind before the command set, that set the name
oh ok thanks freestyle
if (data.lyrics.length > 2048) return msg.edit('Lyrics were too long.');
TypeError: Cannot read property 'length' of undefined
Why
help me
ok
Basically data.lyrics exist or it could exist (and if so) send what the log of it was here.
^
hey guys, got a bit of a djs error hope you can help Ill paste my code below
The error is: SOMETIMES the check mark reaction will work and execute the code however 90% of the time it doesn't. Reacting to the X ALWAYS works and executes it's code. I've been trying to figure this out for hours hence how my code is now formatted, I needed to dissect it because it's giving me a headache...
https://sourceb.in/f2b6039408
and the error is?
none
no error
apart from the fact it is just inconsistent
Works, doesnt work, doesnt work ...
that's odd
very
I'm on my phone rn
so I can't actually help
as in it's sometimes not picking up the reaction?
Let me have a look a sec.
@earnest phoenix
sorry yeah sometimes it works
however 90% of the time it doesnt execute the reaction code
the X however, works perfectly fine
Does it print anything in the console?
https://lumap.is-inside.me/VfpFiTSG.png client mod
are you adding the reaction before the second one goes?
:ban:
nothing...
I've used the same code I have used for all my reaction collection commands
before the second one is added by the bot*
they all work perfectly apart from this
and if you unreact and rereact does it work
no
Personally I would of done both reaction collectors in one, rather than 2 separate ones as it's easier to debug.
I really though, don't see anything I've done incorrectly
it's been done poorly but shouldn't be creating an issue
the formatting?
Inside of the reaction collector for the tick, can you do console.log("here") and try and see if it logs?
yeah one moment
mostly everything lol but it's alr
So then run the command and see if it gets there.
Does it log or not?
first time I did the tick, worked perfect (didnt console log however), I started the command again and reacted with the tick, nothing. I reacted with the X and it logged that.
Did you save the code?
If so, it's your reaction collector then and not anything else.
if you wait a few extra seconds after both reactions are added does it start working consistently?
^
still feel like it's a timing issue here
nope
have you- tried it
just tried it and didn't work after approx. 5 secs
Yeah or I'm thinking it could be just getting confused about the 2 different reaction collectors at the same time, where it typically wants it to be in 1.
yeah well try and do that 28r, do the reactions properly,
create the collector before you even add the reactions and you can just switch() the emoji and do actions based on them
Shouldn't make a difference but occasionally it does in some scenarios.
reason, I did it like this is because I don't understand how to do it all conjoined and have been told to make sure I know what my code does to ensure I can debug etc.
however I guess I don't know this way as much as I thought?
well you'll never understand new code if you don't make new code
yeah that's the thing haha I got 0 idea how to do it
it's not too different and it's pretty simple to do if you already have the knowledge you've demonstrated
This one is rather simple (I'll about to share the key bits), and you should be able to read it.
alright, will do my best.
for(const e of ["emjoji1", "emoji2"]) await message.react(e); //This reacts on the message in the correct order.
var validEmojis = ["emoji1", "emoji2"]; //This puts it into an easy array to fetch later.
const filter = (reaction, user) => {return (validEmojis.includes(reaction.emoji) && !user.bot);}; //You can add more parameters here, this just checks it is a valid emoji and the user who reacted isn't a bot, you may want it to ensure that it is the same author however.
message.awaitReactions(filter, {max: 1, time: TIME, errors: ["time"]}).then(async collected => { //This is the reaction collector getting the filter, the max is 1 and you need to fill in the max time allowed.
message.clearReactions() //Clears all the reactions after it was got.
if(collected.first().emoji === emoji1){
//If it was emoji one.
} else if(collected.first().emoji ===emoji2){
//The code for emoji2.
} else {
console.log("Error- no valid emoji found somehow"); //This should never run, if it allw works.
}
});```
This uses exactly what you had but just rearranged.
See if you can finish and complete it, @earnest phoenix
oh alright lemme give it a go, thanks.
@frail ocean btw i suggest adding the collector before adding the reactions as sometimes people will press a reaction before a second or however many there are, are added, they're unlikely to wait until they're all added before adding it
@slim heart its unlikely and this is easier to understand in chronological order. Typically if your bot is on a suitable connection the reactions are added quickly, and I've done testing and people would unreact and rereact.
But yeah 28er can swap it around if it's vital.
well especially when things like this in a game where you're likely to get rate limited no matter how good the connection there's no avoiding it and better practice
Mhm.
0|index | at WebSocket.emit (events.js:198:13)
0|index | at Receiver.receiverOnMessage (/root/bharatbot/node_modules/ws/lib/websocket.js:789:20)
0|index | at Receiver.emit (events.js:198:13)
0|index | TypeError: command.run is not a function
0|index | at Client.client.on (/root/bharatbot/index.js:144:24)
0|index | at Client.emit (events.js:203:15)
0|index | at MessageCreateHandler.handle (/root/bharatbot/node_modules/discord.js/src/client/websocket/packets/handlers/MessageCreate.js:9:34)
0|index | at WebSocketPacketManager.handle (/root/bharatbot/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:108:65)
0|index | at WebSocketConnection.onPacket (/root/bharatbot/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:336:35)
0|index | at WebSocketConnection.onMessage (/root/bharatbot/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:299:17)
0|index | at WebSocket.onMessage (/root/bharatbot/node_modules/ws/lib/event-target.js:120:16)
0|index | at WebSocket.emit (events.js:198:13)
0|index | at Receiver.receiverOnMessage (/root/bharatbot/node_modules/ws/lib/websocket.js:789:20)
0|index | at Receiver.emit (events.js:198:13)```

@frail ocean I got an unhandled promise rejection error
@earnest phoenix add a catch in then, and read the error.
I suddenly encountered such a problem
https://sourceb.in/c025b6058e
that's all I got :/
Hello all, I am having issues with playlist handling in d.js using the packages ytpl and yt-search
Playing a song on it's own works fine, just playlists don't. The code and error message can be found below. Thanks in advance!
js if (url.match(/^https?:\/\/(www.youtube.com|youtube.com)\/playlist(.*)$/)) { const playlist = await ytpl(url); const videos = await playlist.items; const embed = new Discord.MessageEmbed() .setTitle("Playlist Added to Queue") .setDescription(`${playlist.title} has been added to the queue. It has ${videos.length} songs`) .setColor("#00aaff") msg.channel.send(embed); for (const video of Object.values(videos)) { const result = await yts(video.title) var video2 = result[0] return /* I have also tried await*/ handleVideo(video2, msg, voiceChannel, true); }
(node:6632) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'videoId' of undefined
at handleVideo (C:\Users\t\Documents\app\commands\play.js:73:15)
at Object.run (C:\Users\t\Documents\app\commands\play.js:42:11)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:6632) 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(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 6)```
This is the song handler which also works fine with singular songsjs const song = { id: video.videoId, title: video.title, url: `https://www.youtube.com/watch?v=${video.videoId}`, author: video.author.name, request: msg.author, thumbnail: video.thumbnail, duration: video.duration.timestamp };
@frail ocean dont mean to bother you, I know you've probably been helping people all day :/
Is it normal for chrome to send more than 1 GET request to the server? PM2 is telling me that when someone goes to the home page the req/min gets increased by 0.3-0.4 (which I think means 3-4 requests a sec)
I don't make any requests to the server client-side in the homepage
@golden condor I already got this problem, I can explain you how to solve it.
Yes please
Yeah
so they dont have the same proprieties
I am feeding the videos in what I use to handle videos
const result = await yts(video.title)
var video2 = result[0] ```
with this
I use yt-search to handle songs
wats dt
yts = yt-search
@cinder patio Network tab in dev console and see where the browser is sending requests
the problem is from this https://lumap.is-inside.me/9NwOKKcU.png
What about it
try to log a somg from a playlist first to see how they are handled
Already checked, only one request to the server. I am not sure if the JS/css files that the HTML file imports also count
Didn't log anythin
anybody know what im doing wrong here
(djs)
https://sourceb.in/c025b6058e
@golden condor js { 11:28:44 AM worker.1 | id: 'QtW_mlJuSBU', 11:28:44 AM worker.1 | url: 'https://www.youtube.com/watch?v=QtW_mlJuSBU&list=PLrR0UWVc3H19qjOsZ864Dw-KlrGPU7l7F&index=2&t=0s', 11:28:44 AM worker.1 | url_simple: 'https://www.youtube.com/watch?v=QtW_mlJuSBU', 11:28:44 AM worker.1 | title: "Nightcore - Don't Say That - (Lyrics)", 11:28:44 AM worker.1 | thumbnail: 'https://i.ytimg.com/vi/QtW_mlJuSBU/hqdefault.jpg', 11:28:44 AM worker.1 | duration: '3:04', 11:28:44 AM worker.1 | author: { 11:28:44 AM worker.1 | name: 'Syrex', 11:28:44 AM worker.1 | ref: 'https://www.youtube.com/channel/UCeZje_7vr6CPK9vPQDfV3WA' 11:28:44 AM worker.1 | } 11:28:44 AM worker.1 | }
this is how video are in a playlist
no
const song = {
id: video.id || video.video_id,
title: video.title,
url: video.video_url || "https://www.youtube.com/watch?v=" + video.id,
duration: `${minute}:${seconds}`,
author: {
id: message.author.id,
username: message.author.username
}
}
if (video.thumbnail) {song.thumbnail = video.thumbnail}
if (video.author) {song.artist = video.author.name}
if (video.duration) {song.duration = video.duration}
if (video.player_response) {
let vid = video.player_response.videoDetails
if (vid.isLiveContent) song.duration = 'Live'
song.thumbnail = vid.thumbnail.thumbnails[vid.thumbnail.thumbnails.length-1].url
song.artist = vid.author.name
}
if (video.server_response) {
let vid = video.server_response.videoDetails
song.artist = vid.author.name
}
```
this is how personally I do
it tooks me several entire days of work to solve this issue, and I dont want you to feel this pain
Thx
^^
@frail ocean this is where I got https://sourceb.in/c025b6058e :/ not sure what else I need to do but yeah
Should it be this
for (const video of Object.values(videos)) { await handleVideo(video, msg, voiceChannel, true); // eslint-disable-line no-await-in-loop
}
@tight plinth is this right?
const song = {
id: video.id || video.videoId,
title: video.title,
url: video.url || https://www.youtube.com/watch?v=${video.videoId},
author: video.author.name,
request: msg.author,
thumbnail: video.thumbnail,
duration: video.duration || video.duration.timestamp
};
try it and see
but
I dont recomment ptuuing the entire msg.author as request
it takes ram
if (message.author.id !== message.guild.ownerID || message.author.id !== client.config.ownerID) return message.channel.send('Only the server owner can change my prefix!');
```I'm a bit confused, I want the server owner AND/OR me (if I am the server owner) to be able to change my bot prefix. How to do that?
@golden condor hell no
try doing msg.author.id
just id should be enough
or tag
or both
Why wouldn't .toString work
coz msg.author is an object
It just worked
lol
does it say the text if the msg.author is not the owner?
idk
try it lmao
are u using json db?
quick.db
ah
https://lumap.is-inside.me/Y57sYCFz.png in my private server, it works
@woven sundial https://lumap.is-inside.me/mKE0uiYZ.png
here it does not?
owner detection works
I just want the dev to bypass server owner perms
ok
@woven sundial invite.inviter doesnt exist
can you help me solve this error before I go nuts?
whats ur host kyra
try using sudo npm i integer
@tight plinth check client owner id first
lumap try using else if
@tight plinth I am going insane
lel
And I don't know how to make a bot using noblox
@atomic quarry what are u trying to do
Make a Discord bot with noblox
an irritating module :/
and now retry
is noblox a module?
....
sudo?
oof
@atomic quarry yes noblox is a module
wait a sec
@tight plinth terminal
if (false || true) return 1``` returns 1?
12v?
try it
i think its hasPermission
.hasPermission(permission, { checkAdmin = true, checkOwner = true } = {}) {
``` can also work ig
wait a second
server owner have admin by default
so it works fine in my private server
splitted the prefix command in 2 commands : one for the users, one for me
[python] so im suppose to get a text file, which contains numbers from 1 to n(not in the right order) but is missing one number, i need to find what is the number that is missing and also add it to the file, i dont even know where to start
easiest way is just to sort it and find the gap 😛
how do i find the gap tho? just go over it with a for loop and check when the number im currently on is +2 than the number before
Is the step a constant?
after i sort it, yes

