#development
1 messages · Page 1050 of 1
choose a random pic from an array THAT"S IT
i can show you my code
use Cheerio
THAT AIN'T SPOONFEED
@delicate shore use cheerio
notepad is dead from the amount of stuff in my index.js
lol
imma type it out
function pickRandom() {
return "Just copy code from stackoverflow for the methof i did this";
}
var dogpics = ["a","heck","load","of","pics uploaded to imgur"];
//some shenanigans
if (command === "dogpicture") {
message.channel.send(`A random dog picture: ${pcikRandom(dogpics)}`);
}
that's it
literally it
really
Just copy code from stackoverflow for the methof i did this"?
imma tell you
k
use cheerio :3
do you want the whole array of dog pics
dumb
lol
@delicate shore use cheerio
and require```js
function image(message, parts) {
/* extract search query from message */
var search = parts.slice(1).join(" ");
var options = {
url: "http://results.dogpile.com/serp?qc=images&q=" + "doggo",
method: "GET",
headers: {
"Accept": "text/html",
"User-Agent": "Chrome"
}
};```
if(command === "cat") {
//catty
try {
fetch('http://aws.random.cat/meow')
.then(res => {
msg.channel.send({files: [{attachment: res.body.file, name: `cat.${res.body.file.split('.')[2]}`}]});
});
} catch(err) {
return msg.channel.send(err.stack);
}
}```
and u dont need search
thats also a gud idea
lmao
@delicate shore
function pickRandom(warray) {
var randomNumber = Math.floor(Math.random() * warray.length);
return warray[randomNumber];
}
var doges = [
"https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fpuppy-1903313__340.webp?v=1593084690595",
"https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fpug-801826__340.webp?v=1593084694122",
"https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fpug-690566__340.webp?v=1593084700772",
"https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fpets-4415649__340.webp?v=1593084704596",
"https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fhusky-3380548__340.webp?v=1593084709666",
"https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fdog-3277416__340.webp?v=1593084714281",
"https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fdog-2785074__340.webp?v=1593084720651",
"https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fdog-1224267__340.webp?v=1593084730544",
"https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fdog-1168663__340.webp?v=1593084733684",
"https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fdog-1168663__340.webp?v=1593084733684",
"https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fdog-838281__340.webp?v=1593084737829",
"https://cdn.glitch.com/a942381f-ffd2-4139-a741-0fafbfe74da9%2Fbulldog-1047518__340.webp?v=1593084740577"
];
var randomdoge = pickRandom(doges);
if (command === "dogpicture") {
message.channel.send("Random doggo:"+pickRandom(doges));
}
oh jesus
the links are long that's it
this hurts my soul
store your array somewhere
this is all that matters:
function pickRandom(warray) {
var randomNumber = Math.floor(Math.random() * warray.length);
return warray[randomNumber];
}
var doges = [
"insert pics","here"
];
var randomdoge = pickRandom(doges);
if (command === "dogpicture") {
message.channel.send("Random doggo:"+pickRandom(doges));
}the only part is this:
store your array somewhere
@earnest phoenix no
recreating it each and every time the command is executed degrades your performance
i suck at everything don't wanna cause errors
recreating it each and every time the command is executed degrades your performance
@earnest phoenix wtf im not i am just running a function and passing the whole array
yeah... but you're recreating it
bot.on("message", function(message)
{
if message.content.startsWith("pictures yeet")
{
// recreate the array on each command usage
let dogs = ["picture 1", "picture 2"];
// random element from `dogs`, etc.
}
})```
so i did enable-npm
Did it say any error?
no
Okay
varies from language to language
In js it's /**/
discprd.js
/*
This
Is
A
Comment
*/```
hey
and i got across an issue i dont know how to fix
i am having an issue with my review command
https://pastebin.com/yhERb07k
i am getting in line 45 an error
TypeError: Cannot read property 'then' of null
have you tried reading the error
i did tho i dont know how to fix
yea ik tho the problem is i have no clue on how to fix it sorry if i seem rude btw
I have a small problem:
var chan = this.client.guilds.first().channels.get(channelid)
I want that every guild is list here. That I can use every guild channel
Not only the first guild
my error
if(command === "cat") {
//catty
try {
fetch('http://aws.random.cat/meow')
.then(res => {
msg.channel.send({files: [{attachment: res.body.file, name: `cat.${res.body.file.split('.')[2]}`}]});
});
} catch(err) {
return msg.channel.send(err.stack);
}
}
my code
bot.on("message", function(message)
{
if message.content.startsWith("pictures yeet")
{
// recreate the array on each command usage
let dogs = ["picture 1", "picture 2"];
// random element from `dogs`, etc.
}
})```
@slender thistle i said I'm not recreating it
help pls
Is the code i provided earlier working?
what are you trying to do?
Why in living God's name is my Delphi program adding a string to Memo2.Text instead of Memo1.Text when I use Memo1.Text := Memo1.Text + #10 + inttostr(a[i]) 
and whats your issue?
can u just send it
And pickRandom(thenameofthecatarray)
i really cant be bothered to scroll up
Returns a random one
that is easy
Smh
using an api is hard? 
Now that's the definition of easy smh
using an api is hard? :PepeYikes:
@digital ibex if you are using it instead of an easier method that a guy named code913spent so long to type
You can copy my source ckde and BOOM donr
using an api is supposed to be easy thats the idea of an api
@earnest phoenix i am using your code only!! for dog command
and i am thankful
to u
Wtf i reused that code for 47 other commands
for that
I have a small problem:
var chan = this.client.guilds.first().channels.get(channelid)
I want that every guild is list here. That I can use every guild channel
Not only the first guild
And i don't get a single error
lol
You just use my method temporarily and learn the API one then use it
x)
ok
i am using api
for others
but for this one command
i am getting error
ahh
Learn it first i said...
ok
not hard code the images u want
if(data) {
if(!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send("Nu ai permisiunea sa faci asta ! | Permisiune necesara: Administrator");
let newPrefix = args[0];
if(!newPrefix) return message.channel.send("Trebuie sa specifici un prefix!");
Prefix.findOneAndUpdate(
{ GuildID: message.guild.id },
{ Prefix: newPrefix }
);
message.channel.send(`Prefixul a fost setat la ${newPrefix}`);
}
Why the data don't update?
like insult
whats 'Prefix' ?
Args[0] X)
like insult
@delicate shore you asked for how to make the dog command, i told you how, then you use an API and ask us how to fix an error because you didn't learn how that API works and i am NOT insulting you
Data = await the search for the guild ID
const Prefix = require("../../models/Prefix");
model file code :
const mongoose = require("mongoose");
const Schema = new mongoose.Schema({
GuildID: String,
Prefix: String
})
module.exports = mongoose.model("Prefix", Schema);
no the 'Prefix.findOneAndUpdate'
like insult
@delicate shore you asked for how to make the dog command, i told you how, then you use an API and ask us how to fix an error because you didn't learn how that API works and i am NOT insulting you
^^^did you read this?
dont make a collection for each thing like prefix, logs, mods or whatever, i believe its just gonna use more ram and storage than needed
So should i only make a GuildConfig and then an array of settings ?
I'll update that later, but first i want to know why the data don't update
Hello, in my ! User-info command I would like the bot to give me the role of the person on the server, do you know what I should add?
and that will solve the problem ?
Yes it worked
Thank you
Hello, in my
! User-infocommand I would like the bot to give me the role of the person on the server, do you know what I should add?
@earnest phoenix no offense but idk
I am creating a bot, and I would like to have the text in value so that when I do ! User-info my bot gives me the roles that I have
if(command === "cat") {
let msg2 = await msg.channel.send("Fetching a image, please wait a second!");
fetch("http://aws.random.cat/meow")
.then(res => res.json())
.then(json => {
let embed = new Discord.MessageEmbed()
.setTitle(json.title)
.setImage(json.url)
.setFooter(`Dogs are better?`)
msg2.edit(embed);}
)}
how to solve this
eroooooor
does someone know if you can save mutiple tings into one field with mongodb? want to store mutiple roleids under one key
APIs are ez
Just tell me how many libraries including discord.js are that are nothing but an easier version of Discord API
They are supposed to be API wrappers so
Nvm

iirc find will also find all keys containing the item you searched
@indigo cloud .fetch(...) does not return a promise.
u know how to fix it
bc i used to use db.fetchObject tho they updated it
and so i made i replaced it with fetch
You can fix it by not treating it like a promise.
You have the value there.
If it's null it means nothing was found.
ik
*stress noises*
findMany in what. MongoDB?
no its fine i fixed it now :D
Aka my XP system is working
Minus one small thing
(node:26556) UnhandledPromiseRejectionWarning: CastError: Cast to Number failed for value "NaN" at path "XPtotal"
nvm i didnt refresh the db yet x)
So I' mworking on this dungeon system and have people party up and I have put the ID of the users in an array like this:
["user1", "user2", ...]
Now every user has stats like health defense strength etc... and when attacking I need to access these stats would it just be smart to do a while loop and query the database every time? Or make a class in advance and save the classes in a different array and access these?
i would make a template and store each user in its own entry. If something happens get all users that are participating on the event
YOOOOOOO MY XP SYSTEM WORKS
I have no clue what that means tho
I'm currently working on this class:
class Player {
constructor(health, defense, strength, cc, cd, weapon) {
this.health = health,
this.defense = defense,
this.strength = strength,
this.cc = cc,
this.cd = cd,
this.weapon = weapon
}
takeDamage(bossDamage) {
// TODO
// Calculate player damage reduction
// Calculate boss Damage
// Remove damage from this.health
}
}
looks fine
Alright
I can just overwrite the this.health with this.health = newhealth
Right
I'm pretty new to classes
idk, i never used classes.
Oh
had no use case for them. there was probably one i worked around with some stupid stuff
Does anyone know if I can do like this:
class Player {
constructor(health, defense, strength, cc, cd, weapon) {
this.health = health,
this.defense = defense,
this.strength = strength,
this.cc = cc,
this.cd = cd,
this.weapon = weapon
}
takeDamage(bossDamage) {
// TODO
// Calculate player damage reduction
// Calculate boss Damage
// Remove damage from this.health
this.died()
}
died() {
}
}
Will that work?
The issue is
I would have to write everything to get the basics of that
Would take me prob around 1-2hours
To then realise if it works or not 🤷♂️
I just need to know if you can call a method inside a method
actually
remove this.
but make sure to first initialize the function and then using it
aaaaaaaaaa the levels arent working
Ok
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa i fixed it
So I would do like if(mobdmg >= this.health) return died();
i cant believe i made a leveling system on my own (with guidance from tim, flaz and superbrain but i wrote it myself) i am so proud of me :D
:D ty
quick.db is the easiest worst database library
i cant believe i made a leveling system on my own (with guidance from tim, flaz and superbrain but i wrote it myself) i am so proud of me :D
@pure lion me is more proud because i made an economy system with no help
class Player {
constructor(health, defense, strength, cc, cd, weapon) {
// Constructor stuff
}
died() {
return 'You died!';
}
takeDamage(bossDamage) {
// Calculation stuff
if(mobdmg >= this.health) return died();
this.health -= mobdmg;
return [this.health, mobdmg]
}
}
ReferenceError: died is not defined
Ok nvm
Wtf
where is died supposed to be defined
It's this.died()
oh-
https://lumap.is-inside.me/wTn77KqI.png
@tight plinth You're totally wrong
also how do you make methods?
You need to do this.died()
Lmfao you died in an undefined way
@pure lion
class Player {
constructor(health, defense, strength, cc, cd, weapon) {
// Constructor stuff
}
died() {
return 'You died!';
}
takeDamage(bossDamage) {
// Calculation stuff
if(mobdmg >= this.health) return died();
this.health -= mobdmg;
return [this.health, mobdmg]
}
}
constructor is to create the class and died() and takeDamage() are methods that are accessed like this:
let Player1 = new Player(stuff)
Player1.takeDamage()
ohkayyyy got it
are there events in d.js that listen to removed roles or added roles besides guildMemberUpdate?
Not sureee
Also can you help me? I'm not sure how to index stuff like multiple docs when they share a key (guild ID)
did you have something that is unique? like a userid?
usually i would use the guildid as primary key. Why did you have mutiple keys inside the same guild?
Because there's a new doc for every user
alternatively make your own unique key. just write guild.id+user.id
this should be always unique
How to get a specific data from mongodb ? like if i want to get a value from a guildsetting ?
findOne
i suggest using the guildID as key
so you can use findOne(guild.id)
this will return the entire document for the guild
i don't really understand
i have the findone here
ReportChannel.findOne({ GuildID: message.guild.id }, async (err, data) => {
if(err) console.log(err);
if(!data) return message.channel.send("Canalul de reporturi nu este setat pe acest server ! Roaga un administrator sa il seteze folosind comanda $reportchannel");
if(data) {
let member = message.mentions.users.first() || client.users.cache.get(args[0]);
let bReason = args.join(" ").slice(22);
if(!member) return message.channel.send("Trebuie sa specific un utilizator !");
if(!bReason) return message.channel.send("Trebuie sa specifici motivul pentru care ai raportat aceasta persoana!");
}
})
how can i get a data from that ? like a channelid
or smth
So I have this array of numbers: [25, 36, 23, 45]
I want to check if one of the number is 10 or more larger then one of the others. Is there a way to do that?
config = await model.findOne(message.guild.id)
console.log(config)
and then how i will get the channel from the specific guild ?
like, how i'll define it
you can get your keys then with config.channelid
but this requires you to set a value with the channelid
(inside the database)
ok, i understand now
if i have in the model channelid saved as Channel i do config.Channel ?
yes
Ok, thank you
let config = await ReportChannel.findOne(message.guild.id);
let channel = bot.channels.cache.get(config.Channel);
so this should work ?
@tulip ledge idk i wish i could help but i have no idea how to do it properly without a stupid workaround
I was thinking of running a forloop and then comparing that with all the elements in the array
But that will be unefficient right?
Since I just want to check if the user's levels are too far appart
So like you can't have a level 50 carry a level 5 in a dungeon
give it a shot. maybe some smarter person ends in here and give you a way more efficent way
if(Math.max(10,20,30,40) - Math.min(10,20,30,40) > 10) console.log("level diff too high")
lmao
I mean mine would still be ok as the array is either 2, 3 or 4 long
(node:16808) UnhandledPromiseRejectionWarning: ObjectParameterError: Parameter "filter" to findOne() must be an object, got 704974227626786827
let config = await ReportChannel.findOne(message.guild.id);
XP system is pain in ass
yup, should work
const config = await shema.findOne({ guildID: guild.id });
``` @earnest phoenix
basically the highest level in the party should not be more than 10 levels above the lowest level
Omg
Tim big brain
Thank you lol
Oh now I understand what Math.min and Math.max do
I mean this dungeon thing is going so well
(node:24380) UnhandledPromiseRejectionWarning: MongoError: E11000 duplicate key error collection: test.guildmembers index: guildID_1 dup key: { guildID: "710964023117479966" }
aaaaaaa
you got a duplicated key
its not even being searched for
const Mdata = await GuildMember.findOne({ID: msg.guild.id + msg.author.id})
w e h
this will not work i guess
make a value with your id and then pass it to your DB query
ok
also make sure you send the dataset to your DB first
alright
Okay now I have to make the thing where players can "move" so would I do like a while loop that keeps going untill either all players are dead or the boss is dead and inside the while loop a for loop that allows the players to move? As when a player dies they get removed from the players array. Should i do it like that or is there a better way?
also i think the error is on a different position
if (!Mdata) {
const db = new GuildMember(newUser)
db.save()
console.log(db)
}
btw this is what i use for creating a new user
this looks fine.
is that sequelize? mongoDB/mongoose?
async function xp(msg) {
const Gdata = await Guild.findOne({guildID:msg.guild.id})
if (Gdata.XP == false) return
var prefixes;
if (Gdata == null) {
prefixes = 'aa!'
} else {
prefixes = Gdata.prefix
}
const newUser = {
_id: mongoose.Types.ObjectId(),
ID: msg.guild.id + msg.author.id,
guildID: msg.guild.id,
userID: msg.author.id,
xp: 0,
level: 1,
enabled: false
}
const Mdata = await GuildMember.findOne({ID: msg.guild.id + msg.author.id})
console.log(Mdata)
var newLevel;
if (Mdata == null) {
newLevel = 1 * 500
} else {
newLevel = Mdata.level * 500
}
if (msg.content.startsWith(prefixes)) {
return
} else {
var randomInt = Math.floor(Math.random() * 10) + 15
if (!Mdata) {
const db = new GuildMember(newUser)
db.save()
console.log(db)
} else if (Mdata) {
await Mdata.updateOne({xp: Mdata.xp + randomInt})
await Gdata.updateOne({XPtotal: Gdata.XPtotal + randomInt})
}
if (Mdata.xp > newLevel) {
await Mdata.updateOne({level: Mdata.level + 1})
await Mdata.updateOne({xp: 0})
if (Gdata.XPmsg == false) {
return
} else {
msg.channel.send(`GG ${msg.author}, you leveled up to ${Mdata.level}!`)
}
}
}
}
heres the full function if it helps
@cinder patio mongoose
ive deleted the document and tried again btw
Okay now I have to make the thing where players can "move" so would I do like a while loop that keeps going untill either all players are dead or the boss is dead and inside the while loop a for loop that allows the players to move? As when a player dies they get removed from the players array. Should i do it like that or is there a better way?
I was more thinking of a awaitMessages tho
players.forEach(/*move*/)
oh
thonk
And forEach will loop untill all players did it and then stop
It would have to keep looping
gg

cumfused<
😳

Dice, you do know that you can search for both guildID and userId, right?
why did you do that (#development message)
no, use updateOne with upsert option on
. ?
🎲
ChickenDev, you can do this without looping, depends on what your logic is for the game
it will try to find the member and if it doesn't exist, it creates the member with all the data you provided
updateOne({ guildID: "123", memberID: "122" }, { "xp": 69 }, { upsert: true });
this doesn't create any duplicate
@cinder patio It goes like this: The user can do a move (either attack or a heal) then the boss attacks him, then the next user does the same and so on... untill either the boss is dead, all users are dead or the move count has gone down to 0
i have terminal stupidity gimme a minute

how would it create the whole object for the user
You can do the check for 0 moves / boss dead / all players dead after the boss attacks, and the boss can attack right after the player does attack or heal. That way you have no loops
Sure
Inside the function
flaz would it create a whole new object and set the xp to 69?
I'd still need a for loop on the players right?
yea
so you need each player to make a move in the form of an answer or reaction or command?
Or do I do like:
function move(player) {
}
move(players[i])
alright im gonna go and try that, i hope i dont die :D
Yes
nah you're good
what if you dont make a move, does it skip your turn after 10 seconds?
alright so i guess awaitMessages is ok for this
and a .catch then?
Could use a collector instead
error throwing is optional in message collectors
So I would make a function inside the function forloop on the players array inside there I do awaitMessages
Am I right?
it doesnt throw an error by time limit if you dont make it
GuildMember.updateOne({ID:msg.guild.id + msg.author.id}, {upsert: true})
like this? (guildmember is the constructor)
Weird it does for me
Guys i have Q: I need to use mongodb in a glitch, but i dont know how to link db to website
what you need here is probably a recursive function
Without a catch
setinterval?
do you have errors:["time"]in the collector options?
yes
then thats why
if you remove it, it wont throw an error, it will just return an empty collection
Oh ok
And if the collection is empty
I just do nothing
And move on to the boss attack
Ok
Alright
and a recursive function is like
function move() {
if() move()
}
Right?
yes
good luck
make the whole battle loop a recursive function
function makeMove(player) {
blablabla
makeMove(next player)
}
good luck lmao
@pure lion if it doesn't work, try GuildMember.updateOne({ID:msg.guild.id + msg.author.id}, {}, {upsert: true}) (empty document as second argument)
Can someone join my server, say test then leave again? :d
use an alt
I don't have an alt
create one, it's really convenient
wsjkhdfgjhsdgkjhs
especially for scumbag activity if you know what i mean
;3
maybe itll add one for webhooks :floshed:
fuck its not adding xp any more
x) forgot to await it
I mean it's working now I just have to let the users actually move
x)
You don't even need recursive functions. If I understand your idea correctly, you can just use one message collector. First, before you start collecting messages, decide what the order of turns for the players would be. For example :
const turns = [player2, player1, player4, player3];
let currentTurn = 0;
Then, when attack/heal is sent by the player who's turn it is
- Do the selected action
- Check if the boss is dead, if they are, stop the game
- Otherwise do the boss attack
- Then check if every player is dead, if they are, end the game
- If the game hasn't ended, switch to the next turn:
if (currentTurn === turns.length) currentTurn = 0;
else currentTurn++;
@tulip ledge
Chicken can you send one word in my server please :D
inb4 he reported you for advertising
hes already in it x))))
but an alt is still nice to have
okay fine
i test my moderation commands using one
@quartz kindle does d.js-light change something on Voicechannel.setName()?
TypeError: channel.setName is not a function
``` this happened recently. But im not sure if it is bcs the bot got certified or the lib
like a month ago this worked with no issue
console.log channel maybe it's not a channel
const channel = client.channels.fetch(data.playercounter_channel);
await channel.setName(`Member Count: ${countmembers}`);
i have a check before this. if it cant find the channel it returns
yes
yea just saw it
@quartz kindle yo
yo
does this look like a jemalloc problem
because I didn't have it before using jemalloc

but it seems to be happening a lot
honestly i dont know
it might be possible, but afaik jemalloc is production ready and 100% compatible with other allocators, so there should be no difference from an application level
but if you stop using it, and the problem disappears, then should be worth investigating
did you change node.js versions by any chance?
uhh
one is on 1.14.2, the other 1.14.4
i doubt the diff is that big
uhh
fuck
14.2 / 14.4
whatever
hello certified developers
this is le build fyi
i googled the error and found links to the node.js repo, linking it to v8 and the n-api
hmm i don't recall having it beforehand
can you make out any version?
also i was wrong about node v
14.4 / 14.5
so it would have to be a breaking change at 14.5
or an incompat with jemalloc
👀
that sounds like a breaking change
can you link the issue
or whatever you found
im inable to do anything on mobile

the issue was from v13.3 tho, not relevant to this case
but it confirmed that its a node.js error
and the issue is still open actually lol
hmm I'll try not using jemalloc & 14.5
and see how it goes
i sadly can't specifically recreate it
it doesn't always happen
rip
yeah try running it, if the issue persists then at least the problem is not jemalloc
is there a way to cache every message with discord.js-light (even messages sent by other users and without replying to their message)?
in v3 yes, in v2 you'd need to do it manually channel.messages.cache.set(message.id,message) (and make sure the channel is and stays cached)
ok ty!
does the guildMemberUpdate cache the member on event or does it need to be done with code? (d.js-light)
if the member is already cached, it updates it, if not, it gives you an ephemeral member
ok
i ask bcs i have some strange behaviour. I want to check if a member gets a role or if it get removed. but it only works for some reason with the bot but not any other user.
the member needs to be already cached before the update event comes, otherwise you have no access to the member's previous roles
So while I was walking to the food bar I was thinking of more moves I currentl have this and am looking for like a "gamble" one that does like 200% damage or something but only hits like 30% of the time does anybody have a name for that move?
djslight doesnt cache members as they come online like djs does
so you'd need to use fetchAllMembers
lmao
That's an option
Yeah I'll call it all in
I mean my moves have a chance to crit imagine u deal 50 damage have 200% crit damage you deal 150 damage on crit then you do all in and land it u deal 400% damage making it 600 damage
Damn
//mainfile
const client = new Client({
token: process.env.CLIENT_TOKEN,
fetchAllMembers: true
});
//guildMemberUpdate event
if(NewMember.user.bot)return;
const config= await client.getGuild(NewMember.guild);
const user = NewMember.roles.cache.map(r => r);
// console.log(NewMember);
console.log(user);
try{
if(user.includes(config.patreon_roles[0])){
await client.updateProfile(NewMember, { patreon: true });
}else{await client.updateProfile(NewMember, { patreon: false });}
}catch(error){console.error(`[Guild Member Update] ${error}`);}
```the event doesnt fire did i overlook something?
The first boss has 1000 hp so you'd still have a challenge
200% of 50 is 100 tho
Well no
unless it counts as "bonus damage"
It's +200%
in your client options
ohh right...
intents will be mandatory in october
why am i having this problem on my server and how can i fix this?
node[27035]: (node:27035) UnhandledPromiseRejectionWarning: TypeError: fields.flat is not a function
On my pc everything is working fine. :/ I assume this has something to do with node
node version on your server?
discord.js requires node.js version 12 or later
which lib
guild.member.roles.cache.map(r=>r)
or just guild.roles.cache.map if its for the entire guild
How does it look?
looks good
i'd put woo's hp line separate from the party, so it doesnt look like woo is part of the party
Ok
maybe a line that says vs in between them
or maybe put woo's data right after "woo appeared"
I'm using classes for the boss so I can easily make new bosses
No I want to do like
ChickenDev dealt 50 Damage to WOO
WOO dealt 30 Damage to ChickenDev
and in the actions menu, maybe put the actions names in bold or something more visible
instead of code block for everything
or add an empty space before it
like it was before
maybe a - between the move name and move description
or ->
i like the second one better
try something like
Strike -> 100% Chance, 100% Damage
Strike - 100% Chance, 100% Damage
Strike - 100% Chance, 100% Damage
How can I remove a reaction from a specific user (with a custom emote, like this one :
) ?
of even
Strike- 100% Chance, 100% Damage
Wait thats possible lol
Oh
@earnest phoenix <code> bla </code>
thank you
Looks good
you need the / to properly close tags
@tulip ledge
That looks slick af
although it doesnt work in mobile
apache
It even fits in with the theme
ahh yes for some reason i have 2 ghost seasons running from one of my bots.
@red sparrow lan
Yeah maybe
fck off @vital shard
yeah I noticed
<@&304313580025544704>
-atmods @red sparrow
@red sparrow
Please do not mention (ping) more than one or two moderators for help, unless there is an emergency.
Here are some examples of emergencies:
- Raids / Multiple members mass spamming.
- Severe disruption of Discord's ToS (NSFW content, etc)
- Anything that requires more than 2 moderators to handle.
I swear
you do not need to ping the entire mod team because somebody pinged you thrice
Alright time to do the rest 😄
So close to finishing the dungeon command
I currently do let move = collected.first().content.toLowerCase(); should I if else stack to look at what move it is or should I use switch?
Is there any way through api to pull someones block lists? Or is that all local to user/private?
you can't
The concept of a DM being rejected seems to be the only indicator
@tulip ledge I like that embed,lol
I can't remove user reaction with this, so I'm wondering how to do it :
let left_arrow = bot.emojis.get("731893513171763250");
/* msg is message.channel */
msg.reactions.get(left_arrow.name).remove(message.author.id);
Ugh
msg.reactions.get("731893513171763250").remove(message.author.id)
Already tried but didn't work :(
.name is used for default emojis, .id is used for custom emojis
But i'll try a second time
reactions.get().remove() is to remove all users
Thanks
reactions.get().users.remove(id) is to remove a single user
Is my english correct?
Oh it still doesn't work :(
its good if WOO used a "scare" move on you, otherwise its better "ChickenDev was too scared to move"
yup
I put :
msg.reactions.get("731893513171763250").users.remove(message.author.id);
this time
as you said
Removing HP is working too 😄
does messages.fetch get images as well?
docs would tell you that
am i the first boss?
if i am, i should have incompetency
and i hit myself
on the ability turn

api abuse?
your bot will auto be banned from discord pretty much instantly if you do that
discord js is not java friend
^
public or private, your not getting help for api abuse here
for(i = 0; i < 1000000; i++) {
<Channel>.send("Spamming...")
}
guys
Bot awaiting approval - Please be patient, us humans take time to verify bots!
wot
can anyone tell me how long does it will it take to verify?
2-4 weeks
3-4 weeks
well
around 3 weeks
about a month
maybe less maybe more depends
hmmm
If you give tonkku some hentai he'll speed up the process for you
lol
Don't actually
Not funny.
will that actually work?
lol
does anybody use galaxygate for hosting? I need some help setting up a database on it, never used a VPS before
try it then.
@restive willow dragon in their support discord is super helpful
A guy named jens#2019 is his tag @restive willow
can anyone here help me speed up the process?
it cant be sped up
@earnest phoenix no
you can't
Be patient
you can't
I remember back in the day my bot got verrified in like a day or so
It was like almost 3 years ago
how do i know what servvers are using my bot?
how do i know what servers are using my bot
i know how to do it in discord.py but my bot is discord.js
also avoid asking for someone to verify your bot, because it wont help and will probably provoke them to not verify it
3 years ago? you've only been here for 2 
@earnest phoenix guilds property of your client
my bot isnt like approved
Karvalian, <Client>.guilds is a collection of all guilds. You could map it so it returns an array of all the guild names your bot is in
Wait how the f do you know? U a stalker 
@sonic lodge can you help me with that?
Hmm.
no im not
Its a joke -_-
just search ur name on the search bar and go to the oldest
your client has a property called "guilds"
Doesn't mean that my first message was from 2years ago it didn't get approved before that
@earnest phoenix In discord.js ```js
client.guilds.cache.each(guild => console.log(guild.name));
e a c h
luvit discordia question- is it possible to save different data in 2 different json files? if so how?
Yeah ok it's 2 years ago
@unkempt marsh that code is returning error
docs, pls
What's the error? @earnest phoenix
@unkempt marsh its forEach not each lmao
theres no need to use a for each function there, thats just slower, just use map
@tulip ledge In discord.js it's each()
@unkempt marsh client.guilds.cache.each(guild => console.log(guild.name));
^
ReferenceError: client is not defined
at Object.<anonymous> (C:\Users\obaid\Desktop\YOUTUBE\Discord Bot\index.js:38:1)
[90m at Module._compile (internal/modules/cjs/loader.js:1201:30)[39m
[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1221:10)[39m
[90m at Module.load (internal/modules/cjs/loader.js:1050:32)[39m
[90m at Function.Module._load (internal/modules/cjs/loader.js:938:14)[39m
[90m at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)[39m
[90m at internal/main/run_main_module.js:17:47[39m
I know what is forEach()
where did you define your client
I knew it.
i have defined it as bot not client
so bot.guilds
my const is bot not client
Replace client to bot
it isnt showing up
There's both each and forEach. Both work
@unkempt marsh In javascript it's forEach()
@tulip ledge Ik.
it isnt showing a error now but it isnt showing anything else too
it's discord collection
each and forEach do the same thing. The difference is each returns the collection again for chaining, while forEach returns nothing.
Oh each is a promise?
no
no
you need to access bot.guilds after the bot is ready
Oh
put it in the ready event function or something like that
forEach also works. Doesn't matter in this case.
do i slap it in here?
sure, it would work
forEach also works. Doesn't matter in this case.
@cinder patio Yeah.
...
you don't need two ready events
lmao
well i only have 2 servers
is it possible to save different data in 2 different .json files in discordia
one of them is my own and the second of them is my own too but its the main server for the bot
@earnest phoenix you don't need two ready events
@sonic lodge i deleted the first ready event i hhad that too so that if the code im applying doesnt work i can still switch back to the old code
Place it here
ok
If you already have event listener like ready you don't need to add another event listener. @earnest phoenix
👍
where do i put the website link of my bot in this server?
whatcha mean?
you dont post any websites here
or any of the channels
if you have a website for your bot, it can go in the description of your bots page
yeah
@unkempt marsh can i do it like that so that it updates the server name?
tank argie, i've already told u to use map
You mean new Map()?
@unkempt marsh can i do it like that so that it updates the server name?
Wdym?
so t hat i dont have to CTRL+C and rerun for it to update the names
tank argie, i've already told u to use map
@digital ibex Btw, I don't understand what you trying to say. I am not the one who is having a problem here.
@earnest phoenix Do a loop.
do you know how to do it so that it updates the server names?
how
like you know every 60 seconds or 30 seconds it updates the names
console logging is a bad way of doing this.
well im running it by node .js so its the only way
console logging is a bad way of doing this.
It depends.
im hosting it using node js
That's a lie.
Ok I have this annoying issue
let Player1 = new Player(accepted[0], userrows[0].maxhealth, userrows[0].health, userrows[0].defense, userrows[0].strength, userrows[0].cc, userrows[0].cd, rows[0].sword, rows[0].consumables, 0)
When creating a player it takes the ID of the array from the people who accepted and then takes the rows 0 this is my SQL query
SELECT * FROM users WHERE discordid IN (${usercheck}) and usercheck is formatted like this: "488825595980021791", "259776081316282368" But for some reason rows[0] are my stats every single time. Meaning that when the user accepts before me he gets my stats. Does anybody have a solution?
No it's not
some peoples logic in this server 😔
I'm using console.log for debugging my codes.
debugging is fine
It won't stop your code.
i can simply use break; after calling to log to fix it
tank argie, u do know nodejs' features is to carry on?
it does until it finishes logging
you probably didn't notice it
sure logging errors, thats fine, because its only errors
still works
yikes
Even so, console logging anything to the console takes way less than a millisecond, won't make your code any slower
yeah
True.
its not really a problem at the scale of logging 50 chars.
but when your server is in 300 guilds, logging that every 30 seconds will cause problems
🤔
not really
and is just a general waste of resources
again, not really
i don't see anything wrong with console.log tbh
ill disable the 30 seconds loop after i get more members. but currently i have less so i have to look for how many members im gaining
can anyone tell me how do i loop that commands?
command*
Well, if you put too much information inside of console.log ofc it will.
ummmm?
can anyone tell me how do i loop that commands?
Even if you printed like 10k lines it would still take a millisecond or two
can anyone help me or no?
If no one gives me a solution I'm just gonna if stack
If no one gives me a solution I'm just gonna if stack
@tulip ledge same here
Dude
setinterval @earnest phoenix
Looping is not if stacking
I MEant ill stack overflow it
to fiind the answer
What's the problem Chicken
setinterval @earnest phoenix
@solemn latch can you tell me the code that i have to paste into my bot :/
no, spoonfeeding is against the rules here
^
i came back to programming after a long break so i need time to warmup
lol
atleast just help me
no, spoonfeeding is against the rules here
@solemn latch I'm about to do it lol.

help needed pls :/
@earnest phoenix He already told you, setInterval()
whhere do i put it
