#development

1 messages · Page 1531 of 1

earnest phoenix
#

help pls

#

I am using discord.js module in discord bot And One Day When I Woke Up I Got NaN Error In Users Section In My V12 Bot

#

The code I use is this

glad violet
#

it have all the code in index.js u may split it to multiple files like commands.js prefix.js main.js i think

golden condor
#

5 seconds

earnest phoenix
#

bot.guilds.cache
.reduce((a, b) => a + b.memberCount, 0)
.toLocaleString(),true)

pale vessel
#

is it working fine locally?

bright flame
#

Anyguy who knows about python?

earnest phoenix
#

help pls

pale vessel
#

just ask your question; it's a waste of time asking

glad violet
bright flame
#

Hey how can i know that why the error is coming in py file if a particular module is installed
it is giving error like that particular module isnt installed

#

see i am encountering this

earnest phoenix
#

@glad violet Error (NaN)

glad violet
#

do u code with js or python

earnest phoenix
#

consol does not show error Says NaN when using command

slender thistle
bright flame
slender thistle
#

Show which module you are trying to import and what you are installing and how

bright flame
#

ok sure

glad violet
#

i wanna learn more about js if u can learn me dm me

bright flame
#

@slender thistle

slender thistle
#

How did you install it?

bright flame
#

pip3 install SpeechRecognition

#

@slender thistle

#

i did this

opal plank
# glad violet i wanna learn more about js if u can learn me dm me

Before you make a Discord Bot, you should have a good understanding of JavaScript. This means you should have a basic understanding of the following topics:

  • proper syntax
  • debuging code
  • basic features (vars, arrays, objects, functions)
  • read and understand docs
  • nodejs module system

As much as we d like to assist everyone with making their bots, we rarely have the time and/or patience to handhold beginners through learning javascript. We highly recommend understanding the basics before trying to make bots, which use advanced programming concepts.

Here are good resources to learn both Javascript and NodeJS:

Javascriptinfo: https://javascript.info/
Codecademy: https://www.codecademy.com/learn/javascript
FreeCodeCamp: https://www.freecodecamp.org/
Udemy: https://www.udemy.com/javascript-essentials/
Eloquent JavaScript, free book: http://eloquentjavascript.net/
You-Dont-Know-JS: https://github.com/getify/You-Dont-Know-JS
NodeSchool: https://nodeschool.io/
CodeSchool: https://www.codeschool.com/courses/real-time-web-with-node-js
Evie s Accelerated JS: https://js.evie.dev/

Please take a couple of weeks/months to get acquainted with the language before trying to make bots!

slender thistle
opal plank
#

correct me if im wrong

#

but

bright flame
opal plank
#

idk how pip interprets it, but im pretty sure you need to use the same name

bright flame
slender thistle
#

No Erwin

opal plank
#

does it not need to be same name?

slender thistle
#

dblpy is a good example for cases when the package name is different from the module

glad violet
#

me uploading 1.734 files

bright flame
#

still same error

slender thistle
#

pip install dblpy

import dbl

opal plank
#

thats retarded, ty whoever made that

slender thistle
bright flame
slender thistle
#

which command is it

bright flame
#

/usr/bin/python3.9 "path/main.py"

tribal siren
#

how to get an emoji from the message content?

#

i tried this

#

const emoji = bot.emojis.cache.get(args[0])

#

it doesn't seem to work

bright flame
slender thistle
#

Hm

bright flame
slender thistle
#

What does pip3 -V show?

bright flame
#

py 3.8

willow mirage
#

Is there any way I can save a function to database?

bright flame
slender thistle
#

How fun

tribal siren
#

uuh

slender thistle
#

Point your pip3 environment variable to Python 3.9

#

What does python3 -V output?

pale vessel
earnest phoenix
#

Why does it do that :/?

bright flame
#

py 3.8.5

#

@slender thistle

slender thistle
#

Dear lord

#

Point python3 and pip3 to python 3.9 interpreter then

bright flame
#

anyway via terminal?

earnest phoenix
#

Hm guys can ya help me!

slender thistle
#

I suggest googling "edit environment variable linux"

bright flame
#

BTW SpeechRecognition is a 3.8.1

#

module

willow mirage
wanton knoll
#
process.on("unhandledRejection", (reason, promise) => {
    try {
        console.error("Unhandled Rejection at: ", promise, "reason: ", reason.stack || reason);
    } catch {
        console.error(reason);
    }
});
require('events').EventEmitter.defaultMaxListeners = 25

This line is having so much problem

I deleted it yesterday but than I was getting max listeners set to 11 than I resest this code because it was sending 404 error in every server when someone try to play song

Now I was try to solve this but I was not able to anything.

ornate otter
#

When my pc restarts ill try to help u

wanton knoll
#

Here my pc is dead pandasad

void saffron
#

hoe do i make it send a message when someone votes

ornate otter
quartz kindle
#

thats trying to ignore the issue, not fix it

earnest phoenix
#

Why the hell does this say null

pure lion
#

there's no one source code for it but you should write it yourself, you learn more and come out knowing what to do if it breaks

quaint basin
#

okay

quartz kindle
#

so if its null, it will say null, and not 0

wanton knoll
wanton knoll
stable eagle
#

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>```

node version:
v14.15.1
npm version:
6.14.8

Why is this happening?
quartz kindle
#

whats the line before that?

stable eagle
#

npm WARN tar EPERM: operation not permitted, open 'C:\Users\user\Desktop\starbol-js\node_modules.staging\punycode-effb31f5\LICENSE-MIT.txt'
npm WARN tar EPERM: operation not permitted, open 'C:\Users\user\Desktop\starbol-js\node_modules.staging\performance-now-aaa0899e\license.txt'
npm WARN tar EPERM: operation not permitted, open 'C:\Users\user\Desktop\starbol-js\node_modules.staging\discord.js-b971e32d\webpack\discord.js.LICENSE.txt'
npm WARN tar EPERM: operation not permitted, open 'C:\Users\user\Desktop\starbol-js\node_modules.staging\jsdom-ce9e3eea\LICENSE.txt'

tribal siren
#

Hi I got a problem

#
let emoji = bot.emojis.cache.get(e => e.id === args[0]);
  const check = {
    true: 'True',
    false: 'False'
  };
  const embed = new Discord.MessageEmbed()
    .setTitle(`Information about ${emoji.name}`)
    .setThumbnail(emoji.url)
    .addField(`Information`, [
      `Animated: ${check[emoji.animated]}`,
      `Added by: ${emoji.client}`,
      `Added at: ${emoji.createdAt().format('LL')} ${emoji.createdTimestamp().format('LT')}`,
    ])
    .setFooter(`Emoji ID: ${emoji.id}`)
    .setTimestamp()
  message.channel.send(embed)```
#

I only have problems with the first line

#

Where it has to get the emoji

quartz kindle
#

delete the node_modules folder

#

and try again

old cliff
stable eagle
#

same error

tribal siren
old cliff
#

Try Changing to const check = (inp) => {return inp == true ? "True" : "False"}

earnest phoenix
quartz kindle
#

use the NOT operator, that will handle both null and undefined

tribal siren
old cliff
quartz kindle
#

if(!coins)

#

the ! is the NOT operator

tribal siren
#

it's all about this line
let emoji = bot.emojis.cache.get(e => e.id === args[0]);

grizzled raven
earnest phoenix
#

So what should I replace it with?

earnest phoenix
#

@quartz kindle

grizzled raven
tribal siren
grizzled raven
#

that means no emoji was found where the id matches your input

tribal siren
old cliff
#

Try

#

Client.emojis.resolve(id)

earnest phoenix
#

@grizzled raven should I replace it with if(!coins)?

old cliff
#

Instead

tribal siren
golden condor
#

Hi so I have a problem, my bot is taking up to a minute and a half to ready, and I don't fetch members on start or anything like that, so I don't know why this is happening, or how to stop it. Is there anything that may be causing it?

tribal siren
#

shut down the bot

golden condor
#

I don't use shards

grizzled raven
#

then uh

golden condor
#

My bot is at 238 servers

grizzled raven
#

half a minute

old cliff
#

Then it can take time

#

If you are fetching membera

golden condor
#

I said in my message that I didn't

grizzled raven
#

mhm

golden condor
#

It used to take around 5 seconds

grizzled raven
#

maybe some of the servers are unavailable, or the shard is waiting for a guild packet to come but it never arrives

earnest phoenix
#

@grizzled raven did the same :/

grizzled raven
#

that's my only other guess

golden condor
#

Ah

true ravine
#

If you are awaiting some kind of external API or database, check that you're making the request correctly, because eventually the connection will time out which will allow the bot to start up

earnest phoenix
grizzled raven
#

no

earnest phoenix
#

@grizzled raven ^

#

What?

grizzled raven
#

if (!coins) coins = "0"

golden condor
#

On startup, I connect to a mongodb database, which works and connects fine

earnest phoenix
#

Isn’t it 3 ===? @grizzled raven

grizzled raven
#

no

#

that's just if you want to compare values

earnest phoenix
#

Ok 1

grizzled raven
#

1 = changes it to "0"

true ravine
earnest phoenix
#

@grizzled raven should I change all of them to if (!coins) coins = "0"?

#

Like and without number like !coin1 !coin1, !coin?

golden condor
#

I make web requests on ready, the only thing I do before it is connecting to mongo, but that works as the bot relies on the database to work

#

On that note, how do you have events in the mongodb wrapper for nodejs

earnest phoenix
#

Alrighty thanks!

#

Let’s try!

#

@grizzled raven still null

#

@quartz kindle ^^

zenith terrace
#

@earnest phoenix did you try what you were told yesterday

#

About removing the " " around the 0

earnest phoenix
#

I cant remember that much but yes

#

Huh

#

Lemme try

golden condor
true ravine
#

At least that's narrowed it down slightly I guess lol

earnest phoenix
#

@zenith terrace still null...

zenith terrace
#

Im out of luck for now

earnest phoenix
#

@zenith terrace see anything that could do something? ^^^

golden condor
pure lion
#

does steam have oauth2?

stable eagle
#

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! https://npm.community

how can I fix this?
npm v: 6.14.8
node v: v12.19.0

true ravine
earnest phoenix
#

Guys help :/

grizzled raven
#

@golden condor console log on debug event

golden condor
#

ok

earnest phoenix
grizzled raven
#

what is null

earnest phoenix
#

This :/

#

@grizzled raven

grizzled raven
#

what is "this"

boreal iron
#

@green kestrel hey, if you got a minute for me later, I would appreciate it - struggeling with an UDP socket and the encoded string I'm sending, if u know how to work with sockets ofc

green kestrel
#

i know a lot about sockets, but very little about node.js

#

i'll help if i can @boreal iron

boreal iron
#

alright, great

#

gonna send u something

#

I'm not able to deal with C# but I mean it's not harsh to understand

#

CheckKey() is building an UDP socket, sending a string to the socket

#
        public function getBattlEyeID( $steam_id )
        {
            if( strlen( $steam_id ) != 17 ) return null;

            $tmp = "";

            for( $i = 0; $i < 8; $i++ )
            {
                $tmp .= chr( $steam_id & 0xFF );
                $steam_id >>= 8;
            }

            return md5( "BE" . $tmp );
        }

//---

$socket = fsockopen( "udp://" . gethostbyname( "arma2oa1.battleye.com" ), 2324, $errno, $errstr );

$steam_id = "xxx";
$be_guid = $Call->getBattlEyeID( $steam_id );
$send = "";

for( $i = 0; $i < mb_strlen( $be_guid, "ASCII" ); $i++ ) $send .= ord( $be_guid[$i] );

fwrite( $socket, $send );

while( $socket )
    {
        var_dump( $data = fread( $socket, 8192 ) );
        var_dump( $stream = stream_get_meta_data( $socket ) );
        
        if( $stream['timed_out'] ) break;
        else
        {
            if( strlen( $data ) > 0 ) print_r( $data );
        }
    }```
#

I'm encoding the var $steam_id like in the C# example above

pure lion
#

how are you getting steam_id?

boreal iron
#

sending it to the socket, but the result is empty, always

#

I wonder if listening to the socket is the right way...

#

byte[] send_buffer = Encoding.ASCII.GetBytes(CreateRequestString(key));
sock.SendTo(send_buffer, endPoint);

stable eagle
#

Cannot find module '@discordjs/form-data'

how can I install this module?

boreal iron
#

ofc can't send the buffer as array, I wonder if that's the issue

pure lion
boreal iron
#

how are you getting steam_id?

steam_id is just hidden here

pure lion
boreal iron
#

it is, yeah

#

a default steam id 64

pure lion
#

ah

boreal iron
#

just have a general issue with the socket, not the encoding

eternal osprey
#

hey guys

#
if(!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send("``You sadly don't have permissions to do that!``");
  let rMember = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);
  if(!rMember) return message.channel.send(xdemb);

  let role = args.join(" ").slice(22);
  if(!role) return message.channel.send("``Please specify a role to add!``");
  let gRole = message.guild.roles.find(role => role.name === `${role}`);
  if(!gRole) return message.channel.send("``Couldn't find that role in your guild. Please double check!``");

  if(rMember.roles.has(gRole.id)) return message.channel.send("``This user already has the selected role.``");
  await(rMember.addRole(gRole.id));

    await message.channel.send(`***``I just gave ${rMember.user.username} the ${gRole.name} role!``***`)

    message.delete();
  
}```this sadly returns me:
#

who could help?

tribal siren
#

@eternal osprey Unknown Role

#

It gets a Role that doesn't exist

eternal osprey
#

yeah but how?

#

because grole, logged gives me the same id as the role.

tribal siren
#

And why do you require Administrator Permissions for something that requires maximum Manage Roles Perms

#

Just give it a Role that exists.

#

Too easy

#

Now with my problem

#

How to show a Role's Permissions?

#

Like I noticed simply doing role.permissions doesn't work

eternal osprey
#

the role does exist

tribal siren
#

Well it says unknown role

eternal osprey
#

it literally logs the same id as the role

cinder patio
tribal siren
tribal siren
cinder patio
#

role.permissions.bitfield

tribal siren
#

oh ok thanks

onyx hare
#

i need some help~ this wont upload the image i have in my file (near index.js) i get no errors even tho i have the catchjs const { MessageAttachment } = require('discord.js'); const botOwnerID = 300695488414351362 exports.run = async (client, message, play, args) => { if (message.author.id == botOwnerID) return; const attachment = new MessageAttachment('./ihs.png').catch(console.error); message.channel.send(`${message.author},`, attachment).catch(console.error); message.delete({timeout:10}); }

earnest phoenix
#

You are owner or the bot @onyx hare ?

onyx hare
#

ya

earnest phoenix
#

300695488414351362
300695488414351362

#

Yes you are

#

You are saying to the bot

#

If the id of the author is this

#

Stop

misty sigil
#

try !==

earnest phoenix
#

!=

onyx hare
#

ok

earnest phoenix
#

._.xd

onyx hare
#

still refused to send the attachment #

earnest phoenix
#

What is the err

onyx hare
#

nothing

earnest phoenix
#

The bot should say something...

onyx hare
earnest phoenix
#

Did you save the changes?

onyx hare
#

ya

earnest phoenix
#

And restarted the bot?

onyx hare
#

yup

misty sigil
#

Try making the ID a string

honest perch
#

First of all, you are returning when the owner does the command

#

Second of all its ===

misty sigil
#

no misly it’s actually not

boreal iron
#

@green kestrel did u figured it out? or can't help me atm?

earnest phoenix
#

= is wrong

honest perch
#

Third of all the id should be a string

earnest phoenix
#

true

#

you can use == or ===

misty sigil
#

they want to compare their ID from the API (string) to an int

earnest phoenix
#

== is the correct way

misty sigil
#

in many cases, no

pale vessel
#

but comparing works for ==

#

and they used ==

onyx hare
#

ive tried with if(message.author.id !== config.ownerID) but i get "config is not defined"

misty sigil
#

maybe because config isn’t defined

pale vessel
onyx hare
#

it works on my eval and i dont have it defined there

pale vessel
#

i'm stupid

misty sigil
lusty quest
#

== compares === also takes the type with into account

misty sigil
#

Variables don’t just spin into existence out of thin air

umbral zealot
#

In JavaScript, you cannot treat Discord IDs as integers

pale vessel
#

explain globals!!!

umbral zealot
#

so you should always do a === comparison

misty sigil
pale vessel
#

yes, under the global object

earnest phoenix
#

Help

onyx hare
#

i have no clue everything goes wrong when i try and assign a owner only
const config = require("./config.json");
Error: Cannot find module './config.json'

honest perch
#

It cant find the file

#

The file isn't in the folder

earnest phoenix
#

or doesnt exist

honest perch
#

Again its not in the directory

onyx hare
#

image*

#

should i move a copy to my commands folder?

pale vessel
misty sigil
#

oh..

pale vessel
#

Please, don't use json to store your configs in a public repl

misty sigil
#

fuck me

pale vessel
#

When and where?

misty sigil
#

now and here

#

there goes today’s quota of brain cells

onyx hare
#

after i moved a copy of the config to my commands it worked -.-

compact scaffold
#

how can i add lines around the table? @drowsy epoch

compact scaffold
#

oh

wanton knoll
lusty quest
#

why did you want to mess with the event emiter?

umbral zealot
#

"resource leakage" means that your bot would use more and more resources until it runs out of them.

misty sigil
#

They’ve probably got the standard discord.js newbie bot with 77 message events for some reason

wanton knoll
lusty quest
#

ok

#

bcs usually people look it up bcs they get errors bcs they got to many event listeners

earnest phoenix
#
@client.command(name='play', help='This command plays songs')
async def play(ctx):
    global queue

    server = ctx.message.guild
    voice_channel = server.voice_client

    async with ctx.typing():
        player = await YTDLSource.from_url(queue[0], loop=client.loop)
        voice_channel.play(player, after=lambda e: print('Player error: %s' % e) if e else None)

    await ctx.send('**Now playing:** {}'.format(player.title))
    del(queue[0])
#

The bot just typed

#

and didnt play any music

#

with the url

past needle
green kestrel
#

@boreal iron not sure whats up with it

boreal iron
#

aw.. damn, struggeling with it

earnest phoenix
past needle
#

how

willow mirage
#

How i can make function to string

past needle
#

yourfunction.toString() litterally

willow mirage
#

ok

inland pulsar
earnest phoenix
#

what the absolute

limber flume
#

Lmao

pale vessel
#

stop

#

i don't think xig likes that

earnest phoenix
#

oml

pale vessel
#

but yes I made that joke because of that

limber flume
inland pulsar
#

luv you xig

pale vessel
#

kekw

inland pulsar
#

especially the api

pale vessel
#

/images/nsfw/thighs

inland pulsar
#

yes

pale vessel
#

Yes

#

LOL

inland pulsar
#

were talking about api development

#

what you on about

pale vessel
#

Right

#

ok gtg

inland pulsar
earnest phoenix
#

how did you do that-

#

what

#

members can send embeds?

inland pulsar
#

a link I hope

pale vessel
#

isn't that patched already

inland pulsar
#

t

pale vessel
#

i think that was real

inland pulsar
#

what

young coral
#

Guys

#

Need your advice

inland pulsar
#

yes

limber flume
young coral
#

I'm using distube and youtube dl for my bots music module

limber flume
#

Uhuh?

young coral
#

But time and again, I run into the 429 error

inland pulsar
#

youre banned

young coral
#

Too many requests

inland pulsar
#

get youtube'd

young coral
#

Can you explain please?

inland pulsar
#

yes

#

you spam youtube

#

youtube sees spam

#

youtube ban ur ip

young coral
#

Yes I see that.

inland pulsar
#

Okay

young coral
#

But how do I find a solution

inland pulsar
#

get new ip

#

rotate ipv6 addresses

young coral
#

None of that actually works with youtube dl

inland pulsar
#

nope

young coral
#

I researched on the issues

inland pulsar
#

its not built in

young coral
#

On github

inland pulsar
#

lavaplayer has it built in

young coral
#

Yes its not built in

#

lavaplayer

#

Okay do you use this?

inland pulsar
#

still your server needs a /64 ipv6 block or higher assigned

#

I use lavalink

young coral
#

Oh

young coral
inland pulsar
#

its an api around lavaplayer

earnest phoenix
young coral
#

Is lavalink better?

#

Can I find a credible tutorial explaining its functions?

inland pulsar
#

(bot) ---http--- (lavalink) ---sockets--- (discord)

#

well

#

probably ?

#

read the github page, wiki ect

#

there should be lavalink clients for most languages

#

my client is for kotlin and is opensource

young coral
#

Oh

#

I'm using JS

inland pulsar
#

well ye theres one for that aswell

#

its listed in the readme somewhere

#

anyway

#

I wish you a lot of luck because getting a /64 block working is a pain

young coral
#

Oh

inland pulsar
#

:/

young coral
#

I'm gonna have a hard time it seems

#

Thanks

#

Anyways

inland pulsar
#

well theres no real other way to work around it sadly

young coral
#

So /64 block should be working on the server where the bot is hosted?

#

Because I don't know much about the server side

#

I just write code and upload

inland pulsar
#

well where your lavalink is hosted

#

its a seperate application

#

you can choose where you host that

young coral
#

Oh

#

I can afford just one host as of now

#

Still gonna find a way

#

Isn't youtube dl gonna work at all?

#

Like no chances?

inland pulsar
#

well it works until banned

#

then youll have to wait for unban

#

normally about a day - week

young coral
#

In public bots, you can't really wait

#

Exactly, can't wait that long

#

What does Groovy do for that?

#

Does that also use lavalink?

inland pulsar
#

they rotate big blocks yes

#

probably lavalink

young coral
#

Thanks for your time.

inland pulsar
#

its not easy to start a public music bot :/

#

in the beginning youtube didnt ban bots

young coral
#

Well true

#

Most other commands work just fine

#

Its music which is a bugger

#

Can we get requests passed from other services

#

Which don't ban bots?

#

Maybe soundcloud, spotify

inland pulsar
#

spotify doesnt have music playback options

#

one at a time if you reverse engineer their private api yes

young coral
#

Oh

inland pulsar
#

soundcloud, twitch and and attachments could still work

earnest phoenix
#
@client.command()
@commands.has_permissions(adminstrator=True)
async def gstart(ctx, mins : int, * , price: str):
    embed = discord.Embed(title = "Giveaway!", description = f"{prize}", color = ctx.author.color
    
    end = datetime.datetime.utcnow() + datetime.timedelta(seconds = mins*60)
    
    embed.add_field(name = "Ends at:", value = f"{end} UTC")
    embed.set_footer(text = "Ends {mins} minutes from now!")
    
    my_msg = await ctx.send(embed=embed)
    
    await my_msg.add_reaction(":tada:") 
    
    await asyncio.sleep(mins)
    
    new_msg = await ctx.channel.fetch_message(my_msg.id)
    
    users = await new_msg.reactions[0].users().flatten()
    users.pop(users.index(client.user))
    
    winner = random.choice(users)
    
    await ctx.send(f"Congradulations! {winner.mention} won {prize}!")```
#

Trying to make a giveaway command

#

The whole thing is error

#

With over 44 errors

#

anyone know why

#

probably because it's incorrect but that's just a wild guess

#

yeah but i dont understand

#

why its incorrect

#

did you copypaste

lusty quest
#

did you got a linter?

earnest phoenix
#

yes

#

thats prob why

lusty quest
#

maybe the linter can tell you where the error is

earnest phoenix
#

i importted everything

#

it shouldnt happen

#
C:\Users\users\Desktop\MoBot>C:/Users/users/AppData/Local/Programs/Python/Python38/python.exe c:/Users/users/Desktop/MoBot/bot.py
  File "c:/Users/users/Desktop/MoBot/bot.py", line 249
    end = datetime.datetime.utcnow() + datetime.timedelta(seconds = mins*60)
    ^
SyntaxError: invalid syntax```
lusty quest
#

i dont know py but did you have to declare a variable like in js?

earnest phoenix
#

i did

#

before the code i did declare it

lusty quest
#

in js you have to tell that you declare a new variable like const myVar = "string"

earnest phoenix
#

i know

faint moth
lusty quest
#

then its maybe out of scope

earnest phoenix
#

idk

golden condor
#

Is it datetime.datetime.timedelta ?

golden condor
earnest phoenix
#

wait i fixed

#

i got the issue

faint moth
#

Yes @golden condor

golden condor
#

What is your code for working out users

faint moth
#

client.guilds.cache.reduce

golden condor
#

Ah you need to check if one of your guild's memberCount is undefined, as sometimes it can be with djs, I had this issue myself the other day, it's when a guild is unavailable iirc

faint moth
#

how can I do that?

golden condor
#

For example

#

What is your exact code rn inside the reduce function

#

Send the whole line

odd stratus
#

I use a /48 block and it works perfectly

faint moth
#

@golden condor client.guilds.cache.reduce((a, b) => a + b.memberCount, 0).toLocaleString()

golden condor
#

A ok

#

So

#

Change that to be

#

a + (b.memberCount || 0)

#

That should fix it

#

That code just checks if the server's memberCount is unavailable or not and replaces with an actual number

faint moth
#

Okayy tnx let me try

odd stratus
golden condor
#

Nice

#

But you should check for the member count being undefined

faint moth
#

client.guilds.cache.reduce((a, b) => a + (b.memberCount || 0).toLocaleString() @golden condor ?

golden condor
#

uhh no

#

client.guilds.cache.reduce((a, b) => a + (b.memberCount || 0),0).toLocaleString()

faint moth
#

oh okay

golden condor
#

Should work

rocky hearth
#

For tsconfig, what target should I select so that the complid code will work for node-v12?

golden condor
#

1.12?

rocky hearth
#

node

golden condor
#

node 1.12?

rocky hearth
#

I'm so dumb sorry, I meant node-v12

golden condor
#

ah

#

You should use es2019 as a target but use the commonjs module

#

Hope that helps :)

faint moth
#

worked, thank you very much @golden condor

golden condor
#

Np

#

Happy to help :)

faint moth
#

:)

wooden tapir
#

hello, I'm a bit confused on how permissions=0 works. I just kicked and re-added my bot to my test server with permissions=0 but almost everything still works

#

so are all the permissions like 'send messages', 'embed urls', etc. useless?

#

here's the perms I'm asking for by default:

    perms.add_reactions = True
    perms.attach_files = True
    perms.embed_links = True
    perms.manage_emojis = True
    perms.send_messages = True
    perms.manage_messages = True

Manage emojis and manage messages aren't strictly required

scenic kelp
#

@wooden tapir If I'm not mistaken permissions=0 just uses whatever perms the @everyone role has

mellow kelp
#

probably the @everyone role gives it said permissions

solemn latch
#

^

brave rivet
#

hello im trying to develop a bot for my server and im so lost

solemn latch
#

What are you lost about?

wooden tapir
#

so does anyone know what actual permissions are allowed when the reviewers test the bot?

brave rivet
#

i made one and it was declined i have some clarifucation on the long description thats to secret agent

solemn latch
brave rivet
#

i was told is was private is there a way of finding a bot that is declined to fix this

solemn latch
#

Are you trying to find who declined your bot?

brave rivet
#

to edit it so it can be approved

solemn latch
#

We delete your bot application when its declined

#

You have to submit it from scratch

brave rivet
#

great thank you how do i know if its public pls

solemn latch
#

If the bots public?

brave rivet
#

yes for the testing thing

crimson vapor
#

you will be dm'ed

#

when your bot is tested

solemn latch
#

Theres a little switch on the discord dev portal for enabling it to be public

brave rivet
#

yes i got the dm unfortunately i was asleep so is there a way i can make it public beforehand

solemn latch
#

on the dev portal in the "bot" section

brave rivet
#

dev portal ? thats where we make the bot correct ?

solemn latch
#

yep

wooden tapir
brave rivet
#

thank you im so sorry im so new to this

#

also the permissions do i set them all ?

solemn latch
solemn latch
brave rivet
#

thank you also where do i put its command things

solemn latch
#

i dont think you understand how bots work.
commands are written by you, and run on a server by you. you dont upload them to discord.

wooden tapir
#

yeah I suppose I can check and default to text mode if I don't have the permissions for images

brave rivet
#

i dont know how they work thats why im here :/

solemn latch
brave rivet
#

no

solemn latch
#

well, bots need to be programmed with a programming language.

brave rivet
#

im a gamer i just want a bot to say when streamers are live and was told this was the. best place to set it up im more than lost i got no idea at all

gilded olive
#

Look into mee6

#

That can be done for you already

solemn latch
#

looks like you want to use a bot, not make a bot.

gilded olive
#

^

mellow kelp
#

the twitch feature recently became premium tho pEnSiVe

gilded olive
#

FR????

solemn latch
#

https://top.gg/
^ you can find bots which do what you want here already made! you just invite them to your server

brave rivet
#

sorry init that im not as smart as you guys ill see myself out i came here for help not to be laughed at

gilded olive
#

Bruh mee6 is becoming a literal pay to use

mellow kelp
#

yeah

gilded olive
#

Fuck that

mellow kelp
#

hope EA isn't behind all this shit

gilded olive
#

probably is

solemn latch
tardy hornet
#
    case 'setbal':
    case 'setbalance':

        var moneytoadd = parseInt(args[2])
         if(message.member.id == "723081690792067143")   {
             if(!message.mentions.members.first()){
                 message.author.send("You need to tag the member you want to set balance to, example: e!setbalance @Broken Tooth 100")
                 return;
             }

             if(!args[2]){
                message.author.send("You need to say what you want to set the balance too: e!setbalance @Broken Tooth 100")
                return;
            }
           message.delete();
           var money =  await db.set(`money_${oppmem}`,moneytoadd)
           message.author.send(`**I setted ${message.mentions.users.first().username} balance to: ${moneytoadd}$**`)
           
         }

    break;

how can i do that i could do it with a mention / user id??

odd stratus
#

Lol!

gilded olive
#

😭😭😭

odd stratus
#

Spends like 3k-5k a week

gilded olive
mellow kelp
#

i think i can just ask this here so

#

i wanna change from windows to linux, should i use ubuntu or mint?

brave rivet
#

im trying to make a bot dont worry ill work it out myself where im not laughed at for asking for very basic help

odd stratus
#

I'd go with Ubuntu

gilded olive
mellow kelp
#

i'm more on the mint side since it's supposed to have a more windows-like interface

solemn latch
#

ubuntu is a great first linux distro.

mellow kelp
#

what does ubuntu have?

gilded olive
#

This feels like I wanna make a bot but got no idea moment

odd stratus
#

It's like driving on the highway if you don't have a license

solemn latch
#

is there an npm package that does stream notifications for you, otherwise this seems like a very hard bot idea for a first project.

brave rivet
#
  1. Be friendly and respectful to everyone just an fyi im in tears i came for help not to be treated like a dumb ass
odd stratus
#

???? I gave you advice

solemn latch
#

one person said "lol" and it wasnt even at you.

brave rivet
#

also fyi my friend was helping with the programming

mellow kelp
#

stop getting offended by advice

solemn latch
#

no one seems to be making fun of you.

odd stratus
#

Oh my god I'm going to go cry now

#

😭

#

But no it was advice idk why you're getting mad at that

#

Which was learn the basics of the programming language first or else it will be very difficult

earnest phoenix
#

Why tf is there 2 people more like kids uh crying wtf am I in Roblox?

wooden tapir
#

what programming language would you recommend? normally I'd suggest python but I feel like the async/await stuff in discord.py would be confusing for a beginner

solemn latch
#

most languages have async await

mellow kelp
#

i found the async stuff pretty confusing when i tried making a bot with py

#

at least coming from a javascript async/await background

solemn latch
#

or a form of promises.

#

isnt py async very simular to js's

gilded olive
#

discord.py is really easy once you learn to read the docs properly

solemn latch
#

🤔

dusky sundial
#

dpy is pretty similar to js yea

mellow kelp
#

maybe i was too lazy to dig further KEKW

dusky sundial
#

at least in my exerience

wooden tapir
#

it is, but if you do a python crash course it probably won't cover any of that stuff where with JS it kinda has to since everything worth doing is async

gilded olive
mellow kelp
#

yeah i did a py crash course and they didn't even mention async

solemn latch
#

i wonder why 🤔

wooden tapir
#

cause it hasn't been part of the language that long

solemn latch
#

OH

mellow kelp
#

o

dusky sundial
#

I guess you don't use async too much with the usual python projects

solemn latch
#

okay pogey

mellow kelp
#

makes sense

dusky sundial
#

I'd say got for either python or js when making your first bot. Otherwise I found Java to be pretty fun as well

#

Or Julia if you wanna feel really special

gilded olive
#

IMO I'd prefer py over js for making a bot

#

I found it to be much easier when I tried both

mellow kelp
#

ah yes, making a bot in julia KEKW

#

i found js easier tho

#

guess it depends on something

gilded olive
#

discord bot in HTML when PoggersHype PoggersHype PoggersHype

dusky sundial
#

It depends on what you're used to, I guess

wooden tapir
#

as someone who already knows a bunch of programming languages I'm pretty happy with discord.py, just curious what people would recommend if someone is learning from scratch

dusky sundial
#

How would you make a bot with html? xd

gilded olive
#

Magic

mellow kelp
#

<script />

quartz kindle
#

by torturing yourself

dusky sundial
#

Just go for cpp :)

quartz kindle
#

yes

#

or even better, C

dusky sundial
#

Ah yes

mellow kelp
#

jokes on you, the best starter language is assembly

#

obviously

wooden tapir
#

a magnetized needle and a steady hand

dusky sundial
#

Just open notepad and start typing binary code

mellow kelp
#

who needs async/await and threading when you have memory management

solemn latch
#

o man, are we making those old ram blocks with the little magnetic rings pogey

quartz kindle
#

a magnetized needle is not enough, you need a pedal that sends electric signals when you press it

mellow kelp
#

how about stones and sticks

wooden tapir
quartz kindle
#

lmao

#

havent seen that one before

mellow kelp
#

accurate

quartz kindle
#

yes

leaden lake
#

why when I type this command in cmd py -3 -m pip install discord.py[voice] it says Successfully installed discord.py 1.6.0 and when I do a pip show discord.py it gives me 1.5.1 version ?

gilded olive
leaden lake
#

okay it worked thank you !!

gilded olive
#

🥳

leaden lake
#

but doesn't work for my linux computer.... only on my windows computer

cerulean ingot
#

which one

dropbot.mystik.xyz
dropbotdiscord.xyz```
or other (dropbot.xyz is taken)
odd stratus
#

second

cerulean ingot
#

i want to buy a domain for my bot, dropbot. but dropbot.xyz is taken

quartz kindle
#

what about other tlds?

#

.app or .dev or even .org

wooden tapir
#

having 'discord' in your domain name might get you in trouble in the future

quartz kindle
#

.top is also cheap

odd stratus
solemn latch
#

top.top

quartz kindle
#

top.top.top

wooden tapir
#

gg.top

solemn latch
#

lmao

quartz kindle
#

top.gg.top

solemn latch
#

everything backwards gg.top

quartz kindle
solemn latch
quartz kindle
#

rip

mellow kelp
#

gg.pot

quartz kindle
#

could be a good weed shop

solemn latch
#

already owned

#

not used

#

🤔

#

its for sale for $385

wooden tapir
#

that seems pretty cheap for a 3 letter domain

solemn latch
#

awh not for sale

opal plank
#

is it possible to get the USER who added a bot? or would i need to do some URI shenanigans ?

solemn latch
#

uri shenanigans.

opal plank
#

frick

mellow kelp
#

how bout audit log

solemn latch
#

audit log doesnt include it does it 🤔

#

oh wait it is in audit log

mellow kelp
#

yea

solemn latch
zenith terrace
#

link it

solemn latch
zenith terrace
#

@solemn latch KEKW

quartz kindle
#

screw namecheap

#

just use this

solemn latch
#

dibs

#

😦

quartz kindle
#

its premium

#

premiums are either too expensive or reserved

solemn latch
#

ah

zenith terrace
quartz kindle
#

the prices they have are the "normal" price

#

they dont account for premiums

quartz kindle
storm marsh
#

Hi, which country are you from? I will make my bot online according to him because when it comes time to check it, I go to bed and the bot goes offline

quartz kindle
#

you cant

#

there are more than 20 bot reviewers, you cant know which reviewer will review it and when

zenith terrace
umbral zealot
#

And if your bot can't be online all the time, it shouldn't be on public bot lists where people expect bots to be online.

quartz kindle
#

its premium

zenith terrace
#

whats the difference in premium

quartz kindle
#

either reserved or costs 20k

storm marsh
#

what is the time span

umbral zealot
#

24/7

solemn latch
#

woo.lol is $110 pogey

quartz kindle
#

1 week i think?

umbral zealot
#

And yes it's a week or more (the queue has gone up in the last month or so)

quartz kindle
#

going up again? is the top.gg queue following bitcoin?

#

xD

solemn latch
#

pogey imagine

quartz kindle
#

now its a good time to sell my btc

zenith terrace
quartz kindle
#

aaahhhhh

storm marsh
#

thanks I applied 5 times because of this issue and it was rejected because it is not online

quartz kindle
#

well top.gg is meant for public-ready bots

#

if your bot is not ready for public usage, you should not add it yet

umbral zealot
#

You should consider hosting your bot on a VPS or just not adding it to top.gg

quartz kindle
#

being ready for public usage includes being online most of the time

zenith terrace
#

tim is premium?

quartz kindle
#

ye

zenith terrace
#

damm

quartz kindle
#

all 3 letter names are

zenith terrace
#

oh wow

#

must be expensive then

quartz kindle
#

try buying it

#

see how much is it

solemn latch
#

good news everyone. im now the proud owner of woo.rip

quartz kindle
#

wait really?

solemn latch
#

yes

quartz kindle
#

how much?

solemn latch
#

so exciting, ima do nothing with it

#

$5

quartz kindle
#

wow

solemn latch
#

$10 every year after

quartz kindle
#

a non-premium 3 letter

solemn latch
#

ikr

quartz kindle
#

amazing find

solemn latch
#

super excited

#

saddly its .rip but worth

storm marsh
#

Online for my home country from morning till night but I can't keep the time because of the time difference

wanton knoll
#

I am having a music bot
There is an command -afk
It means bot can stay in vc for 24/7

But I wanted to make it for some specific permission

So I am confused which permission is required for using -afk command

Not admin power something else

quartz kindle
#

.rip is a cool tld tho

#

much better than something like .website

zenith terrace
#

do you want it to be a staff command or no @wanton knoll

solemn latch
#

its easy to remember at least.

quartz kindle
#

lmao

zenith terrace
#

move members?

solemn latch
#

just become a chef tim

zenith terrace
#

anyway brb getting food

wanton knoll
solemn latch
#

let the tld tell you your profession

wanton knoll
quartz kindle
inner roost
#

Wat

halcyon kite
#

hi guys

#

uh

rustic nova
#

timtaxi

solemn latch
#

oml oml another good one

rustic nova
#

pog

halcyon kite
quartz kindle
solemn latch
#

yeah i saw mine

#

didnt buy it

#

okay

#

i own woo.pics

quartz kindle
#

lmao nice

solemn latch
#

my own image host here we come

quartz kindle
zenith terrace
zenith terrace
quartz kindle
solemn latch
#

easy to remember

tardy hornet
#
    case 'setbal':
    case 'setbalance':

        var moneytoadd = parseInt(args[2])
         if(message.member.id == "723081690792067143")   {
             if(!message.mentions.members.first()){
                 message.author.send("You need to tag the member you want to set balance to, example: e!setbalance @Broken Tooth 100")
                 return;
             }

             if(!args[2]){
                message.author.send("You need to say what you want to set the balance too: e!setbalance @Broken Tooth 100")
                return;
            }
           message.delete();
           var money =  await db.set(`money_${oppmem}`,moneytoadd)
           message.author.send(`**I setted ${message.mentions.users.first().username} balance to: ${moneytoadd}$**`)
           
         }

    break;

how can i do that i could do it with a mention / user id??

pale vessel
#

ah yes punycode

#

just remember those

zenith terrace
pale vessel
#

it's a punycode domain

zenith terrace
quartz kindle
#

lmao

solemn latch
#

so, whats the laziest way to do an image host 🤔

pale vessel
#

pyrocdn

umbral zealot
#

find one that exists? lol

solemn latch
#

with my own domain ;p

pale vessel
#

yes

#

pyrocdn

solemn latch
#

okay thanks flaze 😄

pale vessel
#

you can use sharex too

zenith terrace
umbral zealot
#

I dunno I wrote my own in Clojure and then in JavaScript and it's like... 100 lines of code with express or koa

#

¯_(ツ)_/¯

solemn latch
#

cant sharex, will get bonked by cms 😦

pale vessel
#

ah

#

well it has an API with keys

#

so you're good

zenith terrace
solemn latch
#

woah now

#

beaned

quartz kindle
#

deal

umbral zealot
#

That can be cheap or expensive depending on what you're getting prxGasm

solemn latch
#

ah yeah this seems super easy flaze

zenith terrace
#

owo

pale vessel
#

yea, hop in their support server, they accept suggestions too

#

they as in Luke lmao

zenith terrace
#

lol

#

ima now go to youtube while I eat my food

tardy hornet
zenith terrace
#

no

#

because message.guild

tardy hornet
#

then how can i do that it will

#

with out the guild?

quartz kindle
zenith terrace
#

get the bot to get all users across all the guilds it is in?

zenith terrace
#

deal

tardy hornet
umbral zealot
#

eww quick.db

tardy hornet
#

ik ik

zenith terrace
#

ok ima be on youtube now

umbral zealot
#

A better start is enmap, or nedb.

lusty quest
# pale vessel ah

did you got an woring url for the pyrcdn dns setup? i just get redirected to /200

umbral zealot
#

quick.db is like the very opposite of "Quick"

pale vessel
#

oh you have to go to the domain itself

#

rn it redirects to that yea

lusty quest
#

nope for me the entire page is borked

pale vessel
#

make sure you set the a record to pyrocdn otherwise it won't work

lusty quest
#

if i press manage sub domain here i get a 404

#

if i press view guide here i get a 200

pale vessel
#

you have to go to the subdomain itself

gritty bolt
#

anyone know of any good temporary free hosts to use while I sort out a VPS?

lusty quest
#

with a custom domain?

pale vessel
#

yes

lusty quest
#

even tho the domain is managed elsewhere?

pale vessel
#

yep

#

to the subdomain

#

not the apex domain

#

the subdomain you added in pyro

lusty quest
pale vessel
#

that's ok

#

add the a record for the subdomain pointing to pyrocdn

lusty quest
#

i could fix it if i knew the ip to point the adress to

pale vessel
#

ping it

#

worked for me

#

but I used the ip

lusty quest
#

if i use pyrocdn it works

#

atleast the subdomain

#

found a way

#

created a subdomain from pyrocdn pinged this one then used the ip to set the dns record

pale vessel
#

i just ping pyrocdn.com and used the ip from the response

#

and <subdomain name> <ip> for the a record

#

and then visit the subdomain.domain.tld

solemn latch
#

so, you have to use a subdomain?

pale vessel
#

yeah

solemn latch
#

kinda pognt, but i.woo.pics is good enough

pale vessel
#

I think it's just how it works

solemn latch
#

yeah no makes sense.

#

its free, so i cant complain.

pale vessel
#

yea

earnest phoenix
lusty quest
# pale vessel yea

what did you have to set for sharex for uploading stuff? i know they have some sort of api but i cant find any docs

pale vessel
#

did you see the key though

lusty quest
#

APi key?

pale vessel
#

yeah

lusty quest
#

yes

pale vessel
#

sec

solemn latch
#

just sitting here, waiting for the dns records to update 😦

pale vessel
#

under upload path

lusty quest
#

thx

#

wired i cant ping the subdomain

solemn latch
#

yeah, will take some time for the subdomains dns record to propagate.

lusty quest
#

well then

#

probably up to 24 hours

pale vessel
#

took me less than a minute

solemn latch
#

mines already mostly propagated, guessing i just need to flush dns

lusty quest
#

if i visit my subdomain i just get redirected to pyrocdn

#

did already a flushdns

pale vessel
#

that makes sense

#

you have to go to /manage

lusty quest
#

manage works

pale vessel
#

but it's useless

lusty quest
#

but if i add it to sharex i cant find it

#

nvm works now

pale vessel
#

lulw

distant cobalt
#

on DJS, i forgot how to put the bot's profile pic on the footer?

pale vessel
#

if you use the embed constructor you can use embed.setFooter(text, image)

solemn latch
#

ah, my pihole cached the dns too pandasad

distant cobalt
#

oh k

#

thanks

lusty quest
#

i have a pihole running and no issues with the caching

solemn latch
#

my pihole is set to cache stuff pretty hard

lusty quest
#

ok

#

still not 100% sure if the way i integrated the lancache into the pihole works entirely

solemn latch
#

sharex has a way to have multiple binds for separate providers right?

lusty quest
#

you can set as many custom uploaders as you want

#

but idk how it handles if you set mutiple for the same thing

#

like you tell sharex if it is a image, text ,file uploader

solemn latch
#

i might just manually click for the custom one, and leave imgur as the bind.

#

prevent accidentally using mine for stuff i shouldnt.

#

o

#

it works

earnest phoenix
#

there aren't really any good ones per se

lusty quest
#

get a proper VPS then deploy

#

the few days you sort some out you can usually wait

solemn latch
#

so yeah, you can set a bind to a specific uploader rather than using the one selected in the menu

glad violet
lusty quest
#

dont upload node modules

sudden geyser
#

why are you uploading node_modules though

#

and if 1.7k is recursive in the folder then that's small.

pure lion
#

two questions

#

can i make this look less stupidjs for (let i = 0; i < canvas.width; i += 32) { for (let j = 0; j < canvas.height; j += 32) { for (let index1 = 0; index1 < 16; index1++) { for (let index2 = 0; index2 < 16; index2++) { if (patt[index1][index2].height != 0) { ctx.fillStyle = "gray"; ctx.fillRect(i, j, 32, 32); } else { ctx.fillStyle = "white"; ctx.fillRect(i, j, 32, 32); } } } } }and can i make it change colour (at the if statements it doesnt change the fillstyle colour, it stays on gray even if the value is 0)

gritty bolt
#

so i dont need a vps

#

i just need something to work for a little

#

until everythings good

quartz kindle
#

so all your pixels will have the same color

pure lion
#

oh btw it went to index (16^3)*2

quartz kindle
#

i dont understand what that code is supposed to do

mellow kelp
#

yikes

pure lion
#

yeah i know

mellow kelp
#

O(n^4)

pure lion
#

im tired

#

shuddup

quartz kindle
#

its just loops inside loops that have no relationship to each other, so it ends up doing a shit ton of duplicated operations on the same pixels

mellow kelp
#

you could use at most 2 loops to iterate through each pixel

pure lion
#

okay what its supposed to do is get the thing at the index of the array and then colour the rect accordingly

#

nested?

mellow kelp
#

yea i mean 2 nested loops

#

at least if you have a width and height

quartz kindle
#

get what thing from what array and color what according to what?

sudden geyser
#

2000^4

pure lion
quartz kindle
#

youre missing a relationship here

#

color what rect based on the height property of what?

#

and in what basis?

pure lion
#

uhhh

#

uhhhhh

mellow kelp
#

panik

quartz kindle
#

like

#

what exactly do you want to do

#

in terms of graphics

#

you have two images, right?

pure lion
drifting wedge
#

how can i add an item to a div, with html/js without replacing the dib

#

like adding another item

pure lion
drifting wedge
#

with innerhtml without like replacing it

quartz kindle
#

ok set a fill style, but then use this fill style to do what?

#

fill what rect, where

#

with what size

pure lion
#

filling the rect at i, j with a size of 32x32 px

quartz kindle
#

but what is the relationship between i and j with the 2d array?

pure lion
#

they're a grid