#development

1 messages · Page 564 of 1

idle mountain
#

which i don't know but you might

amber fractal
#

well disposing is just deleting all its contents right?

#

or destroying it completly

inner jewel
#

let me reword it, how do i unregister an event listener in djs

static hinge
#

Hey! Where in the discord.js documents can I find how to make the bot respond to only certain ranks

#

For like moderator commands.

sick cloud
#

check if the user has a role that you want

static hinge
#

The user has a role, but I want the bot to only respond to that role and higher

sick cloud
#
const role = <Guild>.roles.find(r => r.name == 'Mods')

if (<User>.roles.includes(role)) { ...

something like that

static hinge
#

ok

keen drift
#

Check the hoist permission of those roles I suppose

#

if you want that and higher

sick cloud
#

djs's docs are to document the classes and methods, not provide code to use

static hinge
#

I just want to see an example of what i'd write after the const role command

bright spear
static hinge
#

Thank you

bright spear
#

yw

sacred forge
#

Hey the urban command can be used to search good words not only nsfw things

idle mountain
#

yes but it's generally considered nsfw

#

also this is not the right channel

vernal rivet
#

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

grim aspen
#

Which library?

vernal rivet
#

not a bot, this is my actually discord application

#

right now i am on browser

grim aspen
#

Then I don’t know

#

Looks like a server error

bright spear
#

Try reinstalling

#

That's not a server error

vernal rivet
#

ok

bright spear
#

It's a missing node module

grim aspen
#

Ah

vernal rivet
#

its still the same

vernal rivet
#

nvm, i didn't do uninstall it right, it works now, thanks

keen drift
#

Anyone familiar with Terraform know how to keep track of a list of provisioned vm ips

keen drift
#

And perhaps a sane way to update consul retry ips without reprovisioning

lusty dew
#

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

amber fractal
#

If you're using discord.js, <Emoji>.toString() will automatically make it use the emoji

lusty dew
#

Hm?

#

That part I think I have

#

It is the part of getting the emoji they put

#

and such

grim aspen
#

I'm seeing if my bot could last til morning

#

Online

#

Then I will think about adding it or not

amber fractal
lusty dew
#

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

amber fractal
#

Well when they use emojis, it looks like this: name:id but its different if its animated i believe

#

That may be backwards

languid bough
#

no

amber fractal
#

Either way i gtg to sleep gn

languid bough
#

it's like <a:name:id>

lusty dew
#

Mk

#

I know about that stuff

inner jewel
#

for reactions it's name:id

#

animated or not

lusty dew
#

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

amber fractal
#

Then just awaitMessages

#

If its a seperate message

#

So prompt them then awaitMessages

lusty dew
#

How does awaitMessages work?

#

OOh wait nvm

#

Won't I need a reactionCollector?

amber fractal
#

Your not collecting reactions are you?

lusty dew
#

It is a poll cmd

#

so yea

lusty dew
#

How could I get the emoji name and emoji id

#

of the emoji(s) they put

mental solstice
#

is there a list of all event names for discordjs?

sick cloud
#

yeah, its listed on the docs under Client

mental solstice
#

ahh there it is

#

ty

sick cloud
#

np

sturdy delta
#

Anyone got an example of a loop function

frosty delta
#

How can i add a reaction to a specific channel (any channel/server) ples i ned help....thonkku thonkku thonkku thonkku

#

(Python)

gleaming geyser
#

@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.

frosty delta
#

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"?

earnest phoenix
#

which lib

frosty delta
#

Python

marble needle
#

that's not what he asked for

#

which library are you using, python is a language

sturdy delta
#

how do i disable the unknown command response?
ive looked through docs and cant find
i did
unknownCommand: false
any help?

#

like djs commando

mossy vine
#

there doesnt seem to be an option for that. best bet is to not use commando at all

quartz kindle
#

@sturdy delta

sturdy delta
#

nvm

#
    commandPrefix: '!',
    owner: '459317913787170827',
    disableEveryone: true,
    unknownCommandResponse: false
});``` isnt working @quartz kindle
quartz kindle
#

thats not how you use it

mossy vine
#

thats not even the parameter

#

like what are you doing xd

quartz kindle
#

well, what version are you on?

#

actually thats valid for commando v11, but not for v12

topaz fjord
#

Install the node module

sturdy delta
#

idk

marble needle
#

check your package.json for the module version 🤔

gleaming geyser
#

@frosty delta Oh, you mean the playing status?

gleaming geyser
#

Assuming a"Yes", this should help: await client.change_presence(game=discord.Game(name='in %s servers'%(str(len(client.servers))), type=1))

ruby dust
#

assuming you are using latest version of discord.py, game is deprecated, use activity instead

forest hull
#

Can someone tell me how to make my bot send auto msg every 12 hours? discord.js

weak parrot
#

Please also say what lang/lib you're using otherwise people won't be able to help you

quartz kindle
#

you can use setInterval

#

its a bit more complex if you need to account for restarts and crashes

slender thistle
#

type=1 what

formal agate
#

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.

Discord Developer Portal

Integrate your service with Discord — whether it's a bot or a game or your whatever you wildest imagination can come up with.

slim heart
#

@formal agate wdym 64

#

Nvrm

formal agate
#

..

#

1 << 6 is about 64

slim heart
#

Wait send the raw response of his user data

earnest phoenix
#

||how do ye cache a message manually in discord.js (nodeJS)?||

slim heart
#

@earnest phoenix fetch it

earnest phoenix
#

yeah but that doesn't cache it

#

Oof

#

well nvm

#

ima try

formal agate
#

@slim heart lost in logs

#

But I’ll try and get it again

slim heart
#

Alright

#

@formal agate anything yet?

smoky spire
#

@earnest phoenix it does cache it if you have the option set to true

earnest phoenix
#

but i meant manually

#

like by command

#

so messages older then the bot gets cached on use

smoky spire
#

Then fetch them in the command

earnest phoenix
#

i fetch -> no cache tho 😉

smoky spire
#

you must have the option set to false then

earnest phoenix
#

oh oki

smoky spire
#

well actually there's no option for fetchMessages but it does cache it

quartz kindle
#

does it really? i cant find anything about it

#

i remember someone saying that only messages coming through the gateway are cached

formal agate
#

@slim heart no nothing yet

#

Nvm here is data
{"house":640,"accessed":"2019-02-01T06:51:35.942Z","username":"InkᎥce"}

quartz kindle
#

is it supposed to be house of brilliance?

formal agate
#

Yes

quartz kindle
#

then it works

#

idk why it comes out like that, but the flag works

formal agate
#

1 << 8 is like 128 I thought

inner jewel
#

use bitwise and to check for a flag

#

it's a bitset because users may have more than one

formal agate
#

I am

quartz kindle
#

1 << 7 is 128

formal agate
#

Sorry

inner jewel
#

640 = 512 | 128

quartz kindle
#
Boolean(640 & 1 << 7) // true```
formal agate
#

Ok

#

Where did the 640 come from tho?

inner jewel
#

or just (x & wanted) == wanted

#

because you have another flag

#

early supporter is 512

quartz kindle
#

ah, thats why

formal agate
#

Didn’t know

#

Probably

#

I hoped it wouldn’t be in flags

frigid juniper
#

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

rustic obsidian
#

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

signal prairie
#

I only used discord.py a little so i can't help you too

rustic obsidian
#

I also suggest doing discord.js, Imo it's easier

marble needle
#

what'd be the best/safest way to go about event message customization? (for join, leave all that type of stuff)

quartz kindle
#

like creating your own custom events?

frigid juniper
#

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

marble needle
#

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

amber fractal
#

replace?

#

well

#

You could just use the user Welcome ${<Member>.user.username}

quartz kindle
#

the safest way would be to use string.replace

marble needle
#

couldn't people basically eval shit they shouldnt be able to if i used template literals for that

amber fractal
#

Oh customize their own response, yea replace then

quartz kindle
#

afaik, js strings automatically escape/sanitize themselves

#

so any string functions should be safe

marble needle
#

alright thanks (:

amber fractal
#

"{user}".replace("{user}", "rm -rf") mmLol

quartz kindle
#

replace("{user}", "eval('process.exit()')")

marble needle
#

wth 👀

quartz kindle
#

replace("eval","nice try noob")

amber fractal
#

Let me go to mdn and delete their entire database now mmLol

quartz kindle
#

good luck

amber fractal
#

Wait

#

you can eval on mdn

#

tf

marble needle
#

wait what

amber fractal
marble needle
#

LUL

amber fractal
#

Its probably safe tho

marble needle
#

obviously, doubt they'd let people run around with full blown evals

amber fractal
#

every demo is on its own VM

marble needle
amber fractal
#

rm is not defined :(

#

I'd need exec for that

quartz kindle
#

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

viral spade
#

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?

quartz kindle
#

i dont think thats possible

#

afaik, discord doesnt provide any reasons for disconnection

#

it just tells you when it does

inner jewel
#

^

quartz kindle
#

thank you for the confirmation, lord master king

viral spade
#

thanks!

formal agate
#

Is there any place that lists all the user flags for a user.

#

Not just the hypesquad stuff

inner jewel
#

not oficially

formal agate
#

Nvm

#

Found one

quartz kindle
#

nice find

slate kayak
#

anybody know how to get the lag fixed on music bots ???

quartz kindle
#

either your code is bad, or your server is bad

keen drift
#

or both

prime oriole
#

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

earnest phoenix
#

wha is that

prime oriole
#

Its blocks swear words

earnest phoenix
#

ah

#

is it javascript?

prime oriole
#

No python

earnest phoenix
#

ew

#

Jks but yeh

#

sorry cant help

#

im javascript

prime oriole
#

Oof ok

quartz kindle
#

regardless

#

please use code blocks and proper indentation

prime oriole
#

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

trim saddle
#

@prime oriole the event args are before, after

#

Not message

prime oriole
#

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

turbid gale
#

The event is called on_message_edit

prime oriole
#

O ok thx

lusty dew
#

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

prime oriole
#

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:

quartz kindle
#

idk python, but you can try adding logging to console to see until where the code executes correctly

prime oriole
#

It didn't report any error.

quartz kindle
#

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

lusty dew
#

How could I get the number of people who reacted to a reaction?

prime oriole
#

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

quartz kindle
#

you're not receiving anything at all from the message edit event?

prime oriole
#

@lusty dew try using something like

on_reaction_say(message)
message = ctx.message.author
lusty dew
#

Not everyone is using python my guy

prime oriole
#

What do u use? Js?

lusty dew
#

Mhm

prime oriole
#

Humm

#

@quartz kindle that's correct
@lusty dew idk then

lusty dew
#

Mk

#

Don't ping me then?

quartz kindle
#

are you using v16 or rewrite?

lusty dew
#

Whom?

quartz kindle
#

wildmaster

prime oriole
#

No

lusty dew
#

Probably rewrite

#

No?

quartz kindle
#

@lusty dew for you, you have to set up a reaction collector

lusty dew
#

I tried

#

I can't remember how

#

xd

quartz kindle
#

show code then lul

lusty dew
#

K lel

prime oriole
#

Im using wordpad

lusty dew
#

Bitch wtf

quartz kindle
#

@prime oriole i mean

lusty dew
#

v16 and rewrite aren't coding prgrams

prime oriole
#

Yes

quartz kindle
#

which version of it?

lusty dew
#

They are versions of d.py

#

I bet rewrite

quartz kindle
#

there is v16 (latest/async/whatever)

lusty dew
#

No one uses v16 anymore

quartz kindle
#

and there is rewrite (v1)

#

or whatever their names are

lusty dew
#

Rewrite is the newest

#

v16 is the oldest

prime oriole
#

0.16.12

lusty dew
#

I think

#

Oh

quartz kindle
#

see

lusty dew
#

fucking end me now

quartz kindle
#

anyway

lusty dew
#

LOL

quartz kindle
#

im checking the docs for v16

#

or rathe v0.16

#

the event should be .on_message_edit(before, after)

lusty dew
#

Mk

#

Sending code in a sec

quartz kindle
#

which contains both messages, pre-edit and post-edit

prime oriole
#

So (before, after, message)?

lusty dew
#

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)

prime oriole
#

Ok

lusty dew
#

not sure how py works with getting the message

#

if it is

#

before.message

#

or what

#

idk

gentle relic
#

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

sick cloud
#

my bots died since it dropped off trending

#

so uh, just keep improving content and hope

keen drift
#

just word of mouth I suppose

#

My bot launched at like May of last year

#

took 2 months, then it exploded somehow

lusty dew
#

Lol

#

Hey Fishy

keen drift
#

hi

lusty dew
#

Question

#

In a filter for a reactioncollector are you able to use an array of emojis

#
const filter = (reaction, user) => reaction.emoji.name === ['✅', '❎']
keen drift
#

no clue, I don't use reactioncollector

lusty dew
#

Well fuck me

keen drift
#

i doubt it

sick cloud
#

use includes

keen drift
#

if you going to use array, use .includes

lusty dew
#

I am trying to get the number of people who reacted xd

sick cloud
lusty dew
#

You mean that?

sick cloud
#

yes

lusty dew
#

Mk

#

I am trying to get how many people reacted to check and how many people reacted to X

keen drift
#

doesn't the api include the count

inner jewel
#

only if you fetch the message

amber fractal
gentle relic
#

sketchy tips lol

lusty dew
#

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

keen drift
#

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

lusty dew
#

That is my cmd handler

#

probably client.commands

#

I'd probably use that to sort through my commands

earnest phoenix
#

Where to put constructor?

keen drift
#

what

#

It's part of the constructor option, it's in the docs, it's in the wiki

#

and prob documented again else where

lusty dew
#

lol

earnest phoenix
#

OK

lusty dew
#

Could I do

#

client.commands.sort()

#

Oh wait sort requires a function

keen drift
#

idk where your command stack is stored

lusty dew
#

in client.commands

keen drift
#

then just iterate that

lusty dew
#

Wdym?

keen drift
#

iterate the object keys Thonk

lusty dew
#

so like

#

Ok

#

I think I got it

amber fractal
#
key: value,
key2: value2,
//etc
}```
#

You can easily iterate over this

gentle relic
#

Anyone happen to have an mp3 of a Discord ping or know where to find one?

sturdy delta
#

oops sorry accidental ping

lusty dew
#

function now() { [native code] }

#

I have no idea why I am getting this

#

Can someone explain what it means?

inner jewel
#

you're printing a function

lusty dew
#

Ah mk

#

Hm

#

then how would I do this

#
Object.keys(client.commands).forEach(command => {
                        command.conf.name
                    })
#

oof

#

wait

empty hare
#

ok quick question am i like the only one in python

amber fractal
#

false

lusty dew
#

^

amber fractal
#

I know many python users

#

Im not one tho

lusty dew
#
                    .setDescription(Object.keys(client.commands).forEach(command => {
                        command.conf.name
                    }))
#

How would I do that then?

trim saddle
#

How exactly are you structuring your request?

empty hare
#

do u want to dm me so we dont need to deal with the extra shit or is in here fine

lusty dew
#

You see it right there

trim saddle
#

You can send it here

empty hare
#

ok

#

do u want my whole code or just the part that the website gave me

amber fractal
#

I use a for loop to iterate objects, personally

trim saddle
#

The snippet when you post

empty hare
#

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

keen drift
#

code block exists

empty hare
#

how

#

im dumb im sorry

#

how does one do that

keen drift
#

triple `

lusty dew
empty hare
#

'''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))'''

lusty dew
#

....

empty hare
#

uh

keen drift
#

backtick

#

backtick not single quote

lusty dew
empty hare
#
  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

trim saddle
#

Did you have the dblpy package installed

empty hare
#

i do

#

its not gicing me an error

#

just not working

lusty dew
#

You know hastebin exists :/

trim saddle
#

Is this at all edited from the example

amber fractal
#

you know you dont have to speak in italics?

empty hare
#

nope straight copy and paste

keen drift
#

...

trim saddle
#

So

lusty dew
#

I can if I want though

keen drift
#

straight copy and paste and expects it to work

trim saddle
#

You didn't change the token part

empty hare
#

i didnt feel ike doing much dude it was 2 am

keen drift
#

at least read the comments

empty hare
#

ah that makes sense

amber fractal
#

Whatever you want to do I guess.

empty hare
#

IT WAS 2 AM

trim saddle
lusty dew
#

No need to use all caps

#

I doubt he was even talking to you I think he was talking to me

empty hare
#

Lol thx no worries, soryr for being so unobservant XD

lusty dew
#

Mk

#

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

vast stag
#

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 😃

crude portal
#

Hey, does anyone know how to get a bot in Discord.js to send a message with a channel link like #rules-and-info

amber fractal
#

<Channel>.toString()

inner jewel
#

<#channelid>

amber fractal
#

Or that

crude portal
#

Cheers!

inner jewel
#

eg [#development](/guild/264445053596991498/channel/272764566411149314/) == #development

crude portal
#

Thanks a lot

amber fractal
#

Both work, I guess it depends if you have the channel obj or the id mmLol

inner jewel
#

you always have the id

#

:^)

amber fractal
#

but toString() is easier if you have the object

#

message.channel.toString() <#${message.channel.id}>

#

ok markdown hates me

lusty dew
#
{ 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

inner jewel
#

you don't want a forEach

amber fractal
#

^

inner jewel
lusty dew
#

It isn't in an array

inner jewel
#

it is

#

Object.keys(client.commands)

lusty dew
#
client.commands = {}
#

it isn't

inner jewel
#

...

#

learn js

#

Object.keys returns an array

amber fractal
lusty dew
#

Whatever

amber fractal
#

not whatever, mdn is usually the first thing that pops up when you google

lusty dew
#

wasn't talking to you

amber fractal
#

It applies anyways.

lusty dew
#

Ill figure it out

empty hare
#

@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

trim saddle
#

I suggest posting without the package then

#

@empty hare

empty hare
#

huh

#

oh thanks

#

i got a different code thing look in api youll see

cerulean haven
#

Um

amber fractal
#

Yes?

cerulean haven
#

what is the webhookauth: "password"

#

i mean what password

amber fractal
#

the password you gave it

#

on the dbl page

cerulean haven
#

ok

amber fractal
#

if you scroll all the way down

cerulean haven
#

now i gget it

amber fractal
#

you can set its auth

cerulean haven
#

ty

mental willow
cerulean haven
#

idk i code discord.js

mental willow
amber fractal
#

It doesnt look like thats the problem

#

idk why thats an issue tho

cerulean haven
#

ya

#

it's import discord

amber fractal
#

Im js, so I dont know much but import discord should work

#

Wait

#

🤔

mental willow
#

idk

amber fractal
#

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

mental willow
#

i was litterally readsing that

amber fractal
#

Are you using rewrite?

mental willow
#

i was using the latest

amber fractal
#

of rewrite?

mental willow
#

i think so

idle mountain
#

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

amber fractal
#

wouldnt importing fail then

mental willow
#

^^^^^^^

amber fractal
#

it wouldnt read a file it couldnt find

idle mountain
#

oh yeah you're right

#

that's odd

amber fractal
#

Either way its 1:35 AM imma get to bed, good luck with that

mental willow
#

yeah

#

xD

#

it is 4:35pm here

amber fractal
#

👋

lusty dew
#

Can someone please explain?

grand raft
#

What issue are you having

lusty dew
#

I don't know what to put

#

:/

grand raft
#

do you have a hostname

lusty dew
#

¯_(ツ)_/¯

grand raft
#

i.e. a domain name you bought/got using a generator?

lusty dew
#

Don't think so

grand raft
#

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

lusty dew
#

Mk

#

do I need to put something in

#

NS1 and NS2

#

?

grand raft
#

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

lusty dew
#

Welp fuck

#

Didn't work sigh

grand raft
#

what's it complaining about

lusty dew
#

the hostename

#

isnt valid or smth

grand raft
#

what hosting provider are you using

lusty dew
#

I am honestly just trying to get a vps for my bot

#

:/

#

Not a website (yet)

#

This one

grand raft
#

Never heard of it, but ¯_(ツ)_/¯

#

There's no technical reason why you have to have a domain name as your hostname

lusty dew
#

Idk I am desperate xd

grand raft
#

are you specifically looking for free hosting?

lusty dew
#

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

grand raft
#

Don't know what to recommend for that then

lusty dew
#

mk

cerulean haven
#

hm

#

Idk why but my webhookauth password is not working

#

actually i use the token for password omegalul (webhook token)

cerulean haven
#

heoku work for me

slender coral
#

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?

soft plaza
#

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

marble needle
#

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

wraith tendon
#

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?

sacred bronze
#

You create roles and channels?

#

Thats essentially how you can setup a server?

knotty steeple
#

@lusty dew any free vps is a scam

#

unless it comes from some legit company which is paid

earnest phoenix
#

not every single one is, but every single one is not reliable yeah

knotty steeple
#

name one which isnt a scam

#

and no glitch isnt a vps

earnest phoenix
#

i dunno i dont use free hosting

knotty steeple
#

exactly

marble needle
#

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

knotty steeple
#

w i n d o w s

#

v p s

#

no

marble needle
#

yea i know lillulmoa

topaz fjord
#

free

neon plume
marble needle
#

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 (:

neon plume
#

xD

#

can you help me to make music bot using discord py?

#

like rhythm

quartz kindle
#

that question is too generic

topaz fjord
#

*Rythm

earnest phoenix
#

a: no
detalied a: use lavalink and copy features because #originality

crimson verge
neon plume
#

i mean i need help in music codes

#

@earnest phoenix

earnest phoenix
#

like Tim said, the question is generic

neon plume
#

hmm

earnest phoenix
#

we can help you if you target a specific topic, e.g "how to make my song loop in lavalink"

neon plume
#

hmm

#

or else help me in level

#

system

#

@earnest phoenix

earnest phoenix
#

what

neon plume
#

xp

earnest phoenix
#

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

neon plume
#

hhh

#

kkk

cobalt dune
#

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));```
quartz kindle
#

awaitReactions has a time option, to specify how long it should wait

cobalt dune
#

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.

earnest phoenix
#

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

sick cloud
#

depends if you want to use a normal map or a collection

#

its up to you

earnest phoenix
#

But which one is better

sick cloud
#

thats for you to decide

#

collections are just improved maps

earnest phoenix
#

oh

lofty hamlet
#

Hi i have a question,

sick cloud
#

then ask it instead of asking

lofty hamlet
#

Yes wait i write this

#

I know

sick cloud
#

what

lofty hamlet
#

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 ?

quartz kindle
#

@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

cobalt dune
#

alright thanks

quartz kindle
#

@lofty hamlet for (var i = 0; i < 15; i++) {

lofty hamlet
#

Yes ?

quartz kindle
#

you're always looping 15 times, so if there are less than 15 items, it will crash because the item doesnt exist

lofty hamlet
#

Ok how should I do it? @quartz kindle

quartz kindle
#

you can do for (var i = 0; i < Dresseur.length; i++) {

lofty hamlet
#

I may have an idea

#

Ok ok

#

I go test

#

It does not work @quartz kindle

#

:/

quartz kindle
#
  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

lofty hamlet
#

🤔

quartz kindle
#

try removing nb++

#

and doing Dresseur[nb++]

lofty hamlet
#

@quartz kindle not work i have remoove nb++; and replace for (var i = 0; i < Dresseur[nb++]; i++) {

quartz kindle
#

no

#

not replace for

lofty hamlet
#

Hum ?

quartz kindle
#

this

#

Dresseur[nb] = {

lofty hamlet
#

Oh ok noty this for ?

quartz kindle
#

this part

#
nb++;
                    var Dresseur1 = Dresseurs[message.guild.members.map(user => user.id)[i]];
                    Dresseur[nb] = {```
lofty hamlet
#

And i leash for (var i = 0; i < Dresseur.length; i++) {

quartz kindle
#

yes that part stays the same

lofty hamlet
#

Ok ok i test

#

And it works thanks @quartz kindle

quartz kindle
#

👍

lofty hamlet
#

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

quartz kindle
#

in the for

#

you can put

#

if(i > 15) { break; }

lofty hamlet
#

Hum

#

The for of dresseur.lenght ?

quartz kindle
#

yes

lofty hamlet
#

below topcount++ or up ?

quartz kindle
#

in the beginning of the for

lofty hamlet
#

Should it still send the top of 15

quartz kindle
#

the place where you had if (Dresseur.length < 15)

#

this means

lofty hamlet
#
                if(i > 15) { break; }```
#

Ok ok

quartz kindle
#

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

lofty hamlet
#

Ok ok like this?

quartz kindle
#

yes

lofty hamlet
#

Thanks you

restive bough
#

@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
}
sick cloud
#

what would be the easiest way to make a script that downloads a load of pngs from urls in an array?

daring trellis
#

how to use jimp.composite in discord.js?

alpine scarab
#

i am having this error when pushing my bot on heroku ERROR: Unsupported FFmpeg version: 3.3.2

restive bough
#

@sick cloud in javascript?

sick cloud
#

or any other, i just need a quick script to do it so language doesn't matter

fallen fjord
#

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!

sick cloud
#

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

marble needle
#

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

sick cloud
#

(you can literally make bots in nim now)

fallen fjord
#

@marble needle @sick cloud thank you for the answers! will try my hand a JavaScript 😄

marble needle
#

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

deft abyss
marble needle
#

why not use that

marble needle
#

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

quartz kindle
#

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

marble needle
quartz kindle
#

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

marble needle
#

oh well, guess ill pull through for the experience and fun

quartz kindle
#

yeah

lusty dew
#

if cdHours = 24
and I do
cdHours * 1000 * 60 * 60
that would make it 24 hours right?

marble needle
#

24 hours are 86.400.000 ms

lusty dew
#

Ok

#

not what I asked

marble needle
#

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 mmLol

lusty dew
#

Mk

#

Thanks

#

I kinda forgot calculators existed for a second

#

uwu

zinc pawn
#

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)

amber fractal
#

it looks like a regular object

zinc pawn
#

i've no idea how to get these things

#

just starting off

amber fractal
#

obj.key.key.key[key]["key"]

#

etc

zinc pawn
#

🤔

marble needle
amber fractal
#

an object is a key/value pair

lusty dew
#

how could I use moment

#

to get the time from a cooldown

#

that is set up like this

#

let cooldown = new Set()

amber fractal
#

My cooldowns are so overworked

lusty dew
#

Ok

#

That is nice ig

marble needle
#

eris has built-in cooldowns thinknow

lusty dew
#

but how do I get a time from the cooldown using moment

#

Also again nice ig

#

I am using Discord.js though

#

so

marble needle
#

what does moment have to do with accessing data from sets though

amber fractal
lusty dew
#

To put it in a Format

#

:/

amber fractal
#

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

marble needle
#

why do you need formatted time data in the set, save cooldowns as unix timestamps and format when you need to output anything

lusty dew
#

so I would do

moment().get(daily_cooldown).format('h:mm:ss a')
carmine echo
#

Will discord exist by 2038

earnest phoenix
#

|| why did my music quality get worse suddenly (some time ago, still bad quality)? 🤔 ||

ruby dust
#

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?

inner jewel
#

you could store it in the state for example

#

then redirect to the proper page

ruby dust
#

Could you elaborate? This is my first time working with oauth2

spare glen
#

how do you tag a id

#

that tags the username

#

not id

inner jewel
#

what

#

all mentions are <@id>/<@!id>

earnest phoenix
#

well message.author works as tag aswell

spare glen
#

yes but i dont wanna tag the username but the id

earnest phoenix
#

so

#

just make it say the id?

#

or idk

spare glen
#

like that

inner jewel
#

state can be whatever

ruby dust
#

Thanks

inner jewel
#

@spare glen that only happens if the user isn't cached by the client

spare glen
#

ugh

#

but i want it to tag the id eitherway

#

to bad

ruby dust
#

Why

spare glen
#

for the looks

ruby dust
#

It doesn't work that way

inner jewel
#

same thing happens for any other id

#

once the client caches the user with that id

spare glen
#

k?

earnest phoenix
#

no u

inner jewel
#

it'll show the username

#

instead of the id

earnest phoenix
#

ID

ruby dust
#

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

zinc pawn
#

How would I turn role permissions bitmap into an array?

amber fractal
#

I would say something but i know nothing about that so i wont :+1:

zinc pawn
#

lol rip

#

i was waiting on your typing

amber fractal
#

You use d.js right?

zinc pawn
#

yeah

amber fractal
#

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

zinc pawn
#

bitfield mb

amber fractal
#

I still dont know what that is mmLol

earnest phoenix
amber fractal
zinc pawn
#

heh 🤷

grand raft
#

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)

meager lava
#

Under what circumstances would message.member be null? Because I got an error from that

amber fractal
#

its in a dm

#

member is a guild member

meager lava
#

Ok then, for some reason someone DMed my bot.

amber fractal
#

I dm bots to store stuff

#

you can just return if the channel type is a bot

meager lava
#

Ok, thanks!

lusty dew
#

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

amber fractal
#

you'd have to read the file, parse the JSON and check if their xp is >= to xpneeded

lusty dew
#

mk

#

forgets how to parse jsons

#

Is there a doc for it?

amber fractal
#

JSON.parse()

lusty dew
#

Mk is there a doc on it though

#

Ah ok

#

thanks

#

fs.readFile can go through dirs right?

amber fractal
#

Yep

lusty dew
#

oof nvm

lusty dew
#

Hm

#

How do I read the file again?

#

i did

#

fs.readFile('./settings/level.json')

thorn nexus
#

Hello everyone, help with this question. if .createRole() creates a role, how do you delete the role?
discord.js

amber fractal
#

you didnt give it an encoding

lusty dew
#

What encoding would I put for a json?

#

utf-8?

amber fractal
#

Yes

marble needle
amber fractal
#
#

Lol

lusty dew
#

Lol

#
            let levels = fs.readFile('../settings/level.json', 'utf-8')
            JSON.parse(levels)
#

Is that how i'd do it?

amber fractal
#

readFile needs a callback

lusty dew
#

Oh yea

#

forgot

amber fractal
#

Also I dont think it returns anything because it has the callback

#

err, data

lusty dew
#

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

amber fractal
#

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

lusty dew
#

hm

#

I wonder

#

I am using a DB i forgot

#

Hm

inner jewel
#

why not use something like a formula to determine those values

lusty dew
#

I am about to use the DB I forgot I had for a second...

amber fractal
#

it doesnt look like it directly varies as it changes

#

like its not always *2

lusty dew
#

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

hushed berry
#

i dont think

#

thats really the best way to go about doing that

topaz fjord
#

you don't get the db to add a level

#

you make the db add a level

lusty dew
#
            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

grand raft
#

.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

lusty dew
#

I mean does anyone know if that is correct

#

what I have

grand raft
#

no, you specify the sort order as the first parameter

#

so { "id": 1 }

#

for ascending

lusty dew
#

Huh?

grand raft
#

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?

lusty dew
#

Don't I stop the process with

#

Process.stop()

#

or smth

grand raft
#

process.exit()?

lusty dew
#

Oh yea

#

I could restart the process by doing

#

oof

#

wrong chat

earnest phoenix
#

Are bots able to hear people and notice if someone is ear rapping ( I think no but I need to confirm it )

pseudo lion
#

@earnest phoenix no

grand raft
#

it's possible but not something built in

#

you could take your audio and test for excessive clipping

keen drift
#

define ear rapping

earnest phoenix
#

Shoutting loud while playing and speaking in voice chat?

quartz kindle
#

can bots listen to audio tho?

keen drift
#

Yes

earnest phoenix
#

that's what I was wondering

#

🤔

quartz kindle
#

i believe i saw a few voice recorder bots

keen drift
#

You can easily detect patterns of long lasting high frequency

quartz kindle
#

so it should be possible

pseudo lion
#

Thats a robot

#

What has intellect

#

👀

quartz kindle
#

you dont need an AI for that

keen drift
#

Fourier transform also helps to spot anonymities

earnest phoenix
#

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

quartz kindle
#

you need to analyze examples of ear-rape audio, and see if you can find any patern

earnest phoenix
#

since I want a clean voice play game & reporting ear rappers isn't that easy as it it is

keen drift
#

most ear rape are either very high frequency or extremely loud in amplitude

#

those are pretty easy to determine

earnest phoenix
#

This is going to be hard to do

keen drift
#

get a base line reading, then determine anonymity

earnest phoenix
#

😓

keen drift
#

look at FFT, get a discrete fourier analysis of a sum of waves

earnest phoenix
#

That's going to take me ages to understand that

amber fractal
#

D.js has a voice receiver

#

Idk if thats what you want tho

#

Or if you use d.js

#

Or what it does mmLol

earnest phoenix
#

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

amber fractal
#

They commit ear rap

lusty dew
#

How could I bring the bot back online after process.exit()

#

cause I did

#

client.login(token)

earnest phoenix
#

Restart it from console

amber fractal
#

^

lusty dew
#

It is supposed to be a restart cmd

amber fractal
#

Process.exit() stops the script

earnest phoenix
#

Unless it's pm2

lusty dew
#

Oh oof

earnest phoenix
#

No, it only restarts with pm2

lusty dew
#

Mk

#

What does pm2 do?

#

doesn't it like keep your bot going?

keen drift
#

a process manager

#

pm2 (process manager 2)

amber fractal
#

You too fast for my mobile self

keen drift
#

you can easily do this with system services, and other stuff

earnest phoenix
#

Em quick question , how to edit a message multiple times discord.js

grand raft
#

just call .edit() on the message again

#

though you'll probably wait to await or call .then(...) on the promise returned by edit before editing again so your edits don't submit out of order