#development

1 messages ยท Page 727 of 1

compact oriole
#

i can hype to

unkempt palm
#

I posted mine 2-3 days ago, still waiting ๐Ÿ™‚ so takes a bit of time

compact oriole
#

oh ok

earnest phoenix
#

I don't know if anyone else has done it yet or not, but I think I may have just published the first public voice chat audio transcription bot

compact oriole
#

are there any analytics bots?

earnest phoenix
#

I think so

compact oriole
#

well now there atleast is

earnest phoenix
compact oriole
#

Hue doesnt even work

earnest phoenix
#

not the first nor the last

#

damn

compact oriole
#

But stonks does ;D

earnest phoenix
#

I thought I had a unique idea

#

all the other audio transcription bots failed, then?

compact oriole
#

It sounds really useful

#

When theres not 100 users

earnest phoenix
#

it listens to each users audio stream independently

compact oriole
#

oh yea

#

then it would be cool

earnest phoenix
#

it's only designed to allow targeting a single user at a time right now

#

because it costs $$/min to transcribe audio

valid frigate
#

regexr is a regex website

earnest phoenix
#

and 100 users * 5 mins = 500 mins

valid frigate
#

also holup

earnest phoenix
#

My last name sounds like "regexr"

#

also I know it's a site

#

one of my favs

#

how else do you learn regex?

solar wraith
#

Stonks?

compact oriole
#

Do you like the stonks site?

solar wraith
#

Not sure

#

my stonks arnt good lately

compact oriole
#

...

earnest phoenix
compact oriole
#

My indie game

#

That i dropped

solar wraith
#

F

compact oriole
#

But i made stonks

#

aint it good?

#

right

solar wraith
#

nice

compact oriole
#

pls

solar wraith
#

Yes

earnest phoenix
#

cool wobbles bro

solar wraith
#

STONKS

#

when your low on stonks so you make more stonks

#

STONKS

earnest phoenix
#

oh man

#

that last video

#

where you give up on development

valid frigate
#

bulma is a good css framework

earnest phoenix
#

"the system wasn't designed for this"

valid frigate
#

did you use that?

earnest phoenix
#

relatable

#

bulma is ugly tbh

solar wraith
#

can i get a hint on how to call a different C# file and use the instructions/commands defined in there

earnest phoenix
solar wraith
#

i am but internal functions

#

defining its various functions

earnest phoenix
#

what

solar wraith
#

i like to keep my main file as clean as possible

earnest phoenix
#

there is no reason to use internal unless you're making a library

solar wraith
#

in solution explorer btw

earnest phoenix
#

why are you creating classes outside of the project

#

you seem to not really know c#

solar wraith
#

they are in my solution btw

#

:3

earnest phoenix
#

it doesn't matter

solar wraith
#

also i want to keep my main file clean

#

so if there is a problem one module fails

#

not all of them

#

thats my main idea

solar wraith
#

....

#

i meant it like call those files

earnest phoenix
#

back to the drawing board

solar wraith
#

and execute the code in those files as if they where internal to the main file\

#

i geuss?

earnest phoenix
#

you don't know how c# works

solar wraith
#

not completely yes

modest maple
#

@earnest phoenix hes basically trying Todo what most people doing discord.py do

earnest phoenix
#

im aware

modest maple
#

Having a seperate file for commands

solar wraith
#

yush

#

not going to happen?

earnest phoenix
#

but

#

they do not know basics of a language

#

no one can really help with that

modest maple
#

It's alot of extra work in C# for little improvement

earnest phoenix
#

you need to learn that yourself

#

no its not

solar wraith
#

i was asking for a gentle push in the right direction

#

i need to learn it my self

earnest phoenix
#

learning c#

solar wraith
#

not get it spoon fed

modest maple
#

Look up how to include external files in C#

earnest phoenix
modest maple
#

Ig

solar wraith
#

i knew i was using the wrong word

#

(im dutch so most words i keep forgetting)

#

(cuz im dumm)

modest maple
#

I can't rlly help much with C# I know some of the robotics side of stuff for CPP but that's about it mostly for the C languages

solar wraith
#

C++ i know

#

hence why i find it little easier to dive into C#

#

and i like the idea of what mick gordon said

#

change the process change the out come

#

:3

modest maple
#

Can't u do a bot in cpp

solar wraith
#

no

#

i cant grasp its version of if statements etc etc

earnest phoenix
#
        userprofile = client.getProfile.get(message.mentions.users.first().id);
        if(!userprofile) {
          userprofile = {   
          id: `${message.guild.id}-${message.author.id}`,
          user: message.mentions.users.first().id,
          profile: "Run `~newprofile` to customise your profile! \n `LIMIT : 1-7 words only`" }
        }
        if (!message.mentions.users.first().id) {
    
          return message.reply('Please use a proper mention if you want to see someone else\'s profile!');
        }
        client.setProfile.run(userprofile);
        return message.channel.send(`${message.mentions.users.first().id}: ${userprofile.profile}`);
      }
   }```
hi im sorry for the interuption and my bad codes but how do i get the username of the mentioned user?
`message.mentions.users.first().id`
slender mountain
#

have you checked the documentation for help?

earnest phoenix
#

username
uses id
have common sense

slender mountain
#

good rule of thumb is to check the documentation for help as a lot of the time it'll have the answer

earnest phoenix
#

sorry i found the answer after playing around with it GWnekomakiNotLikeBOYE

unkempt palm
unique nimbus
#

I think Discord is having a heart attack in the moment

unkempt palm
#

Error fetching applications. Please reload page, or click here to contact support.

rocky rover
#

I thought I was alone !

unkempt palm
#

ok so it's not just me, ty

rocky rover
#

My heart was beating so hard lol

unkempt palm
#

haha

unique nimbus
#

Ye

#

Give them a couple hours

rocky rover
#

and the bot crashed , many things made my heart beat xD

unique nimbus
#

ye

south sonnet
#

Just me or does the test function for the webhook not work?

pale flicker
#

Hello! how can i check if a mention (@user) mention a bot like my bot or another? thanks

warm marsh
#

Get the user for the mention then check if bot.

summer torrent
#

which library do you use

slender mountain
#

Lookin like discord.js

summer torrent
slender mountain
#

^^^

solar wraith
#

wait

#

what did i do wrong every time i lauch my bot it launches and after that it does his thing

#

then exits with error 0x0 (aka a normal shut down)

slender mountain
#

Well without code I wouldnt really be able to help you haHAA

solar wraith
#

fair enough

#

all basic level crap

#

hol up

#

@slender mountain

south sonnet
#
@app.route('/', methods=['POST', 'GET'])
def webhook():
    # top.gg sends data on the latest vote
    if request.method == 'GET':
        return '<h1>This is for Top.gg only, what are you doing here?!</h1>'
    elif request.method == 'POST':
        print("- - - - - TOP.GG VOTE - - - - -")
        give_reward(dict(request.json))
        return '', 200
    else:
        abort(400)

if __name__ == "__main__":
    app.run(host='xx.xx.xxx.xx', port=8083, threaded=True, debug=True) # will listen on port

If I use this with 8083 forwarded correctly and with the webhook info set on the website I should be able to receive votes on xx.xx.xxx.xx:8083, right?

solar wraith
#

did you fill in xx.xx.xxx.xx?

south sonnet
#

Yes ofc

solar wraith
#

also it looks wrong

#

it should be four groups of three

south sonnet
#

Nah it's correct

solar wraith
#

unless your ip adress is something like 97.16.155.25

south sonnet
#

it is

solar wraith
#

but then again YOUR the host

slender mountain
#

@solar wraith is it breaking on any specific line or no.

solar wraith
#

did you forward it in your router

#

no

south sonnet
#

I did

solar wraith
#

me rn ^^^^

#

good

#

also your ip adress you forwarded am i right to assume it starts with 192.168?

south sonnet
#

If I use that exact code a bit different I manage to receive github post requests and get requests but somehow i am not getting the top.gg ones

#

No that's wrong.

solar wraith
#

there is your problem

#

your router needs to have your local ip adress as forwarded

#

your router handles requests to outside

south sonnet
#

It does. I run a website on this exact server too

solar wraith
#

and needs to open a port to your IP adress

#

hmmmm

#

for crying out loud where do i break and with what ;-;

#

cuz break;

#

doesnt work

south sonnet
#

The thing is, I can receive post and get requests from other sites like github and just me checking it

#

But I am not getting anything from top.gg.

solar wraith
#

hmmm

south sonnet
#

So I'm assuming the webhook test function broke...?

solar wraith
#

not sure

#

but are you forwarding an IPv4 adress?

#

cuz i cant force top.gg to ping on IPv4

south sonnet
#

It is on IPv4 yes

quartz kindle
#

try to open xx.xx.xxx.xx:8083 in a browser and see if it logs anything (make it log all requests)

south sonnet
#

It logs

#

and it shows "This is for Top.gg only, what are you doing here?!"

        return '<h1>This is for Top.gg only, what are you doing here?!</h1>'```
quartz kindle
#

then your webserver is correct

solar wraith
#

error 401

#

@slender mountain where do i break?

#

cuz i tried every where but it refuses to break

south sonnet
#

So idk what I'm doing wrong. I have to use webhooks since I'm over the ratelimit but I am having so many problems with this.

slender mountain
#

Wdym, I was meaning if the error happens in any particular place haHAA

quartz kindle
#

well, discord is having issues atm

#

maybe top.gg is also having them

#

youtube was also not loading channels a few mins ago

#

looks like an outage

south sonnet
#

Everything works fine for me

quartz kindle
#

did you try with and without "http://" in the webhook url?

south sonnet
#

Yes I did

#

OMG

#

KIDDING ME

#

I found the problem

#

You have to click "save" first and only after that you can use "test"

quartz kindle
#

lmao

south sonnet
#

I'll show myself out.

#

Thanks guys

quartz kindle
#

np we didnt do anything

solar wraith
#

@slender mountain no error 0x0 is just standard normal exit code

#

no errors

#

for crying out looud

#

either no commands at all

#

or no bot

#

what am i doing wrong

#

@earnest phoenix can you tell me how to get my bot not to exit it self

#

or give me a hint

slim heart
earnest phoenix
#

lol I was pushing my bot's updates to my hosting service using git and it took me over 20 minutes to push all the changes

solar wraith
#

F

glacial mango
#

How do I change ttf font into fnt?

weary lark
glacial mango
#

You can't select fnt as output format

solar wraith
#

F

glacial mango
#

Anyone knows how to fix this?
TypeError: list.splice is not a function

#

I get it when I try to remove an item from list

modest maple
#

What language @glacial mango

glacial mango
#

js

earnest phoenix
#

hoiii i wanna ask can var randomNumber = Math.floor(Math.random() * 201); have some kind of percentage system? like chances to be exact
70% to get number 1-100
20% to get number 100-150
10% to get number 150-200

quartz kindle
#

@glacial mango that means list is not an array

glacial mango
#

What do you mean

quartz kindle
#

@earnest phoenix theres probably a million ways to do that, but the simplest way i can think of rn is to run a random number from 0-10, if it returns 0-7, run a random number 1-100, if it returns 7-9, run a random number 100-150, if it returns 9+ run a random 150-200 lol

earnest phoenix
#

as long as it work i like it pogey

quartz kindle
#

@glacial mango splice is an array method, it only works in arrays

#

an array looks like this: [item1,item2,item3]

glacial mango
#

but list is defined as an array

quartz kindle
#

whatever your list is, its not an array

#

console.log it and see what it is

glacial mango
#

ok

#

@quartz kindle This is the list:

**11.** [Post Malone - Circles](https://www.youtube.com/watch?v=wXhTHyIgQ_U)
**12.** [Post Malone - Circles](https://www.youtube.com/watch?v=wXhTHyIgQ_U)
**13.** [Post Malone - Circles](https://www.youtube.com/watch?v=wXhTHyIgQ_U)
**14.** [Post Malone - Circles](https://www.youtube.com/watch?v=wXhTHyIgQ_U)
**15.** [Post Malone - Circles](https://www.youtube.com/watch?v=wXhTHyIgQ_U)
**16.** [Post Malone - Circles](https://www.youtube.com/watch?v=wXhTHyIgQ_U)```
quartz kindle
#

how did you define it?

#

post the actual code

#

and the console.log output

#

console.log(list)

solar wraith
earnest phoenix
#

what is not working

solar wraith
#

the entire program

earnest phoenix
#

well

#

yeah

solar wraith
#

exception

#

Exception from HRESULT: 0x80131040

earnest phoenix
#

you give it nothing to do after starting the client

#

so it just exists

solar wraith
#

no it crashes now

#

for now reason

earnest phoenix
#

there is always a reason

solar wraith
#

yeah but i dont know

#

why

#

it was functioning good a while ago

earnest phoenix
#

try catch in MainAsync and see what causes it to exist

quartz kindle
#

strong willpower is what causes it to exist

solar wraith
#

strong willpower?

#

wtf

modest maple
#

Exception from HRESULT: 0x80131040

This is a mismatch between assemblies: a DLL referenced from an assembly doesn't have a method signature that's expected.

Clean the solution, rebuild everything, and try again.

Also, be careful if this is a reference to something that's in the GAC; it could be that something somewhere is pointing to an incorrect version. Make sure (through the Properties of each reference) that the correct version is chosen or that Specific Version is set false.

solar wraith
#

@modest maple new one did what you wanted System.MissingMethodException: 'Method not found: 'System.Collections.Generic.IAsyncEnumerable`1<System.Collections.Generic.IReadOnlyCollection`1<Discord.IUser>> Discord.IChannel.GetUsersAsync(Discord.CacheMode, Discord.RequestOptions)'.'

earnest phoenix
#

are you using .net framework

solar wraith
#

yush

#

i think

earnest phoenix
#

why

solar wraith
#

xD

#

cuz it was preinstalled

#

and it worked before with that

earnest phoenix
#

use .net core

#

as well as a ton of other libs

solar wraith
#

nvm

#

i had nothing\

#

xD

earnest phoenix
#

with .net core you get cross platform support and single file app publish

solar wraith
#

F

earnest phoenix
solemn harness
#

ok

#

tell me

#

@west spoke

#

can you please tell me

west spoke
#

no

#

shut up

solemn harness
#

what?

#

why you rude

west spoke
#

there is a thing called google

#

because you pinged me

solemn harness
#

sorry for that

#

i googled but can't find it

west spoke
earnest phoenix
#

yall need to learn how to do keyword searching

west spoke
#

^

earnest phoenix
#

you don't search for "how to use roblox api in my discord bot pls", rather, you search for keywords which would be "roblox api"

west spoke
#

^

solemn harness
#

i don't write this

west spoke
#

Well said cry, well said.

solemn harness
#

i write roblox web api

west spoke
#

just

#

google

#

roblox api

modest maple
#

Smh

solemn harness
#

don't be rude

earnest phoenix
#

lmao

#

nobody is

west spoke
#

^

modest maple
#

^

solemn harness
#

he is

modest maple
#

I'm not

west spoke
#

if I'm seemi--

solemn harness
#

i just ask a simple question

west spoke
#

ok now...

earnest phoenix
#

no, you're just being offended that you didn't get what you wanted

modest maple
#

You didnt

earnest phoenix
#

lmao

modest maple
#

You expect to be spoon fed

west spoke
#

^

#

Never gonna happen spoonfeed

compact oriole
#

Is there a feedback place?

solar wraith
#

Not sure

granite trout
#

Can someone help with http get requests with a bearer token? :/

earnest phoenix
#

just ask your question

compact oriole
#

^

sudden geyser
#

Affax not positive, but I believe DBL's github serves as a type of feedback

loud salmon
#

@compact oriole feedback for the website?

compact oriole
#

Yea

#

How does it look?

#

It also works

#

(The bot)

earnest phoenix
#

love it

#

i also love how it's dark/night themed by default

granite trout
#
fetch('URL.co.uk/api', {
                method: 'GET',
                headers: {
                    "Authorization": '1234',
                    "Content-Type": 'application/json',
                    "token_type": 'Bearer'
                }
            })
#

should work?

earnest phoenix
#

no

#

token type is provided in the auth header

#

Authorization: Type value

compact oriole
#

@earnest phoenix if your pc is on dark mode, the website starts as dark and vice versa

#

"Authorization": 'Bearer 1234'

#

It should be like that ^

#

Atleast in Discord

granite trout
#

awesome

#

and apart from that, it should work?

compact oriole
#

Pretty sure

granite trout
#
if (command === 'cat') {
const { file } = await fetch('https://api2.com/public-api/stats/ModoSN/pc/generic', {
method: 'GET',
headers: {
"Authorization": 'Bearer 42cfa8f2-f2a8abe493d7',
"Content-Type": 'application/json'
}
}).then(response => response.json());

message.channel.send(file);
#

error saying it can't send an empty message,

#

how can i make it send like the raw GET

earnest phoenix
#

json() returns a promise

#

also

#

you're mixing async and sync

#

stop doing that

solar wraith
#

Is dis C#?

mossy vine
#

no its probably js

solar wraith
#

Looks like c#

#

But then again

mossy vine
#

C# and js are both heavily based on java syntax, thats why they are all so familiar

solar wraith
#

I know nothing ;-;

granite trout
#

so how do i do .catch

mossy vine
#

as cry said, it returns a promise

#

await it

#

wait what

solar wraith
#

the hype

mossy vine
#

why do you have both await and .then waitWhat

earnest phoenix
#

also
you're mixing async and sync
stop doing that

granite trout
#

idk where

earnest phoenix
#

that's what comes from copypasting and not understanding concepts

#

tldr monkey sees monkey does

solar wraith
#

totaly not doing the same

granite trout
#

I dont understand the whole await and .then and the http request stuff, like at all

earnest phoenix
#

have you tried research

granite trout
#

yeah but discord.js docs are very basic

earnest phoenix
#

discord.js docs don't cover async and sync concepts

grim aspen
earnest phoenix
#

that is something you should know when going into using the lib

#

i don't get why so many devs don't want to do research because it won't be "first try"

#

it's totally fine to read the docs and play around with different methods to see how it ends up with

blissful scaffold
#

I don't think you can call yourself a dev if you don't research stuff

earnest phoenix
#

psh

blissful scaffold
#

you are just a copy paster if you dont do research

granite trout
#

it already has .then idk why it matters

solar wraith
#

question why are we using async?

earnest phoenix
#

the words alone explain why

#

sync is waiting for x to finish

solar wraith
#

but if you drop that

earnest phoenix
#

async can run while something else is running

solar wraith
#

it doesnt wait

#

neat

#

also

#

i figured it out

earnest phoenix
#

if all apps were to be sync the world like you know it today would be extremely slow

solar wraith
#

i was running C# in vs under a blank solution

#

and now a dedicated C# .net core solution :3

earnest phoenix
#

nice

solar wraith
#

sooooo

#

me when i realised this

#

also

#

i am storing my command modules in a folder called modules

#

it can find them

#

nvm nvm nvm

#

im taking a look at the documentation first

earnest elm
#

man

#

i was so stingy that instead of paying $10 for dbm i learned coding

#

First time being stingy helped me

earnest phoenix
#

congrats lol

solar wraith
#

xD

#

feck

#

it cant find file

#

like where do i give the command handler a pointer to where it must search

earnest phoenix
#

you provide the context to ExecuteAsync

#

ExecuteAsync gets the message out of the context

#

and reads its content

#

then attempts to match your module and commands

#

in order for executeasync to find the module the class needs to be public and needs to extend ModuleBase<ContextTypeThatYou'rePassingToExecuteAsync>

near ether
#

How slow is using manager.broadcast() or manager.broadcastEval()?

glacial mango
#

Can I use local images in embed messages?

#

Please ping me I'm watching netflix

mossy vine
#

@glacial mango yes you can

earnest phoenix
#

you need to uploaded them first though

#

but you can reference an upload to an embed image

glacial mango
#

What do you mean cry?

earnest phoenix
#

attachment://name.extension

#

as the embed image

#

while sending the image

glacial mango
#

hm ok

modest maple
#

i think cry should get a special role

#

to show appriciation

solar wraith
#

true

mossy vine
#

same with tim

solar wraith
#

cry is nice dev

mossy vine
#

gods of this channel

solar wraith
#

:D

#

yush

real crater
#

how to invite my bot at this server?

loud salmon
#

-faq 1 @real crater

gilded plankBOT
#

@real crater

Frequently Asked Questions ๐Ÿ“œ
real crater
#

@loud salmon thank you

near ether
#

How would you manage cooldowns for commands (stored in memory) across multiple shards?

undone rose
#

People would rlly need to know more abt how your bot is setup

#

To answer tht question

short siren
#

a database?

near ether
#

Would it not be inefficient to repeatedly call the database?

#

I use mongodb

modest maple
#

well depends

short siren
#

you could save the time that it will next allow you to run the command again in the database then just cache it in an object or something then when people run the command you only have to compare it to an object then if it seems about right maybe call the db?

#

or just find a fast db

near ether
#

The issue is what if someone uses the command in a server with shard 1, then tries again on shard 2? It wouldnโ€™t recognize the cooldown stored in the object fro shard 1 because they are separate processes

short siren
#

maybe save it to a external file might be inefficient tho

near ether
#

Or could I store the cooldowns in the file with the shardmanager and have the shards get/set cooldown info from there?

valid frigate
#

what

#

no

#

imo the most effective way of handling cooldown on a sharded bot is to store command usage in a database

#

but not storing a new document every time someone uses a command

late hill
#

Are we talking about large cooldowns or just small cooldowns to prevent spam?

valid frigate
#

this works for large & small cooldowns

#

lemme kinda run down how i would think it would work

near ether
#

I have a ;job command on a 15 minute cooldown

late hill
#

Then just use db

valid frigate
#

user X runs a command with a 1 hour cooldown and their command usage gets placed into a db like so:
id: X, command: cmdname, lastUsed: current unix timestamp

#

then if they ever run the command again, check the database for if the difference between now & when they last used the command is greater than the cooldown length or smth

late hill
#

You're concerned that your database would potentially get spammed?

near ether
#

I also have a ;fight command, where you begin a fight with a player. You canโ€™t fight more than 1 player at a time, so if you run ;fight again, it tells you to finish your original fight

#

Nah

valid frigate
#

databases can handle thousands of i/o operations

#

it's fine

late hill
#

You could cache the cooldown on that shard once they've used the command once

near ether
#

So there are timed cooldowns and temp cooldowns

#

I see

valid frigate
#

how will other shards be aware of that cooldown

#

youd have to delve into ipc, which even then is not reliable

late hill
#

As in a double system

#

It's in DB

#

You check if cached, if it's not, fetch from DB

near ether
#

Hmmmm

late hill
#

But as said

valid frigate
#

the idea here is not to have setTimeout or setInterval

late hill
#

DB only would be fine

#

mongo can handle it

valid frigate
#

database only is actually your best choice because as i said

#

dbs can perform a lot of operations at once

#

plus without a cache, your bot is one step closer to being stateless

near ether
#

What does that mean?

valid frigate
#

stateless simply means your bot doesnt have anything stored in its memory, like caches

#

dont quote me on this

near ether
#

Is it ideal to be stateless?

late hill
#

Depends heavily on use case

#

Cache will always be faster

silver rapids
#

as with everything in development :p

valid frigate
#

ehhh

#

cache doesnt scale well on really large bots but sure

silver rapids
#

depends on how you build the cache

valid frigate
#

cant speak on behalf of 9000 million guild bots

silver rapids
#

a bad database design could be worse tbh

#

at work i work a lot with legacy

near ether
#

Gotcha

#

Thanks guys!!!

near ether
#

Honestly dude fuck sharding lmao

#

Or should I say, sharding the traditional way

#

Canโ€™t I just do internet sharding with one line or something?

#

I set my bot to have sharding: auto right?

earnest phoenix
#

hi

quartz kindle
#

internet sharding lmao

near ether
#

*internal lol

#

Autocorrect hates me

modest maple
#

you dont really need sharding unless the bot is above 2,000 guilds

near ether
#

Yea but my bot is growing faster than I expected and I wonโ€™t have time to figure this stuff out later so I thought Iโ€™d get it out of the way now

modest maple
#

fair enough

valid frigate
#

i know people always say "but duuude you shouldn't shard at 30 guilds" but don't listen to people like that

#

if your bot is growing fast definitely go for sharding

modest maple
#

hmm

#

well

#

might have to think about it at some point too den

#

i think we're gaining about 60 guild a day on average

#

but its going in a curve shape so ๐Ÿคท

amber fractal
#

... What? If you shard at 30 guilds it will have a negative impact.

#

Build your bot to be compatible with sharding, but sharding too early is bad

modest maple
#

can someone actually explain how sharding works indepth

#

ik thew basics of it but kinda just interested in how it works in general

broken jay
#

Wtf? In my bot (that is under development) and is in 2 servers, i use Auto sharding, and this work well..

mossy vine
#

auto sharding for 2 servers

#

thats totally not unnecessary

earnest phoenix
#

^

modest maple
#

^^

late hill
#

auto sharding would mean that it only uses 1 shard in that case unless you've set the guild count to 1 server each

earnest phoenix
#

If your bot is growing at an insanely fast rate, sure, shard away, but even at 100 guilds, there's still no need to shard

late hill
#

so it makes no difference

broken jay
#

i use python AutoShardedBot

slender thistle
#

That thing determines the preferred amount of shards

#

so really I'd bet you just have 1 shard running

broken jay
#

Ye

#

But now i don't care about sharding. When i release this and this grow, this just add additional shards.

late hill
#

Yes

#

But you should be aware that that doesn't mean your code will still work as intended when there's multiple shards

broken jay
#

Currently I have no problems, and so much than I searched about discord.py sharding, this shouldn't have any effect to bot work. I know like JS have problems and much others, but i think not python

modest maple
#

you're using () to encase all of the {}? shouldnt it be bot.on('messageReactionAdd', (messageReaction, user))

west raptor
#

.. Any errors?

modest maple
#

just thinking invalid syntax?

west raptor
#

messageReaction is undefined

#

Unless you are using emoji somewhere else

#

Oh also ids should be strings

late hill
#

Yeh

#

I don't think the issue is in your messageReactionAdd listener

#

Actually

#

That is where it breaks

#

But it's because you're emitting the event with invalid parameters

#

var msgReaction = msg.reactions.get(event.d.emoji.name + ":" +event.d.emoji.id);

#

the reactions are mapped by id pretty sure

#

Not sure why you're using the raw events, var and empty if clauses but the above should be what's causing the error ^^ @earnest phoenix

quartz kindle
#

the raw event is needed to handle reactions on uncached/old messages

late hill
#

ah

#

good to know

#

would the raw events be fired before the other ones?

#

uhh

#

You can just ask stuff here, there's multiple people checking this channel regularly

quartz kindle
#

yes, the raw event is fired first

#

you can even use the raw event to intercept and modify the data you receive before it is passed to other events

#

i use it to disable user and channel caching lul

late hill
#

oh

quartz kindle
#

log msg.reactions and log event.d.emoji

short siren
#

Hey, so I'm learning sharding I'm wondering what I should put as the delay between spawning shard I heard I should do a 1 minute delay to allow it time to allow the prior shard to spawn is this correct

valid frigate
#

hmm?

#

most libs spawn shards like 5 seconds apart

#

there is a timeout though (usually 30 seconds) that libs wait for before they realize a shard isnt gonna connect anytime soon

#

shards can spawn synchronously iirc so dont worry about waiting for one to spawn

quartz kindle
#

5 seconds is the rate limit, anything lower than that and you'll get rate limit errors

valid frigate
#

guess some libs do 10 seconds by default apparently

quartz kindle
#

i do 5.5 seconds

valid frigate
#

makes sense

#

exactly 5000 milliseconds leaves room for error

cobalt cape
#

Hey so I want to have my bot pass over a bit of code if it doesn't need it. Its a report command for mods, and it'll see if theres a channel. If there is, it'll send the report but still send the error message for there being no channel. Code block below.

#
          let reportschannel = message.guild.channels.find(`name`, `reports`)  
          if (!reportschannel) return message.channel.send(`Uh... no reports channel`)```
steel heath
#

.find function has changed a little bit

#

So you might want to try .find(c => c.name == "reports")

#

It should work on both ways afaik but just give it a try

cobalt cape
#

Ah thank you, I'll look at the docs for more information.

steel heath
#

yw

earnest phoenix
#

someone knows how can i create a Webhook with author message avatar and the author message username?

summer torrent
#

in discord js? @earnest phoenix

earnest phoenix
#

yep

summer torrent
earnest phoenix
#

thanks :D

summer torrent
#

np

earnest phoenix
#

How would I make a bot make roles ?

summer torrent
#

Which library do you use

slender mountain
#

^

spark mantle
#

if(message.member.roles.some(role => role.name === kevin)){
^

TypeError: Cannot read property 'roles' of null
the code works fine most of the time and then just replys back with this

slender mountain
#

are you trying to check if a user has a role @spark mantle ?

spark mantle
#

yes

slender mountain
#

pretty sure its .has not .some

spark mantle
#

ahh thanks

sudden geyser
#

It's some

spark mantle
#

?

sudden geyser
#

And that's not their problem

spark mantle
#

oh

sudden geyser
#

The guild member is not fetched/kept, so it's null

earnest phoenix
#

@summer torrent

#

Wdym by library

slender mountain
#

do you use discord.js?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

grim aspen
hoary bramble
sage bobcat
#

One message removed from a suspended account.

grim aspen
#

gern geschehen

sage bobcat
#

One message removed from a suspended account.

grim aspen
#

lemme see

hoary bramble
#

Hi

#

thank you

#

whats the difference between that and

#

ctx.author.send?

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

hoary bramble
#

thats true

grim aspen
#

hmmm

hoary bramble
#

yeah

#

lol

sage bobcat
#

One message removed from a suspended account.

hoary bramble
#

ty

grim aspen
#

but not really he;pful

sage bobcat
#

One message removed from a suspended account.

grim aspen
#

yeah i can't find anything

sage bobcat
#

One message removed from a suspended account.

sudden geyser
#

In eris, i believe there's a members prop

#

It's in the docs

#

Nevermind, I don't see it at first glance

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sudden geyser
#

I mean, you could just loop through every guild member and check if they have the role.

sage bobcat
#

One message removed from a suspended account.

#

One message removed from a suspended account.

sudden geyser
#

It wouldn't be that long

#

Like 30-50 characters

sage bobcat
#

One message removed from a suspended account.

sudden geyser
#

Maybe shorter

sage bobcat
#

One message removed from a suspended account.

sudden geyser
#

Check the roles array of each member and see if it included the role id

steady carbon
#

My bot has been running for more than 3 weeks normally. Today, it took a long time to respond to the commands, so I restarted and now he does not want to call, giving the error "Something took too long to do". Can anyone help me?
i already try change token and is not working
and now I tried to start the bot on my computer and it worked normally
what can i do?

hollow tiger
#

@steady carbon .js?

west raptor
#

@steady carbon probably an issue with discord

#

unfortunately noy much you can do

steady carbon
#

@hollow tiger yes

hollow tiger
#

hmm

#

running on your computer or using a website to host it

steady carbon
#

running on my computer work so good

#

but running on VPS isn't working

hollow tiger
#

if its computer im not really sure because i coded my first bot 1 years ago using computer and switched to using a website

steady carbon
#

..?

hollow tiger
#

im not that good at computer stuff and havent hosted a bot running on a computer in a year

steady carbon
#

I'm using VPS Ubuntu 19.10

hollow tiger
#

hmm

steady carbon
#

the bot was working until this afternoon

hollow tiger
#

maybe ask someone else im not the person to ask when it comes to network

steady carbon
#

what is the chance of discord banning my vps ip?

final stone
#

Low if your not abusing the API

#

What is the vps company?

steady carbon
#

Google Cloud

final stone
#

I doubt discord would block any compliant ips from that host, is it showing any error when booted?

steady carbon
#

the bot takes 5 minutes to call and then gives the error "Something took too long to do".

final stone
#

Thats strange, what libary are you using and lang

steady carbon
#

nodejs

final stone
#

with eris or discord.js?

steady carbon
#

discord.js

final stone
#

or some other one?

#

ok, weird

steady carbon
#

maybe.. mysql? kk

final stone
#

you got a mysql server running? Go ahead and check that

#

ยฏ_(ใƒ„)_/ยฏ

steady carbon
#

yeah

#

its running ok

final stone
#

Whats the code that connects it minus the creditinals?

steady carbon
#

user ?

final stone
#

like what lines of code are you using to connect & use the db

steady carbon
#
let mysql = require('mysql');

let connection = mysql.createConnection({
    host: "localhost",
    user: "root",
    password: "",
    database: 'db',
    charset: 'utf8mb4'
});
```this?
#

the connection its ok

final stone
#

Yes, that semes fine at least on the connection ยฏ_(ใƒ„)_/ยฏ

steady carbon
#

shows "connected"

final stone
#

And then it just crashes and says something took too long?

steady carbon
#

i used

client.login(token).then("OK").catch(err => console.log(err));
#

don't show "ok"

#

and later 5 min

#

show "something..."

brave loom
#

were do i find my message/server id? to input for my bot

#

sorry to interupt

final stone
#

@brave loom Turn on developer options in your discord appearance settings and right click your server / name and click copy ID

#

Hmm

steady carbon
#

maybe.. discord was banned my vps address?

final stone
#

Well if it was banned it should not be timing out i believe it would just 401 Forbidden you, or whatever the code is

steady carbon
#

i don't know what i need to do

brave loom
#

were do i right click

steady carbon
#

my bot is offline for more than 7 hours

brave loom
#

i turned it on

final stone
#

you right click on your name to copy your name or on a server icon to copy it

#

and select copy id

#

So it just randomly stopped working @steady carbon nothing was modified?

brave loom
#

wha?

steady carbon
#

i launched an update at 11:00 am

final stone
#

and it stopped working then?

steady carbon
#

right now i'm uploading the last update

brave loom
#

wdym on a server icon

final stone
brave loom
#

oo

#

i got it

final stone
#

well good luck @steady carbon, Never heard of this problem before, there is still a chance discord could of blocked you but im not sure if theres a way to tell right now

#

ยฏ_(ใƒ„)_/ยฏ

#

and ok @brave loom

brave loom
#

it says invalid token

final stone
#

are you trying to log into a bot account?

brave loom
#

no

#

tryna make

final stone
#

what?

steady carbon
#

levi, br?

brave loom
#

im doing this Discord bots | add your bot

final stone
#

what did you put in your client.login or whatever? A bot token or your ID

brave loom
#

my id

final stone
#

are you using discord.js?

brave loom
#

yeha

final stone
brave loom
#

yeah

#

ty

final stone
#

np

#

Also a good starter guide if its your first bot ยฏ_(ใƒ„)_/ยฏ

brave loom
#

ok

#

so

#

i did it

#

now wuut

#

i created it

#

do i need to add it to discord?

#

or is it already added to discord

final stone
#

You need to add it to your server and put the token in your client.login area. All of it is explained in https://discordjs.guide, just look through some pages and you will most likey find what your looking for

steady carbon
#

@final stone I changed the ip of the machine and now the bot is running but is VERY slow

final stone
#

Maybe it was ratelimited

#

Do you have any fast actions on your bot

#

ex, fast changing status?

steady carbon
#

status is changing in 15 secs

final stone
#

Hmm, thats a possible ratelimit but unlikely, any other things that are on a timer?

#

or like logs?

steady carbon
#

timer = setTimeout ?

#

or timeout to delete messages?

final stone
#

setinterval

steady carbon
#

no

final stone
#

anything that repeats

steady carbon
#

have only 2 setInterval in bot

final stone
#

weird

steady carbon
#

have SO MANY .delete(15000) in messages

final stone
#

Wait, so its deleting 15000 messages?

#

oh

#

its a timed delete

#

๐Ÿคฆ

steady carbon
#

noo kk

#

when a person use a command

#

send a message

final stone
#

then deletes it in 15 sec?

steady carbon
#

and.. this message is deleted after 15 secs

final stone
#

yeah

steady carbon
#

this is a problem?

final stone
#

I misread it for a sec, its a bit late where i live

#

not at all

steady carbon
#

relax kaka

final stone
#

create another bot token and see if its faster, if it is you were ratelimited and you should make anything that repeats repeat a bit slower, if not your vps could be having network mantiance slowing it down

#

Not really sure if there is another way to detect a ratelimit

brave loom
#

IM LOST

final stone
#

huh?

brave loom
#

im reading how to out it in servers

#

i dont get it

final stone
#

what is your bots client id?

steady carbon
#

collier

#

can i use commands here?

#

its only for show

final stone
#

I don't think bots can read them from this channel, just in case do it in #commands so you wont get warned

steady carbon
#

okay

#

see that

brave loom
#

it says im not allowed to link my bots client idea

earnest phoenix
#

Hello

brave loom
#

collier

#

ill dm u my clients id

final stone
#

ok

west raptor
#

Client id is basicly public, no?

#

Or are you talking about token

final stone
#

Im talking bout client id, its a new bot dev

#

pepowot wish i did not speak in this chat

steady carbon
#

and how can i optimize the "api"

#

do you know?

#

@final stone

#

and sorry for mention

final stone
#

optimize the api?

steady carbon
#

yeah my code

final stone
#

I mean, you. wha?

steady carbon
#

Can you help me optimize the use of discord api in my code? or at least give me some tips on what to do to use less

sudden geyser
#

Don't send as many useless requests. Kind of confusing what you mean, but most likely won't want to go through your code for that.

valid frigate
#

random ass discord

sage bobcat
#

One message removed from a suspended account.

slender mountain
#

Maybe show your code?

#

That doesnt give us any information

vital lark
#

@valid frigate send the code

valid frigate
#

ah yes

#

one moment por favor

earnest phoenix
#

sorry for being a noob but

client.getScores = sql.prepare("SELECT * FROM scores WHERE user = ?");```
How do I make both of these variable accessible in other commands files?
vital lark
#

it should be accessable by the client paramater

valid frigate
#
val embedJsonObject = JSONObject()
    .put("title", "some title")
        .put("description", "xd")
        .put("color", 0)    
val requestJsonObject = JSONObject()
    .put("embeds", "[$embedJsonObject]")

"webhook url".httpPost()
         .jsonBody(requestJsonObject.toString())
#

yeah about the whole string method

#

it's part of the http client

#

tryna send an embed sucks bro

vital lark
#

so jsonBody needs a string as it's paramater?

valid frigate
#

for the most part

vital lark
#

it should be an object, not a string

valid frigate
#

it's a stringified json

#

literally

#

it accepts a string

vital lark
#

I think you need to send a object

#

not a string

valid frigate
#

id think so too

#

also what's the right content type header to send

#

tried application/json

vital lark
#

because ur sending js "{\"embeds\":[{\"title\": \"title\"}] }" and not json { embeds: [{ title: 'title' }] }

valid frigate
#

yes yes

#

inb4 i just use okhttp

vital lark
#

okhttp3 is fine

valid frigate
#

ok so the problem probably has to do with the fact that i'm sending stringified json

vital lark
#

yea

valid frigate
#

k august thanks

#

finna just use okhttp actually

vital lark
valid frigate
#

dont see any reason not to tbh

vital lark
#

yea okhttp3 is op af

valid frigate
#

yay -1 dependency

earnest phoenix
#

how do i make the bot detect if an input is in json?

#

im tired of the console log errors spongerino

#

try catch

slender mountain
#

That just logs the error haHAA

#

And prevents it from crashing

vital lark
#
try {
//success
} catch(ex) {
//errored
}
slender mountain
#

Cept Danish is implying something's causing his code to throw errors, usually you want to fix those PES_CringeGrin

tranquil drum
earnest phoenix
#

Here's my command

    {
      let messageID = message.content.split(" ")[1];
      let editedmessage =  message.content.split(" ")[2];   
      try {
        message.channel.fetchMessage(messageID)
          message.edit(JSON.parse(editedmessage));  //edit the message in Embed 
      } catch (err) {
        message.channel.fetchMessage(messageID)
        .then(message => {
          message.edit(editedmessage) //edit the message if its not embed
        });
      }
     }```
 So I ran this command 

`~edit 643682364303605760 {
  "color": 0,
  "title": "uwuwwuwuw",
  "description": "OWO"
}`
and the picture below showcase the edited message
#

Sorry if i asked too much but im way too curious

radiant jay
#

Put the code in an actual codeblock please

slender mountain
#

^

#

``

Code here....

``

weary lark
#
 if (command === "edit") 
    {
      let messageID = message.content.split(" ")[1];
      let editedmessage =  message.content.split(" ")[2];   
      try {
        message.channel.fetchMessage(messageID)
          message.edit(JSON.parse(editedmessage));  //edit the message in Embed 
      } catch (err) {
        message.channel.fetchMessage(messageID)
        .then(message => {
          message.edit(editedmessage) //edit the message if its not embed
        });
      }
     }
#

messy code lol

earnest phoenix
#

hey im a noob sooo GWnekomakiNotLikeBOYE

silver rapids
#

try/catch around a JSON.parse?

#

or some regex ๐Ÿ™‚

slender mountain
#

@earnest phoenix I don't know if you can edit an existing embed, I'm pretty sure what you are going to have to do is create a new embed with the same old stuff and change whatever was updated.

earnest phoenix
#

yup my goal, im gonna google ๐Ÿ˜ข i think the fault is at let editedmessage = message.content.split(" ")[2]; since itll only take the { when i ran ~edit 643682364303605760 { "color": 0, "title": "uwuwwuwuw", "description": "OWO" } and i also need to delete the existing embed in the way

slender mountain
#

yea

#

instead of message.content.split(" ")[2]; do message.content.split(" ").slice(1); @earnest phoenix

earnest phoenix
#

Thank you anclint#9255! Here's my code if you guys want to critize or give a more cleaner way haha ๐Ÿ’ž

 if (message.content.startsWith('~edit'))
      {
      var messageID = message.content.split(" ")[1];
     var editedmessage =   message.content.split(" ").slice(2).join(" ");
     var embed = JSON.parse(editedmessage)

       message.channel.fetchMessage(messageID)
      
       .then(message => {
         message.edit({embed});
       });
      }```
late hill
#

ok

#

You could do some research on var / let / const in javascript

#

Because using var for everything isn't rly the best way to go about stuff

#

You could split on " " just once and save the output in a variable which you can then use in the rest of your code

#

It's a good idea to avoid using the same name for different variables, in your case you're just executing one simple line of code in that .then() but if things get more complex it would be difficult to "see" what message is

earnest phoenix
#

oh yea i heard the myth where NEVER use var because .... And thanks for the other tip ๐Ÿ‘

stable perch
#

how to get DBL API Token

quartz kindle
#

your bot's edit page

stable perch
#

i cant find

solar wraith
#

why is my bot auto exiting

#

do i need to introduce a loop?

#

@earnest phoenix throw me a bone

#

xD

solar wraith
#

any one els

earnest phoenix
#

i told you why yesterday

compact oriole
#

It should not do tjat

#

It should stay on

solar wraith
#

that i think i fixed

#

fixed

earnest phoenix
#

what is your code

solar wraith
#

had: await _client.LoginAsync(TokenType.Bot, Environment.GetEnvironmentVariable("token_alpha")); await _client.StartAsync();
now i should have had:

                Environment.GetEnvironmentVariable("token_alpha"));
            await _client.StartAsync();
            await Task.Delay(-1);```
earnest phoenix
#

try catch you're probably getting an exception

compact oriole
#

Oh it's c#

#

Yea

solar wraith
#

no

#

i am not

compact oriole
#

@earnest phoenix is right

solar wraith
#

its compiling correctly

#

C:\Users\ekore\Desktop\bot stuff\tanki alpha\bin\Debug\netcoreapp3.0\tanki alpha.exe (process 16172) exited with code 0.
To automatically close the console when debugging stops, enable Tools->Options->Debugging->Automatically close the console when debugging stops.
Press any key to close this window . . .```\
earnest phoenix
#

getting exceptions is not a compile time thing

#

its runtime

solar wraith
#

nope

#

it just exits it self

earnest phoenix
#

what happens when you dotnet run

#

run cmd cd to your .csproj and do dotnet run

solar wraith
#

i thought i said i fixed the problem MegaThonk

compact oriole
#

...

#

There might be an error lingering about

solar wraith
#

no

#

:)

earnest phoenix
#

how many times do i have to tell you that exceptions are runtime things

west raptor
#

That doesn't include runtime errors

#

VS can't just magically know if there is a runtime error

solar wraith
#

;-;

west raptor
#

And if it did its not like it would know how to fix it because it's not a direct issue with your code but rather the way your code is written

solar wraith
#

uhm

#

i took the example code

west raptor
#

And..?

#

Example code isn't always perfect

solar wraith
#

;-;

west raptor
#

Nor is it always up to date

solar wraith
#

cry you said catch errors how?

west raptor
#

Try catch

solar wraith
#

just plain old catch?

#

well i got that

#

and

#

the program seems to break D:

west raptor
#

Error?

solar wraith
#

11 of em

#

acording to vs

earnest phoenix
#

you're lacking basic c# knowledge

solar wraith
#

not really

#

i know basic basic C#

earnest phoenix
#

and what is your code

solar wraith
#

all in here

#

:}

earnest phoenix
#

i asked for your code

solar wraith
#

well

#

you have my code right there

#

i simply read that

earnest phoenix
#

basic c# doesn't mean knowing that c# uses () { }

solar wraith
#

i am used to C++

#

i do know what () and {} is

#

{} is used for functions and the main program

west raptor
#

Well this isn't cpp

solar wraith
#

() for internal things inside a function

west raptor
#

And yes that is like

#

Basic programming knowledge

#

Extremely basic

solar wraith
#

:3

#

told you

#

xD

#

i just jumped feet first into this thing (._.")

west raptor
#

Then don't do that

solar wraith
#

adhd

#

get used to me doing and then thinking

earnest phoenix
#

d.net is not beginner friendly

west raptor
#

I have adhd too, doesn't stop me from learning a language

earnest phoenix
#

it requires knowledge of TAP

west raptor
#

Jumping into anything without basic knowledge of it is always a bad idea

#

The only times I have jumped into a language is when I have used similar languages

solar wraith
#

i have moderately C++ knowladge

#

i am stuck at the loop stuff

#

i cant wrap my head around it ;-;

west raptor
#

There's a world of difference between cpp and cs

solar wraith
#

i know

#

but both C?

#

xD

earnest phoenix
#

from what I'm seeing you have a misunderstanding between what is a beginner and intermediate knowledge

west raptor
#

Yeah and if you know Java you instantly know Javascript

#

/s

solar wraith
#

i think so

#

but i would be damned if i put away this project now

unique nimbus
#

Discord Bots isn't beginner projects

#

you need to know the errors

#

understand them

west raptor
#

Sometimes that's the best decision

solar wraith
#

F

west raptor
#

Have I dropped projects because I didn't have enough experience? Yeah, everyone has

solar wraith
#

i have never been stopped by an error

unique nimbus
#

Getting errors is what programmers lives is

solar wraith
#

(and that of system admin)

modest maple
#

Bruh I gotta add to that; no matter what Language you do the bot wether you have knowledge in a similar language or not you gotta learn the basics of that language before jumping feet first

solar wraith
#

:3

modest maple
#

The documentation is writen with the idea that the programmer using it has learnt the basics of the language it's based on wether it be D.py, D.net, D.js

#

No matter what language you do your gonna have to suck it up and learn the basics ATLEAST before jumping into a large and unforgiving module like discord

#

If you learn the basics it will save you a hell of alot of headache in future

solar wraith
#

i will just struggle my ass through it

modest maple
#

It's not worth I tho, why would you rather spend hours upon hours being stuck on an error when you have no idea about the syntax and basic commands when that error could just be a syntax error, inspending a couple hrs learning the basics and not having to deal with those errors like syntax and basic errors

green kestrel
#

yayyy

#

i got my secure js sandbox working ๐Ÿ˜„

#
.DR Brain SporksDev js-test
create new context for channel 636822959201452042
Sandbox maximum allocation size reached, 10000768 requested in sandbox_realloc
couldnt run: Error: alloc failed
    at [anon] (duk_api_stack.c:856) internal
    at global (../js/636822959201452042.js:6) preventsyield```
#

can't use more than a specific amount of ram per request, can't run any code for more than 30ms per request

#

cant access i/o, except via a set of marshalled function calls

#

can anyone think of anything else i'd need to secure, to prevent people from being abusive with this?

earnest phoenix
#

hoi its noob danish again

Here my youtube search command that didnt success

if(command === "youtube") {
  let search = require('youtube-search');
  let opts = {
    maxResults: 1,
    key: '' // dont steal mah api pls
  };
  let video =   message.content.split(" ").slice(1).join(" ");

  search(video, opts, (err, results) => {
    if(err) return console.log(err);
    message.channel.send(results);
    console.log(results);
  });
 }```
I have tried finding useful tips in https://developers.google.com/youtube/v3/docs/search/list but none really helped me out.

When i typed `~youtube owo` the bot send a message `[object Object]` and the console said below
languid dragon
#

because results is an Array of Objects

earnest phoenix
#

hm i just need to get the link one on the object and nothing else

languid dragon
#

then channel.send(<Object>.link)

earnest phoenix
#

i need to learn more sorry for making you spoonfeeding me

#

thanks

#

use common sense and there won't be need for that ๐Ÿ™ƒ

solar wraith
#

_<

light drift
#

Hello how nows how develope the comand vote ?

#

And give some coins ?

languid dragon
#

the answer to your question is yes