#development

1 messages · Page 1429 of 1

fleet dove
#

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah ok im stupid

#

XD

#

gg

#

(☞゚ヮ゚)☞

lusty quest
#

you could make it a bit nicer. if you use ` to declare a string you can use ${} inside the string to inject variables in the string

earnest phoenix
lunar sequoia
#

Also, that isn't how you ban a member.

fleet dove
#

mhhhh ok @lusty quest

#

thx

lusty quest
#

message.channel.send(`${BanUser} got banned from the server`)

fleet dove
#

ok

#

thx

#

🙂

cinder patio
#

also const instead of var

fleet dove
#

to make bots use js?

#

@lusty quest

lusty quest
#

?

summer bobcat
#

@fleet dove also what BanUser is a mention itself so u dont need <@> covered around it

#

it aint an id

#

if u want a username/tag do banUser.tag/banUser.username

fleet dove
#

ok

#

:\

lusty quest
#

discord.js parses the member object to a mention

summer bobcat
#

^

#

strong Ap1

lusty quest
#

so you just need to send the object

fleet dove
summer bobcat
fleet dove
earnest phoenix
#

wat

tired panther
silent cloud
#

Yo guys

#

Where is issue?

#

Why tringle

summer bobcat
#

what is the error?

silent cloud
#

Missing )

lusty quest
#

there is an error in the syntax erroring at the 2nd last }

summer bobcat
#

i mean yeah

earnest phoenix
#

You do realize that addFields() takes an array as the first parameter right

silent cloud
#

Fixed

weary socket
#

Could you do this again with my new STart.sh?

earnest phoenix
#

@Script#4345 host sapling is free ?

#

Um

#

@silent cloud

opaque hawk
#

I’ve come back after a long hiatus :D

#

To ask another question lmao

#

UnhandledPromiseRejectionWarning: TypeError: collection_1.Collection is not a constructor

#

On export const guild = new Collection<string, (member: GuildMember) => Promise<boolean> | boolean>();

#

How do I fix?

lusty quest
#

js?

opaque hawk
#

TypeScript, but close enough

#

well no

lusty quest
#

well the example prints are what its strange for me

#

like string and boolean

#

but there im not sure if its a ts thing

opaque hawk
#

This worked before the last discord.js update

#

I mean I could throw in a catch block, but dunno where

#

Since it’s an Unhandled Promise Rejection Warning

obtuse glen
#

i want to add the bot status, but its reading the property of setactivity before the ready part, what do i do pls help

lunar sequoia
#

put it in the ready event?

humble rock
#

yeA

opaque hawk
#

I used an abstract way of setting presence so I couldn’t help

#

Although yeah it does have to be in the ready event

delicate shore
#

Okk thanks

zealous egret
#

Hello how can I programme voting system like more than 1 role giving after voting more than 1 time

opaque hawk
#

Database

zealous egret
#

But i am really really bad in programming

lusty quest
#

learn more to git gud

opaque hawk
#

^

#

Search “reaction collectors” in d.js docs if you use JS

zealous egret
#

Yes but it is waist of time

opaque hawk
#

idk if d.py has anything

zealous egret
#

I don t understand anything you say

#

Please send me some code or some bot

#

And explain how to do it

opaque hawk
#

You know that we can’t spoon feed you right

slender thistle
#

Small on-topic code snippets are fine

zealous egret
#

Where i can find free codes for voting system?

opaque hawk
#

ok

slender thistle
#

Could you show an example of you want to accomplish, solic?

opaque hawk
#

hm

#

I think that they want to make it so that if a user votes twice in something, maybe through reactions, they get a role

zealous egret
opaque hawk
#

oh

slender thistle
#

Oh boy that will be such a pain in the ass to do

opaque hawk
#

^

slender thistle
#

You might as well go with some kind of a leaderboard instead of roles

opaque hawk
#

I thought you meant they get a role if they voted x amount of times

zealous egret
#

Yes

opaque hawk
lusty quest
#

roughtly:
Use a Database to store if a user Voted
on each vote check the current votes the user got
if 10 votes reached give out the role

opaque hawk
#

Not change their roles

#

repl.it has a database now, haven’t tried it yet

lusty quest
#

you can use Firebase or MongDB Atlas

opaque hawk
#

Alternatively, use a .json kekw

#

I use Mongo

zealous egret
#

I really don t know what you mean guys i am not developer

lusty quest
#

but you want to make a bot?

opaque hawk
#

They called learning programming “a waist of time”

opaque hawk
zealous egret
lusty quest
#

i earn money with programing stuff (well mostly writing g-code)

opaque hawk
#

I don’t get paid to code, I’m a hobbyist

#

I can’t even figure out how to insert a catch block in here ;-;

zealous egret
#

Can someone send istructions how to do it easily

lusty quest
#

is it a module.exports?

opaque hawk
#

Yes

#

I think

#

I don’t fully understand, but from what I gather, yes

lusty quest
#

define a function or object where you handle it inside.

opaque hawk
#

It’s a Collection, imported from @discordjs/collection

lusty quest
#

then just slap the try/catch block on it

earnest phoenix
#

i need an opinion on smth, im thinking of adding a command log that consists of the server it was used in (no force invites), the user that used the command and the time it was used, i want to add this because i want to be able to easily fix bugs or crashes that happen at any given time and logging what was last used may be use full. (opt in)

#

thoughts?

lusty quest
#

sounds like a Nightmare to handle if someone requests his data to be deleted

opal plank
#

that SHOULD be fine as long as its not stored

#

caching is different than storing

#

if you want LOGS< you could very well cache and be TOS compliant

lusty quest
#

you could use a Redis DB and set a TTL of 24 hours

opal plank
#

another thing to keep in mind is NOT to have that info publically available

#

no need

#

just store in memory

lusty quest
#

sure but with the Redis DB you have a 24 Hours backlog that could become handy

earnest phoenix
#

it wont show what command was used only if the bot was activated

opal plank
#

again, no need

#

just save it in memory

earnest phoenix
opal plank
#

just map it in memory dude

lusty quest
#

did you log it just in console?

opal plank
#

you get all that in the message object

earnest phoenix
#

thats the concept

#

i mainly want to do this because my bot does alot of ffmpeg processing

#

in async

opal plank
#

i feel like im being ignored even though im helping

weary socket
#

I have a CSS code and want to put it into my background

opal plank
earnest phoenix
#

nah im taking it in

weary socket
#

Should I use .background {

#

or what is it calledß

opal plank
#

so i'll just leave

earnest phoenix
#

i jsut dont know how to respond

#

XD

rustic nova
opal plank
#

i already gave you both the answers you wanted

earnest phoenix
#

@opal plank im sorry i made u feel liek u being ignored sadcat3

weary socket
rustic nova
opal plank
#

Can i log it?

that SHOULD be fine as long as its not stored
caching is different than storing
if you want LOGS< you could very well cache and be TOS compliant

How do i log it?

just save it in memory

earnest phoenix
#

thumbcat thank

opal plank
earnest phoenix
opal plank
#

map it with a timestamp and the message object

earnest phoenix
#

aight

opal plank
#

boom, logs

earnest phoenix
weary socket
#

ok thx

old cliff
#

hey can anyone help me ?

earnest phoenix
#

take the og video reverse it, join them

old cliff
#

my ytdl-core is giving a weird 403 error

    at ClientRequest.<anonymous> (/home/container/node_modules/miniget/dist/index.js:196:27)
    at Object.onceWrapper (events.js:300:26)
    at ClientRequest.emit (events.js:210:5)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:583:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:115:17)
    at TLSSocket.socketOnData (_http_client.js:456:22)
    at TLSSocket.emit (events.js:210:5)
    at addChunk (_stream_readable.js:308:12)
    at readableAddChunk (_stream_readable.js:289:11)
    at TLSSocket.Readable.push (_stream_readable.js:223:10) {
  statusCode: 403
}```
earnest phoenix
#

403 means access denied

old cliff
#

yes but why ?

earnest phoenix
#

what are you trying do exactly

umbral zealot
#

the server denied you.

#

"Why" is up to the server

old cliff
#

why ?

#

I am getting this error from 5 days

umbral zealot
#

sounds like the server you're reaching banned you

lusty quest
#

maybe rate limited

umbral zealot
#

or you have an incorrect token or something

old cliff
#

I am using ytdl-core without a token

earnest phoenix
#

if the dir or file on the server your trying to access has the perms of 711 you cant access them

old cliff
#

just to play audio

#

no searching

earnest phoenix
#

ah

#

country block maybe?

old cliff
#

the server I am using is in germany

#

ah that server got banned from Youtube I guess

earnest phoenix
#

maybe

heavy sky
#

hey um i was wondering if someone could help me witha starting bot code, im using kotlin btw

earnest phoenix
opaque hawk
#

Kotlin seems unlikely to Program a bot with

weary socket
#

My CSS background only appears at the start of the description and not at the whole page

opaque hawk
#

help me who know TypeScript

#

How does —outFile work

old cliff
#

Yeah it worked on my pc... my server got banned from yt.

earnest phoenix
#

tikes

#

yikes*

earnest phoenix
old cliff
#

how ?

#

ok i'll try

earnest phoenix
#

i work in python and the ytdl for python has proxys

old cliff
#

sadly I use node.js

earnest phoenix
#

using js

#

idk what the equivalent of subprocess is for js

opaque hawk
#

Didn’t ytdl for python get taken down

earnest phoenix
#

its back

opaque hawk
#

hMm

earnest phoenix
#

github over turned the take down

opaque hawk
#

I don’t know how that works butnok

old cliff
earnest phoenix
#

the company that got it taken down exploited the dmca rules

opaque hawk
#

DMCA is weird

lusty quest
#

ytdl is back up again

opaque hawk
#

Ah

lusty quest
#

the DMCA claim got resolved

old cliff
earnest phoenix
#

and github now have a 1 million dollar fund as defence against incorrect dmca claims

tacit sundial
#

where do I find a DBL token?

#

is that discord bot id?

silent cloud
#

Not

tacit sundial
#

uhh how am I supposed to get user votes and server count?

umbral zealot
tacit sundial
#

ahh thanks

fast trench
rustic nova
#

that's a whole bot

#

if I'm not mistaking

hollow prawn
#

if I have on my index.js file this (in DJS v12.5.0)```JS
const chnl = bot.channels.cache.get('780537355144134686');
//followed by
client.on('guildDelete', async guild => {});

would I be able to pass the `chnl` for the event listener by making it `async (guild, chnl) =>` ?
it does work the same with command handler, however when I do it for the event listener it doesn't really detect the chnl as being defined on my visual studio code
fast trench
lyric mountain
#

yt's own api

rustic nova
#

it just makes a request to youtube every x minutes or so and checks if a new video has appeared

lyric mountain
#

trust me, it'll be easier if you write it from scratch instead of copying from somewhere else

rustic nova
fast trench
#

I'm not trying to copy...I'm trying to find a node module to install

fast trench
ivory seal
#

are their any alternatives to client.users.cache.get and client.users.cache.fetch . cause by using these two im unable to get the user objects of couple of users

pale vessel
#

you can't fetch cache

ivory seal
pale vessel
#

and client.users.fetch() works perfectly fine

ivory seal
#

ohh

#

ok one sec

pale vessel
lyric mountain
ivory seal
#

wat abt client.users.cache.find?

fast trench
#

which is where? @lyric mountain

lyric mountain
ivory seal
#

that also returned undefined in many cases

pale vessel
#

That grabs it from the cache

lyric mountain
pale vessel
#

If the user isn't cached, it will return undefined yes

lyric mountain
#

first results when I searched "youtube api" and "youtube api node"

pale vessel
#

It's recommended to use users.fetch() since it'll try to look in the cache first and if it doesn't exist, it will try to fetch the user and cache it

#

It's a promise so you have to resolve it by using await/.then()

tacit sundial
#

How do I get update of the votes?

#
    @bot.event
    async def on_dbl_vote(data):
        print(data)
#

I tried doing this

#

but it didnt print the data

#

anyone knows what I did wrong?

slender thistle
#

Show your full code

tacit sundial
#
class TopGG(commands.Cog):
    """
    This example uses tasks provided by discord.ext to create a task that posts guild count to top.gg every 30 minutes.
    """
    bot = commands.Bot(command_prefix="r/")

    def __init__(self, bot):
        self.bot = bot
        self.token = "secret"
        self.dblpy = dbl.DBLClient(self.bot, self.token)
        self.update_stats.start()
        self.count = 0

    def cog_unload(self):
        self.update_stats.cancel()

    @tasks.loop(minutes=30)
    async def update_stats(self):
        """This function runs every 30 minutes to automatically update your server count."""
        await self.bot.wait_until_ready()
        try:
            server_count = len(self.bot.guilds)
            await self.dblpy.post_guild_count(server_count)
            print('Posted server count ({})'.format(server_count))
            self.count = server_count
        except Exception as e:
            print('Failed to post server count\n{}: {}'.format(type(e).__name__, e))

    @commands.command()
    async def servercount(self, ctx):
        await ctx.send(self.count)

    @bot.event
    async def on_dbl_vote(data):
        print(data)
#

basically got it from the doc site

slender thistle
#

pain.

#

Don't create any more bot instances than one

tacit sundial
#

where should I put it undeR?

slender thistle
#

Use the commands Cog listener decorator on on_dbl_vote

#

And preferably use on_dbl_test

tacit sundial
#

so this @commands.Cog.listener() async def on_dbl_vote(data): print(data)

slender thistle
#

Yes

#

also don't forget the self param

tacit sundial
#

why would I need the self param?

slender thistle
#

Because it's a method?

tacit sundial
#

oh okay, because I got confused with the bot.event

#

thank you :D

slender thistle
#

yw

candid berry
#

selamın aleyküm

misty sigil
#

@weak parrot they sent this in all the other channels

earnest phoenix
#

coding go brrrrrrr

#

that would go against the server rules

#

how?

#

discussing that here, im pretty sure

silk wadi
#

ok sorry

sly pier
upper elm
#

is there a way to check who deleted a message in discordjs?

rustic nova
#

most likely through comparing it with audit log

drifting wedge
#

how do i import a file from the same folder im in py

upper elm
#

alr thx

drifting wedge
earnest phoenix
restive furnace
#

@drifting wedge literally import filename_without_extension

drifting wedge
#

it doesnt work

#

it says module not found

#

ive tried everything lmao

hollow sedge
#

You need a __init__.py in the folder and it depends on where the file you are actually running is (main.py) because the path to that is the one added to sys.path

#

@drifting wedge

earnest phoenix
#

Help

hollow sedge
#

You just need an empty __init__.py file for python to identify the folder as a module

#

@drifting wedge

drifting wedge
#

i did but still

#

discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.quest.questint' raised an error: ModuleNotFoundError: No module named 'itemlist'\

hollow sedge
#

can you send your file tree

earnest phoenix
hollow sedge
#

Lol

earnest phoenix
hollow sedge
#

Btw I think you can just run tree in command prompt in the folder to get it @drifting wedge

earnest phoenix
hollow sedge
#

it's called a local repository

drifting wedge
#

console = spam copypasta

hollow sedge
#

This wouldn't be on the server

sterile lantern
#

still cant figure out how to add db values,
fetching the values and doing + with it doesnt work

drifting wedge
hollow sedge
#

How are you importing itemlist in questint.py@drifting wedge

earnest phoenix
#

@drifting wedge bot looks sus I'd like to see it

hollow sedge
#

I like how half of it is crossed out

drifting wedge
hollow sedge
#

in questint.py

#

What are your imports

drifting wedge
#

import itemlist

hollow sedge
#

Yeah that's the problem

drifting wedge
#

in quest int ^

#

import itemlist, questint

#

in other files

hollow sedge
#

You import into that file the same way that you import in main.py

#

So it would probably be import cogs.quest.itemlist

drifting wedge
#

oh

#

cloud how are you not a google employee lmao

#

ur like "the programmer"

hollow sedge
#

lol no my knowledge is definitely not there yet

jaunty surge
#

hi guy, how can I fix this issue Error: input stream: Unable to retrieve video metadata it was working really fine for me like last couple of hours but then this error occurred. I host bot from heroku and use discord.js

hollow sedge
#

But imports were hard for me to understand at first too

drifting wedge
#

my bot is huge lmao

#

its like one of those do everything bot

#

so it has like 50 files and like 20k lines of code so far a bit

#

a bit more doe

stark abyss
#

I am still confused on when to end the pool -db connection

hollow sedge
#

oh god

drifting wedge
stark abyss
#

does anyone have any idea?

drifting wedge
#

its in 476 servers and its been going up fast

hollow sedge
#

probably but that's a lot

drifting wedge
#
  • im releasing a dashboard
hollow sedge
#

epic

tired panther
#

How can I check if both of my shards are online? any ideas?

drifting wedge
#

u cant really

#

u can do logs for when they crash

stark abyss
#

what if you debug --it will check for all shards i think

lusty quest
#

you can log if the shard becomes aviable iirc

drifting wedge
#

ye

tired panther
drifting wedge
#

u deleted it

lusty quest
#

where are you stuck?

sterile lantern
#

me or p0?

lusty quest
#

you

sterile lantern
#

i tried to do

#

db.fetch the bank and money

#

then print

#

bank + money

#

but it doesnt work

lusty quest
#

what programming language / db

sterile lantern
#

js, quick.db

#

i looked at their docs and db.add only adds a certain value to the db

lusty quest
#

db.get("bank") doesnt work?

sterile lantern
#

its db.fetch

#

and it work

#

works* but

#

I want to print the total balance

#

so

lusty quest
#

you want to multiply them?

sterile lantern
#

Total Balance: bank + money

#

no add them

#

to the total prints

#

but that prints

#

100 and 10

#

100 = bank and 10 = wallet (money)

lusty quest
#
message.channel.send(`Total Balance: ${Number(bank)+Number(Money)}`)
#

tryed something like this?

sterile lantern
#

o

#

ill try that

lusty quest
#

Number will make sure the values are Numbers

#

bcs javascript joins strings even if they contain numbers

sterile lantern
#

oh that works

#

tysm

earnest phoenix
#

why is this an error:

                                                          ^
SyntaxError: invalid syntax
  File "bot.py", line 114
    embed = discord.Embed(title="List of Commands",color=1cc9a2)
                                                          ^
SyntaxError: invalid syntax
#

the hex is proper

stark abyss
#

aren't color string?

lusty quest
#

usually yes

stark abyss
#

maybe he needs #?

sterile lantern
#

color="1cc9a2" should fix that

#

i dont think u need #

#

unless u specify its

#

hex

stark abyss
#

oh ok

earnest phoenix
#

nvm

hollow sedge
#

i dont think colors are strings..

lusty quest
#

the hex codes are

hollow sedge
#

can you use hex codes?

lusty quest
#

yes?

sterile lantern
#

let member = await message.mentions.members.first() || message.guild.members.cache.get(args[0]);
how come member.id doesnt work

crimson vapor
#

you need the # and is needs to be a string

sterile lantern
#

or is it

lusty quest
#

is the member object defined?

sterile lantern
#

yes

crimson vapor
#

according to docs

lusty quest
#

its possible that the member is not cached

sterile lantern
#

(node:449) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'id' of undefined

#
let member = await message.mentions.members.first() || message.guild.members.cache.get(args[0]);
    
    let bal = db.fetch(`money_${member.id}`)
    let bank = db.fetch(`bank_${member.id}`)```
lusty quest
#

did you mentioned someone?

sterile lantern
#

yes

hollow sedge
lusty quest
crimson vapor
#

why are you calling await on message.mentions.members.first()?

#

neither of those functions should be async

sterile lantern
#

o

crimson vapor
#

I would say console log message.mentions.members.first()

#

make sure its defined

sterile lantern
#

ah i found the error nvm

stark abyss
#

does anyone know why does my welcome command take so much time to send image? I am using canvas and creating it, is that why? Anyway to make it fast?

crimson vapor
#

what does it run on and what do you do to the image?

stark abyss
#

    let background = await loadImage('https://cdn.nekos.life/wallpaper/o1ZYRofMlno.png');
    const canvas = createCanvas(background.width, background.height);
    const ctx = canvas.getContext('2d');

    ctx.drawImage(background, x, y)

    const pfp = await canvas.loadImage(
      message.author.displayAvatarURL({
        format: 'png'
      })
    )
    x = canvas.width/2-pfp.width/2
    y = canvas.height/2-pfp.height/2

    ctx.drawImage(pfp, x, y)

    ctx.fillStyle = '#ffffff';
    ctx.font = '30px "bhb"';
    let text = `Welcome ${message.author.username}`
    x = canvas.width/2-ctx.measureText(text).width/2
    ctx.fillText(text, x, 60+pfp.height)
    const attachment = new MessageAttachment(canvas.toBuffer(), 'welcome.png')```
#

I am working on it kek it's messy stuff, but it's just taking time to send so I am wondering if it's bad choice and should switch to something else

crimson vapor
#

what do you run your bot on?

stark abyss
crimson vapor
lusty quest
#

i guess the vps is to slow

crimson vapor
#

so I think thats your issue

lusty quest
#

bcs of this it takes longer to render the image

stark abyss
#

oh

#

Alright thx for the info helps a lot

molten yarrow
#

await loadImage takes the most time

stark abyss
#

yeah i thought so

lusty quest
#

well it needs to be async or it wont be done

crimson vapor
molten yarrow
#

yeah i would load it from local files or make it smaller

stark abyss
#

I can try on visual studio code

crimson vapor
#

vsc is a code editor, you still need to host it

lusty quest
#

i can recomend getting the one year free at AWS or GCS

#

maybe even Azure

crimson vapor
#

you could also get a cheap vps for like 2-3 usd a month

stark abyss
#

i see

lusty quest
#

i guess if you use repl.it you dont have anything to spend on a vps

stark abyss
#

so it's the hosting thats causing it to take time?

lusty quest
#

yes

stark abyss
#

yeah

crimson vapor
#

kind of

lusty quest
#

the Free VPS is a potato on the network

crimson vapor
#

its the power of the machine that hosts

stark abyss
#

same thing? thinkLul

crimson vapor
#

kind of

lusty quest
#

VPS = your bot host

#

(in best case)

#

or spend ~50$ on a Raspberry pi

sterile lantern
#
let bank = db.fetch(`bank_${message.author.id}`)
  let bal = db.fetch(`money_${message.author.id}`)
 if (!args[0]) return message.reply('You must enter a number!')
 if (isNaN(args[0])) return message.reply('That was not a valid number!')
 //```
how do i check if args[0] is greater than their current balance
#

current balance is bal

lusty quest
#

<?

crimson vapor
#

you could get a rpi for so much less

#

tbh

sterile lantern
#

if(args[0] > bal

#

?

lusty quest
#

try and see

sterile lantern
#

aight

crimson vapor
#

does isNaN work on strings?

lusty quest
#

but you maybe want a new Pi4 with atleast 4gb ram

pale vessel
crimson vapor
#

oof

lusty quest
#

will return false

sterile lantern
#

> is not defined

crimson vapor
#

didn't know

sterile lantern
#

or not a valid thing

crimson vapor
#

me over here doing big brain parseInt()

pale vessel
#

I use Number()

lusty quest
#

use Number

crimson vapor
#

ye ik I should change that

#

but it doesn't matter for now

hard anchor
#

hi, can someone tell me how to put memes in discord.js without reddit api, since it gives me some errors

lusty quest
#

parseint is also valid

#

use reddit api but correctly

crimson vapor
#

learn to scrape sites?

sterile lantern
#

oh ik what to do

crimson vapor
#

add the )

sterile lantern
#

if (bal < args[0]) {

#

this should work

crimson vapor
#

if(Number(args[0]) > bal) {

#

iirc

#

idk someone correct me if im wrong

#

nvm no need for Number()

#

wtf js

#

I thought you were better than this

sterile lantern
#

no need for number

#

bc

#

if it isnt a number it sends "You need to input a number"

lusty quest
#

number is fine but you dont need it

molten yarrow
lusty quest
#

well the number is still a string

crimson vapor
#

yeah but redundant

#

fucking js

#

"1" == 1

lusty quest
#

yes but no

crimson vapor
#

yes ==; no ===

lusty quest
#

its still a string

#

if you do string+string you join them

#

but if you check if the number in the string is larger than a number in a other string it checks them like they are numbers

crimson vapor
#

yea

sterile lantern
#

if (args[0] = 0) return message.channel.send("You can't deposit 0 coins silly.")

#

this doesnt work

#

still lets me deposit 0 coins

crimson vapor
#

well first I wouldn't use =

pale vessel
#

h

crimson vapor
#

I would use == or ===

#

but not === since they are string and number

#

also

#

!== I think

#

wait no

pale vessel
crimson vapor
#

shhh

#

im tired

pale vessel
#

that is okay, i'm going to shut the fuck up

crimson vapor
#

huh

sterile lantern
#

=== 0 doesn't work

pale vessel
#

You use === "0"

lusty quest
#

= -> assigns value
== -> compares values
=== -> compares values of the same type

sterile lantern
#

oh "" worked

pale vessel
#

Read message above

drifting wedge
#

lets say i send a post request to flask, how can i make the flask reply with showing an alrert of some js element?

lunar sequoia
#

== would compare the values meaning 1 == '1' would be truthy while, === will compare with considering the data type so, 1 === '1' would be false

outer perch
#

should I use .yaml files to add multilanguage support to my bot? or is there another way?

#

I am using JS, maybe I should use .json

sterile lantern
#
   message.channel.send("You can't deposit a negative amount.")
 }```
lusty quest
#

i use json

#

easy to parse

sterile lantern
#

it still deposits the amount

lusty quest
#

return

outer perch
#

aight

crimson vapor
#

I would use (args[0] < 0)

lusty quest
#

also this ^

crimson vapor
#

make everything the same

sterile lantern
#

o i forgot return

#

return worked

crimson vapor
#

I remember when I fucked some shit up because I didn't return after a checking if the db data was null

lusty quest
#

better than forgetting a breakpoint for a loop

crimson vapor
#

true

#

but halting the process isn't as bad as restarting the process every time something happens

crystal wigeon
#

is there a way to recover deleted server? like a grace period or something?

crimson vapor
#

I don't think so

#

but discord never actually deletes anything iirc

queen crane
#

I'd think they do

lusty quest
#

they delete stuff

queen crane
#

There's no reason to keep guilds around

crimson vapor
#

I doubt

lusty quest
#

why did you want millions of deleted accounts taking space in your db

queen crane
#

Things like emojis probably don't get deleted but other than that

crimson vapor
#

because they want data to sell one day

#

true

#

you can test it by writing a message with specific content and then requesting your data

#

if you delete the message it shouldn't be sent back in your data

#

unless they don't actually delete it

lusty quest
#

they are not google

crimson vapor
#

you can request your discord data

crystal wigeon
#

deleting servers and deleting messages are different xD

#

i looked it up but ig there's no temporary delete or soft deleting of servers

#

once you delete a server its gone

lusty quest
#

when deleting one you get an error popup that states you cant revert it

crystal wigeon
#

mm

crimson vapor
#

maybe

#

but its possible they just do something like set deleted to true

lusty quest
#

also if someone deletes his account or Server they have to delete it or they Violate some EU laws iirc

opal plank
#

up to 13 days and if requested iirc

crimson vapor
#

yeah

opal plank
#

even if an account has been deleted(or banned) you still see their messages in discord

#

it just shows as Deleted User

#

but you can still see content n such

crimson vapor
#

I think that is dumb tbh

lusty quest
#

well they are not really associated to an account at this point

opal plank
#

still has an id iirc

crystal wigeon
#

so there is a way to recover my deleted server? its kinda been 24hours now

opal plank
#

so, technically still associated

crimson vapor
#

when you delete an account all content should be deleted

#

same with a message or channel

lusty quest
#

Discord IDs are unique for every user sure but the informations associated with it are gone, like email adresses, names, avatars, friends, connected apps

opal plank
#

what you'd be doing is no different, you are assigning messages/info to an ID.
Discord when ban/delete it stays the same, you still have access to ID and their content.
Not sure how things would go from there.
what im certain is that you have to delete upon request

tacit sundial
#
    @commands.Cog.listener()
    async def on_dbl_vote(self, data):
        print(data)
``` doesnt work for me when someone votes
crimson vapor
#

do you have the webhook setup?

tacit sundial
#

ah, do I have to do that?

lusty quest
#

yes

tacit sundial
#

alright, thanks

earnest phoenix
#

Hi y

#

Everyone not y heh

crimson vapor
#

huh

opal plank
earnest phoenix
#

speak english

#

most people here don't speak quesadilla

#

and it's a rule

opal plank
shy turret
sudden geyser
#

I still get PTSD looking at callbacks

shy turret
#

rip

opal plank
#

you need to use BigInt for those operations

#

which is really really hard

shy turret
#

lol

opal plank
#

its definitively not as simple as adding a n on the number

sudden geyser
#

I don't think it's that hard

opal plank
sudden geyser
#

I can imagine people thinking it's hard ¯_(ツ)_/¯

hard anchor
earnest phoenix
#

well have you read the error

#

positional arguments cannot come after keyword arguments

#

pick either all positional, all keyword or first positional then keyword

slender thistle
#

I'm sorry what is that

#

Did you miss a =

earnest phoenix
#

yeah he did at description

tranquil drum
#

Pycharm POGGIES

desert hazel
opal plank
#

second, you need to split to get args

desert hazel
#

erm the comment works

opal plank
#

simply doing length will only give you the string length

desert hazel
#

its not the args i want, i want the total of the whole collected

opal plank
#

BuT iT WoRKs

#

bugs are bugs, fix ur shit

#

collected is a Map

#

size

desert hazel
opal plank
#

again

#

it doesnt alwasy returns a value

#

fix it

desert hazel
#

hmmm

#

igy

#

one sec

opal plank
#

tdont believe me?

desert hazel
#

no i do

opal plank
#

just type that command and wait 6 minutes

#

or delete the message after

desert hazel
#

yea im planning to add it

opal plank
desert hazel
opal plank
#

im telling you to do it manually to see it error

#

cuz you havent accounted for that

#

collected is a map

#

oor

#

oooh

#

its not a collector

#

it should return a messgae

#

lemme check

desert hazel
opal plank
#

definitively returns a map

#

size should work fine on collected

#

also you should make sure its not a bot before creating the collector, and add it to the filter instead

desert hazel
#

there is that error though

#

it does

#

i didnt add that to the ss

opal plank
#

then why do it on collectedf?

desert hazel
opal plank
#

theres no need to check if its a bot if you already doing it before

desert hazel
#

oh

#

idk i finding it easier this way lol

opal plank
#

its not about easier

#

its just bad code

desert hazel
#

its not a public bot

opal plank
#

doesnt matter

#

bad code is bad code regardless

#

a bot can trigger that command

#

and will give you an error

desert hazel
#

they cant

opal plank
#

they can

#

you are creating a collector

#

which will error with time

desert hazel
cosmic robin
#

how do you get async into a command file using a command handler?

opal plank
#

you are only checking for it AFTERward

desert hazel
#

put async before you call the command

#

run

#

export

cosmic robin
#

ic ty

opal plank
#

thats a completely different command tho

desert hazel
#

thats not a command, that is the message event

opal plank
#

i see

#

then pass that onto the filter instead

#

cuz otherwise it'll trigger on bot events

desert hazel
#

okay

#

thx

opal plank
#

np

desert hazel
#

but the map

tranquil drum
#
async function exports(client, message) {

}

module = { exports };
``` 😳
desert hazel
#

why coes it still not work lmao

opal plank
#

cuz im pointing out other issues u have

#

and the most blatent ones

#

you should always debug your own code

desert hazel
#

how does a bot triggering it make a map not work

opal plank
#

cuz im pointing out other issues u have
and the most blatent ones

desert hazel
#

im not asking about that though

opal plank
#

you fix one you'll still have those other 5 to fix

cosmic robin
#

i think im using a slightly different structure of command but I've added async here and its now creating errors module.exports = async =>{

#

its saying ```; expected

opal plank
#

imagine not using exports

#

thats not how you do functions bt

#

functions take params

cosmic robin
#

ye i didnt think so

opal plank
#

async () => {}

#

not async => {}

cosmic robin
#

the error is still popping up

copper cradle
#

did you save the file?

cosmic robin
#

yes

desert hazel
#

was thinking that lol

copper cradle
#

there's no way that error still pops up if you fixed it

#

show your code

cosmic robin
#
    name: 'ticket',
    description: 'Ticket command',
    execute(message){
        const Discord = require('discord.js');

        const created = await message.guild.channels.create('ticket-' +  message.author,{
            permissionOverwrites: [
                {
                id: '781628166711935006',
                deny: ['VIEW_CHANNEL'],
                },
                {
                id: message.guild.id,
                deny: ['VIEW_CHANNEL'],
                },
                {
                id: message.author.id,
                allow: ['VIEW_CHANNEL'],
                },
            ],
        });        
            message.channel.send('Your ticket has been created')
            
            const Embed = new Discord.MessageEmbed()
            .setColor(0xff009e)
            .setTitle('Thank you for creating a ticket')
            .setThumbnail('https://i.imgur.com/FBnC3oy.png')
            .setFooter('Discord Bot Created by Phil#0005')
            await created.send(Embed)
            await created.send(`${message.author}`)
            await created.setParent('784514197744648263')
            message.delete();
        }
};
desert hazel
#

...

#

you need a space

#

between async and ()

cosmic robin
#

nope

desert hazel
#

no

#

you do

copper cradle
#

you're still doing it wrong

#

you're using commando, right?

cosmic robin
#

commando?

copper cradle
#

the function that gets executed is the execute function

#

and your command handler expects an object, not a function

desert hazel
#

hes not using commando

copper cradle
#

the command will not work even if you fix the syntax error you're getting

tranquil drum
#

Your function body is actually an object

copper cradle
#

exactly

tranquil drum
#

assuming you want to export an async function

#

if you want to export the object instead then just remove the async() =>

opal plank
#

^^

dim wadi
#

worng place my bad

#

How do i add photo to my long discription

copper cradle
#

before you ask, the function that gets called from your command handler is the execute function

#

so turn it into an async func

dim wadi
#

is what i meant to ask

zealous sable
#

You can use markdown or HTML/CSS

copper cradle
#

an img tag or a

dim wadi
#

so like [image link]?

copper cradle
#

no

dim wadi
#

can i get an example then?

copper cradle
#

I'd rather use an <img> tag tho

#

alt can be whatever you want

zealous sable
#

for markdown

dim wadi
#

ohhhhh thank you lots i get it now

zealous sable
#

Like zSnails said, HTML/CSS will allow you to do more easier (in some cases)

copper cradle
#

ok for some reason discord doesn't wanna load images for me smh

zealous sable
#

yeah if you click the link it works

tranquil drum
#

same @copper cradle

zealous sable
#

it isnt loading for me eoither

opal plank
#

it is for me

zealous sable
opal plank
#

localized cdn not working?

tacit sundial
#

is there a way to test upvotes?

copper cradle
#

yes

#

go to your bot's settings, and scroll all the way to the webhooks section

#

there should be a test button

tacit sundial
#

ight thanks

slender thistle
#

P.S. see the Webhooks section

sterile island
#

It worked earlier

#

I'm trying to play music and that's what it's writing

tacit sundial
#

@copper cradle where do I find bot settings? top.gg site? can you link it to me?

tacit sundial
#

my webhook is not working

opal plank
#

cuz thats not how shit works

#

ip:port/path

#

not ip/:port/path

tacit sundial
#

yeah I had a typo

opal plank
#

method not allowed

#

you probably doing GET

#

on POST

tacit sundial
#

self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='*', webhook_auth='*', webhook_port=*)

#

this is what I have

opal plank
#

again

#

you doing a GET request

#

its not the code, its YOU

tacit sundial
#

okay, could you link me on how to do it or explain it to me? Im new to this webhook stuff

opal plank
#

you ARE already doing it

#

that webhook is only recieving POST methods

#

when you click that link, chrome or whatever the fuck you using is doing a GET request

#

click on the test button on your bot page

#

you should see your console with a new vote(if you coded it right)

#

tldr; dont click on the link, browsers do GET not POST request

tacit sundial
#

and where are my bots settings on top.gg? I can see API token and such or is it on discord?

opal plank
#

go to your bot page

#

click edit

#

everything should be there

tacit sundial
#

ahhhh

#

thank you

opal plank
#

that really doesnt like like a thumbs up

tacit sundial
opal plank
#

there

tacit sundial
#

I guess my code is not good, it tested it, but no response in console, back to some more testing...

tranquil drum
#

and other HTTP requests lol

zenith knoll
#

ModuleNotFoundError: No module named 'discordpy

slender thistle
#

discord

copper cradle
#

you don't really need postman

#

3BC are enough

zenith knoll
#

no packages work

slender thistle
zenith knoll
#

ok

#

lets see

#

same error

slender thistle
#

Are you sure your environment didn't somehow get fucked

copper cradle
#

^

zenith knoll
#

no it shouldnt

tacit sundial
#

do I need to perform a GET request or POST request to test the webhook url

zenith knoll
#

i can run programs fine

#

just not with packages

#

like if I do a loop that prnints it works

copper cradle
#

you don't need to perform anything

slender thistle
#

Installed different Python versions recently?

zenith knoll
#

3.8.6 py

copper cradle
#

you just need to click the test button

zenith knoll
#

ok

tacit sundial
#

that doesnt work

#

nothing in console

zenith knoll
#

still

copper cradle
#

you're doing something wrong then

tacit sundial
#

im trying to know what went wrong

copper cradle
#

I mean

zenith knoll
#

What do you need to know

copper cradle
#

I can't magically guess what your code looks like

zenith knoll
#

ok here

tacit sundial
#

is my webhook url working? Is my code working to print test upvotes?

#
@commands.Cog.listener()
    async def on_dbl_test(self, data):
        """An event that is called whenever someone tests the webhook system for your bot on top.gg."""

        print("Received a test upvote:", "\n", data, sep="")
zenith knoll
#

import discord
from discord.ext import commands

client = commands.Bot(
command_prefix="dc!", case_insensitive=False, intents=discord.Intents.all()
)

@client.event
async def on_ready():
await client.change_presence(
activity=discord.Streaming(
name="dc!info | DerperChats IS BACK! (v1.00) | DerperChats Remastered",
url="https://www.twitch.tv/kyrokwtf",
)
)
print(
"I AM ALIVE! DerperChats REMASTERED:\nhttps://discord.com/api/oauth2/authorize?client_id=724076803244818472&permissions=1341517377&scope=bot"
)

client.run("NzI0MDc2ODAzMjQ0ODE4NDcy.Xu67Eg.59nPy-", bot=False)

#

was told to do bot=false so theres no errors

#

didnt work

tranquil drum
zenith knoll
#

so um

tranquil drum
tacit sundial
#

@tranquil drum it says method not allowed

tranquil drum
#

did you do a POST request?

tranquil drum
#

ah

tacit sundial
#

401 unauthorized

zenith knoll
#

no but i cant even run it. Module not found

copper cradle
#

there we go

zenith knoll
#

discord isnt found

copper cradle
#

did you set a webhook auth?

tranquil drum
#

^

copper cradle
zenith knoll
tranquil drum
#

You need to send the auth with your test request

copper cradle
#

I have had similar issues with python on windows

zenith knoll
#

pip3 install discordpy

#

AND

tacit sundial
zenith knoll
#

pip3 install discordpy

copper cradle
#

sometimes I have different installations of it

slender thistle
tranquil drum
#

yep

copper cradle
#

yes

slender thistle
#

Yup snails

copper cradle
#

sup tur

slender thistle
#

do py -m pip install discord.py

#

see what that does

zenith knoll
#

ok

copper cradle
#

^

tranquil drum
#

you're testing the webhook by pretending to be top.gg to your own server

copper cradle
#

you have multiple python installations

tacit sundial
#

ive filled in the auth

copper cradle
#

that should be the problem here

zenith knoll
copper cradle
#

unless

#

yep

zenith knoll
#

huh

slender thistle
#

Yup

#

Different fucking environments

copper cradle
#

remove the extra installation

tranquil drum
#

venv ftw

jaunty surge
#

how could I fix the issue:
unable to retrieve the video metadata

slender thistle
#

My pip defaults to latest Python version installed and I never used venv KEKW

copper cradle
jaunty surge
#

playing music

copper cradle
#

👏

tranquil drum
jaunty surge
#

when I request songs, the bot join voicechannel and.. it stops there

tacit sundial
#

Ive filled in the authorization code in top.gg but it still says unauthorized

jaunty surge
#

and show the error cannot retreieve metadata

tranquil drum
#

that's probably why it didn't work when you tested it through top.gg then

copper cradle
#

that's the problem

tacit sundial
#

what should I do?

proven lantern
#

is there a way to get the latency from the bot to the voice server using discord.js?

copper cradle
#

you probably didn't set an auth token in your code

tacit sundial
#

aha

tranquil drum
copper cradle
#

^

#

that should do it

tacit sundial
tranquil drum
copper cradle
#

and just don't come here asking why you're getting <unclosed client session at 0x00000>

tacit sundial
#

or webhook_password

copper cradle
#

idk

#

read the docs

tranquil drum
#

whichever one is the one it checks for the Authorization: header

#

read the docs true

tacit sundial
#

its the first one I believe

copper cradle
#

just read the docs

tranquil drum
#

rtfm 🙂

tacit sundial
#

I did its the first one

copper cradle
#

lmao

#

oh yeah if you add a + before an emote it reacts to the latest message

proven lantern
copper cradle
#

I was talking to darkside about the docs thingy

#

k imma code

#

brb

tacit sundial
#

it worked

#

hell yeah

slender thistle
#

SOMEONE READ THE DBLPY DOCS

#

OH MY GOD

copper cradle
#

lol

slender thistle
#

I'm actually about to cry

#

They grow up so fast...

terse finch
#

is there a way to get an authors role based on message.author?

copper cradle
#

yes

#

what lib

terse finch
copper cradle
#

ok lemme see

terse finch
#

is it just message.author.roles?

slender thistle
#

role

#

you mean roles because there's multiple

terse finch
#

yeah

slender thistle
#

first, make sure message was sent in a guild. <Message>.guild returns Guild object if a message was sent in a guild, None otherwise

terse finch
#

what is guild?

slender thistle
#

Server but in Discord's traditional fashion

copper cradle
#

ok so it looks like the Member class has a roles property

slender thistle
#

In this case, the reason why you do that check is to be sure that you actually have roles on the message author, because in DMs a user doesn't have roles. In a guild, they do.

copper cradle
#

so if you can get the member then you'll be able to <Member>.roles

slender thistle
#

<Message>.author can return either User or Member depending exactly on what I explained

copper cradle
#

and yes, check whether or not the message was sent in a dm

#

that should do it

terse finch
#

its not sent in a dm

copper cradle
#

but still

slender thistle
#

You still need to make sure you handle cases when it's sent in DMs

copper cradle
#

you should check it, you don't know if your users will be dming your bot

terse finch
#

this is for a small private group either way its fine lol

#

i need to check against a role that a user has

slender thistle
#

Yeah well fuck it then

#

Wasting my time with pointless explanations

copper cradle
#

so you basically have a bot that reacts 🤡 to messages from a certain person... lmao

terse finch
#

yeah

#

like i said its for a small private group

#

we want a role that anyone with that role gets a clown face on every message

slender thistle
#

Are you trying to get a role by a specific ID or name?

terse finch
#

either one

#

whichever is easier

slender thistle
#

Well, either way you would need to use discord.utils.get

copper cradle
#

yeah

terse finch
#

i have that

#

just not shown

slender thistle
#

Refer to discord.py documentation for that. Your iterable would be message.author.roles

copper cradle
#

alr

terse finch
#

so get(message.author.roles)

slender thistle
#

and you'd search by id property for best precision, so use that as a kwarg

terse finch
#

sweet thanks

slender thistle
#

👍

terse finch
#

one more question. if i wanted to determine what channel the message was sent. i could do message.guild.channel right?

#

like if i wanted to limit it to specific channels

stark abyss
#

is there anyway to get user id from username like P025#2022??

#

yeah you can do that

terse finch
#

you can do author.id if that user name is related to something like a message

stark abyss
#

sorry what kek are you talking to me

terse finch
#

thanks again

slender thistle
#

A message is attached to a channel, which is attached to a guild

#

Not vice versa :p

#

Well, a guild has multiple channels

dim wadi
#

instead of showing the image?

hollow sedge
#

Can you show the markdown

hollow sedge
#

Idk what you're trying to do

#

What isn't working