#development

1 messages · Page 747 of 1

mossy shuttle
#

in X mins

#

so its not okay if its pinging?

earnest phoenix
#

it's not okay even if it's not pinging

#

because you're still looping it

modest maple
#

it basically works like this:

mossy shuttle
#

what about tatsumaki's reminder

modest maple
#

If youre looping a command

mossy shuttle
#

isnt the same action

modest maple
#

DONT

#

Tatsu only does it once

#

then has to be reset

mossy shuttle
#

aa

#

now I understood

#

its not okay because the command is automated and not actioned manually

#

ok

modest maple
#

its not okay cuz it loops an API call

knotty steeple
#

i hate having to make this cake bot

#

too much work because a random api for images of cake doesnt exist yet

unique nimbus
#

why not user imgur api and if there was a category setting choose for cake

#

🤔

knotty steeple
#

unreliable

earnest phoenix
#

yuck

#

get a cdn

knotty steeple
#

temporary™️

#

yes hopefully i will

lunar crystal
#
  console.log('Jirobo Kinder ')
});

client.on('message', message => {
  if (message.content === prefix + 'jirobo') {
  const jirembed = new RichEmbed()
  .setColor('679ec5')
  .setImage('https://imgur.com/gallery/XKuNlFc')
  .setTitle('Kinder Bueno')
  message.channel.send(jirembed)
}})
#

Why the image doens't appear ?

earnest phoenix
#

you need the direct link to the image

lunar crystal
#

Thank u ^^ It works ^^

barren moss
#

I have a question

#

Can I put my bot's website, but the website is still in development. Will it still be accepted, or will it be denied? It has the invite link in there tho.

#

™️

grizzled valley
#

im not getting any syntax error but its not playing the voice

#

whats wrong?

restive furnace
earnest phoenix
#

possible to make a gitbook on android?

knotty steeple
#

hi sorry im a dumbass how do i upload a file in a message with eris

#

need to upload image for command

#

actually can you use an image on your local machine on an embed how would you do that

cinder patio
#

mm provide the path to the image

knotty steeple
#

thats what ive been doing

#

for an hour

#

do i have to do a complete path

#

do i require

grizzled valley
#
def speak(speech):
    global num
    num += 1
    print("Pink_Guy : ", speech)
    Speak = gTTS(text = output, lang ='en', slow = False)
    file = str(num)+".mp3"
    Speak.save(file)
    ctx.voice_client.play(discord.FFmpegPCMAudio(file), True)
    os.remove(file)



def takeAudio():
    input = sr.Recognizer()
    audio = ''
    with sr.Microphone() as source:
        print("Say Fag...")
        audio = input.listen(source, phrase_time_limit = 5)
    try:
        text = input.recognize_google(audio, language ='en-US')
        print(f"{user.name} ", text)
        return text

    except:
        print("Fag dont even know how to speak")
        return 0
class Music(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

    @commands.command(aliases=["j"])
    async def join(self, ctx):
        hour = int(datetime.datetime.now().hour)
        if hour>=0 and hour<12:
            speak(f"Good Morning {user.name}")

        elif hour>=12 and hour<18:
            speak(f"Good Afternoon {user.name}")
        else:
            speak(f"Good Evening {user.name}")

            speak("Its Pink Guy here, how may i help you?")```
#

wtf is wrong with this thing? lmao

modest maple
#

whats the error

#

also

grizzled valley
#

fish heres the code

modest maple
#

do Python at the start of ur code so it does the python syntax

#

makes things cleaner

#

and like i said

#

error

#

or no eroror

grizzled valley
#

no error

#

it just wont play

#

tried using ffmpeg wont work

modest maple
#

ctx.voice_client.play(discord.FFmpegPCMAudio(file), True)

#

have u acttually parsed it context

cinder patio
#

not sure, I don't use Eris

modest maple
#

cuz doing ctx means nothing if you dont give it what it needs

vital lark
#

@knotty steeple check the docs

grizzled valley
#

i see

#

in that case

modest maple
#

bear this in mind ctx is just an object in reality

#

well i say that

#

but for simplicity sake we'll call it that

#

you cant call on somthing that it hasnt got

knotty steeple
#

i have

vital lark
#

it should be createMessage(content: string | object, file?: { name: string, file: Buffer })

#

so it should use the 2nd paramater

#

after the content

grizzled valley
#

okie dokie so shall it be something like this ?

        ctx.voice_client.play(discord.FFmpegPCMAudio(file), True)
knotty steeple
#

thanks discord

#

msg.channel.createMessage("hello", {file: {file: require("./some/file/directory")}})

vital lark
#

file needs to be a buffer

knotty steeple
#

how do i

#

do that

vital lark
#

don't think they can resolve files

modest maple
#

@grizzled valley urhm? how much python and discord.py experience have u got

knotty steeple
vital lark
#

they can resolve files but not by a path

modest maple
#

what in god's name is ctx.typing() got to do with playing an audio file - just like logically thinking

cinder patio
#

Use fs with readFile

#

and set he encoding to buffer

modest maple
#

google r u talking about the python code or Sammy's issue

cinder patio
#

Sammy

modest maple
#

ah kk

knotty steeple
#

n i ce

#

thanks u

cinder patio
#

note that you need to provide an absolute path to your file because fs tries to find it from your root project folder (where package.json is)

knotty steeple
#

thanks node

knotty steeple
#
const foile = files[Math.floor(Math.random() * files.length)]           fs.readFile(`${__dirname}/../src/CakeAPI/images/${foile}`, (err, f) => {
    if (err) {
        msg.channel.createMessage("oopsies an error has occured!")
        bakery.loggr.error(err)
    }
    msg.channel.createMessage("hell", {file: {file: f, name: "cakeimage"}})
})
#

does this really not work

vital lark
#

no

#

the object after the content just needs name (String) and file (Buffer)

#

also the name needs to end with the file extension .jpg as an example

knotty steeple
#

great

#

ok then

#

so just msg.channel.createMessage("hell", {file: f, name: "cakeimage"})

vital lark
#

yea

knotty steeple
#

alright

#

yas it works now cheer

knotty steeple
#

so now

#

can i put local files in an embed

cinder patio
#

look at the docs, if the function for setting images accepts buffer, then yes

wooden lance
#

anyone know how to find the bot's highest role in a guild? (discord.js)

twilit rapids
#

What version?

wooden lance
#

stable

modest maple
#

find which one gives the most perms ig

prime cliff
#

Just go through the roles the bot has and get the highest?

#

Some libs also have a heiracy number too

twilit rapids
#

<Member>.highestRole

#

Which returns the role object for the Member's highest role

wooden lance
#

ok, do you know how to get the client's member?

twilit rapids
#

<Guild>.me

wooden lance
#

thank you! :D

earnest phoenix
#

it's a server error

#

you can't do anything about it

#

oh ok

#

so no promotion for my server 😦

#

at most it could be a csrf mismatch so a refresh might help but other than that there's really nothing else except waiting

#

ok, thanks for the help 😄

twilit rapids
#

@pliant gorge was down for a bit and is now booting again. Shouldn't take much longer and it should be fixed

earnest phoenix
#

nice

empty owl
#

how do I track who invited my bot

pseudo whale
#

theres and event guildCreate but i dont think theres a way to track who exactly invited it

empty owl
#

yea

prime cliff
#

@empty owl you could do that with the oauth redirect

empty owl
#

ah

#

but not with guildCreate

#

?

prime cliff
#

When users invite your bot you can redirect them to your own website e.g top.gg/logthispath

empty owl
#

ok

#

wdym logthis path

prime cliff
#

You can choose where they are redirected

empty owl
#

ok

slender thistle
#

That isn't always reliable

prime cliff
#

Yea not really reliable since you would have to update your botlist pages with the new invite too

empty owl
#

so is it fine just to do guild.owner

prime cliff
#

Other users with manage server perms can invite your bot so not really

empty owl
#

ah

slender thistle
#

The user could also just remove the redirect_uri part

empty owl
#

but I can just do owner

slender thistle
#

That won't always be correct

#

you'd just be assuming it was the guild owner

empty owl
#

yeea

#

justy guildOwner: person

shy turret
#

This isn't 100% related to Discord bot development (it kind of is part of it), but how do you send a TCP request with (node)js?

#

working..

knotty steeple
#

doesnt have to be bot development btw

earnest phoenix
#

you guys know how some websites have an image next to the website title

#

how would i do that

mossy vine
#

a favicon?

earnest phoenix
#

yeah

#

place an image named favicon in your website root dir

prime cliff
#

You need to convert a png/jpg to an ico file which you can do online then put a "favicon.ico" in your website root

earnest phoenix
#

most browsers will pull it

#

.ico is not necessary it is not 2007 anymore

#

lol

#

thanks

#

modern browsers will accept today's standard image formats

prime cliff
#

Better to support that standard and it has less file size so it will load faster

earnest phoenix
#

it is a favicon

#

load speed is generally irrelevant

#

since it is such a small file it will get downloaded on a microwave within a second

#

plus caching

prime cliff
#

Still optimization and everything supports it

earnest phoenix
#

you risk quality with .ico s

prime cliff
#

You don't really need it to be HD if it's just a small icon

earnest phoenix
#

Hey guys having an annoying issue with my bot was wondering if you guys know the issue

west raptor
#

it seems you're trying to require a module that doesn't exist

earnest phoenix
#

Hey dream thanks for replying and yeah i just can't wrap my head around the issue it's been awhile since hosting my own bot and now i am having this issue.

#

So you would think loader.js doesn't exist?

west raptor
#

No, loader.js is an internal file nodejs runs

#

I actually don't know where the problem is exactly

#

you can verify you have all the packages you need in package.json

earnest phoenix
#

yeah i don't see loader

#

crap..

vital lark
#

do node .

earnest phoenix
#

had this earlier thought i fixed it

west raptor
#

delete your node modules directory I guess and run npm i

#

might fix it?

#

looks like an issue inside a module

earnest phoenix
#

I'll try that again

west raptor
#

make sure your package versions up-to-date also

earnest phoenix
#

ugh it's just such a mess tired updating and tried running npm i

#

would hate to trash this bot

west raptor
#

what's your node version

#

node -v

earnest phoenix
#

12.5.0 i was on 12.13.1 earlier and it was doing the same thing from what i can remember

#

worth a shot tho

west raptor
#

can you try using LTS

earnest phoenix
#

Sure thing! I'll give that a try right now 😛

west raptor
#

alright cool

earnest phoenix
#

thanks by the way dream

#

🙏

west raptor
#

no problem

earnest phoenix
#

same error

#

its so weird cause same error happens for
"npm update and npm i"

vital lark
#

do you have windows-build-tools installed globally

earnest phoenix
#

don't think so let me do that totally forgot

vital lark
#

you have to do it in powershell iirc

#

or adminstrator console

earnest phoenix
#

did it in administrator didn't seem to help god dammit boys idk anymore ahaha i feel bad taking your guys' time as well

#

it's no big deal

distant plank
#

@west raptor it was no use to pass it to a function, it always gave me the same number. :c

#

Already try different ways and none works

#

I just try to put the code inside the module so you don't have to do more work

earnest phoenix
#

Can i Filter Guild Regions? and when yes how?

cinder patio
#

library/language?

earnest phoenix
#

Discord.js v12-dev

cinder patio
#

client.guilds.filter(guild => guild.region /** Check region here*/)

slender thistle
earnest phoenix
#

this.client.guilds.filter(guild => guild.region === "europe").size

#

?

restive furnace
earnest phoenix
#

ok zoomer

glacial mango
#

How do I get the array from this?

[ '626159042896723968': [Array] ]```
cinder patio
#

array["626159042896723968"]

#

assuming this is an object and not an array

{
'626159042896723968': [Array]
}```
vital lark
cinder patio
#

how is that spoonfeeding lol

#

sorry - I accidently wrote him the whole bot

slender thistle
#

Giving code without explaining

wheat jolt
#

https://npmjs.com/mysql 's .query() isn't asynchronous

knotty steeple
#

make an asynchronous library then

surreal sage
#

would this work? js catch (err) { if(err === "RangeError: RichEmbed field values may not exceed 1024 characters.") { message.channel.send('\n' + evaled + '') } const embed = new Discord.RichEmbed() .setTitle('ERROR') .setAuthor('EVAL Warning', 'https://i.ibb.co/XpScxNQ/warning.png') .setColor('#ff4500') .setDescription('' + err + '') message.channel.send(embed) }

knotty steeple
surreal sage
#

lol

#

ok

knotty steeple
#

@wheat jolt is mariadb async

wheat jolt
#

huh?

knotty steeple
#

use mariadb instead

surreal sage
#

how can i catch permission error?

slow flare
#

my music bot comes to the audio channel when I command to play music, then comes out without playing the music

surreal sage
#

and i just saw what you can do with owner property

#

its just message.author

#

almost then

#

cuz js message.guild.owner.send('') works

wheat jolt
#

msg.guild.owner returns the guild owner

#

duh

#

not sure if the user of the guild member

earnest phoenix
#

In DiscordJS atleast message.guild.owner returns the guild owner (of course) as an GuildMember type. To get the guild owner as User type you need message.guild.owner.user.

surreal sage
#

well message.guild.owner(thing to do) works at the most things

#

but thats not why im here

#

how to catch the missing perms error?

earnest phoenix
#

uhmmmm

#

I know it has to do with the APIError type (https://discord.js.org/#/docs/main/stable/typedef/APIError) and that APIError has an error called MISSING_PERMISSIONS.

#

uhmmm

#

well... the source code of Discord.JS shows it's APIErrors are actually just numbers so....

surreal sage
#

so if i do: if(err.includes === "MISSING_PERMISSIONS") {} works?

earnest phoenix
#

I don't know....

#

try

if (err.code === 50013) { // 50013 represents the MISSING_PERMISSIONS error.
  // Some code here.
}
surreal sage
#

ok y

#

thx

earnest phoenix
#

I'm not even sure if that'll work tho

grizzled raven
#

cough

#

or the owner isnt cached

slow flare
#

pls help me

#

internal/modules/cjs/loader.js:584
throw err;
^
Error: Cannot find module './resources'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/app/dist/app.js:3:21)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)

pseudo whale
#

Its cant find a file

slow flare
#

would you like to help me on glitch

#

Can me send the glitch help link via dm?

modest maple
#
  1. Glitch bad dont use
  2. It cant find the file so ig u gonna have to go look for it and give it the right file path
  3. Either no2 OR you dont actually have the module installed properly
mossy vine
#

./resources is referring to a local file

earnest phoenix
#

@modest maple why is glitch so bad? It works fine and i never has issues

#

How can add Numbers on enmap?

slender thistle
#

Glitch was not created for bot hosting

earnest phoenix
#

It still does what it should

slender thistle
#

It does things other than what it's supposed to do

#

That, however, does not mean that it was created exactly for that purpose

restive furnace
#

its testing environment that means, you can test there your apps etc.

#

because look ram and memory ram only 128mb and memory 500mb

earnest phoenix
#

Its enough for me. Heroku is not good also. It has 550h of Hosting Time what id 22 Days

slender thistle
#

Unless they fixed it, that doesn't matter

twilit rapids
#

hold up

slender thistle
#

Those "550 hours" ran for a month just alright for me

modest maple
#

both of those sites are pretty useless if the bot gets bigger

#

or you want to add any decent new features

earnest phoenix
#

I think about buying a VPS cause Glitch does not Support Image Manipulation. What is cheap and good?

twilit rapids
#

Contabo

twilit rapids
#

Their VPS plans start at 4 euro per month

slender thistle
#

SkySilk have cheap prices

earnest phoenix
#

What of them is Good?

slender thistle
#

Depends on how much you are willing to pay. I suggest going through each website and comparing the specs and prices

earnest phoenix
#

Ok

modest maple
#

or self host

earnest phoenix
#

Now uhm, anyone knows how to add Numbers in Enmap?

modest maple
#

but not rlly worth unless u need big specs

twilit rapids
#

@zealous veldt add Contabo to your list "Popular" vps providers

twilit rapids
#

Wdym "add Numbers"

#

Just to store a number...?

earnest phoenix
#

Yeah

twilit rapids
#

You store it like you store anything else in enmap

earnest phoenix
#

in quick.db is it .add(..) but what is it in enmap?

twilit rapids
#

Read their docs...?

modest maple
#

TIMO!

#

u stole my 👏 👏

earnest phoenix
#

I can't find something there @twilit rapids

twilit rapids
late hill
#

@slender thistle the worker dyno would continue to work forever, but yes they did fix that a while back

#

Like

#

You could have 5 apps all using worker dyno

#

And they would be on for the entire month without any issues

#

lol

slender thistle
#

lmao

ocean rampart
#

What does “Discord.RichEmbed is not a constructor” mean. It didn’t use to say that.

#

lasagna would appreciate if someone could help please ty

earnest phoenix
#

what's your code, lib and lib version

#

are you sure you are requiring discord.js through "Discord"?

ocean rampart
#

Lemme check

#

this is my code

surreal sage
#

how to do secondary links like .setURL('url') but for regular text in like a field or so (richembed)

ocean rampart
earnest phoenix
#

@surreal sage you mean hyperlinks?

surreal sage
#

y

earnest phoenix
surreal sage
#

i tried but it didnt work

earnest phoenix
#

that

surreal sage
#

discord.js

earnest phoenix
#

worked for me so..

#

it only works in description and field values

surreal sage
#

wait

#

` <- this

#

?

earnest phoenix
#

no

#

what

surreal sage
#

not in ' -<

earnest phoenix
#

"

surreal sage
#

ok

earnest phoenix
#

yes

surreal sage
#

works

earnest phoenix
#

👍

ocean rampart
#

Mine still isn’t working

earnest phoenix
#
let server = client.guilds.get("589214763242750048");
server.members.array().forEach(m => {
...
});
``` Can someone tell me if I did something wrong here? Because it keeps saying "Cannot find "members" of undefined".
modest maple
#

isnt it client.get_guild()

earnest phoenix
#

wait is it?

#

no it isn't

#

this is discord.js

#

@ocean rampart Maybe try using " instead of '

ocean rampart
#

What?

earnest phoenix
#

that's irrelevant

#

the bot isn't in the guild or you're doing it before the guild data was downloaded @earnest phoenix

#

my bet is you're doing the latter

#

everything that interacts with discord and you want it to happen on boot, do it on your client's ready event

#

no

#

@flat pelican // @west raptor

#

the bot is in the server and i am trying to do like a list of servers with their members counted

#

no ads here

flat pelican
#

ty guys

#

handling it

earnest phoenix
#

are you doing it in a command

#

or

#

command

#

recheck your id

ocean rampart
#

Can anyone answer my question on why it continues to say Discord.RichEmbed is not a constructor please?

earnest phoenix
#

check the official example and compare it to yours

#

i checked the ID

#

@ocean rampart I dont find any problems. The only thing I can say i try reinstalling discord.js or change const to let.

#

that won't do anything

#

ik lol just to be sure

#

the difference between const and let is just scoping rules

#

ik

#

and immutability

#

i just know that const cant be changed while let can

modest maple
#

thats kinda the idea

earnest phoenix
#

i fixed my problem by restarting the bot

#

nani?

ocean rampart
#

It says client is not defined now

earnest phoenix
#

are you sure you passed it down and its not mispelled?

ocean rampart
#

here's my current code

earnest phoenix
#

jesus christ

#

that's not how js works

#

well, node

ocean rampart
#

Wdym

grizzled raven
mossy vine
#

you dont need to import discord.js on every command usage or log in again per command

modest maple
#

id advise watching a couple more tutorials

#

xD

grizzled raven
#

you defined discord after using it, you defined client after passing client through a parameter

harsh nova
#

you defined Discord under wherever you used it

mossy vine
#

or just trying to understand what the code actually means

grizzled raven
#

and you logged in again

#

that doesnt matter

harsh nova
#

wait really?

grizzled raven
#

yes lol

harsh nova
#

nvm then

grizzled raven
#

discord.js does it for you

#

if the content parameter is an object, it makes the options parameter the content

ocean rampart
#

So everything in it is wrong?

grizzled raven
#

not everything

summer acorn
#

Why does this

{
  "server": {
    "bans": {},
    "mutes": {},
    "kicks": {},
    "warns": {},
    "lockChans": {},
    "configs": {
      "punishLogs": "false",
      "punishLogsChannel": "none",
      "actionLogs": "false",
      "actionsLogsChannel": "none",
      "appLogs": "false",
      "appLogsChannel": "none",
      "xprate": 1,
      "levelRewards": {},
      "levelMsgs": "false",
      "levelChannel": "none",
      "levelMsg": "Congrats {member}! You've just hit level {level}!",
      "premium": {
        "enabled": "false",
        "user": "none"
      },
      "prefix": "%",
      "customItems": {
        "customReplies": {},
        "customCMDS": {}
      },
      "joinWelcome": {
        "enabled": "false",
        "channel": "",
        "msg": "Welcome {member} to {guildname}! You are member {joinpos}!",
        "embed": "false"
      },
      "serverBotBans": {},
      "disabledCMDS": [],
      "joinRole": {
        "enabled": "false",
        "role": ""
      },
      "levelOn": "true",
      "rolePers": {},
      "tempRoles": {
        "add": {},
        "remove": {}
      }
    },
    "levels": {}
  }
}

give the error

SyntaxError: databases/642304841170812939.json: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at /rbd/pnpm-volume/5e67cf9e-ab38-4576-ac99-0726c5933577/node_modules/.registry.npmjs.org/jsonfile/4.0.0/node_modules/jsonfile/index.js:33:18
    at /rbd/pnpm-volume/5e67cf9e-ab38-4576-ac99-0726c5933577/node_modules/.registry.npmjs.org/graceful-fs/4.2.3/node_modules/graceful-fs/graceful-fs.js:115:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)
ocean rampart
#

I think u should put that in a hastebin

earnest phoenix
#

stop using json files as a database

grizzled raven
#

just add an extra }

#

seriously just add an extra }

summer acorn
#

Oh, I didn't do anything to the file, the temp role feature did.

harsh nova
#

json is fine as a database as long as its not a project too big

earnest phoenix
#

it's not fine lol

sudden geyser
#

no it's not

grizzled raven
harsh nova
#

ok i've been tought fake news

sudden geyser
#

any moment you write it can go bye bye

summer acorn
earnest phoenix
#

you're doing IO operations which are sync and there's a high risk of having data corruption

ocean rampart
harsh nova
#

oh yeah i've just never had that issue with my old bot since nobody uses them

grizzled raven
#

json databases are fine if you want to have issues later on and literally want to break your keyboard

sudden geyser
#

try it out and see

earnest phoenix
harsh nova
#

thanks bill

ocean rampart
#

nope

#

It said Discord.RichEmbed is not a constructor

grizzled raven
#

what

sudden geyser
#

is that a mistyping

grizzled raven
#

Embed = new .setColor('#ffff00') .setTitle('Invite Me To Your Dimension!')

round ridge
#

Pls help fast i get this error:

    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)```
When i start my bot i get that error
i use phpmyadmin

Pls help 🙂
ocean rampart
#

Oh

#

Lol no that's just me being idiotic

summer acorn
#

I actually don't know how to work any other database than JSON

modest maple
#

good time to learn

grizzled raven
#

star off with somehting simple and easy to use lol

summer acorn
#

And everything works fine in my databases, except for the temprole

sudden geyser
#

zApex, learn sql first

grizzled raven
#

idk start with quick.db at this point

sudden geyser
#

then pick any database you think will work

#

like a basic sqlite if your app's small

summer acorn
#

I've tried learning sqlite, but I just can't understand it.

ocean rampart
#

it said the same thing again

earnest phoenix
#

you don't have to know sql to use sql databases

#

use an ORM framework

sudden geyser
#

like sequelize?

earnest phoenix
#

yeah

summer acorn
#

How can you use something, without a clue how to use it?

modest maple
#

BY LEARNING

grizzled raven
earnest phoenix
#

how can you use a knife without a clue on how to use it

#

you just do

grizzled raven
#

instructions unclear

earnest phoenix
#

ORM frameworks basically write the sql for you

placid iron
#

idk

#

SQLite is pretty easy to learn

sudden geyser
#

you won't just learn sql and know everything automatically

#

you'll get used to it as time goes on

placid iron
#

oh yeah definitely, thats basically what coding is hahaha

#

over time you just know what to use

summer acorn
#

Well, yeah I know, but I've tried learning it in the past, and I just couldn't work it out.

placid iron
#

i guess handling files is easier than using SQL commands if you know how to work with strings and things

summer torrent
#

how to change database name in mongoDB (cloud) ?

summer acorn
#

The only way I know how to get what I need is with this db.server.configs.tempRoles.add[member.user.id][i].role

round ridge
#

Pls help fast i get this error:

    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)```
When i start my bot i get that error
i use phpmyadmin
 
Full error: https://hastebin.com/eyigijijun.rb

I did start and restart mysql server
earnest phoenix
#

sorry i don't use phpmyadmin and idk what's that

#
let finfo = await db.collection("factions").findOne({_id: "info"});
    let list = "";
    let members = 0;
    for(var i = 0; i < finfo.count; i++){
      db.collection("factions").findOne({_id: i}).then(fsinfo => {
      let fserver = client.guilds.get(fsinfo.serverID);
        fserver.members.array().forEach(m => {
          if(m.user.bot) return;
          members = members + 1;
        });
      list += `**[${parseInt(i)+1}]:** \`${fsinfo.name}\` (${members} members)\n`;
      });
}
    let embed = new Discord.RichEmbed()
    .setTitle("List of factions.")
    .setDescription(list)
    .setColor("#ffa500");
    message.channel.send(embed);
``` I use discord.js and MongoDB (not mongoose). The only thing I get in the embed is the title and no description about the factions. The console didn't upload anything so.. any idea of what's going on?
sudden geyser
#

it might be due to the promise being resolved "later"

earnest phoenix
#

any clue on how to fix that?

earnest phoenix
#

How to add Roles on v12-dev?

deft bobcat
#

Can i make it so you need to have voted for the bot in order to use a command before the bot is approved and listed?

sudden geyser
#

la dev, to a member?

#

well you probably can't do that without an api key

#

but without a lot of features being vote locked a ton yeah

surreal sage
#
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});``` how to use that webhook thingy
#

nvm

#

continue

blissful scaffold
#

People can't vote for your bot when it isn't accepted on the bot list yet

surreal sage
#

its accepted..

blissful scaffold
#

That was meant for @deft bobcat ^^

earnest phoenix
#

How to add Roles on v12-dev? please

surreal sage
#

oh

earnest phoenix
#

go read the docs @earnest phoenix

#

cant find something there.

#

everything you need is there

surreal sage
#

hook is a variable but what to enter there?

earnest phoenix
#

what

surreal sage
#
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});``` how to use that from the webhook?
earnest phoenix
#

use what

surreal sage
#

webhook

earnest phoenix
#

you need to have a webserver with an open port

#

webhooks are reverse api requests

surreal sage
#

is a discord webhook ok?

earnest phoenix
#

no

#

discord webhooks are not dbl webhooks

surreal sage
#

ah.....

#

but do i need that dbl.webhook

#

well

#

what is the value of it

#

nothing...

earnest phoenix
#

as i was saying, webhooks are reverse api requests, instead of you making the requests to the api, the api makes requests to you

surreal sage
#

so i dont have to do anything if i want to log that a user has voted?

earnest phoenix
#

well you have to use the lib

#

the lib opens a webserver for you

surreal sage
#

i have it y

#

ok

#

so nothing to do?

earnest phoenix
#

pretty much

surreal sage
#

ok

#

gonna try then

earnest phoenix
#

you just have to match the data

surreal sage
earnest phoenix
#

your api keys, add a webhook url on the api site etc

surreal sage
#

f

#

im under 1k votes

#

and i want to know who voted

rugged minnow
#
  execute(message, args) { 

async function execute(){
  if (message.author.id !== '305771483865546752') return;
    
      let evaled;
      try {
        evaled = await eval(args.join(' '));
        message.channel.send(inspect(evaled));
        console.log(inspect(evaled));
      } catch (error) {
        console.error(error);
        message.reply('there was an error during evaluation.');
      }
    } 
    execute();
  };```

the last line is giving "unexpected token ;"
even tough everything seems to be working
amber fractal
#

why do you have execute(message, args){ at the top @rugged minnow

rugged minnow
#

because i'm separating each command in a separated file

amber fractal
#

execute takes no parameters

rugged minnow
#

i always used it, but it shouldn't be the cause of the error

amber fractal
#

Well your error is the fact that you're missing a }

rugged minnow
#

god i need a new monitor and a new pair of glasses

mossy vine
#

@safe jungle defBase and defIV are strings, so the + operator concatenates them

amber fractal
#

Also, execute(message, args){ will cause an error

#

It inst a function definition

#

your { isnt needed

rugged minnow
#

i defined it in my main script

amber fractal
#

so why do you have an opening bracket when calling it?

sudden geyser
#

try removing the ";" at the very bottom

#

I don't remember if it plays a role or not

rugged minnow
#

tried that, it still gives an error, but it turns out that @amber fractal was right

#

i forgot to close a }

surreal sage
#
const DBL = require("dblapi.js");
const dbl = new DBL(tokenf.dbl, client);``` i got these and how to setup on vote event
sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

surreal sage
#

i am

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

surreal sage
#

but i dont fully understand

#
const DBL = require('dblapi.js');
const dbl = new DBL(yourDBLTokenHere, { webhookPort: 5000, webhookAuth: 'password' });
dbl.webhook.on('ready', hook => {
  console.log(`Webhook running at http://${hook.hostname}:${hook.port}${hook.path}`);
});
dbl.webhook.on('vote', vote => {
  console.log(`User with ID ${vote.user} just voted!`);
});```
#

that with webhookport etc

#

and wheres the "client" at the "db" var?

sage bobcat
#

One message removed from a suspended account.

knotty steeple
#

hat

surreal sage
#

i dont fully understand

knotty steeple
#

hat

earnest phoenix
#

dbl webhooks are unrelated to discord

surreal sage
#

ik

sage bobcat
#

One message removed from a suspended account.

knotty steeple
#

^

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

shy turret
#

Can someone help me connect my discord bot with a tcp connection?

summer torrent
#

this is my code. I get this error ```js
TypeError: Cannot read property 'channelID' of null

amber fractal
#

res isnt defined

summer torrent
#

no

amber fractal
#

Yes

#

literally that's what that means.

#

You have if(res) return

#

if it got there res isn't defined

#

and it got there

#

and just the fact that that's what that error means.

#

you probably meant if(!res)

summer torrent
#

oh

#

🤦

earnest phoenix
#

how to set the Extension of an iconURL?

#

what

#

that the iconURL ends with .gif

#

not with .webp or .png

#

yes and

modest maple
#

if the hash has a_ before it

#

just make it add .gif to the end

earnest phoenix
#

uh how?

#

you don't have to

modest maple
#

by checking the hash?

earnest phoenix
#

discord will automatically return the correct format even without the extension

modest maple
#

not if its a gif?

#

i was testing earlier

earnest phoenix
#

even if it's a gif

#

message.guild.iconURL({extension: ".gif"})?

#

is that above right?

#

uh no

#

you can't make up your own methods

#

consult with the docs

earnest phoenix
#

got it

#

ah the client doesn't render it

#

discord does return the correct format though

modest maple
earnest phoenix
#

click on the link and open it in a browser

modest maple
#

for me when i was doing it with discord it wont render

#

unless u did gif

earnest phoenix
#

how do i add the a_ between the url?

modest maple
#

wasnt exactly a hard fix to just check if a_ is before it

earnest phoenix
#

it won't render as animated because discord's dev team is incompetent and they depend on the extension of the url lol

modest maple
#

yup

earnest phoenix
#

the api//cdn returns the correct format 🤷‍♂️

modest maple
#

yet discord still fucks it

#

xD

restive furnace
#

Any better solutions (discord.js-v12.0.0-dev). At rn it rounds into 1 min if secs is > 30

let up = client.uptime;
 let secs = Math.round(up / 1000)
 let mins = Math.round(secs / 60) let hours = Math.round(mins / 60) 
let days = Math.round( hours/24 )```
earnest phoenix
#

why not just create a Date object

#

and use the methods from that

charred loom
prisma lion
#

o

#

m

#

g

charred loom
#

?

#

know, is easy

#

but ..

prisma lion
#

i need a big zooom

#

lol

charred loom
#

cannot find module

prisma lion
#

wut

#

i cant seee

charred loom
#

...

#

link ?

earnest phoenix
#

read the error

charred loom
#

i read

earnest phoenix
#

and what does it tell you

charred loom
#

cannot find module

loud salmon
#

@earnest phoenix time to mute

earnest phoenix
#

now recheck the folder name and the name in the code

charred loom
#

ok

earnest phoenix
#

lol

modest maple
#

he hit 22 times

#

🔇

loud salmon
#

-m @charred loom Help vampire, constantly asking about questions that can be easily solved by learning the language they were coding in. They were warned not to ask those similar types of questions, but failed to heed the warning. | 1 week

gilded plankBOT
#

🤐 Muted zZCipricaZz#1442 (@charred loom)

prisma lion
#

can i have help

wooden lance
#

you dont need to ask, what is your question?

prisma lion
#

mm

#

it doesnt work.

#

i tried ..

wooden lance
#

what am i looking at exactly?

amber fractal
#

why

#

why is it all on one line

prisma lion
#

well

wooden lance
#

im so confused it makes zeros sense

prisma lion
#

i just copy pasted it from the visual code

amber fractal
#

We cant help something we cant read

prisma lion
#

a sec

wooden lance
#

send screenshot

#

um

prisma lion
#

hehe

wooden lance
#

wot

prisma lion
#

well

wooden lance
#

um

knotty steeple
#

oh my god

#

my eyes

#

please format that code

#

wtf

prisma lion
#

lol

wooden lance
#

it makes zero sense

prisma lion
#

how to

#

format

#

the

#

code

knotty steeple
#

do you code like that?

#

what do you mean how

prisma lion
#

no

knotty steeple
#

format it

prisma lion
#

lol

wooden lance
#

u doing it in visual studio or?

prisma lion
#

ye

knotty steeple
#

like anyone would

wooden lance
#

take a screenshot

prisma lion
#

hehe

#

k

wooden lance
#

then post the screenshot

knotty steeple
#

if your gonna be annoying im not gonna help

#

so dont be like heHEHhHEHEE

#

i cant read that shit

wooden lance
#

i dont think anyone could

prisma lion
#

ye

#

wait

wooden lance
prisma lion
#

well

#

nvm

#

i found it

#

i didnt add 2 )

#

xD

#

hehe

wooden lance
#

ok then

#

wait, visual studio would of told u...

prisma lion
#

ehm

wooden lance
#

:/

broken jay
#

Anyone know any open source JS bot that use Eris library and is splited to multiple files (like 1 or more commands in one file)? I just want to see how to split...

unique nimbus
#

Have you read the docs

restive furnace
#

What was the normal emoji structure?

#

animated was<🅰️name🆔>i fi remember right

unique nimbus
#

well

#

wait

#

that

#

its structured like that

restive furnace
#

thanks

unique nimbus
#

np

slender thistle
unique nimbus
#

illegal

broken jay
#

@unique nimbus Yes, I already readed docs, but I can't find nothing

modest maple
#

you know splitting stuff up into files is the basics of the programming language right?

broken jay
#

Depends... I know this on Python, but in JS... I'm new in JS. I switched to JS due performance issues.

trail reef
#

So how would I cancel a task? I want to make it so if I reload the extension, the tasks themselves will also be restarted.

Here's my code:

    def cog_unload(self):
      #what would I need to put here?

    async def activity(self):
        await asyncio.sleep(2)
        while not self.bot.is_closed():
            with open("playing.txt", "r") as file:
                playing = file.readlines()
            await self.bot.change_presence(activity=discord.Game(name=choice(playing)))
            print("ACTIVITY UPDATED")
            await asyncio.sleep(10800)
        
    async def topggstats(self):
        await asyncio.sleep(2)
        while not self.bot.is_closed():
            await self.dblpy.post_guild_count()
            print("DBL STATS UPDATED")
            await asyncio.sleep(1800)
            
    @commands.Cog.listener()
    async def on_ready(self):
        self.bot.loop.create_task(self.activity())
        self.bot.loop.create_task(self.topggstats())
modest maple
#

if you reload the extension they should auto close anyway

summer torrent
#

Which is faster? sql or nosql?

trail reef
#

oh

#

I didn't realize

#

Previously when I was using the tasks decorator they wouldn't, so I assumed it would be the same

#

thx chillfish

quartz kindle
#

you cant measure database performance from that alone, it depends on many other factors and there are dozens of different databases, both sql type and nosql type

modest maple
#

either way if on_ready() reloads it will create new tasks with the subrutines

trail reef
#

yeah

#

But w/ limited ram on a raspberry pi....

#

¯_(ツ)_/¯

quartz kindle
#

typically nosql databases are capable of reaching faster speeds, depending on platform, implementation, disk speed, etc... because most nosql databases implement BASE instead of ACID

modest maple
#

i mean you can always find out by doing await client (or bot).all_tasks(loop=none)

#

not sure if client will work with that or not

#

but asyncio.all_tasks(loop=none) should return a list of all tasks

broken jay
#

But anyone, can anyone help me...?

modest maple
#

the question is how df did u get performance issues with python

opaque eagle
#

Eris bots are similar to discord.js bots @broken jay

modest maple
#

xD

mossy vine
#

@broken jay read up on js modules

#

module.exports and require

opaque eagle
#

The code is very similar... you can follow any guide written for discord.js, but swap the discord.js methods (like message.channel.send()) for their Eris equivalents (like message.channel.createMessage())

valid frigate
#

hey does anyone know why there is some inconsistency in tagging users/bots on mobile vs desktop

#

sometimes the raw message will be <@! or <@

#

begin with*

unique nimbus
#

<@! is nicknames

#

<@ is not

#

if I remember correctly

prime cliff
#

Yup

iron scroll
#

how add bot to this server (my bot approved)?

prime cliff
#

K_WaitWhat it should already be added

unique nimbus
#

-bot 431916398361706496 noembed

#

ah fuck

valid frigate
#

how

unique nimbus
#

They both are here

#

however one is muted

#

for common prefix

valid frigate
#

i can tag any bot here without a nickname and it's the same issue

iron scroll
#

@prime cliff i can't @mention it

unique nimbus
#

There is many bots here

earnest phoenix
#

How to do a custom prefix?

#

(completely new bot, in js)

restive furnace
#

Theres tons if tutorials on internet..

earnest phoenix
#

they sucks

valid frigate
#

for each guild, store the guilds specific prefix in a database

restive furnace
#

tip: then learn sql/nosql

valid frigate
#

typically guilds won't set a custom prefix so you should only donit if they get added

#

also opinion but if you're using js id recommend mongodb

restive furnace
#

use orm if u dont know sql/nosql

valid frigate
#

lol

opaque eagle
#

or a querybuilder like knex for javascript

knotty steeple
#

mariadb >>

opaque eagle
#

json >>

#

jk

earnest phoenix
#
const { MessageEmbed } = require("discord.js");

class Ban extends Command {
  constructor(client) {
    super({
      name: "ban"
    });

    this.client = client;
  }

  async exec(message, args) {
    let user = message.mentions.members.first() || message.guild.members.fetch(args[0])
    let reason = args.slice(1).join(' ')
    let Case = this.client.db.get(`cases_${message.guild.id}`)
    if(Case === null) Case = 1
    let e = new MessageEmbed()
    .setAuthor("Ban | Case #" + Case)
    .setColor(this.client.COLOR_RED)
    .addField("User", user.user.tag)
    .addField("Moderator", message.author.tag)
    .addField("Reason", reason)
    let ch = this.client.db.get(`modLog_${message.guild.id}`)
    let channel = message.guild.channels.find(c => c.id === ch.id)
    channel.send(e)
    user.ban({reason: reason})
  }
}
module.exports = Ban;```

Error
#

why

opaque eagle
#

ch is undefined

earnest phoenix
#

how?

summer torrent
#

what is output of db.get(`modLog_${message.guild.id}`)?

opaque eagle
#

There's no entry called modLog_${message.guild.id} in the database...

earnest phoenix
#

You sure about that

opaque eagle
#

then there's no channel with that id

#

in the guild

earnest phoenix
#

There is.

opaque eagle
#

well discord says otherwise

summer torrent
earnest phoenix
#

oh fu

grizzled jackal
#

just learn sql, takes like 30 mins tops to get the basics

summer torrent
#

You're trying to get id of id

earnest phoenix
#

yeah kinda dumb...

#

Why Bot wont get Ready tf

summer torrent
#

¯_(ツ)_/¯

earnest phoenix
#

Is Discord Dead?

summer torrent
#

no

restive furnace
#

yes

#

discord pings seems little bit higher than normal.

compact oriole
#

Thats why my site is semi broken

earnest phoenix
#

seems a bit higher than normal

compact oriole
#

Only 900ms xd

restive furnace
#

basic ping

earnest phoenix
#

only? that fucking normal with 16kbits at my home

#

Yeet Discord Down again

restive furnace
#

hmm maybe time to check google cloud status

#

wait what was it

#

kk pings just higher

tacit stag
#

thanks discord .bots wont go up : P

lapis merlin
#
client.on("message", message => {
        if (message.author.bot) return; 

        if (!db[message.author.id]) db[message.author.id] = {
            xp: 0,
            level: 0
        };
        db[message.author.id].xp++;
        let userInfo = db[message.author.id];
        if (userInfo.xp > 100) {
            userInfo.level++
                userInfo.xp = 0
            message.channel.send("lvl up!")
        }
        const args = message.content.slice(config.prefix.length).trim().split(/ +/g)
        const cmd = args.shift().toLowerCase();
        if (cmd === "level") {
            let userInfo = db[message.author.id];
            let embed = new Discord.RichEmbed()
                .setColor(0x4286f4)
                .addField("Level", userInfo.level)
                .addField("XP", userInfo.xp + "/100")
            message.channel.send(embed)
        }
        fs.writeFile("./database.json", JSON.stringify(db), (x) => {
            if (x) console.error(x)
        });
    })```
#

heelllp

#

It is sending the same message repeatedly each time I execute the command

late hill
#

writing to that file on every single message (- bot messages) seems like a bad idea

#

what do you mean "the same message repeatedly each time I execute the command"

#

Does it start looping

#

Or does it just always give you the same output when you use it

lapis merlin
#

hmm

late hill
#

You should also at least be consistent about your use of semicolons megu

earnest phoenix
#

json files aren't supposed to be used as a database

lapis merlin
earnest phoenix
#

and you're constantly updating values on every message

unique nimbus
#

Don't use json

earnest phoenix
#

migrate to an actual database otherwise you're going to experience a lot of data corruption

unique nimbus
#

use sql or mongodb

lapis merlin
#

hmm okay

opal halo
#

how would you fix a bot responding to any other 2 character prefixes besides the prefix the bot is set to?

earnest phoenix
#

by actually checking for the prefix

late hill
#

As for the multiple replies, I don't see anything in there that would cause that so I'd guess it's
A) you have multiple instances of the bot running
B) you registered the listener more than once

opal halo
earnest phoenix
#

yes but you aren't actually checking for the prefix

#

you're just checking for the length of it

opal halo
#

ah, ok

restive furnace
#

if (!msg.content.startsWith(prefix)) return

grizzled spruce
#

Please write my bot for me ty

modest maple
#

pay me

grizzled spruce
#

I’m a cheap stingy person and refuse

#

I want hours of your hard work given for free plz

slender thistle
#

"do all the work for me for free" essentially

drowsy wedge
#

Hello, I am trying to make an unban all command for a game. I cannot figure out a way to do it, though I'm thinking it would have to do with a for loop to loop through each banned member and unban them. A friend suggested I do bannedUsers.forEach(m=>message.guild.unban(m.id)), but that did not work. Below is my code. If you have any other questions, feel free to ask.

    if(msg === `${prefix}restart` || msg === `${prefix}unbanall`) {
        if(message.author.id !== '242425064631435264') {
            message.reply('no.')
        }
        else {
            guild.fetchBans()
                .then(bans => message.channel.send(`${bans.size} users have been resurrected.`))
                .catch(console.error);
            
        }
    }```
#

This is the unfinished code without a way to unban all.

amber fractal
#

well the first thing is that you will be rate limited and that is api abuse

drowsy wedge
#

that's fair, though there will not be much people to be unbanned

#

also forgot to include but guild is defined as message.guild

#

the max that are going to be unbanned is around 10-12 and the command is only going to be run every couple of hours or days

opal halo
#

@restive furnace omfg THaNk y0u

modest maple
#

still api abuse

drowsy wedge
#

may i please have the definition of api abuse then? i'd like to make sure i don't accidently do it then, because i usually consider something like rainbow role change api abuse, or something like 60 things every minute

restive furnace
#

@opal halo np

modest maple
#

Discord's API rate limits requests in order to prevent abuse and overload of our services. Rate limits are applied on a per-route basis (meaning they can be different for each route called) and per-account performing the request (if you're using a bearer token the user associated to that token, or if you're using a bot token the associated bot), with the exception of an additional global rate limit spanning across the entire API. Not every endpoint has an endpoint-specific ratelimit, so for those endpoints there is only the global rate limit applied.

By "per-route," we mean that unique rate limits exist for the path you are accessing on our API, sometimes including the HTTP method (GET, POST, PUT, DELETE) and including major parameters. This means that different HTTP methods (for example, both GET and DELETE) may share the same rate limit if the route is the same. Additionally, rate limits take into account major parameters in the URL. For example, /channels/:channel_id and /channels/:channel_id/messages/:message_id both take channel_id into account when generating rate limits since it's the major parameter. Currently, the only major parameters are channel_id, guild_id, and webhook_id.```
#

    warn There is currently a single exception to the above rule regarding different HTTP methods sharing the same rate limit, and that is for the deletion of messages. Deleting messages falls under a separate, higher rate limit so that bots are able to more quickly delete content from channels (which is useful for moderation bots).

Because we may change rate limits at any time and rate limits can be different per application, rate limits should not be hard coded into your bot/application. In order to properly support our dynamic rate limits, your bot/application should parse for our rate limits in response headers and locally prevent exceeding the limits as they change.

    warn Routes for controlling emojis do not follow the normal rate limit conventions. These routes are specifically limited on a per-guild basis to prevent abuse. This means that the quota returned by our APIs may be inaccurate, and you may encounter 429s.
#

For every API request made, we return optional HTTP response headers containing the rate limit encountered during your request.
Rate Limit Header Examples

X-RateLimit-Limit: 5
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1470173023
X-RateLimit-Bucket: abcd1234

    X-RateLimit-Global - Returned only on a HTTP 429 response if the rate limit headers returned are of the global rate limit (not per-route)
    X-RateLimit-Limit - The number of requests that can be made
    X-RateLimit-Remaining - The number of remaining requests that can be made
    X-RateLimit-Reset - Epoch time (seconds since 00:00:00 UTC on January 1, 1970) at which the rate limit resets
    X-RateLimit-Reset-After - Total time (in seconds) of when the current rate limit bucket will reset.
    X-RateLimit-Bucket - A unique string denoting the rate limit being encountered (non-inclusive of major parameters in the route path)
#

or a more simple version

#

Bot Rate Limits are as follows:

    A global 50/10 rate limit (meaning, this is the maximum # of messages a bot can send currently across all of discord).
    A 5/5 per server rate limit.
    A 5/5 global DM rate limit.

The rate limit applies to message creation and editing.

If your bot is big enough and is hitting the global rate limit legitimately, reach out to us and we'll increase it.```
earnest phoenix
#

at that point you could've just linked to the section in the docs

modest maple
#

yh

#

did ucour

#

but what the hell

#

get it out ther in text

drowsy wedge
#

i read the docs but was still a bit confused, the 50/10 rate limit means 50 requests every 10 minutes?

modest maple
#

seconds

#

50 requests every 10 seconds per instance globally

drowsy wedge
#

so it could be classified as fine but also not be classified as fine for what i'm trying to do

modest maple
#

not really no

#

cuz diffrent requests have diffrent limits

#

send messages and deleting messages have higher rate limits then editing messages for example

drowsy wedge
#

ill look into it more later

#

thanks for the tip

shy turret
#

rip me

drowsy wedge
#

what's wrong?

shy turret
#

no one's helping me lol

#

i dont think anyone here knows how to tcp/packet

drowsy wedge
#

also, "Clients are allowed 120 events every 60 seconds"
i know that bulk deletion events limits are higher, but i can't find anything for getting banned users and unbanning them
im also not sure whether to continue this in here even though it somewhat pertains to bot development

earnest phoenix
#

ratelimits are dynamic

shy turret
#
const Discord = require("discord.js");
const client = new Discord.Client();
const Net = require('net');
const client1 = new Net.Socket();

client.on('ready', () => {
  console.log('Bot is ready!');
  client.user.setActivity('people chat.', { type: 'WATCHING'});
})

client.on("message", message => {
  try {
    if (message.channel.id == channelid) {
      message.delete();
      client1.write('Discord | ' + client.username.substring(0,5) + " | " + message.content);
    }     
  } catch(err) {
    console.log(err)
  }
});

client1.connect({ port: port, host: host }, function() {
  try {
    client1.write('Discord has joined the server.');
  } catch(err) {
    console.log(err)
  }
});

client1.on('data', function(chunk) {
  try {
    client.channels.get(channelid).send(chunk.toString())
  } catch(err) {
    console.log(err)
  }
});

client1.on('end', function() {
  process.exit();
});

// Request an end to the connection after the data has been received.
//client1.end();

client.login(token)
earnest phoenix
#

that's why there is no official "this is x ratelimit, this is y ratelimit"

shy turret
#

token, channelid, port and host exists

#

but client and client1 dont work in each others functions'

drowsy wedge
#

then im pretty sure i wouldn't be abusing the api

#

ill just watch what im doing

modest maple
#

bulk banning

#

and un banning

#

is pushing it

#

/ going over it

drowsy wedge
#

though its still a max of 12 members and its not being run every minute or so, im not getting how thats pushing it

modest maple
#

i mean ig u can find out if ur accounts get banned or not? xD

drowsy wedge
#

uh yea will do

modest maple
#

i personally dont get why ur banning then unbanning everyone

#

instead of kicking or somthing

#

but okii

drowsy wedge
#

so they can't join back and it makes it easier for the rest of the game

earnest phoenix
#

what's even easier is creating a role that disables access to the game channel

modest maple
#

^^

drowsy wedge
#

ill try that

earnest phoenix
#

and it is also a less aggressive approach

drowsy wedge
#

what about removing a role, is that still pushing it?

earnest phoenix
#

you can delete the role

drowsy wedge
#

delete then readd

modest maple
#

its actually worse deleting and creating roles

mossy vine
#

or permission overwrites?

drowsy wedge
#

oh

modest maple
#

they have a rlly rlly Heavy Rate limit with making roles

#

but just changing channel perms would work

#

would it not?

earnest phoenix
#

they won't be creating a role every 10 seconds lmao

#

create role

add role to people who are supposed to get kicked/banned

once game is done delete the role

#

rinse and repeat

drowsy wedge
#

^ what i was imagining

#

thanks for the idea

modest maple
#

couldnt you just have the same role

#

and just add and remove it from the members

#

rather than delete and remake etc..

earnest phoenix
#

yes, but you then again come back to the same thing as bulk ban/unban

modest maple
#

ig but making the role and deleting it you still gonna have to add it to everyone

earnest phoenix
#

gradually, and it's still ratelimit minimalization

modest maple
#

if u do it gradually might as welll keep the role

earnest phoenix
#

well

#

no

modest maple
#

and just remove it from members etc..

#

especially if its happing per member as they go along the game

#

would be 'bulk'

#

but wouldnt require you to delete, add role to everyone then delete the role

earnest phoenix
#

add role to a member who lost + 2 requests for creation and deletion
vs
add role to a member who lost + n requests for every member

#

the goal is to minimize the chance to get a ratelimit

modest maple
#

yes but u can still have the role existing

earnest phoenix
#

no

modest maple
#

Role A only gets added if user n looses

#

rather than

#

create

#

add

#

delete

earnest phoenix
#

at the end of the game you still have to remove the role for every member

#

instead of just deleting the role

#

you keep missing that point

modest maple
#

oh fuk

#

maybe

#

xD

earnest phoenix
#

1 request vs n requests for every player

drowsy wedge
#

i don't think there is a way for the bot to delete the role, is there? im looking at the docs and can't see anything about deleting a role

earnest phoenix
#

there is

#

which lib do you use

drowsy wedge
#

discord.js

#

the closest thing i can find is .delete but that deletes the guild itself

earnest phoenix
drowsy wedge
#

oh role is a class

#

thanks

modest maple
#

everything is a class

earnest phoenix
#

the createRole method on the guild should return the role object iirc

modest maple
surreal sage
sudden geyser
#

if someone knows the answer or can help they'll respond

earnest phoenix
#

hi today the discord bot om i dont know why but don't want to start
it only does it on the server machine
on my own machine Visual studio code working perfectly
but when i use it on a server machine node index.js command
then I get an error and it doesn't start
I haven't run into such a mistake yet and have no idea what anyone can help me
ERROR CODE⬇️

(node:11818) UnhandledPromiseRejectionWarning: Error: getaddrinfo ENOTFOUND discordapp.com discordapp.com:443
    at errnoException (dns.js:50:10)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
(node:11818) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:11818) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

#

server machine running an ubuntu

#

so far no problem has ever occurred

vital lark
#

it's saying that

#

you can't connect to the WS server

#

because it wasn't found

#

there is nothing you can do and just wait for Discord

earnest phoenix
#

but if the discord itself is bad, then why is your computer running

vital lark
earnest phoenix
#

WTF

#

restartins server pc

#

running

#

bot

#

WHAT

#

okey ubuntu god job

sage bobcat
#

One message removed from a suspended account.

sudden geyser
#

maybe it's discord or youself

#

as I remember it being when your internet dies (I think)

valid frigate
#

weird

#

canary has this interesting new mention that happens for bot users that should only be happening to nicknames

#

it's using <@! in place of <@ now

prime cliff
#

@valid frigate that is normal for Discord when a user has a nickname their mention will be <@!

valid frigate
#

literally it's also happening to users without a nickname

prime cliff
#

Not sure why Discord made it that way but you will have to parse that format too

valid frigate
#

the inconsistency is really confusing and idk why they made that silent update to canary

prime cliff
#

It's not an update that has always been in Discord in all clients

valid frigate
#

no? i was able to mention my bot fine here on mobile, desktop and canary fine since around the end of last month

#

cant have a nickname

prime cliff
#

LaceShrug Discord does weird shit

valid frigate
#

huh

#

well if it does go live then what can i say except discord is being dumb

opal halo
west raptor
#

why link to an svg

#

also yes

opal halo
west raptor
#

dblapi.js updates every 15 minutes if you're auto posting

opal halo
#

ah, thanks