#development

1 messages · Page 1507 of 1

earnest phoenix
#

or san fran

#

i forgot

drowsy grail
#

yes it does work, make sure you're calling this code after the DOM has loaded, you can use an event listener or put the script at the bottom of your <body></body> tags

drifting wedge
#

I am

#

Dw I got it tho

#

Made it single line

#

@drowsy grail

sacred aurora
#

which one is better for loop or foreach

#

in case of performance

pale vessel
#

for

rocky hearth
#

What is that length property on instance.constructor

sacred aurora
rocky hearth
#

Why there's a huge difference for the first test.

earnest phoenix
pale vessel
#

Honestly it doesn't matter

sacred aurora
#

dunno why the first for is that high

lucid owl
#

i want luca's profile picture

earnest phoenix
#

luca clone?

lucid owl
#

no

#

i want

#

it

#

it looks cool

earnest phoenix
#

d o u b t

#

but anyways

lucid owl
#

oh is that it

earnest phoenix
#

yes?

lucid owl
#

it looks like clouds

#

not a person

earnest phoenix
lucid owl
#

no in pc it has the playing status

#

it merges with the blue color

#

and looks lime the earth

#

see it looks like this

earnest phoenix
#

luca clone hashflushed

lucid owl
#

lol

#

i just

#

put it to show u

earnest phoenix
#

wait so just that im correct

lucid owl
#

lol

earnest phoenix
#

you know how to use dev tools to edit a pfp

#

but dont know how to use dev tools to get the url of a pfp

lucid owl
#

no

#

i know

#

but

#

i was confused

#

cuz i coudnt understand

#

that it actually was a man

#

i thought they were clouds

earnest phoenix
#

idk seems a lil scientific name of a pig to me

lucid owl
#

thats y i wanted it

earnest phoenix
#

sus

lucid owl
#

bruh

#

nvm

#

u wont understand

silver lintel
#

how to check if the bot can add a role to a user? djs

solemn latch
urban pelican
solemn leaf
#

why is it so hard to edit metadata for length tags

timber fractal
#

i make a embed but it doesnt fit right inside the embed so how can i make it wider

crystal wigeon
#

hey guys so the latency is too much and its messing things up

#

1k ping

#

i changed my server to US

#

so now players in asia

#

have high pings

#

i need help ;-;

earnest phoenix
#

@crystal wigeon tell players to change server region to US

timber fractal
sacred aurora
#

oh kay

stuck pike
#

My bot is at 80% being close at getting verified

#

Hoe much time would it take mor

#

More

solemn leaf
#

cink out every bug

#

and about 1 week

stuck pike
#

Lol it's at 80% still a week lol

weak parrot
#

No the entire duration from 0% to approved is about a week

#

So most likely only like 1 or 2 more days

stuck pike
#

OwO imagine if my hosting dies during testing

#

Rios

#

Rips

weak parrot
#

Also this isn't really development related (channel is only really meant for asking for help with or discussing code) KEKWlaugh

stuck pike
sacred trout
#

hey

#

i need help with this code

#

discord.ext.commands.errors.MissingRequiredArgument: role is a required argument that is missing.

olive rune
#

that's not a code error

#

that's an invocation error

#

if you set role as one of the args

#

you need to provide it

sacred trout
#

can you look at the code for me?

#

@olive rune

olive rune
sacred trout
#

sure

#

is it down?

olive rune
#

I think so

sacred trout
#

lol

olive rune
#

that one works for me rn

sacred trout
#

there you go sir

olive rune
#

are you having issues with the roleadd command?

sacred trout
#

yes

#

btw can i please add you?

olive rune
#

you need to invoke it as [prefix]roleadd channel, messageid, emoji, role

sacred trout
#

yes

#

ik

#

i did that

olive rune
#

you aren't providing the role

sacred trout
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: UnboundLocalError: local variable 'cursor' referenced before assignment

sacred trout
olive rune
#

well

sacred trout
#

ah

olive rune
#

in roleadd

sacred trout
#

roleadd = cur...

#

?

olive rune
#

nah

#

cursor = main.cursor

#

just like you did in your events

sacred trout
#

oh

#

wow now new error

#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'builtin_function_or_method' object has no attribute 'execute'

olive rune
#

Also, you should probably switch from a blocking lib if you want to make this bot be public, blocking will make the bot not responsive every time that a reaction is added, removed or the roleadd command is called, until it's complete

#

main.cursor()

sacred trout
#

of

#

oof

#

it's only main.cursor(

#

xD

olive rune
#

Make sure to change that for all 3

true ravine
#

Would using a token and an encrypted password be overkill for authorising access to my API, or would it be reasonable?

sacred trout
#

umm

#

overkill

#

in my opinion

true ravine
#

Sounds good then I'll do that

#

Thanks

sacred trout
#

lol

#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: type object 'reaction' has no attribute 'guild_id'

#

@olive rune XD

olive rune
#

so reaction represents a payload object, right?

sacred trout
#

yea?

olive rune
#

does it say which line the error is on?

spark oracle
sacred trout
#
            f"SELECT emoji, role, message_id, channel_id FROM reaction WHERE guild_id = '{reaction.guild_id}' and message_id = '{messageid}'")```
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: type object 'reaction' has no attribute 'guild_id'

spark oracle
olive rune
sacred trout
#

idk

#

me nub

#

i can't do anything

olive rune
#

Does the error give a line number?

sacred trout
#

no

#

sad

#

@olive rune

olive rune
#

try doing something like guildid = reaction.guild_id on the line below cursor = main.cursor()

#

then use that

#

oh

#

@sacred trout don't use fstrings

sacred trout
#

K

#

I have to use f string cause its in ""

olive rune
#

then again, it's not really using user input

sacred trout
#

i will try in some time i was programming for like 3 hours and i am tired now

#

i wanna play valo xD

earnest phoenix
#

im playing mc

mental willow
#

what is the function that is used to get Server Count on discord.py
this is what i have so far

@bot.command(pass_context=True)
async def botservers(context):
    await context.channel.send("I'm in " + str(len(context.guild)) + " servers")```
#

please @ me if you can help

pale vessel
#

is that not it

#

guilds

earnest phoenix
#

len(context.bot.guilds)

#

or just len(bot.guilds) would work as well

#

Redundant pass_context though

#

Also, use f string 😳

mental willow
#

pass_context is required for some of my command. i know it is no longer needed but for some commands it throws an error that requires me to pass context. so i just keep it all the same, let errors and confusion that way

earnest phoenix
#

Huh, what error?

mental willow
#

idk, but the command swork so

#

cheers @pale vessel and @earnest phoenix

earnest phoenix
#

I mean sure the commands work, because Command's __init__ takes any kwarg, the thing is that it's doing nothing with invalid kwargs. So it's pretty much redundant.

willow mirage
#

anyone can help me make this shit looks better?

earnest phoenix
#

my fucking god

#

using javascript to apply css

willow mirage
#

:)?

#

I'm suck at css

#

actually i dunno shits on css

sacred trout
#

anyone hre?

#

i needed some help

earnest phoenix
#

@willow mirage using javascript to change css is the most cringest thing in the entire 96,000,000,000 light years of the entire fucking observable universe

tribal siren
#
let members = message.guild.members.cache.filter(m => !m.user.roles.cache.some(role));```
#

why does this not work?

#

it used to work

earnest phoenix
#

just use a stylesheet

dusky sundial
#

If you can learn js you can learn CSS. Just Google anything you need to know

earnest phoenix
#

@tribal siren m.user

#

user objects dont have roles

tribal siren
#

so it just has to be m.roles.cache.some(role)?

earnest phoenix
#

tryitandsee

#

why do people use double backticks for inline code blocks that does nothing

tribal siren
#

who knows

#

now it's a typeerror: fn is not a function

#

idk there's no find in there

earnest phoenix
#

collection.some takes a function and you're passing a role

#

you're probably trying to do collection.has

tribal siren
#

yes

earnest phoenix
#

Guys I forgot what the uh coding was for timestamp isn’t it

#

.settimestamp()

tribal siren
#

setTimestamp() if for embed

earnest phoenix
#

Thanks!

#

So

#

.setTimestamp()

#

for MessageEmbed objects use that

rocky hearth
#

How to use class methods as generators in js?

earnest phoenix
#

if you're passing a raw embed object set the timestamp property iirc

#

Looking good?

tribal siren
#

no

#

but still it's an embed

tribal siren
earnest phoenix
#

@tribal siren lemme check

willow mirage
#

xD

#

im sad

#

imma go kill myself

tribal siren
earnest phoenix
#

stylesheets are easier than js

willow mirage
#

dude, but i dunno how to use it

earnest phoenix
#

@tribal siren better?

willow mirage
#

like in css has no event onClick

earnest phoenix
#

And uh, guys

willow mirage
#

or smth like that

earnest phoenix
#

youre code is pure css with no events

#

How do I make so the uh successful deleted your messages delete in like 5 seconds

willow mirage
#

@earnest phoenix yes

earnest phoenix
#

then why do you need onClick event

willow mirage
#

CUZ THE BUTTONS

dusky sundial
#

For events you can use js, but using js for all CSS is just inefficient

willow mirage
#

look at the buttons

willow mirage
#

if you are on PC

earnest phoenix
#

Which one is better guys?

willow mirage
#

smh

earnest phoenix
#

I’m iPad btw

#

@earnest phoenix add a random collar color and a thumbsup gif to the embed

willow mirage
#

@earnest phoenix look at the nav bar (the link i sent)

sacred trout
#

any py dev here?

#

who can help me with reaction roles

willow mirage
#

@ shivaco

earnest phoenix
#

For events you can use js, but using js for all CSS is just inefficient

willow mirage
#

@earnest phoenix then how

#

tell me

earnest phoenix
willow mirage
#

Cuz my brain just ded

dusky sundial
earnest phoenix
#

just put your event stuff in js but the rest and i mean ALL OF THE OTHER CSS in a stylesheet

sacred trout
earnest phoenix
#

stylesheets are supa easy:

selector {
propety: value;
}
sacred trout
#

Command raised an exception: AttributeError: type object 'reaction' has no attribute 'guild_id'

willow mirage
#

Yes, when user click a button it return onClick and js need to change text color when that event happend

#

that what i did

dusky sundial
#

I'm on mobile, can you send the check method here?

willow mirage
#

who?

sacred trout
#

what?

earnest phoenix
willow mirage
#

no?

#

for the web design i didn't

earnest phoenix
#

Guys how do I Make a interval for 3 secs

willow mirage
#
setInterval(() => {
  //code
}, 3000)
earnest phoenix
#

Thanks

#

.setinternal(3)

#

Right?

#

you can literally just put the elements in a command group like rules inside a div element that is hidden by default and make it visible when the user switches to tab rules

dusky sundial
sacred trout
#

umm

#

i can try

earnest phoenix
#

make sure you have no sql injection vulnerabilities in your code

sacred trout
#

do i change it everywhere?

#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: type object 'reaction' has no attribute 'guild'

earnest phoenix
#

oof

tired panther
#

my reactionmessageadd event does not trigger on old messages, I Have activated partial and the fetch

earnest phoenix
#

dunno python just taking a guess

sacred trout
#

trying that

#

not workig

dusky sundial
#

Sorry I've never used event listeners for reactions before. I usually just do client.wait_for() inside of a command

earnest phoenix
#

f

sacred trout
#

ok

earnest phoenix
#

▪▪▪▪▪

▪▪▪▪▪

sacred trout
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: type object 'reaction' has no attribute 'member'

earnest phoenix
#

try looking up reaction objects in the dpy docs

dusky sundial
#

reaction.message.guild? Just another wild guess

earnest phoenix
#

or you can just ping shiv

#

▪▪▪▪▪

▪▪▪▪▪

sacred trout
#

amma try

earnest phoenix
#

Lol

sacred trout
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: type object 'reaction' has no attribute 'message'

dusky sundial
#

Hm

earnest phoenix
#

@slender thistle

dusky sundial
#

Yeah, probably look up the docs of the reaction class and see if you find any useful variables there

earnest phoenix
#

dear turtle hater

some guy needs halp with dpy

slender thistle
#

Show your code

earnest phoenix
#

Apple

#

gapple

tired panther
#
const client = new Discord.Client({
    autoReconnect: true,
    partials: ["MESSAGE", "CHANNEL", "GUILD_MEMBER", "REACTION", "MESSAGE", "USER"]
}); // this required to get the messages of the reaction roles

client.on('messageReactionAdd',async  (reaction  , user ) => {
  if (user.partial) await user.fetch();
  if (reaction.partial) await reaction.fetch();
  if (reaction.message.partial) await reaction.message.fetch();
console.log(reaction)
``` it does not trigger on old messages, any idea why? ping me , when u have a idea
earnest phoenix
#

enable partials

#

nvm

#

im

#

blind

rustic nova
#

@earnest phoenix send what you're using to set the image

tired panther
#

I enabled partials xD

earnest phoenix
#

i got it 0_0_meme_lol

rustic nova
#

worked just now?

earnest phoenix
#

yea

earnest phoenix
#

no i mean

rustic nova
#

aight

earnest phoenix
#

i found whats the error

#

or whats missing

rustic nova
#

ohh alrighty

tired panther
#

what?

earnest phoenix
#

What do I do if I want it to delete after 3 seconds and which line?

#

@sacred trout also lowercase class naming is bad, your variable even shadows it.

marble juniper
# earnest phoenix

you resolve the promise and make a timeout and then call the delete function with the message value

earnest phoenix
#

Alr thanks

#

:)!

willow mirage
#

@earnest phoenix .delete({timeout: 3000})

#
message.channel.send(embed).then(m => m.delete({timeout: 3000}))
earnest phoenix
#

@willow mirage under message,channel.send right?

#

Thanks!

willow mirage
#

?

#

no

#

replace it

#

@earnest phoenix

earnest phoenix
#

Oh thanks cutie

#

Lol

#

Let’s try

#

@willow mirage dosent work :/

#

Lol jk it works!

#

Thanks

willow mirage
#

ok

earnest phoenix
#

What if I want it to delete after 2 seconds

rustic nova
earnest phoenix
#

2000?

#

@rustic nova well I asked for help before too

#

Many times

#

Just changed my name etc

fierce ether
#

is there a way to change bitfield to an array?

cinder patio
#

The discord.js Bitfield class?

#

bitfield.toArray() if so

earnest phoenix
zenith terrace
#

Your shard took too long to be ready

solemn leaf
#

how do I make a command handler that goes inside of folders inside my commands folder
then maybe groups them in the collection

zenith terrace
#

nested command handler

umbral zealot
solemn leaf
#

@zenith terrace wdym

crimson vapor
#

@umbral zealot do you comment all of your code, or jut the code that gets read publicly?

umbral zealot
#

I comment the code that's intended for public consumption as learning material.

crimson vapor
#

ok

solemn leaf
#

so wait

crimson vapor
#

makes sense

earnest phoenix
#

Hello, can someone help me?

So I have this script. Things I wanted are is log Welcome when logged value are buyer OR one of the developers

const developer = ['staff1', 'staff2', 'staff3']
const buyer = 'owo'

const logged = 'staff1'

if (logged != buyer || !developer.includes(logged)) return console.log('Not welcome')

console.log('Welcome')```

The result when try it are not I wanted. I alredy swapping the value etc, but didnt work as expected.
Is there any alternative function/tricks that result the same as I wanted?
#

No idea

umbral zealot
earnest phoenix
#

@umbral zealot BRUH, I just said no idea

solemn leaf
#

evie

earnest phoenix
#

You get offended to easily...

umbral zealot
solemn leaf
#

there was no point to say no idea

earnest phoenix
#

So this can only be used by someone that has permission to delete messages right?

dusky sundial
#

He's just telling you that it's unnecessary to reply if you can't help in any way

solemn leaf
#

no idea

umbral zealot
solemn leaf
#

evie

earnest phoenix
#

Thanks

cinder patio
umbral zealot
#

infinite recursion is rarely useful tbh.

earnest phoenix
umbral zealot
#

Awesome! 👍

earnest phoenix
stuck pike
shrewd creek
#

does any one know how to make a stock bot?

#

in discord .py

umbral zealot
#

Step 1) find a stock market API that's free

#

Step 2) query it on command

shrewd creek
#

k...

#

thx

solemn leaf
#

@umbral zealot

fs.readdir("./commands/", async (err, files) => {
    if (err) console.log(err);

    const header = [['Command', 'Status']];

    files.forEach((file, i) => {
        if (file.endsWith(".js")) {
            let props = require(`./commands/${file}`)
            header.push([`${+i + +1}. ${file}`, 'Loaded 🟩']);
            bot.commands.set(props.help.name, props);
        } else return header.push([`${+i + +1}. ${file}`, 'Loaded 🟥']);
    });
    console.log(table.table(header));
});

this is what I got rn

umbral zealot
#

uhhhh

#

ok so?

solemn leaf
#

not based off yours

umbral zealot
#

chuck it

#

You literally don't have a handler that can support sub folders

#

you're asking for one that does

#

trash yours, and look at the code I sent

solemn leaf
#

yeah

#

yours has 1000 comments

umbral zealot
#

Yes, it absolutely does.

#

So you can learn and understand that code.

solemn leaf
#

I dont want to change the way how my mobile exports work

umbral zealot
#

Well then, glhf buddy.

solemn leaf
#
const Discord = require("discord.js");

module.exports.run = async (bot, message, args, embedconf) => {
};

module.exports.help = {
    name: "command"
}
crystal wigeon
#

someone tagged me?

solemn leaf
#

so your telling me it is impossible to use a subfolder handler with this

umbral zealot
#

No I'm telling you I gave you a complete solution that works perfectly find and you're refusing it just because it's not code you can 100% copy/paste without thinking

#

So, y'know, good luck, but your inability to read or write code ain't my problem.

solemn leaf
#

I just cant read

#

bcs of all the comments

umbral zealot
#

The comments are literally things you can read to know what the code does

#

That's how we real developers exchange detailed technical information between one another. might wanna get used to "reading words" if you want to get anywhere in life.

#

Shoveling code ain't it.

solemn leaf
#

okay honestly chill

#

the whole time you have been yelling at me

#

Ive been doing stuff in it

#

long before everything

umbral zealot
#

I'm... not yelling?

onyx hare
#

whjats the python pip again for server count

blissful coral
#

Pog that’s my old handler

#

Lol

umbral zealot
#

You're just acting like a Karen, seriously.

solemn leaf
#

@blissful coral the table is

#

and I improved the table

blissful coral
#

Indeed

#

By one emoji lol

solemn leaf
#

No

umbral zealot
#

There's honestly nothing wrong with that handler, I still use something extremely similar in my own bots.

cinder patio
#

You can totally add sub-folders to your command handler - you don't have to copy evie's whole repository to do so. Either use the function I sent and modify it a bit (because some method names are wrong), or study the code evie sent you and see how they are doing it and implement it in your command handler

umbral zealot
#

But if you want sub-folders it has to be thrown and replaced with a different loop and code that supports those folders.

#

study the code evie sent you and see how they are doing it
Yeah that's exactly what they saying they're unable to do, because "there's too many comments" MarioFP

solemn leaf
#

evie what does this do

fs.readdir("./events/", (err, files) => {
  if (err) return console.error(err);
  files.forEach(file => {
    // If the file is not a JS file, ignore it (thanks, Apple)
    if (!file.endsWith(".js")) return;
    // Load the event file itself
    const event = require(`./events/${file}`);
    // Get just the event name from the file name
    let eventName = file.split(".")[0];
    // super-secret recipe to call events with all their proper arguments *after* the `client` var.
    // without going into too many details, this means each event will be called with the client argument,
    // followed by its "normal" arguments, like message, member, etc etc.
    // This line is awesome by the way. Just sayin'.
    client.on(eventName, event.bind(null, client));
  });
});
umbral zealot
#

It reads the event folder and loads all events from that folder.

solemn leaf
#

do I need it

umbral zealot
#

As the comments say

#

If you want to have events in a folder, yes you'd need it

solemn leaf
#

ok bcs I already use events normaly

umbral zealot
#

IF you want to keep all you client.on("blah") in your index, then you don't need it

sacred trout
#

@earnest phoenix you theere?

solemn leaf
#

Yeah I do

umbral zealot
#

I think having events in a folder is much cleaner, honestly.

earnest phoenix
#

yes?

sacred trout
#

umm

solemn leaf
#

is it bad to do this?

sacred trout
#

i needed help with reation roles

solemn leaf
#

const fs = require("fs"), { resolve } = require("path");

sacred trout
solemn leaf
#

pastebin

sacred trout
#

sure

#

@earnest phoenix ?

#

lol gone?

umbral zealot
#

Maybe if you actually describe your problem other people can try to help

sacred trout
#

umm

earnest phoenix
#

^

sacred trout
#

sure

umbral zealot
#

"I need help with these 120 lines of code" isn't really a good description of your issue

#

only thing I can say for sure: you really need to learn how to spell "Reaction"

class Reation(commands.Cog):

    print("Reactioin cog is loaded")
sacred trout
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: type object 'reaction' has no attribute 'member'

solemn leaf
#

message#reply() is like discord reply now right

#

bcs if so I gotta rewrite lots of verify commands

umbral zealot
solemn leaf
#

never update time

umbral zealot
#

The slash interaction API isn't just "reply with a message" it's a completely different system anyway

earnest phoenix
#

can you provide full traceback

sacred trout
#

ok

#

[Running] python -u "c:\Users\schwt\OneDrive\Desktop\Projects\py projects\bot but with cog\cogs\tempCodeRunnerFile.py"

[Done] exited with code=0 in 3.67 seconds

[Running] python -u "c:\Users\schwt\OneDrive\Desktop\Projects\py projects\bot but with cog\cogs\tempCodeRunnerFile.py"

[Done] exited with code=0 in 3.871 seconds

[Running] python -u "c:\Users\schwt\OneDrive\Desktop\Projects\py projects\bot but with cog\main.py"
Fun cog is loaded
Leveling cog is loaded
Reactioin cog is loaded
Welcome cog is loaded
The bot is online.
Ignoring exception in command roleadd:
Traceback (most recent call last):
File "C:\Users\schwt\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\schwt\OneDrive\Desktop\Projects\py projects\bot but with cog\cogs\reaction.py", line 80, in roleadd
f"SELECT emoji, role, message_id, channel_id FROM reaction WHERE guildid '{reaction.member.guild.id}' and message_id = '{messageid}'")
AttributeError: type object 'reaction' has no attribute 'member'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\schwt\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\bot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\schwt\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\core.py", line 859, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\schwt\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: type object 'reaction' has no attribute 'member'

umbral zealot
#

reaction.member doesn't exist

sacred trout
#

some more errors maybe?

umbral zealot
#

actually reaction isn't defined here either

earnest phoenix
umbral zealot
#
    @commands.command()
    async def roleadd(self, ctx, channel: discord.TextChannel, messageid, emoji, role: discord.Role):

Within this function, reaction doesn't exist.

sacred trout
#

is that's all or are there more errors?

earnest phoenix
#

Within this function, reaction doesn't exist.
thus it takes it from the global scope, which is the cog class

sacred trout
#

should be

umbral zealot
#

Ah, that's a python thing I'm too javascript to understand, sorry.

sacred trout
#

lol

earnest phoenix
sacred trout
#

i tired

#

didn't work

#

so i did _id

earnest phoenix
#

huh? Context does have guild which is Guild object, and a Guild object has an id. What you meant is RawReactionActionEvent doesn't have guild attribute, but it does have guild_id attribute

#

why use f string on query doe

onyx hare
#

I INstalled the py for dbl and added the toekn, but my bots server count isnt appearing on the website or does it need a while?

earnest phoenix
#

did you set autopost to True?

onyx hare
#
self.dblpy = dbl.DBLClient(self.bot, self.token, autopost=True)
earnest phoenix
#

that should work ig

onyx hare
#

ill give it some time ifnot ill re-install it

earnest phoenix
#

it should work instantly though

onyx hare
earnest phoenix
#

Which line do I write this?

#

if(!message.member.hasPermission('MANAGE_MESSAGES')) return;

umbral zealot
#

anywhere within your run command, preferably before running anything else

earnest phoenix
#

are you sure you passed the right token? Maybe try making a request directly to the api and see what the response is

#

Alr so can it be under message.channel.send? @umbral zealot

umbral zealot
#

so you want your code to go "ok I deleted the messages"
"oh by the way you don't have permission to run this command"
???

#

You do understand code is executed from top to bottom and not in random order, right?

solemn leaf
#

@blissful coral

earnest phoenix
#

@umbral zealot sorry I’ve forgot, which line?

umbral zealot
#

anywhere within your run function, preferably before running anything else

onyx hare
earnest phoenix
#

But which line do you prefer?

umbral zealot
#

whichever is a line that is inside the run function but before all the other code

cinder patio
#

try putting it in the first line, if you don't like it then put it in the second, etc.

#

best practice

earnest phoenix
#

So under, run am I right?

umbral zealot
#

that would be inside the run function, yes.

earnest phoenix
#

Thank you good sir

solemn leaf
#

@umbral zealot for

  // Remove the `.js` in the end.
  let commandName = stats.name.split(".")[0];
#

can I make it be my export?

umbral zealot
#

sure

solemn leaf
#
module.exports.help = {
    name: "name"
} 
umbral zealot
#

yes you can

solemn leaf
#

okay how

umbral zealot
#

by... reading the help property

earnest phoenix
#

@umbral zealot after return is it return;(“msmsmsm”)

umbral zealot
earnest phoenix
#

I just....

solemn leaf
#

ayo I never messed with exports

crimson vapor
#

not "I just have a question"

#

learn basic js

umbral zealot
#

"I just need help with this ONE thing"

dusky sundial
#

I feel like there are too many people who try to learn coding by making a bot, rather than making a bot after they know the basics

umbral zealot
#

he says, needing help for the 50th thing

earnest phoenix
#

Sigh..

#

Ok

stoic hull
dusky sundial
#

That's like trying to learn how to run before you can walk

#

it may work, but it's sure as hell not easy

stoic hull
#

Its not easy no.

umbral zealot
#

It's like learning to drive while sitting in a driver's seat barrelling down the highway at 60mph.

earnest phoenix
#

@umbral zealot ooohhh it’s return message.reply("blah blah")

stoic hull
#

But i had about 2 months without going outside (covid) and free of online school, so i just did it.

#

And i mean, it can work out.

earnest phoenix
#

Lol

dusky sundial
#

As long as you understand the code you're writing and not copying things from the internet and hoping it works out

umbral zealot
# solemn leaf ayo I never messed with exports

Meaning your existing exports were copy/pasted from somewhere else, but you don't want to copy/paste mine, so you're stuck in a loop of "I don't know what code to shovel". The solution to that is to actually learn JavaScript so you know what you're doing.

stoic hull
#

Well, you understand it in the first week. Then you ask yourself what the hell you did to make it work.

earnest phoenix
#

This will work right?

#

try it and see lmao

dusky sundial
#

There's an easy way to find out :)

earnest phoenix
#

Lmao I’m alone @earnest phoenix I don’t have friends to test it with me lmao

stoic hull
#

Remove your manage messages perm then.

#

Make an alt or something.

earnest phoenix
#

Alr ima try LLOL

sacred trout
#

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: OperationalError: near "'788276249033179166'": syntax error

#

File "c:\Users\schwt\OneDrive\Desktop\Projects\py projects\bot but with cog\cogs\reaction.py", line 80, in roleadd
f"SELECT emoji, role, message_id, channel_id FROM reaction WHERE guild_id '{ctx.message.guild.id}' and message_id = '{messageid}'")

#

@earnest phoenix

slender thistle
#

Don't use f-strings in SQL queries

earnest phoenix
#

he's been told that

sacred trout
#

but what else do i do?

crimson vapor
#

is it safe to delete everything from require.cache?

dusky sundial
#

Concatinate the strings

slender thistle
#

Some wrappers support applying variables via function args to execute

#

in other words

#

RTFD

earnest phoenix
slender thistle
#

Yup

#

.format, f-strings, concat

#

Everything leads to the same outcome

sacred trout
#

can you look at the error?

#

if i don't use f string then how do i do it?

lusty quest
#

not if you get locked out by the API then its for the entire bot. (happened to me once)

earnest phoenix
#

Ayyy worked @earnest phoenix @dusky sundial

#

😎

slender thistle
#

Literally told you already

earnest phoenix
slender thistle
#

Rtfd

#

Aka read the fucking documentation

sacred trout
#

lol

#

never used RTDF before

pale vessel
#

bruh

sacred trout
#

BRUH

slender thistle
#

bruh moment

pale vessel
#

a real one fr

sacred trout
#

BIG BRUH MOMENT

earnest phoenix
#

also sqlite3 is blocking

#

you might wanna use aiosqlite instead

blissful coral
#

Why are you bruhing in all caps lmao

#

No need to freak out about it

sudden geyser
sacred trout
blissful coral
earnest phoenix
#

he's bruhing himself with caps

crimson vapor
sudden geyser
#

actually wait

sacred trout
earnest phoenix
#

yo guys can ya give me some advice to add some new fresh command I got no idea lol

blissful coral
earnest phoenix
#

Yea

lusty quest
#

does your bot follow some theme?

earnest phoenix
#

Not really just a moderation fun bot @lusty quest

solemn leaf
#

@earnest phoenix command that grabs a random command from github

earnest phoenix
#

Lol

lusty quest
#

did you got the usual Reddit Meme command?

sudden geyser
#

Node.js' documentation states that reloading a native addon may result in an error:

Modules are cached in this object when they are required. By deleting a key value from this object, the next require will reload the module. This does not apply to native addons, for which reloading will result in an error.

@crimson vapor the affect it'll have on your code is when require is called on the module, it'll be reloaded. With cache, it doesn't bother reloading it.

earnest phoenix
#

Isn’t that kind of spoon feeding lol

#

@lusty quest ye

lusty quest
#

then make a meme Generator

crimson vapor
#

alr ty

earnest phoenix
#

Huh how does that work Lol?

lusty quest
#

use Canvas to edit a meme Template

earnest phoenix
#

Oh what about economy?

#

Something unique idea

lusty quest
#

since you dont know how it work it will get you busy researching

blissful coral
earnest phoenix
blissful coral
#

That isn’t really unique

cinder patio
#

or get him busy askin more questions in here

solemn leaf
#

wait

#

its props.help

earnest phoenix
#

What’s the development made for

earnest phoenix
stoic hull
lusty quest
#

Economy is unique like a Drunk Russian

earnest phoenix
#

Show the coding then

dusky sundial
#

For asking questions when you run into issues you can't solve on google. Not learning how to code

earnest phoenix
#

@lusty quest what about like a job economy or something

lusty quest
#

?

cinder patio
#

You don't do any development, you only copy code and ask why it doesn't work

sudden geyser
#

The economy category is oversaturated

stoic hull
#

Yes.

sudden geyser
#

looks like its missing indentation

#

and spacing in general

earnest phoenix
#

Bruh-

lusty quest
#

everything could be copied.

cinder patio
#

yeah... but let's cut it

lusty quest
#

even some really really stupid code.

cinder patio
#

this is development after all

stoic hull
lusty quest
#

well the Toppic doesnt forbid chatting about Bot development, and he asked for an idea for a command to add to his bot

earnest phoenix
#

Yea

#

What should I add?

#

I’m not gonna add music command they’re too hard lol

lusty quest
#

the meme generator could work.

stoic hull
#

They are not that hard...

lusty quest
#

Dont do Music this is even more saturated than Economy

earnest phoenix
#

Music commands are..

#

Lol

dusky sundial
#

Make a command to check the weather in a specified location. That might keep you busy for a while-

earnest phoenix
#

yes! @dusky sundial

#

lol

lusty quest
#

in the past 3 Days i saw atleast 6 People here asking stuff for Music bots

earnest phoenix
#

LOL

dusky sundial
#

Music bots aren't even worth trying to make anymore. It's like trying to make an MMORPG as a small indie company

stoic hull
cinder patio
#

try making a customizable soundboard

earnest phoenix
#

@lusty quest what about 8ball?

#

Or how tall am I

lusty quest
#

sure but there is no Reason to add some buggy Music command to your multi Purpose bot. Most people will just use some of the Larger Ones

earnest phoenix
#

And then it gives you a random number

lusty quest
#

you could do this. iirc there are even APIs for 8ball

earnest phoenix
#

Yea

stoic hull
earnest phoenix
#

I’m thinking of making like 8ball

dusky sundial
#

There is an api where you enter 2 names and it tells you how much in love they are or whatever. It's pretty fun

cinder patio
#

you don't need an api for this stuff

sudden geyser
#

It depends how you want to implement it.

lusty quest
#

if you use a proper Backend eg lavalink or similar then sure, but who would run lavalink just to have a music command for a Multi Purpose bot?

sudden geyser
#

Most people just take two input from users and pick a random number

earnest phoenix
#

Or how much money do I have! @lusty quest

lusty quest
#

?

earnest phoenix
#

Like

sudden geyser
#

Or maybe you want to throw in some machine learning neural networks to see how much they love each other smirk

earnest phoenix
#

You say

#

+how much money do I have

#

Then it gives you a embed

#

Number

#

And it’s like

lusty quest
earnest phoenix
#

100$
You are poor

#

Lol

lusty quest
#

this is easy to make

#

just use a random number generator

earnest phoenix
#

Ima make that yea that sounds good to me

sudden geyser
#

The power of love is with you.

earnest phoenix
#

Like pls pp

#

And then it gives you a random size LOL

stoic hull
#

Just rig that command.

lusty quest
#

so you got now a few ideas

dusky sundial
#

@sudden geyser The one I used returns the same number if you enter the same names twice, so that's something more than a random number gen CoolChamp

stoic hull
#

I rigged my pp command.

earnest phoenix
#

Then how much money I got is also find

#

@lusty quest thanks

sudden geyser
#

In the meantime, does anyone have suggestions for editors dedicated for writing/markdown?

#

Preferably not VSC

dusky sundial
#

Notepad++? KEKW

lusty quest
#

use Discord chat

umbral zealot
#

It works super well and gives you a nice preview

sudden geyser
#

Is there a desktop app for it?

#

I've used it before and liked it

umbral zealot
#

not that I know, but it works on any PC that has a browser. so like. every PC 😂

lusty quest
#

if you get flagged to often you will get locked out from the API at some point

solemn leaf
#

@umbral zealot can I add an .then for when it is done going through all the commands?

sudden geyser
#

aw, well I'll use it in the meantime. time to flood my google drive omegalul

umbral zealot
earnest phoenix
#

@lusty quest with the uh how much money do I have I can copy n paste a 8ball command and modify it a bit

#

And make it embed etc

#

bru

solemn leaf
#

@umbral zealot How should I make it run after it is done

umbral zealot
#

literally put the code after the loop

solemn leaf
#

did and it logged

╔══════════╤════════╗
║ Category │ Status ║
╚══════════╧════════╝

╔═════════╤════════╗
║ Command │ Status ║
╚═════════╧════════╝
drowsy epoch
#

Does anyone know how to set a bot pfp to be a gif on top.gg via html

solemn leaf
#

css

drowsy epoch
#

how do u do it?

solemn leaf
#

well

#

you know how you load in css?

drowsy epoch
#

mhm

solemn leaf
#

you know css

drowsy epoch
#

bits an peices

solemn leaf
#

get the class

drowsy epoch
#

this is what i have so far

#
          border: 5px solid var(--gold);
        border-radius: 64px 64px 64px 64px;
    }```
#

for the header

#

image

#

which is the icon

solemn leaf
#

well you need to chaneg the image

drowsy epoch
#

yes, how tho

solemn leaf
#

is it background

#

or data

cinder patio
#

probably by setting the background property of the header image class

drowsy epoch
#

just the icon

dusky sundial
#

try

.entity-header__image {
        backround-image: url("url-to-your-image");
        border: 5px solid var(--gold);
        border-radius: 64px 64px 64px 64px;
    }

Not sure if it'll work tho, just a guess

drowsy epoch
#

o, ty

drowsy epoch
#

*work

dusky sundial
#

Not sure, you can try it

drowsy epoch
#

it does not work

#

hmm

dusky sundial
#

try background instead of background-image

cinder patio
#

isn't --gold a custom variable

drowsy epoch
#

mhm

cinder patio
#

maybe that's why it's failing

#

remove the border to see if it works without it

#

or replace var(--gold) with a valid color

drowsy epoch
#

ok

#

so

#
        backround-image: url("https://media.giphy.com/media/j7Qdi1oI45tQuXgljo/giphy.gif");
        border: 5px solid #F9A602;
        border-radius: 64px 64px 64px 64px;```
cinder patio
#

try it

small ermine
#

So

drowsy epoch
cinder patio
#

you misspelled background

drowsy epoch
#

wow

#

fixed it but it did not work .entity-header__image { background-image: url("https://media.giphy.com/media/j7Qdi1oI45tQuXgljo/giphy.gif"); border: 5px solid #F9A602; border-radius: 64px 64px 64px 64px;

dusky sundial
#

Since the avatar is defined with a src in the website I'm not sure if it's even possible to replace it with css? I might be wrong, have you seen others use gifs as avatars?

drowsy epoch
#

yes

slender thistle
#

It's a tricky trick

#

Google "replace html element with css"

drowsy epoch
#

@craggy pine

#

Sorry i needed ur id

slender thistle
#

The idea is that your main element is displayed in very small details (almost with visibility: hidden) but you have a ::before/::after that's actually displayed

earnest phoenix
#

If I want this embed yea it’s under user.unban right?

dusky sundial
#

Enable developer mode and you can right-click people and then "copy ID" :)

still grotto
#

why the api is very high in my server
Time taken: 4031 ms
Discord API: 5509 ms

drowsy epoch
#

Bc its wrong

drowsy epoch
#

That 1 is kinda

dusky sundial
#

Well do what turtle guy said, google "how to replace html element with css"

earnest phoenix
#

Help me....

slender thistle
#

I'm just rephrasing an answer from stackoverflow

dusky sundial
#

Relax, people will see your message

earnest phoenix
#

Yea but it’s under user.unban right?

#

You know what ima just ru

#

Try

dusky sundial
#

I'm not a js dev

umbral zealot
#

You can't unban a user or member because they're not accessible

#

it's guild.unban("id")

earnest phoenix
#

@umbral zealot I mean like

#

If I want it embed

#

It’s under user.unban right#

umbral zealot
#

what

earnest phoenix
#

If I want it embed it’s under user.unban right?

umbral zealot
#

you'd replace the message.channel.send with the embed

#

I mean not that this unban would work anyways because of what I said, tbh

still grotto
#

i'm waiting 😦

earnest phoenix
#

@umbral zealot I’ll fix it it’s line 18 right?

umbral zealot
earnest phoenix
#

Autocorrect..

still grotto
#

ok thanks

umbral zealot
earnest phoenix
#

I jUst need help making it embed :/

umbral zealot
#

You need help for literally everything, not just this.

dusky sundial
#

It seems like you've "just" needed help for a lot of things

earnest phoenix
#

That’s what development is for..

umbral zealot
#

there will be no spoonfeeding here

dusky sundial
#

They're not supposed to write the bot for you.

#

If you don't know JavaScript it's not a good idea to make a bot with JavaScript

earnest phoenix
#

No I’m just asking if I need it to be embed it’s under User.ban right?

umbral zealot
#

I already answered that question

cinder patio
#

Think logically

earnest phoenix
#

Well yea

#

Ok..

umbral zealot
earnest phoenix
#

There’s no message channel send @umbral zealot

umbral zealot
#

message.reply then, same difference

#

you'd know they're the same thing if you actually understood any of this code

earnest phoenix
#

That’s something else it tells you that you haven’t mentioned a user @umbral zealot

#

Not that a user has been unbanned

young moth
#

iwanna to make a music bot but the idont have a package for it

umbral zealot
#

Well then sure, put it under that pointless user.unban

solemn leaf
#

message.reply('a').then((m) => {m.edit('a')});

earnest phoenix
#

@umbral zealot yes I’ll change it...... I knew it before that it wouldn’t work

earnest phoenix
#

Uh, you have to uh code it by yourself

#

I guess

#

@young moth

young moth
#

imade a code

#

and it works the idont understand the package

umbral zealot
#

Which package

#

which language

#

which library

faint prism
#

what code

umbral zealot
#

What do you have now, what did you try, what didn't work?

young moth
#

are u using glitch . com?

solemn leaf
#

glitch banned discord bots

faint prism
#

Really? Nice

solemn leaf
#

im pretty sure

earnest phoenix
solemn leaf
#

then they said use a phone app called termux

earnest phoenix
#

I accidentally removed something but I can’t remember now it’s showing error..

#

@umbral zealot

umbral zealot
#

maybe try CTRL+Z ?

faint prism
earnest phoenix
#

I’m iPad @umbral zealot

solemn leaf
#

no really

umbral zealot
#

Then "undo", man, idfk

earnest phoenix
#

Wtf

#

There no undo lmao

young moth
#

iwant to make a bot

#

a music bot but iwant help pls

solemn leaf
#

no

umbral zealot
earnest phoenix
#

@umbral zealot what do you see wrong with it? It was some about like cool down or something

umbral zealot
earnest phoenix
earnest phoenix
#

BRUH JAVASCRIPT CAN REDO WHAT I JUST DID @umbral zealot

#

Cant*

#

lol

umbral zealot
#

not automatically

#

but you'd have to re-write it

earnest phoenix
#

😬

faint prism
#

my face too ^

umbral zealot
#

but to re-write it you'd have to know what the hell you're doing which you clearly don't.

crimson vapor
#

I heard that djs has a require function in its send function, is this true?

umbral zealot
young moth
#

iwant package for a musicbot

limpid heath
#

{dancin

umbral zealot
#

Ok great

faint prism
#

Still doesn't answer the questions

young moth
#

language English

faint prism
#

Nonono

#

Programming language

umbral zealot
#

PROGRAMMING language ffs

earnest phoenix
#

He means uh he wants the coding for the music bot

faint prism
#

We got that bit

#

But nothing else

young moth
#

wait iwill send u the code

#

comst Bot =require("ctk-musicbot");
const musicbot = new Bot({
Token: 'xxx'
prefix : '~'
});
musicbot.start();

umbral zealot
#

So you don't have any idea how to answer any of my 4 questions? smh

earnest phoenix
#

@umbral zealot godsaved me

umbral zealot
#

Ok well that looks like javascript

earnest phoenix
#

It was cooldownAmount);

umbral zealot
#

if only you could spell const properly maybe

young moth
#

sorry but idont know any coding language

umbral zealot
#

Then maybe you should learn first

mellow kelp
#

comst sounds like cheems pogey

earnest phoenix
#

Try python I think that’s the easiest one @young moth

young moth
#

thank u guys for your time

earnest phoenix
#

Np, just try your best

#

Lol

young moth
#

can u help me with my bot?

#

its only music bot

earnest phoenix
#

What ya need

#

What’s it called?

mellow kelp
#

only

young moth
#

I just need to keep him online

earnest phoenix
#

Oh what website are you using?

lusty quest
#

get a VPS to run the bot on

earnest phoenix
lusty quest
#

"Free" VPS wont run Music bots

earnest phoenix
#

@young moth does the bot work?

#

Like the commands etc

umbral zealot
#

Glitch is not an appropriate place to host bots, you cannot keep it online 24/7

umbral zealot
#

for a music bot there's no appropriate place that's free.

earnest phoenix
#

Oh uh

young moth
#

the code never works

#

comst Bot =require("ctk-musicbot");
const musicbot = new Bot({
Token: 'xxx'
prefix : '~'
});
musicbot.start();

umbral zealot
#
  1. you don't know how to code
  2. you do'nt know how to host
    you shouldn't be trying to make a music bot at this stage. Use an existing one.
earnest phoenix
#

Well, when I was a newbie I knew nothing i also copied codes I still am a newbie but learnt new stuff and tried to make my own

lusty quest
#

or learn how to

faint prism
#

comst

earnest phoenix
#

Hello, which team is there to ask for help for discord bot developer or I am adding friends there, but the invitation is not going, what will I do or when I add friends, can I tell you where the invitations are coming?

umbral zealot
#

comst is not a thing

stuck pike
#

Lmfao

umbral zealot
stuck pike
#

It's const

umbral zealot
stuck pike
#

Lmao

#

Smol keeds here

earnest phoenix
#

ok thx

faint prism
umbral zealot
# young moth will u help me?

My help is this:

  1. you don't know how to code
  2. you don't know how to host
    you shouldn't be trying to make a music bot at this stage. Use an existing one.
    If you absolutely want to make one yourself, learn javascript first. #development message
stuck pike
#

Yea

#

I learned from Yt

slender thistle
#

Red flag

stuck pike
#

Just took me 7 months

slender thistle
#

YouTube is not fit for Discord bots

stuck pike
#

Yea

umbral zealot
#

I mean , there are javascript tutorials on youtube, some people learn better with videos. That's a valid thing.

mellow kelp
#

But the thing is

stuck pike
#

Yea

umbral zealot
#

Learning bots before javascript though, that usually doesn't work.

mellow kelp
#

LEARN javascript first

slender thistle
#

JS — sure, but D.js

stuck pike
mellow kelp
#

Thats called

#

meth

stuck pike
#

Smort

umbral zealot
#

sounds about right

stuck pike
mellow kelp
#

Hm yes

#

Jabascrept

earnest phoenix
#

@umbral zealot ima be honest, I don’t learn from documents but I learnt a bit lol

umbral zealot
#

well if reading isn't your thing, try javascript tutorials on youtube

#

and if that doesn't work, go to school or pay for a tutor

earnest phoenix
#

Yes, school or a tutor they learn me a lot

#

And uh

#

I got a problem

umbral zealot
#

clearly.

earnest phoenix
#

Why is this showing error?

umbral zealot
#

what error

earnest phoenix
#

I mean like it’s saying on my server that there is a bug but I don’t see any

umbral zealot
#

how it is saying there's a bug

#

what's the error

earnest phoenix
#

Not showing any thh

umbral zealot
#

"it's saying on my server that there is a bug" you said

#

how is it showing? what is it showing?

earnest phoenix
#

It’s just saying

#

You found a bug! Please report it in the server | code

umbral zealot
#

And there's nothing in the console that shows an error?

earnest phoenix
#

Yea

umbral zealot
#

this part here you can't see because you're on a damn iPhone trying to code

earnest phoenix
#

Just says everything loaded successfully

fierce ether
#

if(!user.bucks !== null && user.bucks < amount) return message.channel.send(a, nomoney); this does the complete wrong thing

earnest phoenix
umbral zealot
#

Sounds like your code is silently catching errors and sending them to the void, which is entirely unhelpful.

earnest phoenix
#

Yea I know...

sonic lodge
umbral zealot
#

acutally maybe