#development

1 messages Β· Page 775 of 1

stable horizon
#

Can you show your code when you try to make a cog?

grizzled valley
#

yes wait

stable horizon
#

Well... Client isn't defined there

#

Unless that's in your main file

grizzled valley
#

it is i defined it at the top

stable horizon
#

Ah

grizzled valley
#

i checked 12 times no syntax error

stable horizon
#

Your probably missing some) on the lines above

grizzled valley
#

oops lmao yeaaaah

#

xDDDDDDDDDDDDDDDDD

stable horizon
#

The executor don't lie about syntax errors

grizzled valley
#

sry to bother

#

sry again

errant tusk
#

lets say i send embed message

#

how can i edit it later

#

with normal message i just .edit(), i wanna edit an embed field

modest maple
#

Just replace the embed with a new embed thats identical just with the field you want changed

fossil frigate
#

so i changed my bots server and im fairly sure it was crashing and restarting all night due to a little oopsie.... anyways now i cant connect to discord using any token from that application in the dev portal... if i make a new app/bot and use it its fine. what can i do to fix this?

earnest phoenix
#

check your email first to see if discord had contacted you

#

if not, you got api banned and you have to wait it out

fossil frigate
#

how long?

errant tusk
#

you cant get api banned for that, your token might got reset

#

check ur email

modest maple
#

You can

earnest phoenix
#

you can

errant tusk
#

it happened to me before (multiple times), they just reset your token

fossil frigate
#

no emails and my token even regened dosent work

modest maple
#

They reset your token if it happens again they ban your IP in a set time frame

fossil frigate
#

its not an ip ban though i just cant use that one bot

earnest phoenix
#

spamming the endpoint repeatedly will cause you to hit a ratelimit, if you keep hitting the endpoint while the ratelimit bucket had not expired you'll get api banned

fossil frigate
#

aighty, well how long do they usually last?

earnest phoenix
#

the api bans usually last an hour

#

oop

#

yeah

fossil frigate
#

its been two days

errant tusk
#

doubt you got a ban

fossil frigate
#

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

earnest phoenix
#

contact discord about it

modest maple
#

Just an fyi

fossil frigate
#

i tried and got the message contact the bot owner

#

or server moderator

#

lmao

earnest phoenix
#

did you state it was your app

fossil frigate
#

yes

#

even changing servers

earnest phoenix
#

it's an auto response lmaooo

fossil frigate
#

and the token

#

lol

earnest phoenix
#

reply to it that you want to speak to an actual person

#

a member of the trust and safety team will then get to manually replying

modest maple
#

Each time you get a ratelimit your request limits go down for X amount of time, if you keep spamming somthing like status change or messages your limit will stay low for a while, continued spamming of the API after resets or spamming token regens and logins can get you banned for a ehile

errant tusk
#

doubt

modest maple
#

Wdym doubt

earnest phoenix
#

api bans don't last two days

fossil frigate
#

i only regened like three times

modest maple
#

Not normally no

fossil frigate
#

anyways som else might be wrong here

#

do i just ask it as other technichal issue?

modest maple
#

If it's over anything over a day can mean application termination but that's a very severe case

earnest phoenix
#

anyways, just reply to the sent email that you want to speak to an actual person - it works

errant tusk
#

you have to spam like retard to get api banned

fossil frigate
earnest phoenix
#

yeah that's an automated response

fossil frigate
#

yea it has code to autostart itself but it was crashing on start so weird things happend

modest maple
#

Wdym weird thigs

#

Things*

fossil frigate
#

like this lol

#

this is the only weird thing, buts its pretty damn weird

modest maple
fossil frigate
#

ok wtf its working now.... quick response time discord?

#

damn

modest maple
#

@slender thistle how much do exp do u have with BytesIO

slender thistle
#

just as much as I know Turkish
it kinda somehow works

modest maple
#

hmm

slender thistle
#

What's up

modest maple
#

Trying to work out why my GDrive Upload system isn't taking the bytesIO ovject

#

It's not Erroring

#

But equally it's not doing anything it's supposed to either

slender thistle
#

rip

earnest phoenix
#

Do I need to add a shard rn if my bot is almost at 2000 servers?

slender thistle
#

Recommended

modest maple
#

Might be an idea to think about yh

fallow mango
#

anyway to give a bot an animated icon? and if i change the bots name will it stick on the website

modest maple
#

No animated icon ability

fallow mango
#

oof

modest maple
#

Yes if you change the name it will change on the site

fallow mango
#

wait wont an apng work?

modest maple
#

No

fallow mango
#

oof

slender thistle
#

Let's try not to exploit anything

fallow mango
#

k 😦

slender thistle
#

You'll only dig a deeper hole for yourself if you try to bypass it

fallow mango
#

wouldnt i get banned if i found how to do that anyway?

slender thistle
#

Most likely your bot would get deleted in average cases

#

the worst being your account getting banned

modest maple
#

I mean discord takes the first Frame of any image or gif you pass it unless it's a user account with nitro

fallow mango
#

oooof

earnest phoenix
#

How do I fix the β€œThe port is already used” error? It occurred because I spawned 2 shards on the file that I used to both host my website and my bot.

tiny tinsel
#

@earnest phoenix Use different port or kill the process that uses it.

earnest phoenix
#

like different port for different shards?

tiny tinsel
#

All shards are on the same port.

modest maple
#

(all shard should be on the same port)

#

If they're not then fuck knows what you've done

amber fractal
#

@modest maple could be running on a different server

#

@earnest phoenix only make one webhook

modest maple
#

You know how big of a bot you would need to make multi-server bot hosting feasible

amber fractal
#

People do it anyways

#

Horizontal scaling to the max

balmy lantern
#

So on a scale from 1 to 3.97, how good is auctions?

fallow mango
#

how would i get multiple prefixes other than server prefixes like make it so i can use the 668876359363461139

#

id of my bot

#

like @gilded plank sosos

#

i wanna do @hushed fox sosos

vital lark
#

use an array

fallow mango
#

how use array

vital lark
#

arrays are wrapped in []

#

so js const array = []; array is an Array, which has a push method to push anything inside it

fallow mango
#
client = commands.Bot(command_prefix = 'des! ')```
#

how would i do it like this

vital lark
#

oh ur using python

fallow mango
#

yeah

vital lark
#

thought you were using JavaScript

#

I don't use Python, sorry

fallow mango
#

oof

#

it fine

fallow mango
#

**PYTHON USERS**im trying to give a player a role when they join but don't know how to like give it. Im new to bot coding and it is very confusing

#

even though my bot has 400 lines of cod

#

code**

oak minnow
#

@fallow mango Im not good at Python but try this:

@bot.event
async def on_member_join(member):
    role = discord.utils.get(member.server.roles, id="<role ID>")
    await bot.add_roles(member, role)
``` Just put role ID well, the roles ID
west raptor
#

no spoon feeding please

oak minnow
#

sorry

fallow mango
#

ill try it

earnest phoenix
#

;)

west raptor
#

Next time read the docs pls @fallow mango

#

not everyone is gonna spoonfeed you code

fallow mango
#

the docs is very confusing on the on_member_join thing

#

i read

west raptor
#

I mean not really

#

it gives everything you need

#

and assumes you know how to make event listeners

oak minnow
#

a good way 2 get good at coding is, try new things, google it, expiriment, recode and keep trying. If you are just beond confused/stuck then try and ask the question

#

im currently working on trying 2 have my bot auto delete new messages on a specific channel

#

ik the general bases, just not how 2 get the bot 2 detect the new messages on the specific channel

fallow mango
#

hmm

#

the command got like 30 errors but thanks for trying!

#

thank you though

west raptor
#

command?

fallow mango
#

@dreamy jacinth.event
async def on_member_join(member):
role = discord.utils.get(member.server.roles, id="<role ID>")
await bot.add_roles(member, role)

#

@bot.event
async def on_member_join(member):
    role = discord.utils.get(member.server.roles, id="<role ID>")
    await bot.add_roles(member, role)```
west raptor
#

where are you putting it

#

you say "command" despite it not being a command

fallow mango
#

under my on ready

#

wait

#

y i say command

oak minnow
#

oh just came back youwelcome @fallow mango sorry it didn't work tho

fallow mango
#

idk

west raptor
#

can you give the errors then

fallow mango
#

i close the terminal and deleted thingy

west raptor
fallow mango
#

i did get something like discord.utils doesnt exist

west raptor
#

from what it looks like it exists

#

according to the docs

fallow mango
#

exactly

#

and i use that

#

probably other things

#

but ill just not use it

west raptor
#

well considering you're giving very little information i cant help you

fallow mango
#

oof

#

its fine

west raptor
#

are you using async

fallow mango
#

re-write

#

1.3.0a

oak minnow
#

This is a Heroku question. Do I have 2 add a credit card/bank card 2 install addons or is there another way?

fallow mango
#

async garbo

#

tf is a heroku

oak minnow
#

xD

#

A thing 2 pretty much host ur app/program 24/7

fallow mango
#

hmm

oak minnow
#

well 24/7 all day every month with a credit card on ur account

fallow mango
#

i use a bat file

#

free. goes offline if u error on ur code or terminate it

#

closing it normally doesnt make it do that though

#

sooooo

#

easy

#

hmu if u want that lolololo

west raptor
#

..or get an actual host

#

that is on 24/7

#

running windows 24/7 is never a good idea

fallow mango
#

y

west raptor
#

because it slows down over time

fallow mango
#

not wrong

west raptor
#

I almost have my computer on but i use linux

#

yes i do host somethings on here

#

but i dont recommend it

fallow mango
#

i run my bot on my laptop. file sharing

#

easy

west raptor
#

I recommend either getting a home server setup or just getting a cheap vps

#

contabo is very inexpensive, trustworthy, and good for the price

fallow mango
#

i dont know how to get a host though i jsut have a bat file with ```bat

@echo off
py bot.py
pause``` in it

#

that easy

#

its free

#

no money

#

no vps trials

#

no fees

#

no nothing

west raptor
#

at what cost? Slow, horrible uptime, etc?

#

also take internet connection into acount

fallow mango
#

moderate, decent uptime with very good internet

west raptor
#

running a bat file should not be a permanent regardless

fallow mango
#

ik

#

when i have money

west raptor
#

then why are you recommending it

fallow mango
#

ill probably upgrade

#

if u has no money

#

and r lazy

#

like me

west raptor
#

being lazy gets you no where in this field

fallow mango
#

ik that

#

ends conversation

#

---------------------------

unique wagon
#

@quasi marsh

#

When you run:

#

m#backup create

#

it runs this code:

#

@cmd.bot_has_permission(manage_channels=true)

quasi marsh
#

Can I see the full command code?

unique wagon
#

oops, sorry for the ping whoever i did

#

stupid discord.. smh

quasi marsh
#

use codeblocks for code

#

Type three backticks

#

`

unique wagon
#

ye ik

#

im doing this in ESXI

#

so i cannot copy and paste

#

^^^^^^^^^^^^^

quasi marsh
#

Alright so

unique wagon
#

idk why i have administator

#

i shouldnt have that

quasi marsh
#

@earnest phoenix.has_permission with discord.py will mean that the user that runs the command needs the "Administrator" permissoion

unique wagon
#

wait

#

this could be old code....

#

oh no

#

its not

#

wtf

#

im SURE i removed tjhat line...

#

ok so... ill remove that @quasi marsh

#

what else

quasi marsh
#

well what permission do you want the person to execute the command to have?

unique wagon
#

Everything else

#

if it dosnt have those perms it will crash

#

ok i removed the cmd.bot admin check

#

What else do i need to do?

#

i mean, that should be it lol

quasi marsh
#

I mean requiring admin is fine

unique wagon
#

no

#

u cant have it here

#

apparently

#

i got declined for that too

#

xD

quasi marsh
#

But you should make sure that users are aware that they need it

unique wagon
#

no

#

i got declined for having it

#

so they said to use this method

#

Just one question...

#

is all this right?

#

it should all be right

#

i never used the has permission tho

quasi marsh
#

Alright

#

Let me get started with saying

unique wagon
#

wot

quasi marsh
#

It's important for your bot's users to be aware of what permissions they need to run the command

unique wagon
#

Well

#

it will say that they need it

#

maybe invite it to test....

#

let me build and run it

quasi marsh
#

In addition

#

Administrator is consired a "dangerous" permissions

#

It's because admin gains all permissions and also ignores all channel overrides

unique wagon
#

exactly

#

thats why i removed it.

#

Ill DM you the invite for the server to test.

#

so you can see what i mean about the checks thing

quasi marsh
#

Well not really needed

unique wagon
#

ur dms are off nvm

#

true

#

wait

#

let me get it running

quasi marsh
#

So you require manage_messages, manage_channels, manage_emojis and manage_webhooks

unique wagon
#

yep

#

im inviting it with permission 0

quasi marsh
#

So

#

Missing any of these permission will, when the command is ran, raise a discord.ext.commands.BotMissingPermissions

#

Do you have code to handle this?

unique wagon
#

ye i think

#

what happens ^

#

when u give it that perm

#

and run it again

#

it will say the OTHER perm it needs

#

and you keep repeating until its happy

#

Maybe the tester got confused and thought its the same error?

#

When its regarding for another permission??

blissful scaffold
#

You can't check all permissions at once and show a list of missing permissions?

unique wagon
#

i can

#

but the fact is

#

How can i...

#

lmao

blissful scaffold
#

I cant really help you with that language, it looks like python?

quasi marsh
#

It is

#

Do you use the permissions tho

unique wagon
#

yes

#

what

quasi marsh
#

Well

#

Which calls are you making that are prefixed with await

unique wagon
#

Look,

#

I got a developer to make half of it

#

i know HARDLY any py, and thats why im a noob lol

#

I only know some basics

#

The developer didnt put in any checks

#

and i needed to do it myself.

quasi marsh
#

Can I see the full code of the command?

unique wagon
#

And here i am, stuffed up.

#

what commands?

quasi marsh
#

m#backup

unique wagon
#

i rather not -=-

quasi marsh
#

Make sure to clean out anything that should remain private

unique wagon
#

just the start of it

#

k

#

here

#

thats what happens

#

most of it is private

blissful scaffold
#

Maybe you can send it to Grobbe in a DM if you dont want to share it here

unique wagon
#

he has dms disabled

#

and you know how i deleted the admin check?

#

Guess what.... it was a user check

#

lmao

#

now i gotta add it back...

#

this is the error output

earnest phoenix
#

So uhh

#

I need help since i dont have a computer

unique wagon
#

@quasi marsh ya know whats going on?
lol sorry for earilier i didnt understand lol

earnest phoenix
#

And cant activate the bot token

blissful scaffold
#

@unique wagon make sure to keep a backup of the command before changing stuff

unique wagon
#

yep

blissful scaffold
#

@earnest phoenix I don't think we can really help if you don't have a computer.
But I think it should be possible to get a bot token with the mobile browser

earnest phoenix
#

I know

#

i have it

#

just cant do anything with it

blissful scaffold
#

You need to program a bot to be able to use it

earnest phoenix
#

Mm how do i do that?

#

programming

#

Mmmmmmmmmmmm

unique wagon
#

With a server

#

Get code

#

Put on the server

#

Run it

earnest phoenix
#

Ight

unique wagon
#

If you don't have a computer, gl having a server.

quasi marsh
#

@unique wagon without seeing the full thing i can't really help you

#

I've send you a friend request

unique wagon
#

Accepted.

#

But. That's all the database stuff

quasi marsh
#

DM me the code, i'll go to bed to sober up

unique wagon
#

You don't need to see any of that.

quasi marsh
#

Fair

balmy lantern
#

So on a scale from 1 to 3.97, how good is auctions?

earnest phoenix
#

No

balmy lantern
#

?

quasi marsh
#

The main thing however is, like for example

unique wagon
#

All i need to do,

quasi marsh
#

To run the create command, your bot want certain permissions

unique wagon
#

Is put all of the checks

#

into one check.

#

ye

#

exactly

#

we want to put it at the start.

quasi marsh
#

I need to know what your bot is doing exactly to warrant the need for them

unique wagon
#

i can tell you what it does.....

#

and it better for you to test it

#

It needs these perms:

#

Channel
Message
Webhook
Emoji

#

All of these manage.

earnest phoenix
#

I have a sever

blissful scaffold
#

did you already try to run the command on your own server with 0 permissions and then only give the permissions that it asks for?

unique wagon
#

manage channel
Manage message
manage webhook
Manage emoji

#

Yep @blissful scaffold

#

it all works.

#

thats why

#

im going nuts

#

that im getting declined

#

(Sorry for the way i type... i just type this way lol)

blissful scaffold
#

You really should try to add all the missing permissions in one message

unique wagon
#

thats what im trying to do...

blissful scaffold
#

This says permissionS, check if it can handle more than 1 permission at the same time?
Maybe check how that function is build and what arguments it accepts

unique wagon
#

im waiting for @quasi marsh

quasi marsh
#

I'm fairly certain it can

unique wagon
#

idk how to

quasi marsh
#

Essentially

unique wagon
#

πŸ™Œ

quasi marsh
#

cmd.bot_has_permissions(perm_x=True, perm_y=True, perm_z=True)

unique wagon
#

uhh

#

can you give the valid output to me??

#

-=-

balmy lantern
#

So on a scale from 1 to 3.97, how good is auctions?

vital lark
#

that is a valid option

unique wagon
#

with all the perms in....

#

nvm ill do it

#

the code is on a external server

blissful scaffold
#

The output is probably the same as when you have 1 argument in it

unique wagon
#

^^^^^^

#

exactly

quasi marsh
#

Well, the @cmd.bot.bot_has_permission stuff is referred to as a decorator

#

So what that means is that before the command is ran, your bot will first execute the decorators before it

unique wagon
#

ye

#

that makes no differance...

#

-=-

quasi marsh
#

Yeah but what I'm thinking is

blissful scaffold
#

And I guess if one of the decorators fails it wont execute the command

unique wagon
#

same as having it all in differant

#

unless we edit the output code.

quasi marsh
#

What if something is fucked

#

And your bot says

#

oi

#

i need perm X

#

But the problem is caused by the bot wanting perm y

unique wagon
#

exactly

#

so if we keep the code how it is...

quasi marsh
#

So it's telling reviewers here to give the bot perm X when it's wanting perm Y, so when it still is not working they decline it

unique wagon
#

i dont understnad

#

cant i just get accepted.

#

I mean

#

it all works

#

its not my fault the tester things it says the same thing

#

when its not

#

lmao

blissful scaffold
#

when was the last time your bot got declined?

unique wagon
#

last year

#

I was so over it

#

i never applied back

#

And i want to get this done

#

-=-

quasi marsh
#

Well

#

The weird thing is

#

Looking at your error handling code it should be fine

unique wagon
#

exactly

#

And every time

#

i got declined

#

Not being rude

#

its the same person who assess me....

#

i re applied HOPING someone NEW would test it and accept me

quasi marsh
#

Also just to be sure

unique wagon
#

I already contacted oliy

#

and he never replyed

#

smh

quasi marsh
#

When you change the code, are you making sure that the code is actually changed

blissful scaffold
#

oily doesn't check bots

quasi marsh
#

If I remember you are working with another developer

unique wagon
#

he is a manager.

#

no

#

I told him everything i need

#

bought the bot

quasi marsh
#

So when the code is changed by you, is that replicated on the server that hosts the bot

unique wagon
#

for a shit load of money.... smh

#

And i still didnt get it working.

#

@quasi marsh

#

incorrect

#

I wish it did that

#

lmfao

#

I have to REMOTE connect

#

to my server

#

EVERY time

#

and edit it

quasi marsh
#

oof

unique wagon
#

and rebuild it and run it manually.

blissful scaffold
#

that is why i prefer to write my own bad code instead of depending on someone else's bad code

quasi marsh
#

hehe

unique wagon
#

well

#

i do server side stuff

#

not coding

#

lmao

quasi marsh
#

are you editing it on the server?

unique wagon
#

ye

quasi marsh
#

or uploading your local code?

unique wagon
#

i have the server right next to me :D

#

in the office.

quasi marsh
#

i would recomend getting to know the scp command

unique wagon
#

its not linux

#

its windows

#

lol

quasi marsh
#

if you don't mind btw, i do have to go to bed

blissful scaffold
#

I use winSCP when I need to transfer files to my linux server

quasi marsh
#

i have a visitation day for the school i want to go to so i shouldn't be too tired

blissful scaffold
#

night kuiken

quasi marsh
#

gn

unique wagon
#

byeee

#

gn

#

-=-

blissful scaffold
#

i should be going to bed too soon

unique wagon
#

so what do i do now

#

lol

blissful scaffold
#

zara, your pc and server are both windows?

unique wagon
#

yeee

blissful scaffold
#

I guess you are just copying your changed files to the server?

unique wagon
#

no

#

im doing it all on my serer

blissful scaffold
#

When you change and restart your bot make sure to test your changes in your test server

unique wagon
#

yeop

#

So

#

what should i do?

#

Who can i contact????

blissful scaffold
#

and make sure to always keep a backup ^^

unique wagon
#

yrp

blissful scaffold
#

you should talk with the people who decline your bot

#

but that is already 4 months ago or so

unique wagon
#

reapply?

#

again???

#

:D

blissful scaffold
#

try to add the permissions in one message like we explained ^^

#

and test if it works

unique wagon
#

it wouldnt tho

#

because it would only display one at a time....

#

-=-

blissful scaffold
#

Grobbekuiken said it would look something like this
cmd.bot_has_permissions(perm_x=True, perm_y=True, perm_z=True)

unique wagon
#

ik

blissful scaffold
#

it also only displays one at a time when the message looks like that?

unique wagon
#

no

#

wouldnt it tho????

blissful scaffold
#

I think it will show a message for all the permissions that are missing, but you should try it

unique wagon
#

trying now

blissful scaffold
#

With my bot I can give a list with all permissions that a command needs and it will show a message with every missing permission, but that is something I wrote myself

unique wagon
#

yer ok'

#

teesting

#

WOOOOOOOO

#

@blissful scaffold

#

It works!!!

blissful scaffold
#

nice ^^

unique wagon
#

yeeeey

#

now time to test

#

uwu

blissful scaffold
#

looking goooood

#

now you can also do that for all the other commands that need more than 1 permission

#

also check what the message shows if the backup load command is only missing 1 or 2 permissions

unique wagon
#

ye

#

time to do it to the backup command

#

lol

#

its all right

#

time to apple

#

LUL

blissful scaffold
#

good luck ^^

unique wagon
#

thanks lol

#

reapply *

#

lmao

#

Tysm @quasi marsh (when you wake up :D )

#

thanks all of you.

near ether
#

so for some reason my bot doesnt launch its shards anymore

#

all the shards take too long to get ready

#

and so they never actually come online

#

i havent changed anything at all in like 2 weeks and this just started happening yesterday

#

does anyone know why this might happen? thanks!

blissful scaffold
#

Discord is a stable platform and never breaks

#

Aka, it might be something on discord's side

near ether
#

i thought so too but then why do other bots work?

blissful scaffold
#

My bots are small enough that they don't need shards, so I can't help with that

near ether
#

gotcha

#

ty!

quartz hill
#

There is an asynchronous function in the filter inside the emoji collection function(collector), but I cannot write await. What should I do? (nodejs)

vital lark
#

@quartz hill you append async to the filter inside and use await

#
const array = [];
array.filter(async () => await something());
quartz hill
#

When I write this style, it does not wait, but I tried.

#
const filter = async (reaction, user) => {
  let credits = await Utils.getCredits(user.id);
  if (!credits && user.id != cfg.botid) { 
    if(reaction.emoji.id !== e){
      return false;
    }
    let minutes = Utils.getCreditsTime(user.id);
    Utils.sendEmbedFooter(msg, 'hak_kalmadi', user.username, minutes);
    return false;
  }
  return reaction.emoji.id === e && user.id != cfg.botid
}
let collector = msg.createReactionCollector(filter, { maxUsers: 1, time: cfg.randomCharTime });
#

While collector is forming, it ignores the contents of the filter.

#

What should I do in this situation?

late hill
#

Not entirely sure if async functions would work there

#

What are you doing with the collector

#

The code you posted just creates a collector

#

Doesn't do anything with it

quartz hill
#

the continuation
This code get the id of the person who pressed the first emoji except the bot.

#

If he has enough credit, he agrees to print emojis. But if not, he ignores and waits for someone else to press.

#

I did not write the code because the continuation is long.

late hill
#

Yeh

#

It won't work with an async function as filter

#

The collector would have to await the result of the filter

#

Which it doesn't

#

What you could do

still merlin
#

Please can someone help me I have a issue with my code

late hill
#

Is just filter the emoji and the user

#

And then in the collect event, you can use an async function that does the credits stuff

#

@quartz hill ^

still merlin
#

Can someone help me i use a thing called glicth to make a bot but I typed "discord.js": "3" and it didnt work for me

#

I was trying to create a bot that PMS the hole discord server

late hill
#

Depending on the size of the server and the speed of your PMS, that could be a very big issue

#

Please just don't do that

#

Why would you even want to do that

#

If it's going to be the same message, just send that message in the server and tag everyone

still merlin
#

for important things plus a bot test

#

for my own youtube discord

#

PMS the hole server when I realise a new video

modest maple
#

@still merlin

  1. this is not glitch support
  2. we recommend you remove that command entirely as we don't tolerate ToS abuse when you know your doing it
still merlin
#

Wait theres ToS

modest maple
#

That's is a massive API abuse and is against ToS of discord

still merlin
#

Omg I'll delete RoboPM then

#

I saw a video of someone doing it

#

I thought it was legal becuase it was a tutorial

modest maple
#

They're breaking ToS

#

And don't follow yt tutorials they're awful for bots

still merlin
#

Ok

#

Can someone tell me how to do some basic code

#

or just like to make my bot do something .-.

quartz kindle
#

If youre using discord.js, learn javascript first

still merlin
#

Ok, Is there any link were I can start

quartz kindle
#

You can look for javascript tutorials, or use websites like codecademy

still merlin
#

Ok! Thanks

#

I'm gonna try my best to create a bot that makes announcements when you ping the bot like @botname Tell #channel message

#

Hey guys, How do I add the code to the bot

#

In discord developer is there a way I can upload a file

modest maple
#

You don't?

#

You have to create a script and run a script

still merlin
#

Im dumb

#

Dang

quartz kindle
#

Discord developer gives you a bot token, which you use to make your bot login

#

But you need to code your bot yourself, and run it yourself

#

And host it somewhere

short siren
#

@still merlin W3 is sicko imo

still merlin
#

?????

#

W3 .-.

short siren
#

W3 schools

fiery crater
#

does anyone know if someone votes our bot on dbl and our bot sends a message?

slender thistle
#

Webhooks are supported on top.gg

fiery crater
#

then, how to make it?

slender thistle
#

host a webserver on your machine

fiery crater
#

Hmmmmm

rancid gate
#

@fiery crater they way I know webhooks work is, you put there an url, and then top.gg will make a request to they url whenever someone votes your bot, so you intercept that request and do whatever you want with it

slow garnet
#

Are you able to put custom emojis in a bots playing message?

late hill
#

no

slow garnet
#

rip

worn drift
#

Hey, im new with discord.js and i need to create an thing. How can i put to users only can answer an number?

earnest phoenix
#

use the Number function

#

on the argument

worn drift
#

how can i use this?

earnest phoenix
#

google exists

worn drift
#

i already try but i dont found the answer for my problem

earnest phoenix
#

stop being lazy x

worn drift
#

i seach this "discord js answers only can be an number" xD

#

Sorry but with this i still dont know how can i do this xd

sudden geyser
#

convert to a number (like cry said) then compare it

worn drift
#

convert what?

near ether
#

hey did anyone happen to see my message yesterday?

#

i cant figure out whats wrong 😦

sudden geyser
#

can you provide the link

sudden geyser
#

are you possibly using discord.js, I remember my friend having the same issue, which (I think) was pinned on the issues tab of the github repo

near ether
#

yea im using djs

earnest phoenix
#

wheere support?

sinful lotus
#

either something gets blocked on bot launch.
EX: loading guilds / members / cache etc blocks your bot event loop.
something db related?
EX: using something like an SQLite on big projects.
something server related?
EX: too weak cpu to load guilds / members / cache in time
somethign discord related?
EX: nothing u can do

earnest phoenix
#

how do i add the bot?

near ether
#

i am logging my bot's launch processes

#

and i see that it can load the database and everything just fine

worn drift
#

and about my problem :/? anyone can help?

sinful lotus
#

first step is logging client.on('debug') and see if anything is unusual on booting it on

near ether
#

oo i see

scenic kelp
#

@worn drift You were literally given the answer to your problem

sinful lotus
#

I encountered an issue on d.js on some bots that it cant fire ready because the cpu cant keep up on cache

#

and it blocks the event loop

worn drift
#

where @scenic kelp

scenic kelp
#

If you don't know how to do that I suggest further learning javascript before continuing on your bot-building endeavours

sinful lotus
#

= hence cant hearbeat to discord api

#

= dropped connection

sinful lotus
#

if you understand Event Loop you would realize what Im trying to point here on what maybe the cause of why your bot doesnt boot up

worn drift
#

But on my bot only need this and i finish him ..

sinful lotus
#

but if you dont, think of it like something is blocking the way for other tasks to execute

sudden geyser
worn drift
#

it's literally the last thing i need to finish

sinful lotus
#

but personally

#

I run 17k avg guilds in single process

#

and encounter no issues at all

#

so it could be also code related

near ether
#

i know its not my cpu or something bc it was lighting fast a few days ago

#

then all of a sudden it just silently dies

sinful lotus
#

but if your bot gets added on big guilds

#

and your code cant keep up

#

thats an issue

near ether
#

thanks kino btw, im gonna check that

sinful lotus
#

as well keep track of what you use on your d.js master

#

running very outdated builds also causes issues

#

so keep that in mind

near ether
#

i dont think im using an outdated djs build

scenic kelp
#

@worn drift Use the Number() function. It takes a string and converts it to either a Number or a NaN.

near ether
#

but ill check it out just in case

sinful lotus
#

I run a PR build without any issues and is not also that outdated like 3 or 2 commits behind

#

current build on master

near ether
#

im gonna your try the client.debug() suggestion, what should i be looking for with those logs?

sinful lotus
#

it should show it caches members during the start up

#

if that takes too long to the point your bot cant heartbeat

#

then your bot will never fire ready on that case

red umbra
#

how do I get my bot invited here?

sinful lotus
earnest phoenix
#

how do i get more people useing my server? how do i bump it?

near ether
#

alright i tried client.on('debug') and the only message it logs is "authenticated using token ____"

sinful lotus
#

so it gets stuck on that?

near ether
#

yea

#

then the shard fails to launch

#

ie "Shard 0's Client took too long to become ready."

sinful lotus
#

then something is blocking your bot from logging in

#

try doing it on other server or your pc

worn drift
#

@sinful lotus after you finish here you can help me with one thing on private?

sinful lotus
#

if it goes in there

blissful scaffold
#

could there be a firewall that is blocking your connection?

sinful lotus
#

then your server might have some problems on connecting to d.api

near ether
#

alright ill give that a shot

sinful lotus
#

which is firewall or cloudflare or discord beaned the ip

#

and on the side note on who pinged me, Im not your personal helper

#

ask your question here and wait

near ether
#

the weird thing is this problem started happening on like thursday, and sometimes my bot launches fine, but silently dies

sinful lotus
#

I will answer if I want to or I know the answer

near ether
#

sometimes it takes ~40 minutes for it to respond to ;help lol

#

then other times it doesnt launch at all

sinful lotus
#

thats why test it on other server or your pc

near ether
#

gotcha brb ty!

earnest phoenix
#

With djs, how to make a bot react to a message? I know i have to message.react('emoji'), but i want my bot to react to a existing message (with a message id)

sinful lotus
#

fetch then react

#

await (await channel.messages.fetch('123')).react()

near ether
#

ok so i just ran my bot on my pc and it connected all 8 shards perfectly fine

#

does this mean my hosting service is screwing up?

earnest phoenix
#

Oh ok

#

what hosting provider do you use

near ether
#

cry i use aws

#

i havent reconfigured anything about the ec2 instance i use to host

#

i rebooted it yesterday too and it still is having the same issue

earnest phoenix
#

are you sure the vps has the power to run such a big bot

near ether
#

its m5a.large it definitely should be able to

worn drift
#

help me please 😦

modest maple
#

Read the error

near ether
#

8 gb ram and 2 vpcus, i checked their stats and it consumes like 10% or less cpu after a full day of usage on my bot

earnest phoenix
#

huh

#

no idea then

worn drift
#

@modest maple and now

sinful lotus
#

@near ether yes seems ur hosting got its ip flagged or routing to d.api bad

#

I suggest to raise an issue or leave them

near ether
#

oh shit wym ip flagged/routing bad?

sinful lotus
#

ip flagged for abuse probably?
routing bad = their path to discord api is bad

#

basically lot of bad routers or bridges on the way to d.api server

#

or bad connections, overloaded too probably

near ether
#

damn

#

so you suggest i bring this up with aws?

#

also if my ip was flagged for abuse then how come my bot will work perfectly sometimes?

#

when it does work, it just becomes unresponsive after a few hours

sinful lotus
#

then you can rule out flagged ip then

#

now its either routing is bad or something

#

thats how you usually debug that kind of things

#

test and rule out possibilities

near ether
#

yeppp

#

at least we've narrowed it down

#

thank you!

#

its something wack with my hosting service i guess

uneven wyvern
#

@worn driftgosh do you even know what you are doing

near ether
#

ok saya in case you want an update, my bot is able to connect fine right now

#

let see if it silently dies soon

abstract crow
#

Would anyone happen to know why in ASP.NET when I edit a model it then gets deleted? My teacher was saying something about it how data gets deleted in the POST edit method but I wasn't sure on how to fix that

abstract crow
prime cliff
#

Seems like an issue with the website tbh thonK the post request should edit it not delete it

worn drift
#

Anyone can help ?

slate kestrel
#

It seems I'm a bit out of the loop here -
A year or two ago I was building a bot using the C# and the Discord.Net library, but had to put it on the shelf. I decided to take a look at resuming the project, but (no surprises), nothing works anymore.

The odd thing is when I go to Discord and view "my bots" the list is empty. And my code won't compile at all after updating the Discord.Net library (channel, user, and all sorts of things are no longer defined)

Was there a major overhaul to the API that removed existing bots and broke all compatibility?

earnest phoenix
#

nope and nope

#

discord.net did have a few breaking updates which means you'll have to migrate the code to a newer version

slate kestrel
#

Thanks. I'll keep looking around and see if I can access my bot again. It still appears on my server, but not in any of my "your bots" lists. I'll keep poking around.

earnest phoenix
#

make sure you're not using the wrong account on the dev apps page

slate kestrel
#

Yeah, maybe. I can't think of any reason I would create another account though.

#

Ah, found it (under 'applications'). Thanks again.

golden condor
#

I am tryna set my bot's status to do not disturb or idle but I'm not sure how, can I have some help please

earnest phoenix
#

in which lib

earnest phoenix
#

@golden condor js or py

golden condor
#

js

amber fractal
#

djs or eris?

earnest phoenix
#

Client.user.setStatuts('idle')

#

Deprecated but works

amber fractal
#

Is it deprecated?

#

Docs dont say it is

west raptor
#

ClientUser#setStatus isn't deprecated

#

might be confusing it with ClientUser#setGame

eternal adder
#

My bot is now 24/7 and public, polishing off the support server then I'll apply to have it here

modest maple
#

ngl i applied and then actually did the commands xD

worn drift
#

Anyone know what this happen

golden condor
#

@amber fractal how do you make the links like that?

#

How

#

is it sharex?

#

Pls explain

#

I have wondered how

slender thistle
#

A webserver running on a machine

#

whenever a link is posted, a request is sent to the URL and the webserver returns an image

eternal adder
#

@modest maple honestly I'm tempted to, given the wait aswell

modest maple
gilded plankBOT
#

#development etiquette

  1. If you know something, and someone asks a question about that thing, don't shit on them for asking. Either help them or stay quiet. If you don't have anything nice or helpful to say, keep quiet.
  2. This channel exists to help people. If you're not feeling helpful, your not wanted in this channel.
  3. Keep in mind that we started as beginners once, so be nice. Helping people helps us all. The more knowledgeable the development community as a whole is, the more we all benefit.
  4. Don't say random, un-helpful, unrelated jargon to try to make yourself sound smart, if anything it makes you look dumber.
  5. If you can't answer someone's question, don't try to extrapolate your knowledge from something else, you'll most likely confuse everyone involved.
  6. Don't ask to ask (eg. "can I ask a question"), this channel exists for questions, you don't need permission to ask one.
  7. Keep inside jokes in responses to a minimum, they're likely to confuse the person asking for help.
  8. No language/library wars, it makes everyone involved look like a dick.
    Do not assume people haven't already Googled their problem. If they're asking here, they've likely already Googled their problem. Telling someone "google it" is run and unhelpful.
zealous veldt
amber fractal
#

@golden condor I own the domain. I have sharex send a post request as multipart/form-data and the handler I made sends it to a folder on my machine that oliy.is-just-a.dev uses

earnest phoenix
#

the message has typos ^^^

grizzled raven
#

is run

earnest phoenix
#

and confusing your and you're

grizzled raven
#

well tbh that doesnt really matter, when someone reads that they wont stop reading and scratch their heads because it said your instead of you're

earnest phoenix
#

true

earnest phoenix
#

just pointing it out, when you notice a small detail like that it drives you mad >.>

grizzled raven
#

DMChannel is undefined

#

well for me i dont care anymore about your and youre xd

#

but what was "Telling someone "google it" is run and unhelpful." supposed to mean

#

is rude?

worn drift
#

@grizzled raven

#

isn't it?

grizzled raven
#

the channel doesnt exist yet you need to create it first

#

await message.author.createDM()

worn drift
#

but i put it where?

#

Sry but it's my first time whit js

fleet chasm
#

await the creation of the dm channel

#

or something like that

uneven wyvern
#

@grizzled raven doesnt the dmchannel already exists?

fleet chasm
#

no, its like if i started one with you, there'd be no messages or anything cause i just started it with you

modest maple
#

Why would you need that

fleet chasm
#

if there was already one dm channel, discord would probably be dead

modest maple
#

If you're just planning to send a message

#

It should create one upon the DM message being sent

fleet chasm
#

i think they are also trying to collect from the dm channel

modest maple
#

It's handled by the same event

#

On_message

#

Only difference is between a guild message and a DM message is guild object is None

worn drift
#

@fleet chasm

#

What is wrong ?

mossy vine
#

.on first argument has to be a string

worn drift
#

What i need to change?

#
bot.on(async function(message) {
ruby talon
#

Hey, I'm pretty new to JS.
While trying to run this code I received this error:

import * as mySE from '../mySE/meSE.js';
#

And I don't get it. 😦

uneven wyvern
#

@worn drift sry told ya wrong bot.on("message", async function(message) {

mossy vine
#

@ruby talon node doesnt support that, at least not the version glitch is on afaik

uneven wyvern
#

@ruby talon glitch don't supports import

worn drift
#

@uneven wyvern

mossy vine
#

oh god what the fuck have you done

worn drift
#

xD

late hill
#

that

sudden geyser
#

You can enable importing modules like that, but using require is >

late hill
#

By looking at the naming

#

You can pretty much tell what's wrong

worn drift
#

me?

late hill
#

DMChannel starts with a capital

#

Because it's a class

worn drift
ruby talon
#

I'm running on local.

What should I install to be able to run the import thingie?

late hill
#

You don't pass the class to it

ruby talon
#

Ah

late hill
#

You pass an instance of that class

ruby talon
#

Ok, I'll try Kino.

late hill
#

That entire code

worn drift
#

Wesley worked but now give me this

late hill
#

Doesn't require using those classes like that

#

You should be able to just create a message collector from a message instance

#

And yes

#

You can't just change it to lowercase and have it working

#

oh wait

#

You've actually created a DMChannel variable

worn drift
#

yha

#

and now this error is fixed

#

and now give me this

late hill
#

Just like

#

Don't

#

get the dm channel from the user

#

and then use createMessageCollector on it

worn drift
#

How can i do this?

late hill
#

You can get that from the user

#

(message author)

#

But I think it might not be there if the bot and that user have never had any dms

#

So you might have to use createDM() instead

#

and await that

worn drift
#

and now i use this?

late hill
#

You also create 2 embeds that are the exact same other than their description, so I suggest creating 1 embed, sending that, override the description, send the same embed again

#

No

#

you don't CreateDM() out of nowhere

#

You call createDM() on the user object

#

which you can get from message.author

worn drift
#

Can you tell me the line?

late hill
#

It returns a promise that'll resolve to the DMChannel, so you'll have to await it and save that in a variable

#

There's no specific line

#

I'm giving you all the information you need

#

You just have to apply it

scenic kelp
#

See there's a difference between helping and spoonfeeding

zealous veldt
#

@earnest phoenix Don't be an asshole

earnest phoenix
#

i still use if else command handling

#

its sure alot easier when you only have 3 commands angry_laugh_cry

modest maple
#

it doesnt make a load of diffrence tbh

earnest phoenix
#

no it doesnt

#

Unless i have 20+ commands i wont make a command handler

modest maple
#

like command handlers are better if you have hundreds of commands cuz it just save a lil time

earnest phoenix
#

or 100s

mossy vine
#

tbh if return > if else

earnest phoenix
#

@earnest phoenix Don't be an asshole
that wasn't being an asshole, i provided a link to a tip that tells them to learn the language in a more friendly way

#

instead of having to repeat the same thing over and over again

green kestrel
#

@earnest phoenix use what works, if your code for something feels ugly or too long, put a comment next to it saying ```cpp
/* XXX FIXME */

#

then when you know more, come back and enhance and refactor it

earnest phoenix
#

Yeah I'm not having any issues or anything

#

And I know my way around typescript

green kestrel
#

i have some ugly if/then/else command handlers in my bot too. i know better, and should use a hash of std::bind or something, but meh. i only have like 10 commands, and will probably never add more.

#

basically if its ugly and it works, thats what is important because you can always refactor later, right? πŸ‘

earnest phoenix
#

Most of the bots ive written are use -case so i dont use my command handler much

#

this is the only bot that has not been public

#

i have a pretty nice command handler i do use for one though

green kestrel
#

the lib im using isnt centred around commands and has no command handler system built into it, string parsing has been done so many ways and so many times in C++ you can just lift something else in and use it

#

i tend to use stringstream

earnest phoenix
#

i was thinking of using a switch aswell

#

but not much of a point

#

im not going to dread over it though

#

the bot im trying to get approved has 3 commands

#

and when im done with it it will probably have like 7

#

Still moving the old database over though

green kestrel
#

what does your bot do?

earnest phoenix
#

The one im trying to get approved or the one with the command handler?

green kestrel
#

either/both? im just nosy/curious about other peoples developments

earnest phoenix
#

The one with a command handler controls and deploys game servers for a specific game

#

Aswell as handles bans and firewall rules for the server its on and a few remote servers

#

You can think of it as a SQL interface with a loop

#

thats about it

green kestrel
#

interesting

#

i bet theres a lot of shell scripts behind that

earnest phoenix
#

at first yes

#

but i now have none

green kestrel
#

cool πŸ™‚

#

how do you handle adding and removing firewall rules then?

earnest phoenix
#

so

#

i write my own iptables file within the bot

#

then have a cron job to reload that file every x minutes

green kestrel
#

ah, ok

earnest phoenix
#

pretty straight forward

green kestrel
#

thats why it says 'this wont last long'

earnest phoenix
#

it says that as a joke

#

like he wont be whitelisted for long

#

the network rules are persistent

green kestrel
#

i do a lot of stuff through crontab too, like updating bot lists server and user counts thru their apis, i put my counters to a mysql table and a cron job posts it to all the lists at once every 10 mins

modest maple
#

many many attempts later

#

and we're still defeated by BytesIO

loud salmon
#

@zealous veldt

modest maple
#

they still havent given you cert yet spider?

loud salmon
#

cry is a good boi

#

@modest maple no its just that I keep joining and leaving

modest maple
#

oh

earnest phoenix
#

the second bot the one i want to get approved is just a tarkov helper

#

for the game tarkov

green kestrel
#

i heard that the person who approves cert is away till late feb/early mar

earnest phoenix
#

Still in the proccess of building a long enough DB

#

large*

green kestrel
#

i sent them my letter early december as soon as i broke 150 servers or whatever the minimum was

#

by now im close to 900 lol

#

i might break the big 1k before they look at it

earnest phoenix
#

I also have a voice receiving based bot, but it has approval issues

#

the whole recording everything ppl say

modest maple
#

ngl sporks is one of the best new bots ive seen in a while

#

in terms of how its made and the concept itself

earnest phoenix
#

What is it?

green kestrel
#

it has two basic functions celty, to learn transparently from chat, and be able to respond to simple questions, and to allow server owners to script it in javascript

#

without me having to worry that they'll obtain the bot's token or other nonesense

earnest phoenix
#

ooo

green kestrel
#

i have been thinking about voice recogntion on voice channels for a bit

#

but im not sure i can dedicate the cpu time to it for voice recognition and synthesis