#development
1 messages · Page 857 of 1
What issue ?
.addField
The command handler?
module.exports.run
you defined guild in your exports.run
Yes
why?
Maybe that's just what he/she wants to do
If i use guild for an other field
well, it might be an mistake in the cmd handler then
What is the error you are getting?
filter of undefined
Where is filter?
.addField("Utilisateurs 👶 ", ${guild.members.filter(member => !member.user.bot).size}, true)
yea
I want all members
Is she trying to filter the function to only show bots?
Oh i see
@earnest phoenix client.users.cache.size
@golden condor
Not for v11
oj
It will returned number of members not the bots
Im on v11
client.members.filter
Okc
@earnest phoenix all users of the bot or guild?
client.users.size
@earnest phoenix all users
let members = 0
client.guilds.forEach(g => {
members += g.memberCount;
});
members
@golden condor
Client.users.size not showing the correct numbers
Ik
Hmm...
CLIENT_NAME.users.cache.size
you gotta do this
that's v12
@elder vine
I have test and its undefined
Still not correct numbers Ryan
let totalUsers = client.guilds.reduce((a,b) => a + b.memberCount, 0)
What
And i can add the first code of leny
What?
?
What does the reduce function do again, remind me
reduces an array into a single value
just gave me undefined
Ok
For me filter is undefined on my console and my bot crash
let totalV = client.guilds.map(g=>g.memberCount).reduce((a,b) => a + b, 0)
i mean, you can do it like that
but thats double the work
you can use .reduce directly
gave me undefined
Hello
it works for me lol
weird..
you didnt return it lul
@quartz kindle it work for me thx you
Why won't this work
//command handler
try{
command.run(client, message, args, queue)
const cnl = client.channels.cache.get("697061184708280350")
const Embed = new Discord.MessageEmbed()
.setTitle("Command Run")
.setDescription(`The command **${command.category}/${command.name}** was run by **${message.author.username}** in **${message.guild.name}**`)
.setColor(0x00aaff)
cnl.send(Embed)
} catch(e){
const {ownerid} = require('../config.json')
message.channel.send("Unfortunately, there was an error executing that command and I will inform the developer so he can fix it.")
client.users.cache.get(ownerid).send(`There has been an error executing ${command.name}\n\`\`\`js${e}\`\`\``)
}```
It still shows an error
in conosole
what's the error?
It should still be logging something to the console though
that send method is async
^^
try {
await send()
} catch(error) {
console.log(error)
}
or
send().catch(error => console.log(error))
how can I get my bot hir on the server?
hey
remove .format
just do moment.utc(User.createdAt).fromNow(true)
and see what it returns
@quartz kindle thx
In one of my packages it says TypeError: client.users.get is not a function.. But, it's a index package and not like my main folder.
It's likely outdated if you are using the latest version if discord.js
client.users.cache.get
Thanks.
i am using JSHINT for part of my bot, and i cant get the esversion option to work (need it for await so it doesnt throw errors)
i assume i am using the options correctly because i can get the unused option to work (as shown in image) but no matter what i put in esversion (have tried 8 9 10 '8' '9' and '10') which according to JSHINT docs and stack overflow should make it respect async/await, i cant get it to work. anyone have any experience getting JSHINT to work with async/await?
So i have a meme command that randomly fetches memes from the stored subreddits using the random-puppy module... But when i tested it to pull and fetch nsfw from nsfw subreddits it outputed an error saying imgur.com's api has blocked the nsfw subreddits... (Imgur.com is the host where it gets the images)... So...
Can it also pull and fetch nsfw images from non-fully-nsfw subreddits? As the subreddits are meme subreddits...
(few of the stored subreddits:
Memes
Dankmemes
ComedyCemetery)
Lol
(also I'm asking that because i want it to be free-of-nsfw meme command and to be used publicly without only being able to use it in nsfw channels...)
you can filter them nsfw memes
@pale vessel how do i do it with random-puppy module that fetches them?
i can't help you with that unfortunately since i used the official reddit api
Yo
why does it use imgur?
@twilit rapids
What error?
TypeError: message.guild.members.get is not a function
with the new package
so whats the new one?
v12?
@astral yoke message.guild.members.cache.get
ty
Np
ty
Guys i have a question...
In my guildCreate event on discord.js...
Is it possible to get an invite link of the server that it joins?
(I can get the name and id but idk how to get that)
im confused
@earnest phoenix if it does have it... What's the code for it?
Oh ok... Thx... I'll read that...
0k siorry
Hi
you do not have bot on website
i have
-bots @quartz goblet
not approved yet
ok
Ur NoT SuPpOsEd To Do ThAt HeRe
Guys i need edit the embed and I do not know how
which lib
do you know how to use message.edit()?
My bot has that, you have to create a whole new embed you can't edit just one field I think
(then use message.edit())
you can clone the existing embed and edit it
i am using JSHINT for part of my bot, and i cant get the esversion option to work (need it for await so it doesnt throw errors)
i assume i am using the options correctly because i can get the unused option to work (as shown in image) but no matter what i put in esversion (have tried 8 9 10 '8' '9' and '10') which according to JSHINT docs and stack overflow should make it respect async/await, i cant get it to work. anyone have any experience getting JSHINT to work with async/await?
https://cdn.discordapp.com/attachments/272764566411149314/697170463918391306/unknown.png
(i hath been buried with no replies o.0)
My bot is on v12 - discord.js
I am trying to send a message to a channel on a different shard
My Code:
let premiumadd = new discord.MessageEmbed();
premiumadd.setTitle('Premium Added');
bot.shard.broadcastEval(`
const channel = this.channels.cache.get('679079839466127390');
if (channel) {
channel.send(premiumadd);
true;
} else {
false;
}`).then(sentArray => {
if (!sentArray.includes(true)) {
return message.channel.send('I could not find such a channel!');
}
return message.channel.send(embed);
});```
Error:
```js
[07/04/20 22:00:20] [ERROR] (node:24) UnhandledPromiseRejectionWarning: ReferenceError: premiumadd is not defined
that code is looking for a premiumadd variable in the target shard
that variable doesnt exist there
How many I fix the issue
cause
bot.shard.broadcastEval(`
const channel = this.channels.cache.get('679079839466127390');
if (channel) {
let premiumadd = new discord.MessageEmbed();
premiumadd.setTitle('Premium Added');
channel.send(premiumadd);
true;
} else {
false;
}`).then(sentArray => {
if (!sentArray.includes(true)) {
return message.channel.send('I could not find such a channel!');
}
return message.channel.send(embed);
});```
Even this doesnt work
Or am I doing it in a wrong way?
Or is there a diffrent way to do it?
I keep getting js (node:1160) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Channel even when I eval message.channel.send()
No idea why lol
May be your eval command is made wrongly
I need help with the status. Is it possible to show what server it's watching?
Actually no, it isnt working wrong, cause it works in other channels
even when I get the channel with the ID
it gives the same error
Lol
https://discordapp.com/channels/264445053596991498/272764566411149314/697210615038738532
Cause the error must be ...
Cannot send an empty message
Is it possible to show that it's watching a individual server it's in? Like it'll be watching each one
@heavy marsh does your broadcastEval thrown an error?
When I do it how?
[07/04/20 22:00:20] [ERROR] (node:24) UnhandledPromiseRejectionWarning: ReferenceError: premiumadd is not defined
at eval (eval at _eval (/home/container/node_modules/discord.js/src/client/Client.js:376:12), <anonymous>:4:14)
at Client._eval (/home/container/node_modules/discord.js/src/client/Client.js:376:12)
at ShardClientUtil._handleMessage (/home/container/node_modules/discord.js/src/sharding/ShardClientUtil.js:184:82)
at process.emit (events.js:323:22)
at emit (internal/child_process.js:876:12)
at processTicksAndRejections (internal/process/task_queues.js:85:21)
[07/04/20 22:00:20] [ERROR] (node:24) 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: 2)
This is my full error
even if you do it like this?
Hold
@raven urchin no, its not possible. its only possible per shard
how can i encrypt plaintext in node via rsa keypair instead of a plaintext key? e.g.
let crypto = require('crypto');
let assert = require('assert');
let algorithm = 'aes256'; // or any other algorithm supported by OpenSSL
let text = 'this needs to be encrypted';
let privateKey = "private key"
let publicKey = "public key"
let cipher = crypto.createCipher(algorithm, privateKey);
let encrypted = cipher.update(text, 'utf8', 'hex') + cipher.final('hex');
let decipher = crypto.createDecipher(algorithm, publicKey);
let decrypted = decipher.update(encrypted, 'hex', 'utf8') + decipher.final('utf8');
assert.equal(decrypted, text);
.createCipher() second parameter only allows text afaik
https://cdn.danbot.xyz/lqClB6Ay
SyntaxError: missing ) after argument list
I dont get it cause It closes all
OOh so I have to use \
@quartz kindle for like the status it would say Watching server name
But only possible with shards right?
I dont think You can have a status change for each guild
@valid frigate are you trying to create a new pair or use an existing one?
i'm using an existing pair
that's my problem
i don't know how to import an existing keypair
So there are 2 things one it won’t let me access your guy’s website and 2 every time I try to put the prefix and then say kick and I say @ the person it doesn’t kick them it just says error
@earnest phoenix wdym it doesn't let you access the website?
createCypher has been deprecated in favor of createCypheriv
and also i just checked node docs, .createCipheriv() is apparently used over .createCipher()
the docs mention key can be <string> | <Buffer> | <TypedArray> | <DataView> | <KeyObject>
@earnest phoenix sure
bot.shard.broadcastEval(`
const channel = this.channels.cache.get('679079839466127390');
if (channel) {
let premiumadd = new discord.MessageEmbed();
premiumadd.setTitle('Premium Added');
premiumadd.setDescription(
\`**User ID:** ${UserID.id}\n**User Name:** ${UserID.tag}\n**User Created:** \`${bot.users.cache.get(UserID.id).createdAt.toUTCString().substr(0, 16)}\`\`
);
premiumadd.setThumbnail(UserID.displayAvatarURL({dynamic:true}));
premiumadd.setTimestamp();
premiumadd.setColor('#2ACC76');
premiumadd.setFooter(\`Command Run By: ${message.author.tag}\`);
channel.send(premiumadd);
Should This be correct?
i saw some SO answers saying the keys need to include the "BEGIN KEY" and "END KEY" parts
oh yeah that's already there
so it should just work if i read the keys from my filesystem i guess
brb
This is dyno
So idk if it’s my internet or what it is
either dyno's site is down or cloudflare thinks you're a bot
↑
Yea, it's down
btw this server is not dyno's support server
Sorry I just joined cause at this rate I’m very confused
Yes, it's down.
hiya
Well then why does it redirect me to that :/
i am trying to set a custom rps
@earnest phoenix also can i see your code... (Kick command code)
Wdym code
where can i put details?
You mean the code I got when I joined
i think that makes sense
@earnest phoenix wait... Are you using the dyno bot to use the kick command to kick someone or wdym?
@digital ibex you put details in details: ""
Yes I tried to kick someone from my server using the bot but it just kept saying error
This is not Dyno bot support.
oh, sorry my bad
@heavy marsh you cant use ` both for the inner code and the eval code, else your variables will get all confused. you should use " for the eval instead and use regular string concatenation if you need it
Join Dyno support server and ask there
@earnest phoenix hmm... The bot has Overloaded or there's an error going on...
You have to wait...
Also this server is not a dyno bot support server
Well thanks anyway guys you’ve been helpful
Np
@digital ibex what are you confused on?
details: "whatever you want"
oh
bot.shard.broadcastEval("
const channel = this.channels.cache.get(`679079839466127390`);
if (channel) {
let premiumadd = new discord.MessageEmbed();
premiumadd.setTitle(`Premium Added`);
premiumadd.setDescription(
`**User ID:** ${UserID.id}\n**User Name:** ${UserID.tag}\n**User Created:** \`${bot.users.cache.get(UserID.id).createdAt.toUTCString().substr(0, 16)}\``
);
premiumadd.setThumbnail(UserID.displayAvatarURL({dynamic:true}));
premiumadd.setTimestamp();
premiumadd.setColor('#2ACC76');
premiumadd.setFooter(`Command Run By: ${message.author.tag}`);
channel.send(premiumadd);
true;
} else {
false;
}")
Or am I still mixing this up?
what is UserID?
Users ID
but from where are you getting it?
is this user ID gonna be available in that shard?
const UserID = message.mentions.users.first() || bot.users.cache.get(args[1]);
The user is going to be on the same shard
because you are sending a piece of code to be evaled in a target shard. you need to know what is in the current shard that you want to send to the target shard, and what is available in the target shard
in your code, there is no UserID in the target shard
the same way there was no premiumadd before
...
you need to use concatenation to avoid this problem
this will also make it easier to identify what comes from where
does anyone know why the rpc isn't working?
let outside = "test";
shard.eval("
if(true) {
let fromOutside = " + outside + ";
let embed = new Discord.MessageEmbed()
.setTitle(`title: ${fromOutside}`)
} else {
return false;
}
");```
const discord = require('discord-rich-presence')('685544642934341695');
let starttime = Date.now();
console.log("Started!")
discord.updatePresence({
details: details[Math.round(Math.random() * (details.length - 1))],
startTimestamp: starttime,
largeImageKey: "https://cdn.discordapp.com/avatars/650136984211292180/3dbcf8a2f49c193cd460eb441c7856a0.png?size=512",
smallImageKey: "https://cdn.discordapp.com/avatars/650136984211292180/3dbcf8a2f49c193cd460eb441c7856a0.png?size=512",
largeImageText: "Lost",
smallImageText: "hiya person",
details: "Running in a robot world",
state: "Walking in a robot world",
instance: true
})
ooh
and uh, thats it?
you see the difference between variable that comes from outside, and variable that is available inside?
broadcastEval() sends the code to all shards
shard.eval() sends to a specific shard and can only be used from the manager i think
so in your case, use broadcastEval
OOk
the channel is not guaranteed to be always in the same shard
when you change the number of shards, which server goes to which shard also changes
unless the channel is a DM channel
DM channel = Private message right?
ye
Ahh nope its going to xxx channel with that id always
Is there no simple way to use broadcastEval()
the best way is to create a function
in your shards
and run the function with broadcastEval
ie ```js
// main.js
async function premium(channel,user) {
let user = await client.users.fetch(user);
let embed = new Discord.MessageEmbed().bla().bla().bla();
client.channels.cache.get(id).send(embed);
}
// manager.js
....broadcastEval(if(client.channels.cache.has(${channelID})) { premium(${channelID,userID}) })
ooh ok thanks
does anybody know why my bot constantly disconnects and reconnects
my internet connection is stable and:
it happens too often
const manager = new ShardingManager('./bot.js', {
token: config.token,
totalShards: 2
});
manager.on("launch", shard => {
console.log(`Shard [${shard.id}] launched`);
shard.on("death", () => console.log(`Shard [${shard.id}] died`))
.on("ready", () => console.log(`Shard [${shard.id}] ready`))
.on("disconnect", () => console.log(`Shard [${shard.id}] disconnected`))
.on("reconnecting", () => console.log(`Shard [${shard.id}] reconnecting`));
});
manager.spawn().catch((err) => {
console.log(err);
});
I'm having issues with "launch" not working at all (no logs what so ever)
The bot.js (ready event) fires twice tho.
bot.js is the ready event or the file that boots the bot?
Hey there! is there any way for the cache for a user on the site can be refreshed? I am attempting to add one of my co owners to my listing, but they aren't currently in the server. The name cached by the site is their deadname, so it would be really helpful if that could be changed in some way.
bot.js is the bot
wait so I dont understand why you pass token through
why not just set it to boot normally
and just shard it like that
Still didn't fix.
that was kinda a question that I just wanted answered
gimme one sec to look through your code
alright
I dont understand
doesnt bot.js start your bot
if it does, you should get logs
bot.js is the place where events/command handler etc. are
Yea
ok
v12.1.1
you can also use the bot.on('shardReady') I think
bot || client
I assumed you used bot
client then?
but shardReady worked
ok good
Anyone know why my bot is doing this?
I have tried making my own code and taking code from online and it always does this
I’ll send screenshots of the code in a min
@quartz kindle Yikes, sorry for no response. Maybe I should've asked to ping. I use d.js and.. heartbeat packets? Elaborate, please?
If it helps, this only started occurring recently.
which discord.js ver are you on
wait
im dumb
i dont even know if you're using d.js
tldr check if there are any updates for your library
this is most likely due to recent gateway changes
I have a problem, I have this command, but it doesn't run unless you have money with money.db:
const db = require("megadb");
const dinero = new db.crearDB("dinero");
module.exports = {
nombre: "inv",
alias: [],
categoria: 'Bot',
run: async (client, message, args) => {
const user = message.mentions.users.first() || message.author;
let cantidad = await dinero.obtener(`${user.id}`);
const embed = new Discord.RichEmbed()
.setTitle(`Inventario de ${user.username}`)
.setColor('90EE90')
.setThumbnail("https://cdn.discordapp.com/attachments/696127264915587093/697245085066199040/mochila.png")
.addField("Escudo:", "``0``", true)
.addField("Poder:", "``0``",true)
.addField("Dinero:", "``"+ cantidad +"``",true)
.addField("Nivel:", "``0``",true)
.addField("Rango:", "``Cadete``", true)
.addField("Puntos:", "``0``", true)
message.channel.send(embed)
}
}
...
because the first thing it does is to get the money from the """""database"""""
@earnest phoenix
I hate megadb it doesn't even follow naming convetions
crearDB and it's sooo redundant, like srsly, should be Crear and that's it.
I'm not saying the code is wrong, alright?
I've been getting this error recently, I have a feeling it's something to do with the voting system
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print("voted")
logger.info('Received an upvote')
print(data['user'])
user = self.bot.get_user(int(data['user']))
print(user)
try:
await user.send("Thanks for voting! You have recieved 600 gold for dailying. You can vote/daily again in 12 hours!")
except:
pass
@commands.Cog.listener()
async def on_dbl_test(self, data):
print("voted")
logger.info('Received an upvote')
print(data['user'])
user = self.bot.get_user(data['user'])
print(user)
try:
await user.send("Thanks for voting! You have recieved 600 gold for dailying. You can vote again in 12 hours!")
except:
pass
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(TopGG(bot))
init and class on top
you sure that's where it originated?
are you using aiohttp? or maybe it comes from dblpy
I'm not using anything http or aiohttp related besides dblpy
import dbl
import discord
from discord.ext import commands, tasks
import asyncio
import logging
class TopGG(commands.Cog):
"""Handles interactions with the top.gg API"""
def __init__(self, bot):
self.bot = bot
self.token = 'token'
self.dblpy = dbl.DBLClient(stuff here)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
print("voted")
logger.info('Received an upvote')
print(data['user'])
user = self.bot.get_user(int(data['user']))
print(user)
try:
await user.send("Thanks for voting! You have recieved 600 gold for dailying. You can vote/daily again in 12 hours!")
except:
pass
@commands.Cog.listener()
async def on_dbl_test(self, data):
print("voted")
logger.info('Received an upvote')
print(data['user'])
user = self.bot.get_user(data['user'])
print(user)
try:
await user.send("Thanks for voting! You have recieved 600 gold for dailying. You can vote again in 12 hours!")
except:
pass
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(TopGG(bot))
that's the entire cog
idk, it just recently started appearing
listofem.forEach((groups) => {
var date = groups[0]
groups = groups.shift()
str = groups.Id + " ("+ date +"), " + str
})
})```
P.A.E.T. has hit an error!: TypeError: Cannot read property 'forEach' of undefined
huh
what is json
"JavaScript Object Notation is an open standard file format, and data interchange format, that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and array data types. Wikipedia"
🙂
oh wait
i found issue
ur so smart zsnails
i forgot to change where it gets json
LOL
"JavaScript Object Notation is an open standard file format, and data interchange format, that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and array data types. Wikipedia"
@earnest phoenix are you kidding
it was a joke
is it possible to actually @ the user javascript let person = message.guild.member( message.mentions.users.first() || message.guild.members.get(args[1]) ); @${person.user.tag}
that writes their name as text
just ${person}
thank you
if(michelle = true){
if(message.content.startsWith(PREFIX + "ship-candle")){
message.channel.send(
message.author + ' candles' + ' have a ' + '100% ship rate ' + 'no relationship is better then theres'
)
}
}else{
message.channel.send("You're not " + michelle)
}
});```
@pallid vector Does that error appear by itself?
I have a feeling it does, don't quote me on this; but I feel like it happens when someone votes?
Not too sure when it occurs

so i assigned the var michelle and equaled it to a person's id but any person can use that command not just they can anyone help so its just thwm
basically that says to wrap it in a promise
I have this as my prefix RegEx, it functions well with special characters but breaks if the prefix is a letter like ABC. Can someone tell me how can I make this RegEx compatible with prefixes like b! and stuff?
const prefixRegex = new RegExp(`^(<@!?${client.user.id}>|\\${prefix})\\s*`);
if (!prefixRegex.test(message.content)) return;
Yes
it means your calling a module (look at require statements) that doesn't exists
check line 976
I'm not gonna read the whole error for u man
I already did most of it for i
u
cough maybe look up the module cough
I'd you didn't write the code then it's in an installed module, see the error for which one cough
@queen needle you're using an assign operator, are you like, blind?
Anybody have a clue as to why my bot keeps disconnecting and reconnecting? Someone mentioned heartbeat packets but I don't have any clue as to what they mean.
yes,
and imma assume this is js, so imma mostly stay out of it, but how's your internet/cpu? is there anything blocking the main thread?
CPU is sitting at a low 18%, nobody is using the internet except me, I'm sitting at a hot and spicy 160Mb/s. (16MB/s)
Nothing is blocking anything.
did you just compare 160Mb/s to 16MB/s D:
8Mb = 1MB
but yea after that my knowledge of the topic is zero
no its fine :p
Anyways, thanks for the attempt. Cheers.
If anybody else has an idea, please let me know.
hi
TypeError: db.fetch is not a function
``` with quickdb, does anyone know how to fix it? i am new to databases
and i've tried with db.get()
Ah, yikes, I haven't seen that. Sorry.
But is it really meant to reconnect every few seconds?
hi help me
my guess is that your library keeps getting kicked off the gateway but it cant reconnect properly because it isn't sending the new opcode - so it just gets in an infinite loop of
gateway: i want this
library: I don't know what that is, here is this instead
gateway: i dont want that
That's a perfect explanation lol, love it.
Thanks Discord JS, Very Cool. Thanks for your help, cry.
it was stupid from discords side to force this update so suddenly without prior notice
discord made a stupid decision? would have never guessed
I'm getting a 401 from dblapi, just started happening recently. Any ideas why?
0|index | 08-04 00:09:10.334: at IncomingMessage.<anonymous> (/root/mybot
/node_modules/dblapi.js/src/index.js:118:25)
0|index | 08-04 00:09:10.334: at IncomingMessage.emit (events.js:327:22)
0|index | 08-04 00:09:10.334: at endReadableNT (_stream_readable.js:1201:12)
0|index | 08-04 00:09:10.334: at processTicksAndRejections (internal/process/task_queues.js:84:21) {
0|index | 08-04 00:09:10.334: raw: '{"error":"Unauthorized"}',
0|index | 08-04 00:09:10.334: body: { error: 'Unauthorized' },
0|index | 08-04 00:09:10.334: status: 401,
wrong token
but my voting still works
🤷♂️
it's on the initial loading that errors pops up
401 is always used for providing incorect details to a locked endpoint, so unless DBL is misusing status codes, your token is wrong
try regenerating it
how do i use dblwebhook in my flask app
Hey! anyone know what url to post to to get a new url using refresh token?
What
would it be breaking discord ToS if i made a command that allowed people to choose if they wanted to get a dm notification
when i say dm notification, i mean when someone with special perms to the bot sends out an announcement using the bot and whoever has the dm notifications enabled would get the announcement via dm
I don't think so
i couldnt find it while reading the tos
@rugged hatch what token are you trying to refresh?
discord or dbl
what token?
@steady hamlet I suggest you use a separate private channel where the bot mentions them instead of DMing
ok
"SYSTEM"
Did you not even read the banner text above and below that
Idk ive just seen alot of crap where people get baited by 'official' accounts
As well as the spooky link that discord in theory should of undid so just bein safe
I got that too
F
lenth?
lmao
typo
wtf
I noticed that already
I'm trying to create a command handler and F*ed it.

XD, I only got stuck on command handlers
I have the base url
https://discordapp.com/api
How would I, for example, get a guild? Where do I put my authentication token in the url?
how can i make a message edit like 10 times with timeout..a simple way to do it?
for a get request? @pale vessel
I'm trying to use postman to send a get request
can't figure out how to include header for a get requst
I have to verify my discord account with my identity card (see image for proof), I put my identity card but Discord puts me its a few minutes after:
** We are unable to verify your identity because one or more of the documents you provided are unverified. Please try again.**
Yet my identity card can be seen
arent you supposed to be emailing support about htat
Any good tutorials for Discord OAuth (js related) for me to hand onto someone asking? Can't find any decent ones.
follow the official docs
oauth isn't locked to a language
how do i post the server amount?
Is the privileged members intent, purely these events?
Will I still be able to "download" members the way it does now without this?
Hiya,
I'm still having issues where it's claiming name is undefined.
/app/bot.js:25
console.log(Command ${props.config.name}.js (#${props.config.id}) loaded!
TypeError: Cannot read property 'name' of undefined
at files.filter.forEach.file (/app/bot.js:25:49)
at Array.forEach (<anonymous>)
at fs.readdir (/app/bot.js:22:78)
at FSReqWrap.args [as oncomplete] (fs.js:140:20)
If you would like to help me and my friend fix this please DM me so I can add you to the glitch project. Thanks.
.-.
._.
Since I swithched hosts from my bot (now on glitch) to fix a problem, it gives weird errors like this: message.guild.members.get is not a function, anyone know why?
the code works perfectly fine on my desktop
is it discord.js v12?
probably the djs version
yup
your choice
You can read the docs for v12
and update your code to v12
or downgrade to v11
yes I'm reading docs now that should work
but I'm gonna update my code later when I have time to do it all
you mean docs?
yes lol
yes was reading that too
.-.
thanks guys
np
You guys got discord verification message? Im a bit skeptical sending my id lol
what?
@vernal yoke https://support.discordapp.com/hc/en-us/articles/360040720412-Bot-Verification-and-Data-Whitelisting
Its an official message
if you actually read the message and looked at the details on their site
How to get bot's cpu in %?
Yep
process.cpuUsage()
Thanks
It... timed out?
yeah but
why
its been happening for over 30 minutes, i've reset my password a few times as well
Possible scenarios where server selection timeout can happen include – if a network is down or a primary node failure in a replica set.
are there any ways to fix them?
yeah
Try connect via localhost and the port
What language you using?
javascript
You could try use something easier like quick-db
i want an actual database
yeah, ik about quickdb
i mean like
one which is customizable
if that makes sense
This is pretty good
He is tryna set it up for the first time
is there any way i can get mongoose to work though?
How do you connect through postgres and use it?
I have a heroku postgres d
and a mysql db
Sequelize is an ORM for different databases
Not sure how to connect]
And it's syntax is very similar to mongo
for some reason this command handler doesn't work,
it's somehow correct but it doesn't send anything.
it doesn't show an error on console logs either,
i dont know anymore
is there a way for my bot to be online but with the phone thing?
lmao
i think my bots been in the future
You need to install it
No matter if it is inside the package.json or not, it does not mean that it is installed
run enable-pnpm in your glitch console
pnpm gets disabled if you manually edit your package.json afaik
you should use the glitch add package button instead
👍
hi
does anyone know why my mongoose is not connecting on the compass?
it says Server selection timed out after 30000 ms and my ip is whitelisted
any ideas? I even deleted that cluster and made another one, its still not connecting
are you using atlas?
yeah
did you follow this guide? https://docs.atlas.mongodb.com/compass-connection/
I can login with atlas and everything works fine on atlas, i can't connect to compass for some reason
my friend was helping me with it
i'll check that
how many days discord take to verify a bot
also how does one fix this
msg.edit(`:heartbeat: ${Date.now() - message.createdTimestamp} ms`); ```
discordjs
yep, i followed the guide but still
@quartz kindle OHK
@honest perch what is msg and what is message? maybe you want msg.createdTimestamp
you could also console.log those two values
I've tested it and it seems fine mathematically you might be getting 2 different messages mixed up misly
@digital ibex double check the guide, maybe there's something you missed. i cant help you any more because i dont use mongo
okay
@quartz kindle, thing is it worked fine but when I updated some code and cloned my repo its now doing this. I haven't touched my ping command for weeks
does the value keep decreasing further into the negatives every time you run the command?
anyway console.log both message.createdTimestamp and msg.createdTimestamp and see if there is any pattern
you might be accidentally overwriting the message object or its timestamp
Or just use the debugger that can work even better
never worked for me lmao
It's really damn helpful beyond belief
it gets randomly stuck on "attaching/connecting/waiting for debugger"
I prefer console logs
This is why we can't have nice things
lol
if i need to debug something hardcode, i login to my bot via nwjs and use chrome's console lmao
it seems random
The first time you run the debugger it takes a while to set it values up
looks like there is a fixed offset of -430000
are you adding/removing the value 430000 anywhere?
After that it pretty much launches straight away though I think there's also an extention which sets the debugger up for node.js stuff
ok i fixed it by changing it to this
module.exports.run = async (bot, message, args) => {
message.channel.send("Pong...").then(msg => {
msg.edit(`:heartbeat: ${msg.createdTimestamp - message.createdTimestamp} ms`);
});
}
module.exports.help = {
name: "ping"
}
you know, message is the author's message
but well if it works it works
just not what most people use because it includes the time for the client sending the message
How do I link coding to a bot?
you could simply do something like js let time = Date.now() message.send("bla").then(msg => { msg.edit(Date.now() - time) })
const m = await message.channel.send({ embed: { color: 0x3AFF84, description: 'Ping is *Calculating*...' } });
m.edit({ embed: { color: 0x3AFF84, title: '🏓 **Pong!** 🏓', description: `Latency is ${m.createdTimestamp - message.createdTimestamp}ms\nAPI Latency is ${Math.round(client.ping)}ms` } });```
This is one I've used
Either one works really
you use the embed objects?
It's an old code I'm not bothered updating rly
oh
If it works it works
i use embed objects as well
in v12, can I use the cache on a guild channels manager to read/modify all channels in a guild?
or do I need to fetch them first?
(or both, heh)
Tim, are embed objects more efficient or do you just prefer the object syntax?
you should be able to access them all without fetching, but you cant update them all without adding some proper delay
yeah, I figured. Thanks
@crimson vapor they are more efficient, but the difference is probably a few nanoseconds
so on a large scale bot, that would be more optimal
It's in a scope where it doesn't matter which one you use
its just that you have more control over your code if you do it manually, you can see exactly whats going on at first glance
Each person likes it their own way
Honestly, as long as I am consistent I don't care.
I use objects more often, since I usually include some language/translation files with my bots, stored in a json format.
(instead of hardcoding ex. a help embed, I'll use the language json file specified in the config and grab the object from there)
https://cdn.danbot.xyz/5qY8JBGj
Can some one example theses 2 for me
There's a link at the top that takes you to where all the things are for each box
So if your not uses any of those
You have to click the box and provide an image or video showing your bot using that function
Eg if your bot does something when someone joins a guild
Your gotta tick that bottom box
The top box is for presence stuff like games
OOk ok thanks
This may be a dum question, but in javascript, is storing references to objects more expensive than storing just a short string?
@cinder patio i dont think so
would be arguably the same as storing a pointer in C
How long roughly does it take for our bot verification applications get responded to
canvas
you could use a node module called
node-html-to-image
I prefer canvas
you can use puppeteer as well if you want...
@woven sundial the error log literaly tells you where the error originated...
learn to read errors
I need help with my unban on discord.js
so it sends an embed saying who got banned and for what reason in a logs channel
but it still sends it when you say !unban (user) and the user is already unbanned
@woven sundial show the error
what lib
and I'll show you exactly where it is
Whats popin
I just tell that to everyone
https://cdn.discordapp.com/attachments/385837258768515083/696475235796647946/496.jpg council will judge ur code
What problem do you have?
so
I have an unban thing
when you unban a user
it sends an embed
to a log channel
and
dont spam btw
ok
if you unban a user which isnt banned, it still sends the embed to the logs channel
the embed contains the info like the reason and who got banned
well then make it check if the user has been banned
show ur code pls
then you missing an return or a command that checks if that user is banned or not
i don't know how to check that though
gimme sec
ill hover over your code
if (!message.guild.me.hasPermission('BAN_MEMBERS')) return message.channel.send('Error: I don\'t have the permission to unban members.');
if (!message.member.roles.cache.some(role => role.name === 'Server Administrator')) return;``` why?
dont check for a role, check for permissions.
uug
not everyone will have a role called Server Administration
i mean you can do a setup command that create the role but...
useless
So, what you wanna do @royal portal
tell me your idea
so
if there is no unban
it doesnt return anything
even if the user is unbanned
u can do
} else return;
you have a ban command right?
yeah
and it works perfectly
if the user is banned, it doesnt send it in the log channel
i will test ur code just to see for myself tbh
wait, me stoopid.
/// let bannedMember = await client.users.fetch(args[0]);
why is there ///?
btw, start using modules.
so you dont need to doe this
`if (message.author.bot) return;
if(message.channel.type === "dm") return;
let prefix = "-";
if (message.content.indexOf(prefix) !== 0) return;`
ok
696121075192299552
but i dont want all bans to go to that channel
so if someone bans in that server, it goes to that server's logs
replace this
let logsChannel = message.guild.channels.cache.find(ch => ch.name === "mod-log");
with this:
client.channels.cache.get(696121075192299552).send()
for later
so if someone bans in that server, it goes to that server's logs
what you mean?
so
if someone bans a person in the server, it goes the logs in that server
not in my server
ok.
mh.
let reason = args.slice(1).join(" ")
if(!reason) reason = "No reason given."
let logsChannel = message.guild.channels.cache.find(ch => ch.name === "mod-log");```
like i said you miss a return
let reason = args.slice(1).join(" ")
if(!reason) reason = "No reason given."
let logsChannel = message.guild.channels.cache.find(ch => ch.name === "mod-log") return;
if message.guild.members.bannable return; this is not valid javascript
you dont need try catch here, nor .then() if its empty
.then() !== await
throw new Error(`Please install ${moduleName} package manually`);9:37 PM
^9:37 PM
9:37 PM
Error: Please install sqlite3 package manually9:37 PM```
How to fix it?
please install sqlire3 package manually
9:37 PM
So i have commands that you can mention people or use their id to do stuff but...
How can i make it so it detects the user by their username?
Example: _userinfo Zeiad
Iterate through the guild member list and find the user by their username by checking their username (input === username).
@sudden geyser hmm... Like can you show me the code of it?
I got a little confused...
@earnest phoenix what library are you using.
Discord.js 12.1.1
guild.members.cache.find((member) => {...})
member is a GuildMember. Check the docs for the user and then the username to check.
Hmm i see... Thx for the code... I'll check that out...
@charred jetty run enable-pnpm in your glitch console
is it a bad idea to host different features of my bots on different services? like multiple instances that uses the same token but contains different commands, if that makes sense
well, nothing wrong about that, but you're wasting a lot of resources
because you will have multiple machines wasting tons of ram and cpu for little work
a much better idea would be to use them for sharding instead
was thinking it could be useful if i want to test a new command and don't want the entire bot to crash if my code doesn't work as expected
throw err;10:04 PM
^10:04 PM
10:04 PM
Error: Cannot find module '../build/Release/canvas.node'```
Now this
canvas requires a lot of dependencies to be installed in the system
not sure if glitch supports them
But i was using it
then try reinstalling it
try reinstalling canvas
Tried nothing happened
Trying re-enable npm
LMFAO
??
I think it's working
ok cool
Ok.. by enabling npm the thing installed
Solved
@quartz kindle can you please teach me how you get that i have to enable-pnpm ?
sqlite 3?
Yes
afaik glitch disables pnpm if you manually edit your package.json or if you install stuff in the console
glitch wants you to use the add package button instead
Oh
But bot was not working... Like couldn't install anything with npm and it was stucked.. couldn't even refresh...
After 20mins it could install almost everything with npm
following are the things that could have happened
ur internet oofed
the project oofed
I think my project crossed it's limited requests
you get what you pay for :3
Yup
Same happened for me my internet was giving fine speed
tim bully 
And the same thing happened when i was trying to self host my bot.. exactly same error... Now i understand how to fix it
@finite bough ok.. mangoman
or json :^):^):^)
how do I link code to a bot?
im downloading node.js currently
i do have coding experience
in what language tho
ive used python java and snap
why not use Python or Java then
^
rather than a language youve never used...
well i just don't no how to put the code into the bot
thats.... not how it works
what do you mean
you dont put the code into the bot. you build a program with your code, and this program logs in to discord
ok
you can use nearly any programming language, and there are a lot of libraries out there to interact with the discord api
ok im just trying to figure out how the bot uses the code
you use a discord library and login via your bot token
ok
you can do it without a library by using websockets yourself, but dealing with websockets is a pain
so just install and use a discord library
for example, for python there is discord.py
for javascript there is discord.js and eris
for C# there is Dsharp and discord.net (or something like that)
you can check more here https://discordapi.com/unofficial/libs.html
most of those libraries will have a website featuring comprehensive documentation and code examples that shows how to build a basic bot with it
.
isnt there like one c++ discord api wrapper
isnt it dead
cpp api wrappers are a pain in the ass cause of websockets
@woven sundial this is nicer js let prefix = "."; if (message.guild.id === "DBLID") prefix = "cor!";
one sec lemme get the file open for mine
client.user.setPresence({ activity: { name: `c!help | ${client.guilds.cache.size} servers` }, status: 'dnd' })```
a command doesn't work?
Nope
just do client.user.setStatus("dnd") if you don't need anything else
but it still doesn't work for you
It won't work
i know
actually. i have 2 prefix now. . and cor!

