#development
1 messages ยท Page 1388 of 1
const msg = await message.channel.send(helpss);
await msg.react('๐๏ธ')
await msg.awaitReactions((reaction, user) => message.author.id == user.id && (reaction.emoji.name == "๐๏ธ"), {max: 1, time:15000})
.then(async collected => {
if(collected.first().emoji.name == "๐๏ธ"){msg.delete(), message.delete()}
else return message.channel.send("error")
})
break;
someitimes it just send a error that emoji is not define, but most of the time its working well
@north birch it depends on what exactly you are doing
you also gave a snippet of code, which doesn't help
you also gave a snippet of code, which doesn't help
@earnest phoenix Sorry xd
That's api spam I think
I don't think so.
I do instead xD
@lethal grail u still need help?
hi
hi
why is this not working
no errors, but it doesnt log username when user joins
do you have the intent required for that enabled
ye
what am i supposed to do to get that intent
When initializing Discord.Client, you'll need to pass ws as a key, with the value of the expected object: https://discord.js.org/#/docs/main/stable/typedef/WebsocketOptions
There's an intents key/value after you pass it, which I think you should include GUILD_MEMBERS
this?
For example: js new Discord.Client({ ws: { intents: [Discord.Intents.GUILD_MEMBERS] } })
You should add intents for what you need.
You'll also need to enable it on the developer portal for your bot.
is that privileged intent
GUILD_PRESENCES is for presenceUpdate if u need that
GUILD_MEMBERS is for guildMemberAdd, guildMemberRemove, guildMemberUpdate
yes
they keep making things more complicated
but it failed
xd
hey does anyone know the battle formula for an rpg?
Imagine if i could ping @earnest phoenixry1
im trying to figure out the ratio in which the 80hp points is converted to 1900 hp during battle
;-;

help pl0x ;-;
80hp to 1900hp is 23.75 or what u mean? xD
@digital ibex yep
so i change run to execute?
yes or in your message to run
????
What i mean is, the hp here shows a 80 or 90, but then during the actual battle its scaled to 2390 etc. how is this ratio calculated?
in your message event, where u check if its a command or not and run it
so i change run to execute
just change in your commands run: to execute:
@crystal wigeon it depends how u want it, on my Bot i used 1 point = 100hp, but u can scale it how u want tho
if(err) console.log(err)
if(!money) {
const newCoins = new coins({
_id: member.id,
money: 0
})
newCoins.save()
} else {
return money.money
}
})
This returns as [object Promise] for some reason, does anyone know why?
use await before coins.findOne
ok, imma try
also you dont need async in the cb
await and .then? i think thats incorrect
im hyptonised by the always make functions async spell
xD
hey guys
why is my code sending out lastcoordinate = o? Eventhought that is not true:
still returns [object Promise]
function toRad(value) {
return value * Math.PI / 180;
}
function calcCrow(lat1, lng1, lat2, lng2) {
var R = 6371;
var dLat = toRad(lat2 - lat1);
var dLon = toRad(lng2 - lng1);
var lat1 = toRad(lat1);
var lat2 = toRad(lat2);
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.sin(dLon / 2) * Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
var d = R * c;
return d;
}
let lastcoordinate = calcCrow(lat1, lng1, lat2, lng2)
console.log(lastcoordinate)```
developer portal
the other one
anyone that knows how to solve my issue?
it worked
just a heads up, if your using priv intents you should really learn the rules of them.
what might cause random data to be deleted from a mongodb collection? not all data gets deleted but some do randomly
timed deletion?
Nah
nah yaraklar
if mongo has logs, I would look at those.
anyone that could help me out please?
@eternal osprey console.log(lat1,lng1,lat2,lng2)
Hey guys, i'd like to make my bot displaying how many messages a certain user sent, any help with that?
@eternal osprey then you're still getting them wrong
you didnt read the answer i gave you
i can't be getting them wrong
i told you to split by comma
i did read everything
yeas i did
const lat1 = raid.lat;
const lng1 = raid.lng.substring(1);
fs.writeFileSync("./lastcoordinate.json", [lat1, lng1])
console.log(name, + "\n" + raid.gym_name, + "\n" + raid.lat, + "\n" + raid.lng);
const coordinates = fs.readFileSync("./lastcoordinate.json","utf8").toString()
const final= coordinates.split(",")
const lat2 = final[0]
const lng2 = final[1]
console.log(lat2 + "\n" + lng2 )```
look
and what does that console.log show ?
let me run it for you. 0/
another thing
if lastcoodinate.json is literally lat1 and lng1
why the fuck do you save them into a file then read the file again?
Egg 0RAILROAD Park 040.824952 0-73.915779
program.js:65
40.824952
73.915779
program.js:72
0
that is because this code does refresh every 10s
i want to compare the newer lat1 and lng1 with the previous ones
(the distance between them)
that is why i am saving them
you're writing to a file and reading from the same file right afterwards
there is no reason to do that
you can literally do lat2 = lat1
what previous ones, if you literally write new ones to the file before you do anything else?
you're deleting any previous thing before anything
these will be saved in the json file.
wait i am stupid
you are right
that is why it i 0 ofcourse
huh but how would i do it then?
why did you save it in the first place?
you could maybe get away with using variables to temporary store them. this maybe fixes some of your issues
i want to save the previous coords and compare it with the newer ones
as my code generates a new raid every 10s
ive had an idea but it will not work
if its every 10s do you need it to be stored between restarts anyway?
yeah right now i am really stuck.
yea you write and read every 10 seconds from a json thats not good
i guess saving between restarts is stupid
since its quickly replaced anyways
and if the first run shows a 0 in your distance i dont think someone cares
yeah
is there any way to let the json file overwriting skip one cycle (of the setinterval = 10s)
can't i try to put a cooldown on the json writefilesync of like 10s?
why u dont save it in a map?
wdym?
https://www.npmjs.com/package/node-cache maybe this helps
- Raid Map(1) delete after 30sec
- Raid Map(2)
- Raid Map(3)
or do you need all your data from all Raids?
you store values in a Cache and can set a automatic self destruction of the data
I'm trying to post a json to my api, it receives the post and its meant to return the res.body bUuuuUuuuU its not sending the body or anything other than an empty json
and its easy to use
require("node-fetch")("https://dice.ryadev.xyz/database/accounts/registerGJAccount.php", {method: "post", "Content-Type": "application/json", body: {"userName":"Dice", "password":"dghiousdahhfsdughs", "email":"se@x.com","secret":"Wmfd2893gb7"}}).then(res => res.json()).then(b => JSON.stringify(b))``` here's how im posting
me neither but it looks easy to implement
@pure lion did you use postman for API tests?
router.post("/database/accounts/registerGJAccount.php", async (req, res) => {
res.send(req.body).status(200);
});
``` and here's the route
nah i posted with my bot
postman is lag for my pc
depressing ik
you can use it in a browser
why did you send the body in a post event?
testing
make a console.log and see what it spits out?
did you pass any data when making a request
fixed it
i am astronomically stupid
app.use(express.urlencoded({extended: true})); kekw
cant be as bad as the dude that made his bot spam nsfw pictures in 80 guilds
ah-
@eternal osprey would recommend using (if you use the node-cache) .set to set your last location and .take to retrive it (take will get the data and delete the key)
it didnt fix it
also works
feck
but its a placebo
would recommend using the node-cache or something like this
has some pros over your file system
the largest one is its faster
hmm okay i will study node-cache
its working not good
"good" is subjective
doesnt he need it stored in disk tho?
to compare after a bot restart
then is it for the first 10 seconds 0
yeah i tested it
but sure, if hes fine with having no comparison the first time the bot runs it, then its fine, but in that case he doesnt really need a module lol
im using express as my API ting (and body-parser to parse the json). it works when im in browser, sending as a form with a name but when I'm just sending the JSON it console logs absolutely nothing
sure
store stuff in cache
thanks boys, really happy that i got it working!
its like u want to fuck ur performance
Can't u just store a hash for post-restart comparison?
thanks for the tips etc!
lol everyone who uses redis wants a talk with you
@slim umbra i've got a vps
what?
lol
it would not affect my pc performance if you were talking about that?
no lmao
and he will store a few kb in the cache usually it will impact nothing
i meant ur bots memory usage
Everything uses memory actually
hes storing a few bytes per guild it looks like
most guilds names are more than what he is caching
cansomeonepleasehelpmewithexpressplease
Could you express that better?
lol
i hate you
.slice(3) will make sure that the string will cut after character 3 right?
lmao
so starting from 0
so basically when i send the JSON from the browser using a form and posting the inputs with names it works
but when I just post the JSON it does absolutely nothing
did you call the correct endpoint?
@pure lion are you using the json body parser? because forms dont use json, they use urlencoded
beautiful formatting
Const ๐ฉ
@pure lion are you using the json body parser? because forms dont use json, they use urlencoded
@quartz kindle yes i called router/app.use(bodyParser.json())
@earnest phoenix you know that you can make a code block with 3x` then your code and 3x ``
new new new new new new new new new new new new new new new new new new new new new new new new ```
i would like a new new
```here you go```
or
```js
```
lmao
lmao indeed tim please help me
That'll await faster
yes
idk show code?
would be stupid if with every await it uses a new thread
Js has no threads tho
i know
where are you?
awaiting the promise
hurry up
await await promise()
app.use(express.urlencoded({extended: true}));
app.use(bodyParser.json());
app.use("/", endpoints.register);
app.listen(port, () => console.log(`[ALERT/express server] Server running on local port ${port}`));
const router = require("express").Router()
const bodyParser = require("body-parser")
router.use(bodyParser.json());
router.post("/database/accounts/registerGJAccount.php", async (req, res) => {
res.send(req.body).status(200);
console.log(req.body);
});
module.exports = router;```
ill try posting again
console is {}
i asked him this too but his potato wont run the desktop app
are you pretending your website runs on php?
hEr*
lmao
If it ain't a local api just try apistester
well kinda
its for geometry dash and because of the way bytes are written to requires them to report the correct size
that means the endpoints have to be the same length
and nobody wants to write the dll
@quartz kindle So regarding my previous inquiry, here's a coordinator I came up with, in case you were inquisitive: https://gist.github.com/rumblefrog/37e48d8d64dbb5155920125f2197040a
I need help with the code ```const fs = require ('fs');
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'))
for(const file of commandFiles){
const command = require(./command/${file});client.commands.set(command.name, command);}
@earnest phoenix error? Tips? Info?
oh it worked
@lyric mountain mobile looks like shit
But anyway, you probably have some syntax issues there, but it's quite hard to find it without highlighting
looks like a json parser ran over it
yeah
but it looks fine
Why don't u use ' inside "?
yea makes it way easyer
but i did post json
are you sure?
hey peeps
back at it again
let lastcoordinates = lastcoordinate.slice(0,3)
``` lastcoordinate.slice(0,3) is not a function?
is lastcooditate a string?
it is an array
and you want to keep the first 3 entrys?
exactly!
are you sure its an array and not an object?
yeah
run a console.log(lastcoordinate) and see if it is an array
let me just use isArray()
or console.log(typeof lastcoordinate)
it's a huge problem
how did you run your commands?
listen once
i have a bad feeling about this one
no no
show how you're creating ur listener
tf
no
please learn js
you dont need to set max listeners
@lusty quest the console.log returns: number
you just need to use less of them
so its not an array @eternal osprey
there should be something like addEventListener somewhere in ur code
unless...is that code copypasted?
how many times did you listen to the on message event?
exactly
you have a single number?

does anyone know a way to send files using a webhook? c#
could i maybe use substring?
and lib?
@bronze fable https://stackoverflow.com/questions/62494644/how-to-send-file-attachment-with-embed-discord-net-webhook-c-sharp did you tryed this one?
I've tried every solution on adding an embed on a web hook but none work on my case or am I missing something?
I'm using Discord.Net v2.2.0
here's part of my code
var DCW = new DiscordWebhookClient(
so any suggestions on how to cut off the string after the 3rd character?
your not working with a string are you? but a number @eternal osprey
@lusty quest its not the same, example there is using discord.net, im trying to send webhook raw using requests
ok lol
ohh ok. sadly my C# knowledge is not that good for now
@eternal osprey try toFixed(3)
to fixed is just after the decimal right?
ohh right only decimals
my thought was maybe .toString then slice it.
owhyeah okay i will try!
yea will probably work better
probably
Js
multiply the value by 1000, then cast to int, then cast to float and divide by 1000
gg
how do i fix this it only break when it done like this tuphug but when it done like this tuphug @ someone it didnt break
here error
.setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)
^
TypeError: Cannot read property 'username' of undefined
at Client.<anonymous> (C:\Users\love\Documents\Discordbot\index.js:101:109)
at Client.emit (events.js:327:22)
at MessageCreateAction.handle (C:\Users\love\Documents\Discordbot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\love\Documents\Discordbot\node_modules\discord.js at WebSocketManager.handlePacket (C:\Users\love\Documents\Discordbot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\love\Documents\Discordbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\love\Documents\Discordbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\love\Documents\Discordbot\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (C:\Users\love\Documents\Discordbot\node_modules\ws\lib\websocket.js:797:20)
here code
if(message.content.startsWith(prefix + "hug" )){
message.channel.send('**OMG YOUR HUGGING**');
}
if(message.content.startsWith(prefix + "hug" )){
var embed = new Discord.MessageEmbed()
.setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)
.setTimestamp()
.setImage('https://gifimage.net/wp-content/uploads/2017/06/anime-hug-gif-11.gif')
message.channel.send(embed);
}
module.exports = {
name: "avatar",
aliases: ["av"],
category: "Utility",
usage: "avatar/avatar @user",
description: "Gives avatar for message author or mentioned user.",
execute: async (client, message, args) => {
let user = message.author || message.mentions.users.first();
let embed = new discord.MessageEmbed()
.setTitle(`${user.username}'s Avatar!`)
.setImage(user.avatarURL({size: 2048, dynamic: true, format: "png"}))
.setColor("RANDOM");
message.channel.send(embed);
}
};```
avatar command, wont respond
@lucid prawn if you use Node 14+ use optional chaining alternative check if a user is mentioned or not and handle accordingly
@lethal grail did you get an error?
when i user is mention it work when a user not mention it break
did you know basic js?
nope started today
h
for you*
no for you too. since you will understand what i talk about
should i put this in my coded to fix it ```js
if(!args[0]) return msg.channel.send('Please mention someone to hug');
if you want or check if there is a mention and add it if aviable
@lethal grail you got somewhere a promise that throws an error that is not handled. did you got any sort of Error handling?
yep
return message.channel.send(`An error happened while executing this command, the error is as follows:\n\`\`\`\njs${err}\n\`\`\``);```
there is somewhere a error that is not handled
like this ```js
if(message.content.startsWith(prefix + "hug" )){
message.channel.send('OMG YOUR HUGGING');
}
if(message.content.startsWith(prefix + "hug" )){
if(!args[0]) return msg.channel.send('Please mention someone to hug');
var embed = new Discord.MessageEmbed()
.setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)
.setTimestamp()
.setImage('https://gifimage.net/wp-content/uploads/2017/06/anime-hug-gif-11.gif')
message.channel.send(embed);
why 2 checks for the command?
kiss cmd ?
@lucid prawn thats wrong
???
if(message.content.startsWith(prefix + "hug" )){
message.channel.send('**OMG YOUR HUGGING**');
}
if(message.content.startsWith(prefix + "hug" )){
if(!args[0]) return msg.channel.send('Please mention someone to hug');
var embed = new Discord.MessageEmbed()
.setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)
.setTimestamp()
.setImage('https://gifimage.net/wp-content/uploads/2017/06/anime-hug-gif-11.gif')
message.channel.send(embed);
}
or error
the first check - if you type only hug it returns OMG YOU'RE HUGGING
and then on the second check
yea
the first one .. yes
ok
like this ```js
if(message.content.startsWith(prefix + "hug" )){
if(!args[0]) return msg.channel.send('Please mention someone to hug');
var embed = new Discord.MessageEmbed()
.setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)
.setTimestamp()
.setImage('https://gifimage.net/wp-content/uploads/2017/06/anime-hug-gif-11.gif')
message.channel.send(embed);
}
msg not defined
what is your error @lucid prawn
use this it may work
if(message.content.startsWith(prefix + "hug" )){
if(!args[0]) return message.channel.send('Please mention someone to hug');
var embed = new Discord.MessageEmbed()
.setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)
.setTimestamp()
.setImage('https://gifimage.net/wp-content/uploads/2017/06/anime-hug-gif-11.gif')
message.channel.send(embed);
}
your message variable is probably message not msg if msg is undefined
yh
my error ```js
ReferenceError: args is not defined
at Client.<anonymous> (C:\Users\dogli\Documents\Discordbot\index.js:97:21)
at Client.emit (events.js:327:22)
at MessageCreateAction.handle (C:\Users\dogli\Documents\Discordbot\node_modules\discord.js\src\client\actions\MessageCreate.js:31:14)
at Object.module.exports [as MESSAGE_CREATE] (C:\Users\dogli\Documents\Discordbot\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (C:\Users\dogli\Documents\Discordbot\node_modules\discord.js\src\client\websocket\WebSocketManager.js:384:31)
at WebSocketShard.onPacket (C:\Users\dogli\Documents\Discordbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (C:\Users\dogli\Documents\Discordbot\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (C:\Users\dogli\Documents\Discordbot\node_modules\ws\lib\event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (C:\Users\dogli\Documents\Discordbot\node_modules\ws\lib\websocket.js:797:20)
define args
how
as an array of the source message content probably.
with the command and prefix removed
i only worked with args once so
const Discord = require("discord.js")
let prefix = ","
module.exports.run = (bot, message, args) => {
if(message.content.startsWith(prefix + "hug" )){
if(!args[0]) return message.channel.send('Please mention someone to hug');
var embed = new Discord.MessageEmbed()
.setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)
.setTimestamp()
.setImage('https://gifimage.net/wp-content/uploads/2017/06/anime-hug-gif-11.gif')
message.channel.send(embed);
}}
module.exports.help = {
name: "hug"
}
stop using msg and use message @restive otter
aaa can someone help
im trying to send file as webhook, but it doesnt work ๐ก
this is the code
code stolen and modified
maybe ask on the Discord Developers or Discord API server idk how many people here actually use C#
of i change it to ur coded #development message i will have to change 200 commands
use my code @lucid prawn
ok
wait
what
2 seconde
I was about to say that lmao @solemn latch
Remember that clients mods are against Discord TOS, watch out or somebody can report you
@restive otter
clients mods what that 
Yeah @prisma bramble
module.exports = {
name: "kick",
usage: "kick <@user> [reason]",
description: "Kick a user from the guild.",
execute: async (client, message, args) => {
let user = message.mentions.users.first();
let reasonkick = message.content.split(' ').slice(2).join(' ');
let guild = message.guild;
let memberkick = message.guild.member;
if(!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send(`You Require `KICK MEMBERS` Permission to Execute this Command`)
if (message.mentions.users.size < 1) {
return message.channel.send('You need to mention someone to kick!');
}
if (!reasonkick) {
reasonkick = "No Reason Given"
}
if (!message.guild.member(user).kickable) {
return message.channel.send("That Member couldn't be kicked due to role hierarchy");
}
message.guild.member(user).kick();
let embed = new Discord.MessageEmbed()
.setTitle("User Was Successfully Kicked")
.setDescription(`${user.username}#${user.discriminator} was kicked by ${message.author.username}`)
.addField(`Reason :-`, `${reasonkick}`)
.setColor("RANDOM")
message.channel.send(embed)
let DmEmbed = new Discord.MessageEmbed()
.setDescription(`You were Kicked from ${guild} for: ${reasonkick}`)
.setColor("RANDOM")
user.send(DmEmbed)
}
}```
this kick command makes my bot not start at all
@lucid prawn BetterDiscord for example
ok
I've used it. Once you use hundreds of themes you'll realize nothing is better than default discord
Remember that clients mods are against Discord TOS, watch out or somebody can report you
@restive otter
@north birch poukave
whats the error @lethal grail
the coded is not working @restive otter
const discord = require("discord.js");
module.exports = {
name: "kick",
usage: "kick <@user> <raeson>",
run: (client, message, args) => {
if(!message.member.hasPermission("KICK_MEMBERS")) {
return message.channel.send(`**${message.author.username}**, Vous ne disposez pas des autorisations nรฉcessaires pour utiliser cette commande`)
}
if(!message.guild.me.hasPermission("KICK_MEMBERS")) {
return message.channel.send(`**${message.author.username}**, Je n'ai pas assez de permission pour utiliser cette commande`)
}
let target = message.mentions.members.first();
if(!target) {
return message.channel.send(`**${message.author.username}**, Veuillez mentionner la personne que vous souhaitez kick`)
}
if(target.id === message.author.id) {
return message.channel.send(`**${message.author.username}**, Vous ne pouvez pas vous expulsez`)
}
if(!args[1]) {
return message.channel.send(`**${message.author.username}**, Veuillez donner une raison pour interdire`)
}
let embed = new discord.MessageEmbed()
.setTitle("Action: Kick")
.setDescription(`Kicked ${target} (${target.id})`)
.setColor("RANDOM")
.setFooter(`Kicked by ${message.author.username}`);
message.channel.send(embed)
target.kick(args[1]);
}
}
module.exports.help = {
name: "kick"
}
kick cmd
no error
just create channel "logs"
I've used it. Once you use hundreds of themes you'll realize nothing is better than default discord
@prisma bramble Me too, i tried it but it slows down discord
the coded is not working @restive otter
shut hup now @north birch beacause y have used
@lethal grail you're missing ) somewhere
shut hup now @north birch beacause y have used
@restive otter Dont worry i used it too one time
yes i know that but idk where @prisma bramble
if(!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send(`You Require `KICK MEMBERS` Permission to Execute this Command`)
the `` around kick members
is messing up your quotes
try using
"You Require `KICK MEMBERS` Permission to Execute this Command"
instead
please stop spoonfeeding
its against rules
sorry
I'm french @lucid prawn , my code is french
my error js ReferenceError: emitter is not defined
what u code?
api server? ๐ค
Define emitter
discord api, or developers server
coded ```js
emitter.setMaxListeners()
Btw i want to make a christmas countdown with parse-ms, on reaching date trigger that function, anyone is expert with that?
@bronze fable https://discord.gg/discord-api
why are you changing the number of max listeners?
Define emitter @lucid prawn
Yeah even better question ^^^
my coded ```js
client.on('guildMemberAdd', member => {
// Send the message to a designated channel on a server:
emitter.setMaxListeners()
const channel = member.guild.channels.cache.find(ch => ch.name === 'general');
// Do nothing if the channel wasn't found on this server
if (!channel) return;
// Send the message, mentioning the member
channel.send(Welcome to the server, ${member});
});
Tf
wtf?
setting max listeners on every guild member 
what
have you any idea what you are coding?
yes i do
it doesnt appear to
okay whats this line for
emitter.setMaxListeners()
you only need one listener per event
i dont use it and im now at 300 guilds?
which can handle all guilds
so how do fix it
theres very rarely a reason to setMaxListeners more than once at startup.
theres also very little reason to set it at all. the default of 10 is plenty in 99% of cases.
if you have a specific reason to use it, use it, but you need to know exactly why and where to use it.
not just put it randomly somewhere.
it was working but it stop today
even if it was working, its not the right way to do things.
ok so what do i change
is there any website where can i take ms till xmast on every bot startup?
@solemn latch your solution for the kick command didint work what should i do?
get rid of the emitter.setMaxListeners() line.
ok
i mean its able to start now but the command wont respond
is it giving a new error?
i will check
my fix solved the error that was displayed, or should have ๐คทโโ๏ธ /
is it giving any response at all when you do the command?
no error but i need someone to join to see of it give me a error
create an alt account
is it giving any response at all when you do the command?
@solemn latch nope
Guys is there a source when i can get updated milliseconds left to christmas on my bot so i can make a countdown command?
you could do the math yourself.
dont think it would be that hard
just set a date to christmas, then subtract now, then thats the miliseconds remaining right?
using Epoch time ofc.
is the command properly added to the commands collection(or however your storing them) @lethal grail
didnt work
what didnt work?
okay. but what error happened.
no error
so, what part didnt happen? did it get the channel and not send the message? did it not even run the event? did it not find the channel?
@earnest phoenix what kind of help?
it didnt send the message
did it find the channel?
@lucid prawn did you have a channel called "general"?
Its best to use a db so people can have custom channels for things like a welcome message
i change it to spam
Because not everyone has a channel called General
const msg = await message.channel.send(helpss);
await msg.react('๐๏ธ')
await msg.awaitReactions((reaction, user) => message.author.id == user.id && (reaction.emoji.name == "๐๏ธ"), {max: 1, time:15000})
.then(async collected => {
if(collected.first().emoji.name == "๐๏ธ"){msg.delete(), message.delete()}
else return message.channel.send("error")
})
break;
someitimes it just send a error that emoji is not define, but most of the time its working well
even when it dose send the error
its deleting it after 30s instead of instantly deleting
please ping when asnwer
@lucid prawn ok so do you have a channel called "spam" then?
yes
Hmm
is the command properly added to the commands collection(or however your storing them) @lethal grail
@solemn latch yeah
so when you console.log it it shows up?
what?
what error
client.on('guildMemberAdd', member => {
const channel = member.guild.channels.cache.find(ch => ch.name === 'spam');
if (!channel) return;
channel.send(`Welcome to the server, ${member}`);
});
if a bot is missing say manage_roles permission how would you have it send an error message if it is?
I know it's like:
return message.channel.send('missing manage_roles');```
what would you put before .hasPermission?
anything else logged or just that @earnest phoenix
if(err) console.log(err)
if(!money) {
const newMoney = new money({
_id: member.id,
money: 0
})
newMoney.save()
} else {
return money.money
}
})
Normally, this should show an int, but instead it returns [object Promise], does anyone know why?
no error @solemn latch
you have a promise you need to resolve
please someone dont ignore me
honestly, not sure with just that info. @earnest phoenix
I would try using npm filename in your projects folder to run it.
okay i see
thx for the help everyone, i will come back in 1h hopefully someone will want to help me then
its kinda hard to solve that issue
I dont have enough info to really debug that ๐คทโโ๏ธ
maybe try logging the channels collection and see if spam actually exists as far as the bot is concerned?
@solemn latch #development message
still do not work should i delete it
like i said broken, I want to help, but i dont have enough info
i thought you talked to him
my guess is its not finding the channel @lucid prawn
I would log on the return to see if it is finding it or not.
hold up let me send it here again
so i could see it
const msg = await message.channel.send(helpss);
await msg.react('๐๏ธ')
await msg.awaitReactions((reaction, user) => message.author.id == user.id && (reaction.emoji.name == "๐๏ธ"), {max: 1, time:15000})
.then(async collected => {
if(collected.first().emoji.name == "๐๏ธ"){msg.delete(), message.delete()}
else return message.channel.send("error")
})
break;
someitimes it just send a error that emoji is not define, but most of the time its working well
even when it dose send the error
its deleting it after 30s instead of instantly deleting
i dont see the problem
and this is the entire command?
well, there is the embed
is there a specific line the error is pointing to?
thats the full command: http://pastie.org/p/0ALgRRfLCnfIkKNSswXnyp
is there a specific line the error is pointing to?
@solemn latch no
maybe it look for the channel called spam it every server I ๐ค @solemn latch
well, it taking longer can be due to ratelimits or lag.
reactions have a harsh ratelimit
i know, i thought it was because the host,
@lucid prawn its looking in the guild specific to member.
member.guild.channels.cache.find(ch => ch.name === 'general');
brb
just incase, I would look at the ratelimit event
https://discord.js.org/#/docs/main/stable/class/Client?scrollTo=e-rateLimit
noo
it might be a good idea to have the event log into a private channel.
so you can see when ratelimits are caused.
but i dont think its needed.
ok i recoded it to this ```js
const Discord = require('discord.js')
const client = new Discord.Client()
const config = require('./config.json')
const welcome = require('./welcome')
client.on('ready', () => {
console.log('The client is ready!')
welcome(client)
})
client.login(config.token)
@solemn latch
yo @solemn latch i checked, and after it deletes that, it send:
(node:6440) UnhandledPromiseRejectionWarning: DiscordAPIError: Unknown Message
at RequestHandler.execute (D:\among us emojis\node_modules\discord.js\src\rest\RequestHandler.js:154:13)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async RequestHandler.push (D:\among us emojis\node_modules\discord.js\src\rest\RequestHandler.js:39:14)
at async MessageManager.delete (D:\among us emojis\node_modules\discord.js\src\managers\MessageManager.js:126:5)
(node:6440) 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: 1)
(node:6440) [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.
message.member
@tardy hornet isn't that for checking a members permission
with which module can we recover the images?
@tardy hornet isn't that for a member not a bot?
@vocal sluice bro......
it actually say message.member
ok i recoded it to this ```js
const Discord = require('discord.js')
const client = new Discord.Client()const config = require('./config.json')
const welcome = require('./welcome')client.on('ready', () => {
console.log('The client is ready!')welcome(client)
})client.login(config.token)
my code
Do you have a question to go with that code?
No I have no question
what
@lucid prawn what is your question?
What's not working, what do you need, etc etc
Re-state the issue so we can know what you need.
development
@safe quail wtf are you even doing
the channels
And you think your one message in each is going to accomplish what exactly
in channels that move up every minute
uhh lokl
It's 100% pointless.
completely seeing the pointless\
with which module can we recover the images?
@wicked pivot node-fetch
i need help
ok
so i want to make bingo bot and i want to every 5 minutes to send results of bingo
how can i do that
or i cant
Use a timeout function
yes but how to make it automatically every 5 minutes
without command
like I said
an interval
anyone know how to check the operating system using eval
get the channel, then send to it.
@lethal grail it's more "check with nodejs", eval is just a way to run nodejs code
get the channel, then send to it.
@solemn latch how i will get their specific channel for bingo of every server
thats is my problem
bruh
... is there any way tho
there's process and fs depending on what you need
and also the os module
it depends what oyu need to do
!eval process, i see
depends @earnest phoenix
no..
what depends
you d'ont just eval an entire module
You find what specifically you need to get, and you run that code.
if you want every server to select the channel, youd make a database to store that info
i have database
whether it's run in eval or a .js file makes no difference, you still need to know what it is you want.
okay, store the ids of the bingo channels for each guild
then fetch those channels each interval and send to them.
yes but how i gonna remember servers what has that specific channel
do servers have id?
yes
yes
hi
i fix it @solemn latch
just a warning, if you have 600 guilds, each getting a message every 5 minutes, youll start hitting ratelimits
https://discord.com/developers/docs/topics/gateway#rate-limiting
120 requests per minute is 600 requests every 5 minutes.
or something like that.
what
was for shovel
ok
hello~ i have a question
what ur question
im trying to use discord.ext commands, however when I use the @client.event async def on_message(message): command none of my other commands like
async def _help(ctx):``` work
I feel like its an easy fix, like im missing one small thing
and whhen i comment out on_message, the help command works. If i keep it uncommented the help command doesnt work
ummm sorry i cant help because i do javascript
:(
all good thanks tho
wait maybe this will help
ill let yyall know if it works
it works
thx
Hey guys, how do I get my discord.py bot to randomly send memes?
Does doing some setInterval with 1000ms as an interval create a problem with the bot?
I don't know how to program an embed for memes haha
Set interval is fine to use even at 0ms
Set interval is fine to use even at 0ms
@solemn latch Perfect
hi I am new to this so not that experienced at this and was wondering how to get a bot to dm someone? i am on c# discord.net
how do i fix this
if(!args[0]) return message.channel.send('Please mention someone to hug');
my error ```js
ReferenceError: args is not defined
what is the problem?
help #development message
how do i fix this
if(!args[0]) return message.channel.send('Please mention someone to hug');my error ```js
ReferenceError: args is not defined
@lucid prawn mmmh
how do i fix this
if(!args[0]) return message.channel.send('Please mention someone to hug');my error ```js
ReferenceError: args is not defined
@lucid prawn Can you send the full code?
@humble rock you need the Privileged presence intent to get presence data.
๐
await client.send_message doesnt work can someone help me
what library
1.5.1
.....
py is on 1.5.1 so probably had to be it :p
Instance of 'Bot' has no 'send_message' member
yeah, dont think clients have that method.
await client.send(<message>);
i use this, but i've different discord.py vers
async execute (args, msg){
const name = args.join(' ');```
it hit me with the args.join is not a function
my coded
if(message.content.startsWith(prefix + "hug" )){
if(!args[0]) return message.channel.send('Please mention someone to hug');
var embed = new Discord.MessageEmbed()
.setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)
.setTimestamp()
.setImage('https://gifimage.net/wp-content/uploads/2017/06/anime-hug-gif-11.gif')
message.channel.send(embed);
}
my error
ReferenceError: args is not defined and poop is not defined
define args and poop
yes
lol
define args and poop
the last one is easy
i defined args
in the same scope?
๐
await client.send(<message>);
i use this, but i've different discord.py vers
@humble rock thanks it works
const args = message.content.slice(prefix.length).trim().split(/ +/g);
lmao
what function is used for dming people
{
const args = arg def;
}
{
console.log(args); // this line will error args was defined out of scope
}
user.send()
in most libs
what user
user class/object
how to get it
@earnest phoenix
await ctx.send(<message>)
i use this? #development message
no
thats showing how just because you define something doesnt mean it will be defined in other scopes
@earnest phoenix
await ctx.send(<message>)
@humble rock i want to dm more than 1 people
the result of bingo
i mean what they won
new error
.setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)
^
TypeError: Cannot read property 'username' of undefined
help #development message
Maybe this
message.mentions.users.first().user.username
Or
const member = message.mentions.user.first()
member.user.username
what event are you trying to do this in
do you want to i send you my source code?
one guys have musique cmd please ?๐
we dont spoonfeed here
i want to do it in def sendResults(a,b,c,d,e,f)
are you mentioning someone in the command @lucid prawn
okay, you need to add a check if someones mentioned
if(!message.mentions.users.first()) return; // send message maybe if you want?
how to dm someone with having only their id
fetch the user
and
then user.send() on the fetched object
did you fetch the user?
sec
like this @solemn latch
if(message.content.startsWith(prefix + "hug" )){
if(!message.mentions.users.first())
var embed = new Discord.MessageEmbed()
.setDescription(message.author.username + ' huged ' + message.mentions.users.first().username)
.setTimestamp()
.setImage('https://gifimage.net/wp-content/uploads/2017/06/anime-hug-gif-11.gif')
message.channel.send(embed);
}
i would return on that line
if(!message.mentions.users.first()) return;
and send a message if you want to saying you need to mention someone
so here do i put it
what arguments user.send() needs
I think it only requires content, or an embed, or an attachment.
it would be on that docs page
what about fetched user?
fetching just requires the ID afaik
if(!message.mentions.users.first()) return;
@solemn latch here do i put it
can i see the lines?
yes
@lucid prawn only when you dont mention someone correct?
yes @solemn latch
cant declare things on an if statement
yes
@lucid prawn isnt that what you want? you cant hug someone without mentioning someone else.
thx
i will do what i needed to do from start
actually thats a decent idea unironically
https://www.merriam-webster.com/dictionary/edgy
Edgy: having a bold, provocative, or unconventional quality
sorry google translate doesnt make sence
if i could describe it as anything, its like being 13, hating everything
Itโs just a funny idea to huge yourself if you havenโt mention anyone,
why would someone hate everything
Thatโs what they wanna say
why people are obsessed with anime
why are people obsessed with having conversations in bot development channels
i am not obsessed
just begin noob on this server
ok i give up on dming people clearly i cant do that
lol
discord.user.send i dont think makes any sense
your looking at sending to the user, not discord.user.send
i think you want fu.send("message")
user.send("yourmessage")
.send sends to what its used on
and fetch the user before
^
that makes sence
which, fetch is also async isnt it ๐ค
when I think youll need to await it, or however py handles async.
or not 
await or async
me too
async function, await anything that's an async function/returns a coroutine
so its like def and return?
if(message.content.startsWith(prefix + "meme" )){
if(!message.mentions.users.first()) return;
var embed = new Discord.MessageEmbed()
.setDescription(message.author.username + ' memed ' + message.mentions.users.first().username)
.setTimestamp()
.setImage('www.meme.com/pooponme')
message.channel.send(embed);
}
how do i get it to change meme every time someone use the command
store the sent message and edit it each time they use your command
oh wait
you want a different each time you enter the command
use an api that gives you a random image each time
how
https://github.com/D3vd/Meme_Api would be an option
parse the image url from the examples on the github and setImage with that url
this is spoonfeeding
No
giving you the full code is spoonfeeding
explaining how you can make use of this is not
read the Meme_api on there. You can parse the web request through that api and receive the image url to use in your MessageEmbeds .setImage
await fu.send("test") doesnt cause error but it doesnt dm user
yup, the github documentation should explain it
can someone help me
does the user have dms disabled maybe?
did u fetched the user?
and that
show me this two lines where u fetch and send
ok
my brain is died now @rustic nova
If you are not able to understand what i sent, then you are unfortunately not able to do this with your current knowledge yet. Maybe come back to it once you have more experience in Web Requests
yes
@molten yarrow what now
oh i didnt put await when declaring "fu" nvm i fixed it
Is there a way to show how many guilds my bot is in using the status with the Python language?
do you guys know any cool apis I can yoink for image manipulation
the yoink api
doubt it
lol
lol
is it cool
lmao yes
if(message.content.startsWith(prefix + "meme" )){ if(!message.mentions.users.first()) return; var embed = new Discord.MessageEmbed() .setDescription(message.author.username + ' memed ' + message.mentions.users.first().username) .setTimestamp() .setImage('www.meme.com/pooponme') message.channel.send(embed); }how do i get it to change meme every time someone use the command
@lucid prawn i would use superagent for that
@solemn latch it needs a key
most apis do
there's a lot that don't
most that i use dont
can you give me some for image manipulation please
lol
I'm too lazy to make one myself
so I use apis
lol
@earnest phoenix lemme add you
if you find them
then send them
okey?
ok
tysm
discord js tho
ye
k

im playing rouge company rn tho
they are apis ๐ค it doesnt matter the lib
ok
lol
whats the difference?
u guys got any code to log data in a json
@solemn latch time
๐ค
@hasty mulch
async def on_guild_join(guild: discord.Guild):
await bot.change_presence(status=discord.Status.online, activity=discord.Game(f"Guilds: {len(bot.guilds)}"))
@bot.event
async def on_guild_remove(guild: discord.Guild):
await bot.change_presence(status=discord.Status.online, activity=discord.Game(f"Guilds: {len(bot.guilds)}"))
@bot.event
async def on_ready():
await bot.change_presence(status=discord.Status.online, activity=discord.Game(f"Guilds: {len(bot.guilds)}"))```
google npm i superagent


