#development
1 messages · Page 685 of 1
is that an array?
if it is, includes() checks whether or not a value is in the array
hmm
there are def some weird things going on
yes it's an array
when i check the array is gone
why is it like that tho? [ id: [id] ]
it's a nested array ( i think it's called)
but why
I recommend using classes for this kind of stuff, and maybe attaching an object containing everything about the game to message.channel instead of storing everything in an array.
don't have much ( any) experience using classes
what would the structure look like ?
like how do you do something similar to a nested array in a class
do you understand what js classes are
something about like nested objects ?
no
have a Game class which stores information about the game like players, states, etc. and attach an instance of it to message.channel
oh yeah
Google javascript classess tutorial
so i would have a game room and variables tied to a channel
and then i can store a simple list of the users inside that class
?
yes
how do i send a message to every user??
could i do something like
For example:
constructor() {
this.players = {}
}
}```
message.channel.game = new Game()
For example.
gameRoomClass.users.push(user) ?
how do i host a bot at discord?
sure! But I recommend using a discord collection or a map for storing discord objects
userID
okay, i'll try rewriting it
and hope that fixes that weird bug i had
wait, how do i differentiate the classes ?
like right now
if i want to get a userlist from a game room in a channel
i do userList =gameRoom.channelID
mmm if you are going to do it the way I told you to, you should attach an instance of the game class to a channel object like so:
message.channel.game = new Game()
and you would get all users with: message.channel.game.users
ah okay, so that's how you " name " the class ?
yeah
ah okay very similar syntax then
in arrays it's just gameRoom[msg.channel.ID]
instead of a .
I guess
Hey, can someone from mods add my bot again, I've changed the prefix to .q now. 🙂
np 
@frigid juniper bot ID
347405743235792908
@earnest phoenix can you please be more specific? No one can guess what you are trying to ask/say and no one will spoon feed you
When Write !mute [cat], Cat must got a Muted role
make the bot add the muted role
You assign them the role
^ 

If I were to make a Dashboard with a login, in order to store information about that user after the signed in, I need to use cookies that expire whenever the token expires right?
in mongoose is the mongoose.conncetion thing constant or do i have to pass it as function arguments?
im trying to do aliases cmd
with args
if(args[0] === options) {```
that wont work :/
ofc that doesn't work
you're checking if args[0] is equal to the options array
why are u expecting that to work
then how would i do this ?
options.includes(args[0])
I'm getting this traceback when I try to start my bot :
Traceback (most recent call last):
File "/home/pi/Red/bin/redbot", line 6, in <module>
from redbot.__main__ import main
File "/home/pi/Red/lib/python3.7/site-packages/redbot/__main__.py", line 34, in <module>
from redbot.core.core_commands import Core
File "/home/pi/Red/lib/python3.7/site-packages/redbot/core/core_commands.py", line 453
author = ctx.message.author
^
IndentationError: unexpected indent```
Its fine
Thank
np
HI, so I wanted to play a youtube video via a command and this is what I got:
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([<URL>])
download = discord.FFmpegPCMAudio("<NAME>")
voice_client.play(source, after=None)
This code seems to be working so far as the bot will have a green circle arround him. Sadly there is no audio being played (I don't hear any):
So I have to questions I'd kindly ask:
- What is the error here
- How can I get the filename in advance (So far I hardcoded it with an example, downloaded via YTDL)
Sorry, I had to go afk. I am using python the default discord[voice].py
I just mapped a Map
@pine jacinth are you on discord.py rewrite
I know this sounds dumb but what exactly is meant by rewrite?
they re wrote the whole source code
is this a correct way of declaring an empty list in a class ?
message.channel.game.players.push is not a function
did you define players
i thought that was the first part in the class ?
sorry, literally first time i'm using classes
this.players = {}
let/var/const players = this.players
Depends where you're using it
Use let/var/const players = this.players wherever you are using the third code snippet you send
you can push to arrays, not objects iirc
where
isn't this server a turkish server
then you can "do bot" @earnest phoenix
@tawdry briar no
also, move to #memes-and-media
so should i declare an array inside an object inside the class ?
@copper cradle where can i learn coding

Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for.
@earnest phoenix just do this.players =[];
shouldn't discord servers list be gulu?
ig
y e s
so can you throw gulu's server
I don't know what gulu is, and I already told you to move to #memes-and-media you can ask there, this channel is only for development purposes if you don't cooperate a mod may mute you, so if I was you I would move to #memes-and-media
omfg...
@copper cradle I'm sorry if I disturbed you
can I ask something
did the formatting for codeblocks beak?
hmm how would i check if an instance of "msg.channel.game" already is the name of a class
yeet ask2ask
Dont ask to ask
Just ask your question
it wastes time if you say "i need help" or "can someone help me?" instead of just saying what the problem is. Save your time and other people's time and just ask the question.
@onyx summit discord broke their regex for md
that's why they look a bit fucked up
https://cdn.discordapp.com/attachments/272764566411149314/617466243565355192/unknown.png is there any other way of checking if msg.channel haven't already been made into a class other than making a separate list ?
@tawdry briar wdym?
what @earnest phoenix
I am British and I would like to say thanks and wrong area
What does wdym mean
This is development lmao
uh, i dont really know the terms
"wdym" = "what do you mean"
@tawdry briar what do you mean
i have a class called "game"
fell for the trap
hello i have problem can anyone help
for a certain price we do
start more shards
is it a 786?
buy more servers
hahahahahha
i literally was gonna joke that i got a 4011 error
how did you read my mind
Have you tried turning it on and off again
sudo rm -rf / usually fixes it
have you tried restarting the master 
how do i host my bot at discord
email the t&s team saying you'll offer them a new fursuit if they host it
Someone on d.js asked if they can compile their bot and thus won't need a host
lmfao

anyway, how 2 make good help command
my current one is over a reaction menu, but thats garbage cuzz you need like 20 secs to see all commands
help alone lists all categories and their commands
help <command> provides more info about the command
I got the second one working
so just print them all out
oke
gonna make help <category> too
@earnest phoenix discord's markdown parser uses regex
ah
how can that go into prod
@twilit rapids happy bday timo!!!!
My birthday will end in 20 minutes, so your in time :)
No, and #memes-and-media
how do I send three different embeds with one command
you send 3 messages
webhooks are able to contain up to 3 embeds per message, if you decide on that
It doesnt work for me,
I put
let serverembed1 = new Discord.RichEmbed()
then at the end
return member.send(serverembed1);
then for the second
let serverembed2 = new Discord.RichEmbed()
then at the end
return member.send(serverembed2);
but not working
You have return in the the first... damnit you fast boi
bye
anyone know a good way to mention a user by their id ?
<@id>
@165937223554826241
send the <> too
yes
like "<@$id>" ?
no
oh, close
replace the "" with ``
its js strings
depends on the language and library
in d.js its client.guilds.map(x=> x.name) that gives you an array of names
Kek still trying to get oauth2 to work
I still havent use oauth 
but I would just copy most of the code from guidebot dashboard and modify it to my needs
Lol
I’m trying to modify https://discordjs.guide/oauth2 to my needs to work with express
A guide made by the community of discord.js for its users.
I can do it in implicit grant
But I wanna do it in authorization code grant
And for some reason it is being da rude
do you use passport-discord?
No didn’t know it was a thing tf
No plan, as said, never created a dashboard with Discord oauth, but I'm looking into the guidebot dashboard
well it uses mongo sessions thats shit
but I have some rethinkdb session storage so thats okay
they store sessions in a db (mongo), so you don't have to login everything you use it
https://github.com/AnIdiotsGuide/guidebot/blob/dashboard/util/dashboard.js
its in a different branch
So basically everything is handled for you?
not everything, but I think most
I wouldnt build the bot and the dashboard in one node app tho
I knew about passport not passport-discord
Nah I’m doing it separately
You did say it was okay to host the site on your server right?
Okay
I gotta get a domain as well
If only I could change the name of an existing domain I have that I don’t use anymore
can't 
yeah, passport-discord gives you the user if the authenticated
Okay.
imo that code isnt good, all in one file and not really moduled
Yea
its enough to learn from it tho xD
Ima try and organize my code as much as possible
I forgot how to use express though 😬
Gotta look at the docs again
before I create a dashboard I have more important stuff to do
Like?
Building a server that streams to voice channels without my bot running in it
Finishing my rewrite
A localized server that saves and handles mp3 files (basically a cdn with one server lol)
could some one help me create a bot?
:I
One message removed from a suspended account.
One message removed from a suspended account.
The bot that I try creating
One message removed from a suspended account.
One message removed from a suspended account.
English
One message removed from a suspended account.
Yes
One message removed from a suspended account.
16
One message removed from a suspended account.
im also new to creating bots...
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
points for what? i just want to spread a bot that sounds like an idiot ...
but im intrigued what are points?
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
im fine with that its an offensive bot i expect people to be offended or laugh its a choice
One message removed from a suspended account.
Why would that be?
One message removed from a suspended account.
One message removed from a suspended account.
I know to be nice but its like an offensive meme
One message removed from a suspended account.
and yes i do
One message removed from a suspended account.
just kidding
One message removed from a suspended account.
One message removed from a suspended account.
its not thats just the user
I name everything after my name also i deleted it cause people might take offense to it and the slave part and making it say they are playing with their self at the playing thing
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
search My Little pepe in bots it has "retard" in the description
One message removed from a suspended account.
That is how ever offensive and used to refer to people with autism
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
i already delete it but for some proof of the My Little Pepe thing people compare autism and retardation and much more "
Autistic children with an IQ below 70 and with an IQ above 70 were systematically compared. The two groups differed somewhat in the pattern of symptoms, but were closely similar in terms of the main phenomena specifically associated with "
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
im not argueing i accept my bot will not be accepted i am aware of that im going to change the bot im just saying about the pepe thing i am in no way trying to come off as agressive nor trying to harass
One message removed from a suspended account.
One message removed from a suspended account.
I want to make a bot that gets data off from some webpage every N minutes and then draws a graph
and i want that to be like in a picture that i can post on discord
any APIs or frameworks you suggest?
just that
i wanna make a bot but i have no idea how to code
https://discordjs.guide/ @tall osprey
A guide made by the community of discord.js for its users.
@polar sentinel maybe canvas-constructor on npm
thnx!
And cheerio for getting data from a webpage
how do you create text channels on master build of djs
discord.pleaseCreateATextChannelInThisServer(serverId)
gunna slap u
guild.createChannel isnt in master :(
<guild>.channels.create @earnest phoenix
thanks boo
does it have same args
as the old one?
check the docs
smh making me work for knowledge
😤
Does anyone know what a placeholder is in JavaScript? I saw someone talking about it.
how do you get the number of total members in a guild that are offline in discord.js
let offline = message.guild.presences.filter(offline=>offline.status==='offline').size;
I tried this and it keeps returning 0 when there's multiple people/bots offline
hmmm thats weird. cause there a lot of members offline
Shouldn't it be 'message.guild.members.filter'?
Oh.
no
Hm
console is clear
You’re using master right?
i mean i believe so,, how do i check?
Uhm do you have an eval cmd
nah,, i just started making the bot and havent got to that yet
Or you could probably check package.json depending on how you installed it
If you installed it like npm install discordjs/discord.js
Then you have master installed
Could also install it from the GitHub
i installed it like npm install discord.js --save should i uninstall and try that?
Then you have stable
ahh okay,, ill try the other way
Ye
hmm still returns 0,, ill just mess around with it and hopefully it works eventually
<GuildMember>.status doesnt exist
Me 2
<Presence>.status does
y'all broken then
https://oliy.is-just-a.dev/ocm81d_1133.png works for me
Ffs
it also isnt embedding, which leads me to believe that there is a server error
of some sort
Yea
yeah i just cleared cached and the docs are offline,, sad
also let online = message.guild.presences.filter(online=>online.status==='online').size; works. so im very confussed
gawd (a dev) is updating the website i believe
well what you are calling online is a Presence object
wait what?
in the callback function, you call the presence object online
@amber fractal can you join something so i can test it on you
is that not okay to name the callback that?
well i mean you can name it whatever you want, it's just misleading
i wouldn't do it that way though, I would fetchMembers() then filter by the .presence.status, then access .size
hmm didnt think about that. thanks ill try that
so it appears guild.members.get(id).then seems to not be a thing on master
am i just retarded?
it's not a promise
nope
.fetch() is
https://oliy.is-just-a.dev/cvtg9_1132.png also for the above
you dont need to do any of that
it's presence.status not just .status
that's gonna be inconsistent
since .members is only cached members
which is why i suggested fetchMembers()
That's bad for ram, but if it really matters then yeah
fetchMembers().then(...)
@earnest phoenix what did you want m8
@amber fractal ill invite in sec
How do I turn off bot
Does somebody knows how to fix the column cant have a default value on mysql?
Who pinged
I’m trying to make a command called promocc where I can create promo codes for the bot like -promocc premium true 2 2m format being -promocc [options] [value] [uses] [duration] how can I make the options optional?
let options = args[0]
let promoCode = args[4]
db.write(`${{id: promoCode, options: value}}`)```
Could I do something like that?
I’m using better-sqlite3
If that would work I gotta figure out how to write the uses, and duration to the db cause I’d have to do "uses": uses and "duration": duration, unless I’m able to use strings inside the template literal
HI, so I wanted to play a youtube video via a command and this is what I got:
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([<URL>])
download = discord.FFmpegPCMAudio("<NAME>")
voice_client.play(source, after=None)
This code seems to be working so far as the bot will have a green circle arround him. Sadly there is no audio being played (I don't hear any):
So I have to questions I'd kindly ask:
- What is the error here
- How can I get the filename in advance (So far I hardcoded it with an example, downloaded via YTDL)
I am using discord.py v 1.2.3
guild.channels.forEach(channel => {
//...
})
How to understand that you have access to the channel? The bot goes through channels that even he cannot see. Disocrd.js
No, the bot doesn't gets channels that he cannot see
It gets only the channels where it has read messages permissions
Which is the permission to see the channel
@proper inlet
Gets. I launched the bot under the user account for the test. He showed # admin-chat channels on some servers, although I didn’t see them
Bot can't read messages, but bot can see channel
User account?
You mean a selfbot?
I don't recommend using selfbots
Selfbots are against discord tos
Well, I make the code and check through the selfbot, but then I use it on the bot account
check in channel permissions if the bot's permission to read message and read message history are revoked
It's more comfortable for me
Selfbots are against Discord ToS
@proper inlet the bot caches all channels
It's more "comfortable" for you to create an new discord account, use a browser to get a token?
but on perms your bot that cant view, makes you unable to view for example it contents
The problem is how to check for permissions? I can not find anything on the Internet
Am I allowed to do ${variable + "string"}
Does someone have an idea concerning https://discordapp.com/channels/264445053596991498/272764566411149314/617631956821082112 maybe? :<
Idk I’m not sure why I thought you couldn’t
@pine jacinth py?
discord.py (python)
I use d.js :(
It's essentially the same as
let variable = someString + "string"
Yea
Or
let options = args[0]
let value = args[1]
let uses = args[2]
let duration = args[3]
let promoCode = args[4]
db.write(`${{id: promoCode, options: value, "uses": uses, "duration": duration}}`)```
Use ${somestring}string
This is my thought process
thanks @slender thistle xD didn't think about that

If it is outdated, then how can I check the permission to read messages?
Read messages is deprecated?
@lusty dew ```js
let someString = 'string1'
db.write(${someString}string2)
This will write string1string2 in the db
I don’t see the point of that

I’d have to make another ${}
Unless I concatenate the variable which is pointless
So I’d think it’d be better to just use one ${}
What is db @lusty dew
better-sqlite3
and also ping @gilded plank when you do it at the start, its fine! dont worry about it!
How to check if an object has a parameter? discord.js
this.write2 = (table, sK, aK, ids = ["id"]) => {
const id = ids.join`, `
const all = ids.concat(aK, sK)
const str =(`
INSERT INTO ${table}
(${all.join`, `})
VALUES(${aTA(all)})
ON CONFLICT(${id}) DO UPDATE SET
${aK.map(k => `${k} = ${k} + excluded.${k}`).concat(sK.map(k => `${k} = excluded.${k}`)).join`,\n`}
`);
console.log(str)
const q = db.prepare(str)
return (...a) => q.run(...a)
}```
Can someone explain what this is for
Like I already have a write function
Idk what my old dev was doing
That really looks gross
it does
I don’t understand the point of it
I have this already:
write(table, obj, id = "id") {
let p = Object.keys(obj)
let ins = db.prepare(`
INSERT INTO ${table}
(${p.join`, `})
VALUES (${aTA(p)})
ON CONFLICT(${id}) DO UPDATE SET
${p.map(k => k+" = excluded."+k).join`, `}
`)
//return obj => ins.run(obj)
return ins.run(obj)
}```
Oy prepared statements
?
If anyone can tell me what the difference between the two is I’d love to know
Cause if they both do the same thing I’d like to remove one of em
- Stop using callbacks
- Prepared statements basically prevent SQL injections (so some users gets you to insert user given code, which will do bad stuff with your SQL query)
is it possible to have a something like this https://i.imgur.com/PmNtHEm.gif, but not have the gif start over when you leave the channel of the gif ?
no
No
t.t
@onyx summit Wait what
i have a list with n elements, for each element i'd like to react with a number emoji correspondent to the index of the element, is there someway to do this without hardcoding a lot of values ?
like if my list contains 3 elements i'd want to react to a msg like this
yeah, forEach also gives you an index https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach#Parameters
aight, thank you
@lusty dew just Google what are SQL injections
Its a very old security issue that. Somehow still exists(because people like you insert user stuff into SQL queries)
Can someone tell me how do I get contents from db.collection.find() in MongoDB? Because I tried to use db.collection(“something”).find({_id: message.author.id}).items[equipped] and it returned “Cannot find “undefined” from undefined.”. Items is an array and equipped is an int.
I know what sql injections are
I just don’t get what you mean by prepared statements.
I thought that was a prepared statement?
DiscordAPIError: Unknown Emoji
im confused, when i hover over the emote
it says it "0⃣"
\0⃣
you need to react with the id of the emoji not the emoji itself
oh
var member = g.members.me;
if(!member.hasPermissions('VIEW_CHANNEL')) return;
TypeError: Cannot read property 'hasPermissions' of undefined
Why? I tired to use hasPermissions and has but it doesnt work
but that actually makes it much simpler
Use that
use \ before tthe emoji
\0⃣
?
wait \0⃣ is the actual id ?
Copy this: 0⃣
0⃣
it is not
o.o
i don't think it has an id
U+30
No @weary lark
sorry
message.react('0⃣')
is 0⃣ not the same as U+30 ?
im trying to find the ids for 0⃣ to 🔟
and it was apparently not \0⃣ to :keycap_ten
message.react('0️⃣');
'0⃣'
wait the heck
where do i find the codes ??
like this one
it returns unknown emoji
and \0⃣ doesnt work either
Can't you do \0⃣
i tried
0⃣
:zero:
What about the unicode characters
where did you find em ?
and is there anyway to type em ?
like msg.react(n+"weird ass box symbol")
so weird, it's like number with a [] on top of it
when i try deleting the
your number + keycap
no spaces
it's how numbers are actually sent
it's just that they're rendered differently
1⃣
there we go
any number from 1-10 + ⃣
ah okay
thought it was some kind of weird thing you had to do to type the kecap "on top" of the number
Can someone help me if they have time, I can go into screen share if you want as that will help a lot.
just ask your question
I have the code for a bot, I believe I have changed everything and linked it with my bot, but it still doesn't work.
The setup cmd doesn't do anything when I load it up.
would it be something like this ?
yes, the keycap has to be a string but yes
ah okay
that keycap char is really finicky
Can anyone help me? My setup isn't working.
is this async loop incorrect ?
it should wait for the msg
then start a loop that waits for each reaction
but no reactions are made when i run it
looks correct. double check if the loop is running (ie: console.log(i)), try to react once outside of the loop, try to react with a different emoji, catch the react(), etc..
hey if someone could help me its really important i got a ovh vps so i tried to login via ssh and done ssh root@vps ip. then its asking for me the password and im writing the correct password and its not working. i tried to copy the password too and its till dont working.. i just cant access my vps.. someone knows why and what i should do?
should i try reinstalling my server?
exports.run = async (bot,message,args,ops) => {
if(!message.member.voiceChannel) return message.reply("Please join an Voice Channel First!")
if(message.guild.me.voiceChannel) return message.reply("Im already Connected to an Voice Channel in this Server.")
if(!args[0]) return message.reply("Input an URL")
let validate = await ytdl.validateURL(args[0])
if (!validate) return message.reply("Please input an **valid** URL!")
let info = await ytdl.getInfo(args[0]);
let connection = await message.member.voiceChannel.join()
let dispatcher = await connection.play(ytdl(args[0], {
filter: "audioonly" }))
message.channel.send(`Now playing: ${info.title}`)
}
module.exports.help = {
name: "play",
aliases: []
}```
nani?
which d.js version
if (cmd.startsWith("!create")) {
prefix = "!create"
const args = message.content.slice(prefix.length).split();
if (args[1]) {
makeChannel(message, "c-" + args)
message.channel.send("Collaberation channel created!")
return
} else {
message.channel.send("Incorrect usage. Use `!create <collab name>`!")
return
}
}
I'm trying to make a Discord bot for my friends... about some geometry dash stuff, which i want to make a command !create <collab name> work, except it keeps saying Incorrect usage.. ||(and don't red this like I'm a little kid lol)||
your logical solution to your problem is to update discord.js and rewrite half of your code instead of use a different method?
me?
no, Clickbxit
@earnest phoenix yea just got it lel
lol
@shy turret arrays start at zero
audio = discord.FFmpegPCMAudio("<FileName>.mp3")
voice_client.play(audio)
Result: The bot gets a green circle but no sound starts playing.
Why is there no sound?
Hello, im working on leveling system and im almost done. But i need help about rewards system. Im using js. Is there anyone can help me?
what are u using for a db @prime zenith ?
sqlite
rip 😄 cant help sry
.d np
this is super weird
when i set the timeout to like 6 seconds it runs as intended
but when i set the timeout to 10 mins
10 mins goes by, and then it starts repeating the block of code inside the timeout brackets
oh
i check if an id is included in a list at the beginning
after the timeout, i execute the code + remove the id from the list
that works when the timeout is 6 secs
but if i set it to 10 min, for some reason the code inside the timeout starts looping
after the timeout
@barren crest Would you like to elaborate? didnt load it right
like this
but you never add the message's channel id to inProgress
so the if check always goes through
wait no
im blind
ignore what i said
@pine jacinth yea sorry wait for the file to load await it it prob didnt load fully
oh wait
if list.length = 1
and i do
list.length-1
it doesn't return int 0
but NaN
i think, is that normal behavior ?
I am sorry but how do I wait for the file to load @barren crest ?
maybe return(null); at the end will fix it
even though it shouldn't be a problem in the first place
i'm kinda just treating it as loop, because it loops for some reason
np
You made my day
yeah xD so basic and I am asking and looking into it since yesterday
wait
xD
oof but still thank you
omg that's so lucky xD
imma see if it works in my code too
wait really?
> function identity(x) { return(x); }
undefined
> identity(123)
123```
@pine jacinth use a await in a async func

yeah, I recognized this one wasn't async
audio = await discord.FFmpegPCMAudio("<FileName>.mp3")
voice_client.play(audio)```
@earnest phoenix you defined del as a global variable, idk if thats intended
oh
it only needs to be used within that block of code
but not sure how that can explain
why that code block works when timeout is 6 seconds vs 10 min
rn im just waiting 10 min < < to see the logs
it's dumb to think there is an upper limit on the timeout thing, right `?
especially 10 min.
a global variable can be replaced by other instances of the same code, ie: when multiple people run the command, and can cause other unexpected side effects as well
not sure if thats the source of the problem, but worth a try
lemme check for other instances of del real quick
just define it as a local variable
it's the only instance
let del =
sure
ok, it didn't repeat this time ( version with local "del" var)
but every time it did repeat was also with several players in in the list
is it possible the async loop can affect the the timeout ?
ok testing with local var for "del" with 2 players now
@quartz kindle
still happens
whats your full command?
thats your problem
you dont handle the command
that code will execute on EVERY SINGLE MESSAGE FROM EVERYONE
including the bot's own replies
the id is only removed from the list after the bot replies, which by that point, your code will already respond to it
Which is the best programming language in which one can be made an music bot
Oh shit
there is no best, go with whatever you are good with
any which there's already a library built for
so move it above the reply ?
that's still in the scope of the timeout
@earnest phoenix you need to add other checks
any language that can use lavaplayer 
checking if something is in a list or not is no where near enough to stop all kinds of messages trying to execute that code
really ?
a common bot command usually includes checks for it sender is a bot, if sender used prefix, if sender wrote a command, etc... at least
you need to think of all possible scenarios
but i want that code to execute as close to the 10 min mark as possible
its not a timing problem, is a conditions problem
hmm
you just need to eliminate what your bot should not respond to
for instance, dont respond if the user is a bot
but if i put those check above that if statemnt
this will stop it from responding to itself
it will only check the time when someone uses a bot cmd, right ?
wait, that's wrong
or maybe not
One message removed from a suspended account.
you are working with the message event, which includes all messages, without any filtering
@sage bobcat the only ruby experience i have is RPGMaker lul
One message removed from a suspended account.
One message removed from a suspended account.
One message removed from a suspended account.
im not sure, i used it like 10 years ago
One message removed from a suspended account.
One message removed from a suspended account.
doesn't that mean the "time's up" msg only will happen after 10 min + the time it takes someone to write a bot cmd ?
or will the code in the timeout brackets be executed as soon as the 10 min are done
even if no messages are written
@earnest phoenix the code in the timeout will be executed 10mins later
but every message you receive will create a new timeout
so the bot will keep creating timeouts
ah okay
and respond multiple times when they are done
@earnest phoenix why dont u use a command handler?
i could argue that it's better to be more "hands on" and it's more intuitive etc. etc.
but not really any reason
just how i started out
😄
so the code isn't executing at all now ._.
10+ mins has gone by¨
oh right
i have to move the codeblock even lower
because the id was pushed into the list below
how do add currency every x time
so 1min = 2 credits
how are ppl suppose to help if you don't show any code
@barren crest be a little more positive please
¯_(ツ)_/¯
@earnest phoenix basically those guilds are unavailable, you need to handle those accordingly
if a guild is unavailable only the guild id is available
Do you know how I could do so?
your library should handle that
which is basically just waiting for discord to send the guild data once it's available
I use kurasuta myself with a forked ver and I dont have problems like that
if you do stuff with guild, make sure to check if the guild is available
.available on master
although from what Im seeing, probably you failed your eval code
nvm not eval
wait it is from eval I think so
😄
since a simple message dont use _eval() method
so yeah check your eval
as for what eval code
/shrug
i'll delete eval cmd for now and check, thanks
.. didn't work
so for client.guilds.get, where would .available fit @sinful lotus
can you remove a vote in dbl?
not by force, but if the user votes, can they remove that vote?
No
okay thanks
I'm pretty sure we've had no cases of removing someone's vote so far
@earnest phoenix guild has available property
how would i store a users uptime in a database?
Use Date.now() to compare difference of date
how would i get username of peoples that precence is online
filter a member collection to only have online people
then you can map to their name and join
in js anyways
im trying to create a Coins per minue command im having troubles adding coins to users every minute
this wont work
client.users.forEach(u => {
db.add(`currecny_${u.id}`, 100)
});
using quick.db ^
@amber fractal @earnest phoenix no filter people that arent offline so you get idle and DND to
stuck on what?
client.users.forEach(u => {
db.add(currecny_${u.id}, 100)
});
adding
coins to everyone every minute
em
is there a way to get your user as id in the discord desktop client?
ill try
yeah @remote cosmos do user.id
or however u want to get it just do .id after
oh
u mean for u to get in discord?
ah okay thank you
TypeError: Cannot read property 'users' of undefined
everyone the bot recongines
🙄 so 1 guild
yes
client.guild.users.forEach(u => {
db.add(`currecny_${u.id}`, 100)
});```
i see it doesnt thow
?
i tested with a log for each it works fine
bot.guild.users.forEach(u => {
console.log(`${u.id}`)
});```
worked fine
¯_(ツ)_/¯
client.guild???
i have a question
if i put in message event
i have to send message to get the coins
where would i put it so it will automactially add?
inside the message event?
First off
in order for it to add
yes
ah
Are you sure you want to add to everyones balance in a constant loop
i have stucture
don't use setinterval/etc
every time the user is called from the db update their coin count
based on when it was last updated
ok
using the last updated time, calculate the difference between the time of querying/last updated
then based on their CPS add that number to their coin count
😑
on the dbl api, how do you set the authorization on the site for the webhook?
client.users.forEach(user => {
setTimeout(function(){
db.add(`currency_${user.id}` , 100)
console.log('GIVEN 100 COINS')
}, 10000)
});
every time you need to query a user, update a field called "lastUpdated" to the current time
I mean
setTimeout is okay but what if your bot goes down
Timestamp 0: player interacts with bot, save timestamp
Timestamp 1: player interacts with bot again, compare current time with previously saved timestamp, add coins depending on time, save new timestamp
..
basically this
couldnt you just put that in the ready event?
And yes
the idea is to not use set timeout
it would make a million set timeouts lol
wait
Put it outside of any other events if possible
so put in ready event?
ready event can fire multiple times
if your bot dies but the node process is alive you will create another settimeout
when the ready event is fired
just read the thing about timestamps
could i put it in there
if you are using mongo you don't have to use forEach






