#development
1 messages · Page 1163 of 1
if (message.author.id == "554185890453389322") return message.reply("I m sorry but this is a owner only command")
now ?
Why don't you try it and see
hm
use !==
kk
parenthesis moment
Same diff
cutted from one test bot
Also spoonfeed
No
Es em h
Allow me to explain
how can we explain code without showing any code
but dice, rem? good choice, i'm so proud of you
:D
Random Edgy Memory
this guy isnt talking anymore so.. problem solved I guess
Can't do emojis as field names
^
setDescription is possible?
yes
can i +1 setDescription?
i am used 2 setDescription
only 1 appeared
sorry my english
:c
Anyone here who knows how to convert a website like ht tps://youtube.com/c/ItzRockstarYT to json format and get channel details like subs and total views?
but not in field title
@misty sigil We can use emoji in field title
I have used
in d.js v12
no, no you can’t?
@polar temple <:emojiname:emojiId:>
guild create
@weak rain it emits a guild member object
or ```js
let emoji = client.emojis.cache.get("id")
.addField(${emoji} Title, "Value")```
How to convert a website like ht tps://youtube.com/c/ItzRockstarYT to json format and get channel details like subs and total views?
YouTube API?
yea
find the API if there is one

@ionic dawn change ur nick
remove the : in the end
Yea
ok
ID doesn’t need the : at the end
No?
pepega
whatsup gamers
: )
<a:id:name>*
r u sure?
yes
i too
'<a:NAME:ID>'
not working
for me
didn't 1 out of 2 work
"<a:NAME:ID>" and "<:a:NAME:ID>"
you can try doing client.emojis.get("the custom emoji ID")
Hello, I'm Brazilian and I don't have this content here, I would really like this progress bar, can someone help me?
its <a:name:id>
@misty sigil It worked, thanks c:
@misty sigil what do we have left to do other than delete?
how do people still not know how to calculate percentages
no
tfw your entire bot is based on copypasting from samples
@earnest phoenix that's how all great bots are made
I did everything so far on the embed but this progress bar doesn’t have anything like it here, so I don’t know where it starts, and I already have a lot
just stop..
if you cant notice that the code provided isn't js then you should stop
It's not python, this is js
you're right 04:40 should i go to sleep
I don't recall being responsible for your sleep time
can I have multiple bot prefixes??
Yes
thanks @golden condor
titles do not support markdown or mentions
don't use mention then
@earnest phoenix thats favela language, means 'bye you asshole'
fields name cant have mentions iirc
nor title
Hi, i just made a rank command and i have this error saying Cannot read property 'users' of undefined and I have already defined it but i have the same error.
Code?
const { MessageAttachment, MessageEmbed } = require("discord.js")
const Canvacord = require("canvacord");
const { match } = require("ffmpeg-static");
const { Attachment } = require("canvacord");
const canvacord = require("canvacord");
module.exports = {
name: 'rank',
description: "rank command",
async execute(client, message, args) {
let user = message.mentions.users.first() ||
client.users.cache.get(args[0]) || match(args.join(" ").toLowerCase(), message.guild) ||
message.author
let level = client.db.get(`level_${user.id}`) || 0
level = level.toString()
let exp = (client.db.get(`xp_${user.id}`) || 0).toString()
let neededXP = Math.floor(Math.pow(level / 0.1, 2)).toString()
let every = client.db
.all()
.filter(i => i.ID.startsWith("xp_"))
.sort((a, b) => b.data - a.data)
let rank = every.map(x => x.ID).indexOf(`xp_${user.id}`) + 1
rank = rank.toString()
const card = await canvacord.rank({
username: user.username,
discrim: user.discriminator,
level: level,
rank: rank,
neededXP: neededXP.toString(),
currentXP: exp.toString(),
avatarURL: user.displayAvatarURL({ format: "jpg" }),
color: 'RANDOM'
})
const MessageAttachment = new MessageAttachment(card, "rank.png")
return message.channel.send(MessageAttachment)
}
}
which line ?
client is undefined?
@earnest phoenix show the error line
Why are you using ffmpeg-static for it lol
assuming its line 15
add a breakpoint/console log the user after its been defined
see whats going on with it @earnest phoenix
Oh okay
Can you show your message event?
you mean client.on?
client.on('message', async message => {
let prefix = db.get(`prefix_${message.guild.id}`)
if (prefix === null) prefix = "h!";
if (!message.content.startsWith(prefix) || message.author.bot) return; //if the content does not start with the prefix or author is a bot
const args = message.content.slice(prefix.length).split(" ");
if (!message.content.startsWith(prefix)) return;
const command = args.shift().toLowerCase();
const commandFiles = `./commands/${command}.js`;
if (fs.existsSync(commandFiles)) {
require(`./commands/${command}.js`).execute(message, args);
} else {
message.channel.send("error, not found");
}
Ah
Can you show another command, does it just take message, args or client, message, args?
Also you have two checks in the message startsWith the prefix
const discord = require("discord.js")
const { NovelCovid } = require("novelcovid");
const track = new NovelCovid();
module.exports = {
name: 'covid',
description: "covid",
async execute(message, args) {
if (!args.length) {
return message.channel.send("Please give the name of country or try using ``As!corona all``")
}
if (args.join(" ") === "all") {
let corona = await track.all() //it will give global cases
let embed = new discord.MessageEmbed()
.setTitle("Global Cases")
.setColor("#ff2050")
.setDescription("Sometimes cases number may differ from small amount.")
.addField("Total Cases", corona.cases, true)
.addField("Total Deaths", corona.deaths, true)
.addField("Total Recovered", corona.recovered, true)
.addField("Today's Cases", corona.todayCases, true)
.addField("Today's Deaths", corona.todayDeaths, true)
.addField("Active Cases", corona.active, true);
return message.channel.send(embed)
} else {
let corona = await track.countries(args.join(" ")) //change it to countries
let embed = new discord.MessageEmbed()
.setTitle(`${corona.country}`)
.setColor("#ff2050")
.setDescription("Sometimes cases number may differ from small amount.")
.addField("Total Cases", corona.cases, true)
.addField("Total Deaths", corona.deaths, true)
.addField("Total Recovered", corona.recovered, true)
.addField("Today's Cases", corona.todayCases, true)
.addField("Today's Deaths", corona.todayDeaths, true)
.addField("Active Cases", corona.active, true);
return message.channel.send(embed)
}
}
}
Also you have two checks in the message startsWith the prefix
@golden condor where is that
So you need to change the command you just showed
wdym
wot
So
@viral iris no markdowns, no mentions, no formatted text
You know the rank command
yeah
Ah
so This won't work ?
You can do that iirc @viral iris
oh okay
If you do this
do what?
`__This__`
what about ping role ?
I have another error saying ReferenceError: match is not defined
Like pinging a role with it
@golden condor ye
okay
const { MessageAttachment, MessageEmbed } = require("discord.js")
const Canvacord = require("canvacord");
//const { Attachment } = require("canvacord");
const canvacord = require("canvacord");
module.exports = {
name: 'rank',
description: "rank command",
async execute(message, args) {
const client = message.client;
let user = message.mentions.users.first() ||
client.users.cache.get(args[0]) || match(args.join(" ").toLowerCase(), message.guild) ||
message.author
let level = client.db.get(`level_${user.id}`) || 0
level = level.toString()
let exp = (client.db.get(`xp_${user.id}`) || 0).toString()
let neededXP = Math.floor(Math.pow(level / 0.1, 2)).toString()
let every = client.db
.all()
.filter(i => i.ID.startsWith("xp_"))
.sort((a, b) => b.data - a.data)
let rank = every.map(x => x.ID).indexOf(`xp_${user.id}`) + 1
rank = rank.toString()
const card = await canvacord.rank({
username: user.username,
discrim: user.discriminator,
level: level,
rank: rank,
neededXP: neededXP.toString(),
currentXP: exp.toString(),
avatarURL: user.displayAvatarURL({ format: "jpg" }),
color: 'RANDOM'
})
const MessageAttachment = new MessageAttachment(card, "rank.png")
return message.channel.send(MessageAttachment)
}
}
I'm not sure if you can
@golden condor can you fix
What does the match function do?
i'll test
throw new Error(`The class ${this.constructor.name} may not be instantiated!`);
^
Error: The class Canvacord may not be instantiated!
at new Canvacord (C:\Users\hajji\OneDrive\Desktop\Attitude\node_modules\canvacord\src\Canvas.js:25:15)
at Object.<anonymous> (C:\Users\hajji\OneDrive\Desktop\Attitude\commands\social\rank.js:7:16)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1042:19)
at require (internal/modules/cjs/helpers.js:77:18)
at load (C:\Users\hajji\OneDrive\Desktop\Attitude\handlers\command.js:7:26)
at C:\Users\hajji\OneDrive\Desktop\Attitude\handlers\command.js:12:96```
It's the prefix i think but i can remove it
Anyone knows what is wrong
Also I would suggest doing message.guild.members.cache.get(args[0]) instead
of the client.users.cache.get
ping not working
okay
CALLUM
I'm not sure why you are using the match function, can you try remove it and see what happens?
Ffs
@viral iris apologies, only no ping for field name
Can you just fix earth
okay
ok ;-;
I don't think the match function is very important in this case @earnest phoenix
Alright
Try it now
(node:21076) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'get' of undefined
Show?
const { MessageAttachment, MessageEmbed } = require("discord.js")
const Canvacord = require("canvacord");
//const { Attachment } = require("canvacord");
const canvacord = require("canvacord");
module.exports = {
name: 'rank',
description: "rank command",
async execute(message, args) {
const client = message.client;
let user = message.mentions.users.first() ||
message.guild.members.cache.get(args[0]) || message.author
let level = client.db.get(`level_${user.id}`) || 0
level = level.toString()
let exp = (client.db.get(`xp_${user.id}`) || 0).toString()
let neededXP = Math.floor(Math.pow(level / 0.1, 2)).toString()
let every = client.db
.all()
.filter(i => i.ID.startsWith("xp_"))
.sort((a, b) => b.data - a.data)
let rank = every.map(x => x.ID).indexOf(`xp_${user.id}`) + 1
rank = rank.toString()
const card = await canvacord.rank({
username: user.username,
discrim: user.discriminator,
level: level,
rank: rank,
neededXP: neededXP.toString(),
currentXP: exp.toString(),
avatarURL: user.displayAvatarURL({ format: "jpg" }),
color: 'RANDOM'
})
const MessageAttachment = new MessageAttachment(card, "rank.png")
return message.channel.send(MessageAttachment)
}
}
The define bit i think
The error should tell you the line I think
What is on line 15?
let level = client.db.get(`level_${user.id}`) || 0
CS:GO:
is there any api i can use to get rank of someone?
okay
Uh
I'm not sure why it has done that
Unless client.db doesn't exist
In your main file
Can you say
client.db = db
Like somewhere near the top but after db and client have been defined
Just put it underneath where you have defined db
What the.
...
But i put message.mentions.users.first() ?
Yeah but there might be no mentions in the message
That'll be to do with CanvaCord
i need help to js
Yes
np
i need help to js
yah
I have another question about the command. So if i talk more, it will rank up automatically?
The newer beta update for android bug does not display for discord calls.
I have another question about the command. So if i talk more, it will rank up automatically?
@earnest phoenix you need to do leveling yourself
@earnest phoenixyou need to code that
I just did and thanks
Is it legal to embed Bitcoin mining scripts on my website? That's the only alternative I have to ads and ads suck
also
is there anything that i can use to mine it anyways
Is it legal to embed Bitcoin mining scripts on my website? That's the only alternative I have to ads and ads suck
@earnest phoenix don't do it
That's just being a dick
No one agreed for their pcs or phones to mine btc
if it was possible I'm sure a lot of shady sites would make you stay while mining bitcoin in the background
No one agreed for their pcs or phones to mine btc
@honest perch it's in my TOS
they agreed
Not if they randomly go to the site
Also it will earn you 0 money
Usually these scripts are blocked and sites blacklisted from google
and I doubt they will stay long enough to mine anything if it would work
ads are your best bet
Or a premium plan for your bot
oh nice ive come to a weirdchamp development moment
ok so
not sure why
if (command === 'test' || command === 'test1') { is kinda broken
you can say test
and then test1
but you have to say it multiple times
for it to actually work
you must define command
dont put number
it doesnt even work without the number
you gotta say it like 5 times for it to work
if (command === 'test'){}else if (command === 'test2'){}
how can i use custom domain on GitHub
do you own the custom domain?
Go to settings
im not sure about that
XD
elif instead of ||
How can I make an API JSON query in discord.js?
A request?
yes
fetch or whatevwr
Node fetch
Do you have an example?
or any other http library such as axios got bent superfetch superagent etc, including the built in http and https modules
DNS verification failed
thunder2op.tk doesn't appear to be served by Netlify
We can’t provision a certificate until your DNS configuration is pointing at the Netlify servers and the changes have propagated.
If you’ve already changed your DNS configuration, allow up to 24 hours for the changes to be processed, or check our troubleshooting guide for some tips on what might be happening.
Go to troubleshooting guide
Retry DNS verification
Provide your own certificate```
what to do
You need to add dns records

You cant edit the favicon
bruh
ads are your best bet
@split hazel I don't have a bank account to receive the ad cash
Or a premium plan for your bot
@honest perch my bot is completely free
Usually these scripts are blocked and sites blacklisted from google
@honest perch there is an option to disable it
Just dont
then how will you redeem the crypto currency to real money without any of those (90% of stores do not support crypto)
how to make the arguments without commas
like
argument argument2
and not
argument,argument2
split on commas instead of spaces?
split on spaces instead of commas
change it to spaces then
console.log('I m ready to Go | Thunder is OP')
client.user.setPresence({ game: { name: 'tr!help | tr!invite | A all in one bot made by Thunder OP' }, status: 'idle' })
const API = new DanBotHosting.Client("api-key", client);
// Start posting
let initalPost = await API.autopost();
if (initalPost) {
console.error(initalPost); // console the error
}
})
why is my status
removed
after some time
presences may be lost during disconnects and reconnects
if you set it in your client options instead, then it wont be lost
because it will be reapplied on all reconnects
same happens with me but the presence is random it changes every 5 minutes, and sometimes it changes to no presence
so what should i do
sometimes the random presence changes, but to the same presence


so what should i do
@weak rain wait until i shows the presence, happens when reconnecting the bot
const client = new Discord.Client({
presence: {
activity: "your activity here"
}
});
ohk
hm
which version of discord.js are you using?
v12
weird... there is no game anywhere in the v12 docs
client.once("ready",() => {
setInterval(() => {
client.user.setPresence(...)
}, 60000)
})
with a randomized presence in there
also, your ready event should be .once not .on
well how should i setup random status @quartz kindle
@weak rain search on google random messages and put them ast he status and make setInterval so it updates every [value] miliseconds
because with .on it may be emitted more than once, during hard disconnects, outages and such, so it may screw up your stuff
also, your ready event should be .once not .on
@quartz kindle what's the diffrence between.onceand.on?
i have.once

should i use .once or .on?
console.log(' Bot is online now!');
let statuses = [
`tr! | ${client.guilds.cache.size Servers`,
`tr! | ${client.users.cache.size Users`,
`tr!help | tr!invite | A all in one bot made by Thunder OP`
]
setInterval(function(){
let status = statuses[Math.floor(Math.random() * statuses.length)];
client.user.setActivity(status, {type:"WATCHING"})
}, 3000) //Seconds to Random
});```
this type will work?
try it and see
kk
You want it to generate a different status every 3 seconds? Isn't that considered API spam?
so what time should i set
You want it to generate a different status every 3 seconds? Isn't that considered API spam?
@earnest phoenix that's most likely not even in the ratelimits lol
15sec will work?
Try and see
how to make it generate random number between a number and a number
discord.js
normally it generates numbers like 0.999999999
Math.random() * (max - min) + min;
Store it in a variable and use it wherever u want..
ty
between a number(max) and a number(min)
and also put it in a ${}
let random = Math.floor(Math.random() * number)
what
but it is different to var, as let will only apply to the current block if that makes sense
you can't access its value from outside of that block, whereas with var you can
just replacing it with var?
Help with bot pliz
@earnest phoenix your bot?
are you getting any errors?
would you mind explaining what exactly you're trying to do
Yes i get errors
what error?
i'm not entirely sure to be honest, i'd suggest you try re-installing your modules (because it looks like you may have a file missing here and there)
otherwise if that doesn't work, just wait for someone who knows what they're talking about to get here lol
Ok
Based on Discord and DBL's rules, would it be ok for me to have an "upvote leaderboard" on my bot's website?
which has their name and avatar
on a leaderboard
Yea I think.
How do i set a code that can separate my folders
Im trying to do this:
const commandmodFiles = `./commands/Mod/${command}.js`;
if (fs.existsSync(commandmodFiles)) {
require(`./commands/Mods/${command}.js`).execute(message, args);
} else {
message.channel.send("error, not found");
}
but doesn't work
thats the full thing?
no i mean
how i see my node.js version
node -v
@azure quail node -v
in cli
lol
no i mean
@finite bough ?
Yeah
I have this above:
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
Why is gcp so expensive T.T
@neat harness life
cry
@earnest phoenix and whats above it
const fs = require('fs'); //fs = file system module
const { execute } = require('./commands/addrole');
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
yes
the starting looks fine
...
Im trying to do this:
const commandmodFiles = `./commands/Mod/${command}.js`; if (fs.existsSync(commandmodFiles)) { require(`./commands/Mods/${command}.js`).execute(message, args); } else { message.channel.send("error, not found"); }but doesn't work
is this inside a message event scope?
Yeah
Is this too complicated for a ping command?
module.exports = {
name: "ping", // Command Name
async execute(
client, message, args, Discord,
config, auth, guild, channel,
color, prefix, emoji, def, login,
dev
) {
// Command Starts Here //
var avtr = message.author.avatarURL()
if (!message.author.avatarURL()) {
var avtr = def.noimg
}
const eembed = new Discord.MessageEmbed()
.setAuthor(config.client.info.name, config.client.image.avatar)
.setColor(color.yellow)
.setDescription("**Pinging...**")
.setTimestamp()
.setFooter(config.client.settings.footer , config.client.image.avatar);
const msg = await message.channel.send(eembed);
const embed = new Discord.MessageEmbed()
.setAuthor(config.client.info.name, config.client.image.avatar)
.setColor(color.default)
.setTitle("Ping Result")
.addFields(
{ name: "Latency", value: `**${msg.createdTimestamp - message.createdTimestamp}ms**`, inline: true },
{ name: "API Latency", value: `**${Math.round(client.ws.ping)}ms**`, inline: true }
)
.setTimestamp()
.setFooter(`${message.author.username} pinged`, avtr);
msg.edit({embed: embed});
}
};
yes
My bot got rejected twice, then accepted, then removed, then reaccepted, then removed again.
First was because of eval command leak
why so
and second was... Some stuff
@earnest phoenix can ya show me the full block?
sure
why so
@finite bough I kinda screwed up the perms for the eval command and gave everyone eval perms
const Discord = require('discord.js')
const Client = require('discord.js')
const config = require('./config.json');
const client = new Discord.Client();
const db = require("quick.db")
client.db = db
const request = require('request');
//const ytdl = require("ytdl-core");
const canvacord = require("canvacord");
const covid = require('novelcovid')
client.on('ready', () => console.log('hedwig is online'))
client.on("ready", () => {
client.user.setActivity("Hedwig | h!help", { type: "PLAYING" })
})
const fs = require('fs'); //fs = file system module
const { execute } = require('./commands/addrole');
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
client.on('message', async message => {
let prefix = db.get(`prefix_${message.guild.id}`)
if (prefix === null) prefix = "h!";
if (!message.content.startsWith(prefix) || message.author.bot) return; //if the content does not start with the prefix or author is a bot
const args = message.content.slice(prefix.length).split(" ");
if (!message.content.startsWith(prefix)) return;
const command = args.shift().toLowerCase();
const commandFiles = `./commands/${command}.js`;
if (fs.existsSync(commandFiles)) {
require(`./commands/${command}.js`).execute(message, args);
} else {
message.channel.send("error, not found");
}
const commandmodFiles = `./commands/Mod/${command}.js`;
if (fs.existsSync(commandmodFiles)) {
require(`./commands/${command}.js`).execute(message, args);
} else {
message.channel.send("error, not found");
}
})
client.login(config.token);
the moderators wont reject it coz of that but you know its coz of the safety of your bot as if people can use eval they can access ur token and can do something bad
put const outside on client.ready, and mix the log to the bottom one, making only one client.on('ready', ()) call
@earnest phoenix
No, actually pull everything out of client.on('ready', ())
except the log
This is mine
// Load Commands /////////////////////////////////////////
client.commands = new Discord.Collection();
var commandFiles = fs
.readdirSync(`./resources/commands`)
.filter(file => file.endsWith(".js"));
for (var file of commandFiles) {
var command = require(`./resources/commands/${file}`);
client.commands.set(command.name, command);
console.log(`Loading command "${command.name}"`);
}
//////////////////////////////////////////////////////////
It's not inside client.on('ready')
The above is also another issue i guess
but each are differrent @finite bough
It's the requiring that's wrong
require(`./commands/${command}.js`).execute(message, args);
while it calls for mod
no i am saying
const commandmodFiles = `./commands/Mod/${command}.js`;
I get it but see his code again, the commandmodFiles are wrongly setup
So i need the for loop as well?
No, actually pull everything out of client.on('ready', ())
??
the only thing i can see which is inside the ready event scope is setPresence and log
lol
i don't use command handlers
they are too hard/or u need to open the command file to ope the command code
makes stuff easier to find
and saves you the repetitiveness of parsing
So how do i do the code to put the folder separately
if (fs.existsSync(commandmodFiles)) { require(`./commands/${command}.js`).execute(message, args); } ```
@earnest phoenix Ngl, I really like that approach
Thanks
I see too many devs putting their logic with their command handler
Separation makes it more maintainable
Yeah
I totally agree
that's severly slow though
checking if a file exists is a kernel call
Probably could require the js file at the start rather than on command, true
or... load all commands and put them in an array/collection
which is the usual approach
array lookups are faster than kernel calls
Do i use for loop for that
Any IO is usually pretty slow. Preloading the logic at the beginning would avoid any unnecessary latency when calling command logic
Could i have an example pls
You may want to iterate over each js file in you commands/ folder, and require them at the start of the application, rather than where it currently is.
You mean something like this:
module.exports = {
name: 'mod',
description: "This is a mod command",
execute(message, args) {
?
Storing them in an array is a good idea. Then when the command is called, you can search for the command in the array where the item's name = ${command} or something
Hmm but if i do this, will it work?
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for (const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
const commandmodFiles = `./commands/Mod/${command}.js`;
if (fs.existsSync(commandmodFiles)) {
require(`./commands/Mod/${command}.js`).execute(message, args);
} else {
message.channel.send("error, not found");
}
There a way to push something into an array in a mongodb document?
my random status sometimes changes to the same status and remains still, how can i make the random status do it without changing to the same one?
discord.js
code?
Check if the new status is the same as the previous status
Probably use a while loop
Or an if like a normal person
There a way to push something into an array in a mongodb document?
@pure lion Yeah, it supports objects and arrays of objects
How do I delete a directory over the command line even if it has files in it? Windows
But that says I can't remove a dir with files in
delete the files using *.* and -r
K
so the directory is clear
@fierce arch
Removes (deletes) a directory.
RMDIR [/S] [/Q] [drive:]path
RD [/S] [/Q] [drive:]path
/S Removes all directories and files in the specified directory
in addition to the directory itself. Used to remove a directory
tree.
/Q Quiet mode, do not ask if ok to remove a directory tree with /S```
that's what it looks like
so rmdir /S /Q "path/to/dir"
Wait sorry its on my VPS so linux 🤦♂️
okay
@fierce arch be super careful with spaces
You need to escape them properly otherwise you'll delete multiple folders
ex: /folder/with\ a\ space/something
rm -rf /beats Not removing it
/ is the root directory
so unless beats in in the root dir you need to check your path
heya, can someone gimme a bit of help setting up namecheap domain + VPS?
like, I'm totally lost
run pwd to see what folder you're in
@lyric mountain Host it on github lol

@faint prism Im in root
why are you saving stuff in root dir lol
Done it
Do i do this?
for (const file of commandFiles) {
let command;
if (Array.isArray(file)) {
command = require(`./commands/${file[0]}/${file[1]}`);
}
else {
command = require(`./commands/${file}`);
}
client.commands.set(command.name, command);
}
do sudo with it if it isn't working, but be careful
Who knows they are all old files from when i made my vps and never discovered linux before lmao
what is the eval to shutdown the bot discord.js
System.exit() if java
fork bomb itself
cause someone is running the bot and theres 2 at the same time
so ill shutdown the bot
and then restart on my host
look up js exit proccess commands
boi, you gotta figure HOW you're running two bots without knowing at first
How do I rename a directory on the command line?
just regen the token
cause someone is running the bot and theres 2 at the same time
@indigo flax
cp old new
rm -r old
Can anyone pls help me with my question.
If I knew JS I'd help lol
Hmm but if i do this, will it work?
you could try it and see
I did but it says there is an error
which error?
require('./commands/${file[0]}/${file[1]}')
Not sure that's a valid path: ./commands/commandThing.js/anotherCommand.js
lol
Files aren't folders
Sooooo satisfying to do some vps housekeeping and free up some storage
lsblk should list drive usage
Files aren't folders
@faint prism always has been
so, namecheap help anyone?
Is there a file type i can use to give a my bot a port on my VPS
what..
I want to basically give each bot a port
file type? give a bot a port? 
On my vps
nginx maybe?
Yes I'm new to VPS and that stuff but all I want to do is give each bot a port
for the sake of using a uptime robot status page to monitor downtime
Bot's communicate with Discord's API. You don't need to forward any ports unless you're serving a service on a port
unless you have some sort of webservice in ur bot, which doesn't seem to be the case
Can I give my code a port tho
no, you can give your webservice a port
Or just open a port on my vps
Why
for the sake of using a uptime robot status page to monitor downtime
a bot is an output service, it doesn't need any port to work
Bot's don't need a port to do regular internet communication
Okay then so how do I get a port of some kind so that I can use monitoring
You only open a port if someone is connecting to a service like myvpnip.some.ext:<port>
Okay
oh, I got what you're trying to do
okay
although I don't know HOW uptime robot work
I just want to monitor my bots downtime on uptime robot basically
I just want to monitor my bots downtime on uptime robot basically
@fierce arch it’s trash. It doesn’t do anything. Just spams your inbox with emails
although I don't know HOW uptime robot work
@lyric mountain To setup monitoring you just need the IP and port of what you want to monitor thats it
yeah, there's only ONE issue
@fierce arch it’s trash. It doesn’t do anything. Just spams your inbox with emails
@static trench Not if you use a public status page and choose not to be emailed
So a you're trying to host a monitoring service? In that case, you would be serving something on a port
you could make a simple webservice which returns code 200 whenever someone calls an specific port (with ip)
Don't know how to do that
then make uptime robot ping that webservice every X seconds
Don't know how to do that
@fierce arch research a bit about express.js
there are other options, but express is the most popular
k
or use netcat and return a 200 http header :^)
şarkı açtığımda botum şarkı kanalına geliyor
gidiyor
nie böyle oluyor
şarkı açtığımda botum şarkı kanalına geliyor
gidiyor
nie böyle oluyor
@earnest phoenix Other languages are in #memes-and-media as per #rules-and-info
when I open a song, my boot comes to the song channel
going
nie, this is what happens.
help me
?
?
Bruh

help me ?
lang tr
when I open a song, my boot comes to the song channel
going
nie, this is what happens.
help me
you're being very vague about it
i'm having trouble understanding you
maybe use a translator?
I don't have English I use translation
I'm opening a song the bot is going in and out of the audio channel
ah
😦
we have improved our English by writing bot
you know what I mean? use translation.
@pale vessel
yeah
Well the translation is still legible.
when I open a song, my boot comes to the song channel
going
nie, this is what happens.
help me
Nie means why
sjsjjs
#memes-and-media for other languages as per #rules-and-info
@faint prism shut up
when I open a song, my boot comes to the song channel
going
nie, this is what happens.
help me
@earnest phoenix firstly, replace nie with, "why" 😖
@faint prism shut up
@earnest phoenix ? But it's rule 6
^
I thought I saw another language. Perhaps it was deleted or I was otherwise mistaken. 🤷♂️
“My bot is joining and leaving the channel when playing a song”
kyoya, can you help them on #memes-and-media ?
“My bot is joining and leaving the channel when playing a song”
@earnest phoenix post the relevant code section
@faint prism DM
I thought I saw another language. Perhaps it was deleted or I was otherwise mistaken. 🤷♂️
@faint prism So? What should be if you saw another language? You can directly report to any mod. Why are you doing this?
Hi
Don't minimod though
copy that
@faint prism DM
@earnest phoenix You DMed me your project, which contains a token. Please regenerate your bot's token
you seem very unconcerned about leaking your token
@earnest phoenix , taken from DAPI:
read that bottom text thank you
256mb ram 10GB memory free hosting
no
lol
you shouldn't even trust providers you never heard of, go with providers that are reputable
Right. Running on someone elses server could result in a token leak
They could even grab it from in-memory if they were trying
any sensitive data could get leaked
Is there someone who want free hosting for the bot
no i already got my host
Hey when i start my bot i get this error:
Code:
const server_count = client.users.cache.size;```
```js
client.on("ready", async () => {
console.log("ready");
setInterval(() => {
dbl.postStats(server_count);
}, 1800000);
}); ``` Error:
`[dblapi.js autopost] Failed to post stats: {"error":"Required parameter server_count or shards missing"}`
Please help
are you spoofing your server count lol
you're using the users instead of the guilds
are you spoofing your server count lol
@earnest phoenix what is spoofing?
ah
Wait
that is why
oops
shouldn't be the issue that's causing the error
smh
oh
i changed it guilds
using a lib for this is dumb anyways you can make a request yourself
oh
what?
Hello guys I coded a discord bot in nodejs and I am looking for a vps to host it, but I can't choose where, does any1 have a good recommandation for a hosting provider?
oh thanks
about cname (namecheap), how do I setup a domain like test.domain.tld (consider my domain as domain.tld)?
what do you want the subdomain to do?
This might sound stupid, But how do you give a webpage a url?, I've got a file url but no one can visit it
vps, domain
well that's because it's hosted locally in your computer
if you have a webserver, you can access it via ip address
Cool, thanks
@restive furnace Give me @restive furnace Domain
freenom
bruh
i don't think you can

i dont know anything about netlify, vps provider or something?
nope


i spent like $10 a month
Better than what? Savings compared to what?
lol
so saving 38k would be neato
Yeah, I'd love to save $38k lol
How do people log stuff on their vps
System logs?
In the command line that is
log what specifically
^
how do i add one more prefix to my bot
i mean mention prefix
Check for if message starts with either of prefixes or if it is present in a collection of prefixes
@weak rain
if msg starts with x || y
@weak rain
this will work?
If I were to print it would show the string in the terminal
@weak rain Yeah, wherever you are already checking for the prefix, just add an or conditional
So do I have a logging terminal?

🤔
Dude
im sorry
Anyway
@weak rain did an edit
https://discordapp.com/channels/264445053596991498/272764566411149314/745303585536999536
// Do the thing
}```
Just remove the !not and add an OR
Add a handler for the event, and implement a logger to log whatever details you want
Psudocode:
```client.on(`guildCreate') {
logger.log('something')
}
Can i get a sword related story for my bot
Gimme money and I'll make one
Epic rpg
wdym
You'll just have to implement it 🤷♂️
@faint prism you nooob!!!! You fool!!!!!! Learn js!!!!!!!
@faint prism you nooob!!!! You fool!!!!!! Learn js!!!!!!!
@pure lion I will eventually. I'm an intermediate C# developer 😛
Like how to end the story
^ lol
Once upon a time
Fuck you
The end
Unless?
Yes it's the end
Love me some rick and morty
omg, my boss just saw you say that. im now fired, this isnt sfw

oof, i was joking
Guys tell fast
Is skysilk worth it ?
If not then pls tell a cheap vps like DO
But DO isnt good fot mr
i like galaxy gate 🤷♂️
Ok whats the price
looking at skysilk, they dont even provide ipv4 addresses on their sub $5 plans
which is pretty standard
if you dont need more than 1gb of ram, its plenty
Oh ok
1gb is enough for bot with even 20k guilds
after that you gonna start needing more
Ok ill go with 3$ one
Is skysilk worth it ?
SkySilk prices seem fair enough for the quality they provide tbh
what do theyd o better than galaxygate?
seems cheaper
Don't know, I haven't used any other provider other than SkySilk
but, also less resources.
But they allow you to use custom .isos
hmm, seems useful sometimes
is there any way to make a contact form without php
the whole, no ipv4 sucks tho
pretty sure most backend servers can handle form data.
contact forms are html
i mean the actions are taken by php
to handle the data sent by them however, many langs can do it
yes
for some reason, a lot of people hate it
oh
use modern secure languages
php is outdated and slow despite still being maintained
fact: php is used by facebook
other languages outperform it
if you already have a webhosting server that includes stuff like cpanel, etc... just go for php
would vercel support it
@misty sigil i dont think they do anymore
they do on messenger
they've changed the technologies they use a fuckton in the past few years
@client.event
async def on_message(message: discord.Message):
channel = client.get_channel(743161649338253423)
if message.guild is None and not message.author.bot:
await channel.send(f'{message.author} sent: "{message.content}"')
await client.process_commands(message)
'NoneType' object has no attribute 'send'. But why though?
- I made this client event in order to receive messages from the channel. However it throws an error if someone else writes a message first. (Means I have to make that event "Active" in order to work)
(python by the way if necessary)
Channel isn't found under that ID
also uh
its a dm channel id
DM channel IDs aren't supposed to be fetched that way 🤔
Huh
dm channels are not cached by default
only if i send a dm to the bot first
they become cached once any activity goes through them
let me explain this problem on my server dm link
you need to create the dm channel first, to ensure it gets property cached if its not cached yet
i see
Can't you use get_user?
get_user(my id) ?
yeah
I'll try that
I use GetUser(id).SendMessageAsync(msg) for my lib if I need to send a DM
@quartz kindle let me explain this problem on my server dm link?
Can I have some help please, I'm getting a error, 'message is not defined' when I've been using message for everything in my code.
Code https://pastebin.com/CsUBmBav
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
@still merlin let me explain this problem on my server dm link ?
No? Tell me here?
What is your issue? @earnest phoenix
json database?
Highly not recommended
o, the all bots require a privacy policy is going into affect today.
Use an actual database like MongoDB, or SQLite, something like that
Lmao
Are private ones included?
I need to broadcast.
i dont think they specify
Broadcast what?
json database?
Highly not recommended
@still merlin Yeah, JSON can easily mess up and become unreadable
no
how would I get the message object of the target msg on on_raw_reaction_add? I tried using MessageConverter, but that requires a ctx argument and I don't have that
Woo, could you toss me the source in DMs?
I can broadcast because I don't have English
@earnest phoenix What exactly do you need help with?
i made a privacy policy like uh ages ago
yeah, ill be a minute tho
not an emergency
Use an actual database like MongoDB, or SQLite, something like that
Thanks for the suggestion
Problems with your music bot, mustafa?
Thanks for the suggestion
@still merlin trust me it's worth it
@restive willow You should have payload.message_id instead




