#development
1 messages · Page 564 of 1
well disposing is just deleting all its contents right?
or destroying it completly
Hey! Where in the discord.js documents can I find how to make the bot respond to only certain ranks
For like moderator commands.
check if the user has a role that you want
The user has a role, but I want the bot to only respond to that role and higher
const role = <Guild>.roles.find(r => r.name == 'Mods')
if (<User>.roles.includes(role)) { ...
something like that
djs's docs are to document the classes and methods, not provide code to use
I just want to see an example of what i'd write after the const role command
A collection of roles that are in this guild. The key is the role's ID, the value is the role
𝗧𝘆𝗽𝗲: **Collection<Snowflake, [Role](https:/...
Thank you
yw
Hey the urban command can be used to search good words not only nsfw things
idk if i can ask for help on fixing my discord application, its just a grey screen, and i went to see what the console error is and it says Uncaught Error: Cannot find module 'discord_utils' at Module._resolveFilename (internal/modules/cjs/loader.js:584) at Function.Module._resolveFilename (C:\Users\korea\AppData\Local\Discord\app-0.0.304\resources\electron.asar\common\reset-search-paths.js:43) at Function.Module._load (internal/modules/cjs/loader.js:510) at Module.require (internal/modules/cjs/loader.js:640) at require (internal/modules/cjs/helpers.js:20) at requireModule (/evalmachine.<anonymous>:6) at Object.requireModule (C:\Users\korea\AppData\Roaming\discord\0.0.304\modules\discord_desktop_core\core.asar\app\discord_native\nativeModules.js:86) at Object.requireModule (0c2962cae1ed20a72b60.js:62) at Object.getDiscordUtils (0c2962cae1ed20a72b60.js:62) at Object.setGameCandidateOverrides (0c2962cae1ed20a72b60.js:62) at q (0c2962cae1ed20a72b60.js:33) at t.initialize (0c2962cae1ed20a72b60.js:33) at t.e.initializeIfNeeded (0c2962cae1ed20a72b60.js:45) at 0c2962cae1ed20a72b60.js:45 at Array.forEach (<anonymous>) at Function.e.initialize (0c2962cae1ed20a72b60.js:45) at Object.initialize (0c2962cae1ed20a72b60.js:127) at Object.<anonymous> (0c2962cae1ed20a72b60.js:101) at t (19959719de309da475d8.js:1) at Object.<anonymous> (0c2962cae1ed20a72b60.js:101) at t (19959719de309da475d8.js:1) at Object.<anonymous> (0c2962cae1ed20a72b60.js:135) at t (19959719de309da475d8.js:1) at Object.<anonymous> (0c2962cae1ed20a72b60.js:135) at t (19959719de309da475d8.js:1) at f (19959719de309da475d8.js:1) at Array.c [as push] (19959719de309da475d8.js:1) at 0c2962cae1ed20a72b60.js:1
Which library?
ok
It's a missing node module
Ah
its still the same
nvm, i didn't do uninstall it right, it works now, thanks
Anyone familiar with Terraform know how to keep track of a list of provisioned vm ips
And perhaps a sane way to update consul retry ips without reprovisioning
I am trying to do something like this with custom emotes
But for a poll command
so it reacts with that emote and puts the emote by the question they assigned the emote to
If you're using discord.js, <Emoji>.toString() will automatically make it use the emoji
Hm?
That part I think I have
It is the part of getting the emoji they put
and such
I'm seeing if my bot could last til morning
Online
Then I will think about adding it or not
Im just saying .toString() makes it so it will use the emoji
Yea
I understand
let format = "tc!poll <title> <question(s)>"
let question = args.join(',')
if (!question) {
return message.channel.send(`You didn't supply a question(s) : ${format}`)
}
let embed = new Discord.RichEmbed()
.setTitle(`Poll`)
.setDescription(`${question}`)
message.channel.send(embed).then(msg => {
msg.react()
msg.react()
msg.delete(client.settings.time);
})
It is just how I have my args et up
for the question
I am confused on how to get the emojis they use
Well when they use emojis, it looks like this: name:id but its different if its animated i believe
That may be backwards
no
Either way i gtg to sleep gn
This isn't what I asked for help for
I am asking how to get the emotes the user used
so like
so tc!poll Question(s)
it'd ask for an emoji(s)
and it'd get what emoji the user said then assign it to the question and also react with that emoji
Then just awaitMessages
If its a seperate message
So prompt them then awaitMessages
Your not collecting reactions are you?
is there a list of all event names for discordjs?
np
Anyone got an example of a loop function
How can i add a reaction to a specific channel (any channel/server) ples i ned help....

(Python)
@frosty delta That should help you out.
Also you don't add reaction to "a channel". You need a message object. It can be any message in that channel.
Whoah thx!!!!!!!
Another q lol, how do u change the bots presens (idk how to spell cuz im freakin dumb) to like this."Playing with number of servers that the bot is in"?
which lib
Python
how do i disable the unknown command response?
ive looked through docs and cant find
i did
unknownCommand: false
any help?
like djs commando
there doesnt seem to be an option for that. best bet is to not use commando at all
@sturdy delta
nvm
commandPrefix: '!',
owner: '459317913787170827',
disableEveryone: true,
unknownCommandResponse: false
});``` isnt working @quartz kindle
thats not how you use it
well, what version are you on?
actually thats valid for commando v11, but not for v12
Install the node module
idk
check your package.json for the module version 🤔
@frosty delta Oh, you mean the playing status?
Assuming a"Yes", this should help: await client.change_presence(game=discord.Game(name='in %s servers'%(str(len(client.servers))), type=1))
assuming you are using latest version of discord.py, game is deprecated, use activity instead
Can someone tell me how to make my bot send auto msg every 12 hours? discord.js
Please also say what lang/lib you're using otherwise people won't be able to help you
you can use setInterval
its a bit more complex if you need to account for restarts and crashes
type=1 what
According to the api docs here (https://discordapp.com/developers/docs/resources/user#user-object-user-flags) the House of Bravery flag should be about 64. But when a test user of mine did it he had a user flag of over 500. (Think it was 575 but idk) If anyone has any idea why his might occurs and how to deal with this in node js please leave a suggestion. Also please ping me with your response.
Integrate your service with Discord — whether it's a bot or a game or your whatever you wildest imagination can come up with.
Wait send the raw response of his user data
||how do ye cache a message manually in discord.js (nodeJS)?||
@earnest phoenix fetch it
@earnest phoenix it does cache it if you have the option set to true
but i meant manually
like by command
so messages older then the bot gets cached on use
Then fetch them in the command
i fetch -> no cache tho 😉
you must have the option set to false then
oh oki
well actually there's no option for fetchMessages but it does cache it
does it really? i cant find anything about it
i remember someone saying that only messages coming through the gateway are cached
@slim heart no nothing yet
Nvm here is data
{"house":640,"accessed":"2019-02-01T06:51:35.942Z","username":"InkᎥce"}
is it supposed to be house of brilliance?
1 << 8 is like 128 I thought
use bitwise and to check for a flag
it's a bitset because users may have more than one
I am
1 << 7 is 128
Sorry
640 = 512 | 128
Boolean(640 & 1 << 7) // true```
or just (x & wanted) == wanted
because you have another flag
early supporter is 512
ah, thats why
Hey i'm looking for creating an eval command for my bot for personnal use and I don't know how to do this. I have discord.py from Rapptz latest version
I suggest learning discord.py. learn on how to make your own commands. It'll take some time, but study the actual language before you code anything. I'm using discord.js, so I sadly can't help you
I only used discord.py a little so i can't help you too
I also suggest doing discord.js, Imo it's easier
what'd be the best/safest way to go about event message customization? (for join, leave all that type of stuff)
like creating your own custom events?
I know how to code @rustic obsidian thanks 😃 But I don't know how to make an eval command I mean, eval inside the script
have the user customize their own response messages or format kick/ban reasons that type of stuff with predefined modifiers for example "Welcome {user} to {guild}" @quartz kindle but in a safe way
the safest way would be to use string.replace
couldn't people basically eval shit they shouldnt be able to if i used template literals for that
Oh customize their own response, yea replace then
afaik, js strings automatically escape/sanitize themselves
so any string functions should be safe
alright thanks (:
"{user}".replace("{user}", "rm -rf") 
replace("{user}", "eval('process.exit()')")
wth 👀
replace("eval","nice try noob")
Let me go to mdn and delete their entire database now 
good luck
wait what
LUL
Its probably safe tho
obviously, doubt they'd let people run around with full blown evals

thats probably not even running anywhere
only in your browser
so even if somehow you could access the local system's terminal/cmd, you would be deleting your own shit
lmao
hi guys. could need some help.
i have a trigger on userStateChange to know when a user leaves a voicechannel. This is working fine, but i wondered if there's a way to distinguish, if the user left voluntarily or had a disconnect?
i dont think thats possible
afaik, discord doesnt provide any reasons for disconnection
it just tells you when it does
^
thank you for the confirmation, lord master king
thanks!
Is there any place that lists all the user flags for a user.
Not just the hypesquad stuff
not oficially
nice find
anybody know how to get the lag fixed on music bots ???
either your code is bad, or your server is bad
or both
client.eventasync def on_edit(message): await client.process_commands(message) contents = message.content.split(" ") #contents in a list type for word in contents: if word.upper() in chat_filter: if not message.author.id in bypass_list: try: await asyncio.sleep(0.5) await client.send_message(message.channel, "🚫 word censored 🚫") await client.delete_message(message) except discord.errors.NotFound: return
I need this event to check a message when it is edited
wha is that
Its blocks swear words
No python
Oof ok
I did ,just discord messed it up
Im trying to use on_edit_message for the bot to detect the blacklisted words but it wont work
I tried using on_edit and on_edit_message, i need the bot to detect the messages after a user edits it but it wont work
The event is called on_message_edit
O ok thx
Is there a way to keep reactions on an embed but not allow people to react anymore after a certain amount of time
Or better yet
Is there a way to make the bot send how many people pressed a certain reaction
I'd need a reaction Collector won't I
I added on_message_edit but it still didnt work
@client.event
async def on_message_edit(message):
await client.process_commands(message)
contents = message.content.split(" ") #contents in a list type
for word in contents:
if word.upper() in chat_filter:
if not message.author.id in bypass_list:
try:
await asyncio.sleep(0.5)
await client.send_message(message.channel, "🚫 **word censored** 🚫")
await client.delete_message(message)
except discord.errors.NotFound:
idk python, but you can try adding logging to console to see until where the code executes correctly
It didn't report any error.
no i mean
async def on_message_edit(message):
log to console (a message was edited)
for word in contents:
if word.upper() in chat filter:
log to console (a match was found in the chat filter)
```
something like that
just so you can see and control what exactly your code is doing, and what is working and what isnt
idk what the command to log to console is
How could I get the number of people who reacted to a reaction?
Its suppost to be activated by editing a message but it wont activate the event, if u use on_message it works but i need to prevent players editing their msg to change it to a blocked word
you're not receiving anything at all from the message edit event?
@lusty dew try using something like
on_reaction_say(message)
message = ctx.message.author
Not everyone is using python my guy
What do u use? Js?
Mhm
are you using v16 or rewrite?
Whom?
wildmaster
No
@lusty dew for you, you have to set up a reaction collector
show code then lul
K lel
Im using wordpad
Bitch wtf
v16 and rewrite aren't coding prgrams
Yes
which version of it?
there is v16 (latest/async/whatever)
No one uses v16 anymore
0.16.12
see
fucking end me now
anyway
LOL
im checking the docs for v16
or rathe v0.16
the event should be .on_message_edit(before, after)
which contains both messages, pre-edit and post-edit
So (before, after, message)?
How do you make a filter again?
For the reactionCollector?
@prime oriole Also pretty sure may be wrong here but pretty sure it is on_message_edit(before, after)
Ok
not sure how py works with getting the message
if it is
before.message
or what
idk
Anyone have tips for growing a bots server count?
I noticed a significant boost in growth when my bot was in the "new bots" part of the website
my bots died since it dropped off trending
so uh, just keep improving content and hope
just word of mouth I suppose
My bot launched at like May of last year
took 2 months, then it exploded somehow
hi
Question
In a filter for a reactioncollector are you able to use an array of emojis
const filter = (reaction, user) => reaction.emoji.name === ['✅', '❎']
no clue, I don't use reactioncollector
Well fuck me
i doubt it
use includes
if you going to use array, use .includes
I am trying to get the number of people who reacted xd
array.includes(emoji.name)
yes
Mk
I am trying to get how many people reacted to check and how many people reacted to X
doesn't the api include the count
only if you fetch the message
sketchy tips lol
Is there a way to sort through all my commands and put them in an embed
so I don't have to hardcode the command and the usage into the help cmd
just whatever your command router is

if you have a handler for routing to a specific command, then you prob have a stack of the commands somewhere
That is my cmd handler
probably client.commands
I'd probably use that to sort through my commands
Where to put constructor?
what
It's part of the constructor option, it's in the docs, it's in the wiki
and prob documented again else where
lol
OK
idk where your command stack is stored
in client.commands
then just iterate that
Wdym?
iterate the object keys 
Anyone happen to have an mp3 of a Discord ping or know where to find one?
Free MP3 Download: https://goo.gl/JxdMiJ
oops sorry accidental ping
function now() { [native code] }
I have no idea why I am getting this
Can someone explain what it means?
Ah mk
Hm
then how would I do this
Object.keys(client.commands).forEach(command => {
command.conf.name
})
oof
wait
ok quick question am i like the only one in python
false
^
.setDescription(Object.keys(client.commands).forEach(command => {
command.conf.name
}))
How would I do that then?
How exactly are you structuring your request?
do u want to dm me so we dont need to deal with the extra shit or is in here fine
You see it right there
You can send it here
I use a for loop to iterate objects, personally
The snippet when you post
async def list_servers():
await client.wait_until_ready()
while not client.is_closed:
print("Current servers:")
for server in client.servers:
print(server.name)
await asyncio.sleep(600)
client.loop.create_task(list_servers())
@client.event
async def on_ready():
print('\n')
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
client.run(TOKEN)
class DiscordBotsOrgAPI:
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = 'dbl_token' # set this to your DBL token
self.dblpy = dbl.Client(self.bot, self.token)
self.bot.loop.create_task(self.update_stats())
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
while True:
logger.info('attempting to post server count')
try:
await self.dblpy.post_server_count()
logger.info('posted server count ({})'.format(len(self.bot.guilds)))
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
await asyncio.sleep(18)
print("logged servers")
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))
the top part is my own part
the list servers part
code block exists
triple `
'''async def list_servers():
await client.wait_until_ready()
while not client.is_closed:
print("Current servers:")
for server in client.servers:
print(server.name)
await asyncio.sleep(600)
client.loop.create_task(list_servers())
@client.event
async def on_ready():
print('\n')
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
client.run(TOKEN)
class DiscordBotsOrgAPI:
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = 'dbl_token' # set this to your DBL token
self.dblpy = dbl.Client(self.bot, self.token)
self.bot.loop.create_task(self.update_stats())
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
while True:
logger.info('attempting to post server count')
try:
await self.dblpy.post_server_count()
logger.info('posted server count ({})'.format(len(self.bot.guilds)))
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
await asyncio.sleep(18)
print("logged servers")
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))'''
....
uh
https://paste.tscforum.com/tdnavxdqeb.js
Full code
await client.wait_until_ready()
while not client.is_closed:
print("Current servers:")
for server in client.servers:
print(server.name)
await asyncio.sleep(600)
client.loop.create_task(list_servers())
@client.event
async def on_ready():
print('\n')
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
client.run(TOKEN)
class DiscordBotsOrgAPI:
"""Handles interactions with the discordbots.org API"""
def __init__(self, bot):
self.bot = bot
self.token = 'dbl_token' # set this to your DBL token
self.dblpy = dbl.Client(self.bot, self.token)
self.bot.loop.create_task(self.update_stats())
async def update_stats(self):
"""This function runs every 30 minutes to automatically update your server count"""
while True:
logger.info('attempting to post server count')
try:
await self.dblpy.post_server_count()
logger.info('posted server count ({})'.format(len(self.bot.guilds)))
except Exception as e:
logger.exception('Failed to post server count\n{}: {}'.format(type(e).__name__, e))
await asyncio.sleep(18)
print("logged servers")
def setup(bot):
global logger
logger = logging.getLogger('bot')
bot.add_cog(DiscordBotsOrgAPI(bot))```
there we go thanks bb
Did you have the dblpy package installed
You know hastebin exists :/
Is this at all edited from the example
you know you dont have to speak in italics?
nope straight copy and paste
...
So
I can if I want though
You didn't change the token part
i didnt feel ike doing much dude it was 2 am
at least read the comments
ah that makes sense
Whatever you want to do I guess.
IT WAS 2 AM

No need to use all caps
I doubt he was even talking to you I think he was talking to me
Lol thx no worries, soryr for being so unobservant XD
Mk
https://paste.tscforum.com/tdnavxdqeb.js this is my full code
I am trying to loop through the commands to get the cmd name
I have that part now I can't figure out how to put it into the embed
hi guys, i'm new in using bot and fuckin asaljjkzmjzhuh code.
so, what must i do / where i can find some informations about how to setting dynobot/other to automatically change roles only for member who chat/introduce first?
i mean dynobot that i used automatically change roles for everyone even for members who not introducing or never chating. they should be white right?
thank you 😃
Hey, does anyone know how to get a bot in Discord.js to send a message with a channel link like #rules-and-info
<Channel>.toString()
<#channelid>
Or that
Cheers!
eg [#development](/guild/264445053596991498/channel/272764566411149314/) == #development
Thanks a lot
Both work, I guess it depends if you have the channel obj or the id 
but toString() is easier if you have the object

message.channel.toString() <#${message.channel.id}>
ok markdown hates me
{ help:
{ conf: { name: 'help', description: 'blah' },
run: [Function: run] },
poll: { run: [Function: run] } }
How could I get the name
ffrom that
.setDescription(Object.keys(client.commands).forEach(command => {
command.conf.name
}))
this is my code
you don't want a forEach
^
It isn't in an array
Whatever
not whatever, mdn is usually the first thing that pops up when you google
wasn't talking to you
It applies anyways.
Ill figure it out
@trim saddle so i added the token and everything but it still no work
I feel like i need to call the setup() function i mean its not just gonna do shit by itself but i dont know what it needs for the bot value it wants
Um
Yes?
ok
if you scroll all the way down
now i gget it
you can set its auth
ty
Does anyone know what this means
idk i code discord.js
i have asyncio and discord.py installed
Im js, so I dont know much but import discord should work
Wait
whats compat.py
🤔
idk
Oh
Idk if that's rewite
rewrite*
Either way, they said its because it supports 3.4-3.6
rewrite says it supports 3.5.3+ tho
i was litterally readsing that
Are you using rewrite?
i was using the latest
of rewrite?
i think so
are you sure it's installed in the right place?
i've seen people have that sort of problem when they installed it to the wrong place
idk anything about python tho
wouldnt importing fail then
^^^^^^^
it wouldnt read a file it couldnt find
Either way its 1:35 AM imma get to bed, good luck with that
👋
What issue are you having
do you have a hostname
¯_(ツ)_/¯
i.e. a domain name you bought/got using a generator?
Don't think so
I'm not sure why it requires it but
NS1 and NS2 are probably going to be the nameservers, which would be configurable (or just provided) by where you got your host domain name
and root password is just the password for the superuser on the machine
If you're using a legit hostname then yes
otherwise just put in a word or something to identify it
and leave those two blank or default
what's it complaining about
what hosting provider are you using
I am honestly just trying to get a vps for my bot
:/
Not a website (yet)
You can get Free VPS Hosting (Windows, Linux) upto 2 GB RAM, 30 GB SSD Space, 1 TB Bandwidth in 1 Minute for $0.00/month for First 6 Months On Trial. Simple, fast, scalable SSD cloud virtual servers, No ADS No Credit Card Required.
This one
Never heard of it, but ¯_(ツ)_/¯
There's no technical reason why you have to have a domain name as your hostname
Idk I am desperate xd
are you specifically looking for free hosting?
Yea
I have no money rn
and heroku and glitch aren't working..
my bot goes offline within minutes
even with the pinging thing on glitch
Don't know what to recommend for that then
mk
hm
Idk why but my webhookauth password is not working
actually i use the token for password omegalul (webhook token)
heoku work for me
Hey I'm super new to coding and developing my first bot and I'm concerned about its potential response time if it goes public with like 200+ users
Would a bot being 8000+ lines be impractical to have running in multiple servers?
Like, would it be ridiculously slow to react to commands?
And are there other factors that can significantly change its runspeed other than length?
The main factor that change the reaction time is mainly its connections speed and what you are doing with the incoming informations
And 8000 lines isn't a super good idea, you should try to split it into multiple files
length doesnt have to affect the performance a whole lot if said code is "good" code. your internet connection/the one your bot will run on affects response time, the worse your connection the longer things may take from a networking standpoint
and as mentioned by vanerac you should keep everything clean and split things that belong together into separate files, having a single 8k line code file is not the greatest idea unless you like searching for a small codesnippet for a solid amount of time
Hello, any ideas how can i make an setup command? When you execute it, it will start setuping the server, and on the other server it won't setup it as on previous server. Any ideas?
@lusty dew any free vps is a scam
unless it comes from some legit company which is paid
not every single one is, but every single one is not reliable yeah
i dunno i dont use free hosting
exactly
i actually found some free windows vps provider and tested it some time ago, it did indeed work and it was free but damn that thing was slow as shit, basically unresponsive
yea i know 
free
who knows discord.py plz help me
there's no point in wasting your time with figuring out who worked with discord.py, ask your question and the right people will come on their own (:
that question is too generic
*Rythm
a: no
detalied a: use lavalink and copy features because #originality
@neon plume here is a link to lern coding discord bots with python: ||https://www.youtube.com/watch?v=DLzxrzFCyOs ||
Artist: Rick Astley Title: Never Gonna Give You Up Difference with original: nothing but the quality of audio and video. all rights belong to their respectiv...
follow my amazing tutorial https://www.youtube.com/watch?v=UbJR2gVPaWY
like Tim said, the question is generic
hmm
we can help you if you target a specific topic, e.g "how to make my song loop in lavalink"
what
xp
oh
have a database, on each message sent (the event should usually be named "MessageReceived") increment the user's xp in the database by whatever you want
Hi, I have this code, trying to make it so that when a message gets a certain amount of reactions, it pings me. Problem Im having is that it pings me right away without waiting for the reactions and Im not sure why. Heres the code:
const filter = (reaction) => reaction.emoji.name === '✅'
message.awaitReactions(filter, {max: 2})
.then(pingchannel.send('@cobalt dune a suggestion was approved', approvedsuggestion));```
awaitReactions has a time option, to specify how long it should wait
so awaitReactions has to be a time only? Cause this is for suggestions, Id rather use a max emojis people react to than having a time limit. In the awaitreaction options, it has a max option as well but not sure why its not working.
Hey I'm confused what I use for my music bot const queue = new Map(); or const queue = new Discord.Collection()
Library: Discord.js
Version: Stable
Pls help me
But which one is better
oh
Hi i have a question,
then ask it instead of asking
what
My command : https://pastebin.com/9LPEUW6q
The problem is that I had to add this line so that it does not crashif (Dresseur.length < 15) return message.channel.send("Erreur :Croix: : Moins de 15 Dresseurs sur le Discord, vous pouvez néanmoins allez voir le Top général : http://akimitsu.xyz/classement.php") because in my code if there are not more than 15 trainers on the discord the command is crash
Dresseur is a json and json.points is a point of dresseur
This is a top of point of the Dresseur of my bot
I would like that ex: if there are 3 Trainer on the discord that sends the top of the 3 Trainer if 5 a top of the 5 and not only of 15 and must have minimum 15 for it to work;
Who can help me ?
@cobalt dune im not sure how time and max are supposed to work, but if its not working you can switch to a reaction collector, which lets you control it better
alright thanks
@lofty hamlet for (var i = 0; i < 15; i++) {
Yes ?
you're always looping 15 times, so if there are less than 15 items, it will crash because the item doesnt exist
Ok how should I do it? @quartz kindle
you can do for (var i = 0; i < Dresseur.length; i++) {
if (Dresseurs[message.guild.members.map(user => user.id)[i]]) {
nb++;
var Dresseur1 = Dresseurs[message.guild.members.map(user => user.id)[i]];
Dresseur[nb] = {```
the nb++
makes so that nb becomes 1
so there is no item 0
🤔
@quartz kindle not work i have remoove nb++; and replace for (var i = 0; i < Dresseur[nb++]; i++) {
Hum ?
Oh ok noty this for ?
this part
nb++;
var Dresseur1 = Dresseurs[message.guild.members.map(user => user.id)[i]];
Dresseur[nb] = {```
And i leash for (var i = 0; i < Dresseur.length; i++) {
yes that part stays the same
👍
and how do I limit to 15 at once? @quartz kindle
It should be sent as the first 15 if there are more than 15 Trainers
yes
below topcount++ or up ?
in the beginning of the for
Should it still send the top of 15
the for will loop the same amount of times as there are trainers
if there is 5 trainers, loop 5 times
if there is 20 trainers, loop 20 times
but if i becomes bigger than 15
it will stop
so 20 trainers will stop at 15
Ok ok like this?
yes
Thanks you
@lofty hamlet you should add more variables to make your code cleaner
like this
const member = message.guild.members.map(user => user.id)[i]
const dresseurMember = Dresseurs[member]
if (dresseurMemberr) {
// your code
}
what would be the easiest way to make a script that downloads a load of pngs from urls in an array?
how to use jimp.composite in discord.js?
i am having this error when pushing my bot on heroku ERROR: Unsupported FFmpeg version: 3.3.2
@sick cloud in javascript?
or any other, i just need a quick script to do it so language doesn't matter
Would it be relatively easy to make a bot which sole purpose, is to send a given sentence after a specific user writes a message within a given time zone?
e.g it has been 10+ hours since the user last wrote, the bot will send a message when that user writes again.
If I could be recommended what&where to look for information and which language to use, that would be highly appreciated!
I have 0 experience in coding, but time is not an issue.
I also apologize if this is not the correct channel to post in!
well you can start by learning a language, that truly depends on personal choice since theres a wide range (python, javascript, java, .net and more)
then you'd need to learn the discord library for that language
many start off with javascript and discord.js as their library as it's fairly userfriendly and easy-to-use (given you somewhat know what you're doing), there are tons of resources to learn from (a few pinned in this channel)
but as tony mentioned you can write bots in basically any language, some requiring more work and knowledge about programming than others
(you can literally make bots in nim now)
@marble needle @sick cloud thank you for the answers! will try my hand a JavaScript 😄
and to answer your question, yes if you know what you're doing or how to approach the problem it's easy to accomplish what you want (:
your bot idea i mean
Anyone know how I can assign a 'false' value to an emoji?
why not use that
do i make my bot's response messages fully customizable or will that turn it into a "garbage multipurpose bot"? Not sure whether i should waste my time on making my bot as customizable as possible or not
from my experience
you can make is as customizable and as easy to use as you wish
yet still
only like 10-20% of your users will actually know they can customize it, and figure it out on their own
https://i.ryeqb.me/4d2f778816.png well, fuck this then 👀
well, its still nice to have, and makes your bot more high quality because you put time and effort into it
but dont expect people to appreciate it
some will, but the vast majority is simply clueless
lmao
oh well, guess ill pull through for the experience and fun
yeah
if cdHours = 24
and I do
cdHours * 1000 * 60 * 60
that would make it 24 hours right?
24 hours are 86.400.000 ms
kinda is, if you were to calculate what you wrote you'd know if it was right or not
adding the units you're dealing with would also be helpful 
how do I actually get the value of xp and levels if its stored like this (nedb btw) {"doc":{"userid":"312617227490951168","serverid":"539058992136323082","xp":(whatever their xp is),"level":(whatever their level is)},"_id":"6oa6uSpTUdwDpokn"}
(nedb is essentially local mongo)
it looks like a regular object
🤔
an object is a key/value pair
how could I use moment
to get the time from a cooldown
that is set up like this
let cooldown = new Set()
My cooldowns are so overworked
eris has built-in cooldowns 
but how do I get a time from the cooldown using moment
Also again nice ig
I am using Discord.js though
so
what does moment have to do with accessing data from sets though
Get it then put it in your own format?
you can go on their website and search for format if you want.
if you can do what you want, it will be in their docs
why do you need formatted time data in the set, save cooldowns as unix timestamps and format when you need to output anything
so I would do
moment().get(daily_cooldown).format('h:mm:ss a')
Will discord exist by 2038
|| why did my music quality get worse suddenly (some time ago, still bad quality)? 🤔 ||
How do people made their redirect URIs so it redirects them to the page where the user was previously at instead of a specific page?
Could you elaborate? This is my first time working with oauth2
well message.author works as tag aswell
yes but i dont wanna tag the username but the id
Integrate your service with Discord — whether it's a bot or a game or your whatever you wildest imagination can come up with.
state can be whatever
Thanks
@spare glen that only happens if the user isn't cached by the client
Why
for the looks
It doesn't work that way
k?
no u
ID
Basically, showing you the id is not really normal, but you can't do anything about it if your client has never saw the user or forgot about them
How would I turn role permissions bitmap into an array?
I would say something but i know nothing about that so i wont :+1:
You use d.js right?
yeah
I would say do the bitmath but idk if theres something to do it for you or if thats even the right term to use
Imma be honest idek what a bitmap is
bitfield mb
I still dont know what that is 

Like the hell does this mean http://c-for-dummies.com/blog/wp-content/uploads/2016/05/0507-figure1-write_bit_field.png
heh 🤷
it's a binary AND
well the first application is
I don't know what it's trying to do, but it makes a bit mask of 0000 1111 (15), bitshifts it left by 3, physically moving the bits over, 01111000, (120), then inverting it with an XOR of 1111 1111 = 10000111 (135)
Then it uses that mask to mask to original byte (think of like a mask in spraypainting, where the original byte is "spraypainted" on with the bitmask blocking parts of it)
after that it's ORed with the second mask, which combines the values (0+0=0, 0+1=1, 1+1=1)
So essentially what they're doing is they're cutting out bits 4 through 7 and replacing them
and there's your crash course in bitwise logic
for most people the most is this likely going to be used for is packing a 4-byte color into a single int
color = (red << 24) + (green << 16) + (blue << 8) + (alpha)
Under what circumstances would message.member be null? Because I got an error from that
Ok then, for some reason someone DMed my bot.
Ok, thanks!
I have a level.json file that is filled with
"levle1" : certainamountofxp,
"level2: certainamountofxp
and so on
and I want to detect if they have that certain amount of xp
and add that level to them
you'd have to read the file, parse the JSON and check if their xp is >= to xpneeded
Mk is there a doc on it though
Ah ok
thanks
fs.readFile can go through dirs right?
Yep
That one is web stuff, this one might be better https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse
oof nvm
Hello everyone, help with this question. if .createRole() creates a role, how do you delete the role?
discord.js
you didnt give it an encoding
Yes
Lol
Lol
let levels = fs.readFile('../settings/level.json', 'utf-8')
JSON.parse(levels)
Is that how i'd do it?
readFile needs a callback
Hm
{
"level1": 0,
"level2": 10,
"Level3": 20,
"Level4": 30,
"Level5": 40,
"Level6": 80,
"Level7": 120,
"Level8": 280,
"Level9": 320,
"Level10": 480,
"Level11": 520,
"Level12": 580,
"Leve13": 620,
"Level14": 780,
"Level15": 820,
"Level16": 980,
"Level17": 1020,
"Level18": 1280,
"Level19": 1320,
"Level20": 1480
}
This is what my json looks like
I am trying to get the amount of xp needed to get that level
mhm
if you use readFileSync, it doesnt have a callback so you can just do let something = JSON.parse(fs.readFileSync("./file/path/txt.json", "utf8"))
something would be a JS object of the json data
why not use something like a formula to determine those values
I am about to use the DB I forgot I had for a second...
Yea
I have a better idea then just the JSON file
I am gonna try and figure out how to get the db to add a level after every x amount of xp
I will come back If I need help :>
Thanks for the help you guys supplied already <3
let newLevel = data.xp / 50
db.collection('users').createIndex({"id": message.author.id})
db.collection('user').find({"id": message.author.id}).updateOne({$set: {"levels": newLevel}})
This is what I have
But the index looks a bit off
does anyone know how to make an index to verify if that is correct
mongodb
.ensureIndex iirc
though that might be a mongoose-level thing, I've never worked directly with mongodb driver
oh wait you mean to verify it
Huh?
indexes have an order, but dont' care about the actual data in them
so if you wanted an index on 'id' you'd specify it as { id: 1 } (ascending) or { id: -1 } descending
I think at least, been awhile since I've used indexes
have you tried using compass to see what the db looks like after you've applied the index?
also can I just ping a mod to get my bot unmuted after I fix the issue?
process.exit()?
Are bots able to hear people and notice if someone is ear rapping ( I think no but I need to confirm it )
@earnest phoenix no
it's possible but not something built in
you could take your audio and test for excessive clipping
define ear rapping
Shoutting loud while playing and speaking in voice chat?
can bots listen to audio tho?
Yes
i believe i saw a few voice recorder bots
You can easily detect patterns of long lasting high frequency
so it should be possible
you dont need an AI for that
Fourier transform also helps to spot anonymities
I want to make few bots that checks if one of the members is ear rapping and voice mute him for 10 seconds for doing so
you need to analyze examples of ear-rape audio, and see if you can find any patern
since I want a clean voice play game & reporting ear rappers isn't that easy as it it is
most ear rape are either very high frequency or extremely loud in amplitude
those are pretty easy to determine
This is going to be hard to do
get a base line reading, then determine anonymity
😓
look at FFT, get a discrete fourier analysis of a sum of waves
That's going to take me ages to understand that
D.js has a voice receiver
Idk if thats what you want tho
Or if you use d.js
Or what it does 
I want to make few bots that checks if one of the members is ear rapping and voice mute him for 10 seconds for doing so
They commit ear rap
How could I bring the bot back online after process.exit()
cause I did
client.login(token)
Restart it from console
^
It is supposed to be a restart cmd
Process.exit() stops the script
Unless it's pm2
Oh oof
No, it only restarts with pm2
You too fast for my mobile self
you can easily do this with system services, and other stuff
Em quick question , how to edit a message multiple times discord.js

