#discord-bots

1 messages Β· Page 773 of 1

slate swan
#

basically it stuck

#

there

#

show me your event?

#

kk

final iron
#

How many commands do you have

slate swan
#

even if they have like 50 commands, it wont take more than 1 second to get returned

#

oh wait

final iron
slate swan
#

I am dumb

#

the channel is not None

#

:p

#

Yea I added extra indents

#

:P

slate swan
dry kelp
#

does anyone have a server banner where i can test my new antinuke check?

final iron
#

Couldn't you technically have like 10k+ commands if you write to a file in loop?

final iron
dry kelp
final iron
#

What do those have it do with each other

dry kelp
#

because i added a check for the banner

#

and idk if it works

#

check all the parts with the #

#

i don't wanna upload them yet bc ion know if it works

final iron
#

I don't think people will just let you invite you bot

dry kelp
#

and i can't check it because i don't have a server banner yk

#

the bot is in already some big servers

#

used instead of wick

#

πŸ€·β€β™‚οΈ

#

they might like my antinuke

final iron
#

Never heard of wick

dry kelp
#

wick is a antinuke "slow bot"

#

some of my friends got nuked while using it

#

reason why they are using my bot now

#

a 5k members server

#

so yuh

#

i just can't check this shit that's why im mad

slate swan
#

Whats the issue?

dry kelp
slate swan
#

How do I create a list of channel ids from channels: commands.greedy[discord.TextChannel]
I tried but dont really understand thinkcat

dry kelp
#

did i ever said that i have a issue or smth like that?

slate swan
dry kelp
#

my bad

slate swan
#

uhuh

dry kelp
#

im just mad

#

almost 6 am and i can't check this shit

slate swan
#

Have faith lol

#

the heck

#

Okiii

dry kelp
#

does anyone have a server that has a server banner?

slate swan
#

Greetings

#

hi

dry kelp
#

ashley do u?

slate swan
#

why

#

what would it even help you with lol

dry kelp
slate swan
#

antinuke a server banner?

#

wut

dry kelp
#

dude ong

slate swan
dry kelp
#

is just a antinuke check 1 OF THE ANTINUKE CHECKS jesus christ

slate swan
#

but you need a server banner?

dry kelp
#

jesus christ just read this shit

slate swan
#

i mean , noone keeps a test server boosted to level 2

dry kelp
#

it can be even a main server

slate swan
#

who would lol

dry kelp
#

i just can't wait for my friends

#

cuz i wanna add it now

#

im desperate

#

and ion wanna upload something that may wont work

slate swan
#

Patience, dear

slate swan
slate swan
#

or maybe just dont give any user perms to edit the guild🧠

#

if it works with icon , would work with banner too

dry kelp
#

yeah but look

#

lemme tell u smth

slate swan
#

yes pls

dry kelp
#

idk how the loop would react

slate swan
slate swan
dry kelp
#

dude do u even know what's the point of the antinuke?????

slate swan
#

make everyone a moderator , so everyone follows rules Bigbrain

slate swan
slate swan
dry kelp
#

imagine a 12 y o child
gets manipulated by some "nuker"
gets nuked
BOOM
Starts crying
this is why im making this feature
ofc there are mature people around cord that don't need that at all
but why not having a security step
that can help u save ur server from this shit

slate swan
#

Lmao

dry kelp
#

no but change it into something bad

#

like ||porn|| images

slate swan
dry kelp
#

@slate swan server owner

dry kelp
#

did i ever say a child?

slate swan
#

my guy cant even follow tos LMAO

dry kelp
final iron
slate swan
slate swan
slate swan
#

Good luck

slate swan
#

age requirement

keen talon
#

Rick @slate swan pithink

dry kelp
#

i said "12" as a RANDOM age

slate swan
#

isnt it astley?

slate swan
dry kelp
#

do u really take everything serious?

keen talon
slate swan
keen talon
#

Hey you are there today pithink

dry kelp
#

@slate swan

#

lemme tell u why i wanna test it more exactly

#

cuz u said that it should work if icon works

slate swan
dry kelp
#

it's about the "loop" here

#

because if the asset was not found

slate swan
#

loop? or the if statement?

dry kelp
#

it will release a error in that loop

final iron
dry kelp
#

is a loop if u see the entire code

#

is not ab the if statement

#

that works perfectly fine

dry kelp
#

the bot it's already in some huge servers

#

but the owners are offline

#

i wouldn't be here if they were offline tbh

slate swan
dry kelp
#

bcuz

dry kelp
#

is not just ab antinuke

keen talon
dry kelp
#

did i ever say just antinuke???

#

u guys are just saying shit without knowing what the bot is capable to do

slate swan
#

02bored it it was some opensourced bot it could have maked more sense ( because of transparency)

dry kelp
#

ask before saying shit

#

immature

keen talon
slate swan
#

you cant even subclass the bot class ok

dry kelp
#

is not just antinuke

#

i said that i wanna test this antinuke check AKA SECURITY STEP

final iron
#

I don't see why that matters

dry kelp
#

holy fuck πŸ˜‚

final iron
#

You could have anything implemented in that bot

dry kelp
#

i could

#

but i wont fuck up my reputation for some shit

#

im even close to verify

final iron
slate swan
#

still people would end up adding mee6

#

Β―_(ツ)_/Β―

final iron
#

Mee6 is kinda broken rn

dry kelp
keen talon
slate swan
dry kelp
#

almost 6 am rn

final iron
dry kelp
#

HOW COULD IT BE FAKE

keen talon
dry kelp
#

jesus fuck

fervent fable
#

What is the best way to hide source code from people?

dry kelp
slate swan
final iron
slate swan
slim ibex
final iron
fervent fable
#

yess but if u want to publsh it so people can use it

final iron
#

You can inspect element

dry kelp
#

😭

slate swan
dry kelp
#

dude

fervent fable
#

who knows a good obf for python?

dry kelp
slate swan
#

Obf?

final iron
slim ibex
#

obf lmao what

dry kelp
final iron
#

Obfuscator

fervent fable
#

yes

slim ibex
#

oh ok

fervent fable
#

obf\

dry kelp
#

still does anyone have a server with a server banner where i can test the antinuke check?

final iron
# dry kelp

Just stop trying. Nobody is going to invite your sketchy bot

slate swan
dry kelp
#

sketchy

slim ibex
#

legit

dry kelp
#

JESUS CHRIST

slate swan
slate swan
dry kelp
slate swan
dry kelp
slate swan
#

Ouch

dry kelp
slate swan
#

hey , lets not go that way

dry kelp
keen talon
#

We are reaching smartness levels tht shouldn't even be possible pithink pithink

final iron
dry kelp
#

so childish

slate swan
#

never seen someone wanna push to github so bad

keen talon
slate swan
dry kelp
slate swan
#

@dry kelp if could be better if you may wait for some time instead of arguing with people here

#

JUST WAIT jeez

final iron
#

Why would you publish a obfuscated discord bot to GitHub

dry kelp
#

im not arguing at all

slate swan
dry kelp
#

they are just acting dumb

slate swan
#

wait

dry kelp
slate swan
#

Oh God

slate swan
#

guys, chill
lets talk about how smart and cool sir okimii is

final iron
#

πŸƒβ€β™‚οΈ

slate swan
#

yes thank you

maiden fable
#

Why do i always come at the wrong time

slate swan
#

and yes hunter with the !ot

slate swan
slate swan
keen talon
slate swan
slate swan
#

!ot

maiden fable
#

Do u know, RPing is allowed, but only in OT channels???

dry kelp
#

this shit gone way too far

slate swan
maiden fable
#

It gets weird fast @dry kelp

#

Am used to it, sooo

final iron
#

!ot

dry kelp
#

it really does

maiden fable
#

Seriously guys, please go to an OT channel if u wanna RP lol

slate swan
maiden fable
slate swan
maiden fable
slate swan
#

we all make discord bots what isnt weird about uspithink

dry kelp
slate swan
#

um , im out
bye

slate swan
dry kelp
#

that's true

#

ion think anyone laughs tbh

maiden fable
dry kelp
slim ibex
#

you real funny @dry kelp

keen talon
dry kelp
#

i felt like she called me weird

slate swan
#

we make discord bots for a living

slim ibex
#

especially people who like ruby

slate swan
#

😭

keen talon
maiden fable
#

Okay, seriously this just went South. Just take this to an OT channel or am pinging the mods

slim ibex
#

cough

dry kelp
#

😭

slate swan
slim ibex
#

LMAO

slate swan
#

😠

slate swan
slim ibex
#

SQL > all prove me wrong

slate swan
#

no its assembly

slate swan
dry kelp
#

will this return stop the error caused by the asset if it was not found?

slate swan
keen talon
slate swan
dry kelp
#

awesome

dry kelp
#

so it's good

slate swan
#

you can have multiple listeners for each purpose ( icon and banner ) different so that if any error happens with one of them the other still executes

dry kelp
#

i didn't know that u could call the same event twice in different files

maiden fable
#

U can call in the same file too

slate swan
#

you surely can do that with listeners , but not event.

maiden fable
#

Facts

maiden fable
#

I don't know why the event deco even exists

slate swan
#

fax

#

to confuse ppl

#

listeners > events

#

thats why people worship me i only speak faxspithink

maiden fable
slate swan
maiden fable
slate swan
#

d!ont

slate swan
keen talon
slate swan
dry kelp
#

tested it

#

icon works

wind cargo
#

#aoc-bot-commands

dry kelp
#
            before_banner = await before.banner.read()
            if before.banner:
                if before.banner != after.banner:
                    await after.ban(i.user, reason="Anti-Nuke: Changing Guild Banner")
                    await after.edit(banner=before_banner)
            else:
                return

            if before.banner == None and after.banner:
                await after.ban(i.user, reason="Anti-Nuke: Changing Guild Banner")
                await after.edit(banner=None)
#

gotta test this but idk where 😭

maiden fable
#

What u even doing...

dreamy sluice
#

How do I assign name of multiple buttons in accordance to a list? (Nextcord)

maiden fable
#

custom_id

dreamy sluice
#

O-o

dry kelp
dreamy sluice
#

How do I do that?

maiden fable
#

!d nextcord.ui.Button.custom_id

unkempt canyonBOT
#

property custom_id: Optional[str]```
The ID of the button that gets received during an interaction.

If this button is for a URL, it does not have a custom ID.
maiden fable
dry kelp
#

antinuke checks

maiden fable
#

BTW you know... member.banner also returns their global banner in case they don't have a guild banner...

dry kelp
#

member?

maiden fable
#

!d discord.Member.banner

unkempt canyonBOT
#

property banner```
Equivalent to [`User.banner`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.banner "discord.User.banner")
dreamy sluice
dry kelp
#

how is before.banner going to trigger the member?

#

before = guild

#

after = guild

maiden fable
#

Oh wait

#

I thought u were doing in on_member_update

dry kelp
#

nope

maiden fable
#

Rip sorry

slate swan
# dry kelp

you should use is to compare with None and not operators and pep8 is screaming

dry kelp
#

all g

maiden fable
unkempt canyonBOT
#

@maiden fable :white_check_mark: Your eval job has completed with return code 0.

RIP, No Banner
dry kelp
dreamy sluice
dry kelp
#

why tf im leaking my commands 😭

maiden fable
vale wing
#

Local error handler 9839megaflushed

dreamy sluice
#

hmmm

maiden fable
slate swan
vale wing
#

@dreamy sluice you mean parse a list to a command?

maiden fable
dreamy sluice
#

I am trying to add buttons with nextcord,

slate swan
dreamy sluice
#

and I want to make the labels of the different buttons to be according to a list I will pass to the instance

maiden fable
dry kelp
#

it's good wys

vale wing
#

Not sure how are views done in nextcord

dreamy sluice
slate swan
#

uhuh

maiden fable
#

@dreamy sluice mind showing an example???

vale wing
#

Just iterate through the list of label names and add items to the view perhaps?

dreamy sluice
#

One second

dreamy sluice
#

lemme show my code

vale wing
#

Alright

dreamy sluice
#
#buttons
class Work1(nextcord.ui.View):
  def __init__(self):
    super().__init__(timeout=15)
    self.list = []
  
  #["bricks", "buildings", "cement", 'tools']

  @nextcord.ui.button(label="Bricks", style=nextcord.ButtonStyle.blue)
  async def one(self, button:nextcord.ui.Button, interaction: nextcord.Interaction):
    self.list.append("bricks")
    self.stop()

  @nextcord.ui.button(label="Buildings", style=nextcord.ButtonStyle.blue)
  async def two(self, button:nextcord.ui.Button, interaction: nextcord.Interaction):
    self.list.append("buildings")
    self.stop()

  @nextcord.ui.button(label="Cement", style=nextcord.ButtonStyle.blue)
  async def three(self, button:nextcord.ui.Button, interaction: nextcord.Interaction):
    self.list.append("cement")
    self.stop()

  @nextcord.ui.button(label="Tools", style=nextcord.ButtonStyle.blue)
  async def four(self, button:nextcord.ui.Button, interaction: nextcord.Interaction):
    self.list.append("tools")
    self.stop()
#

Ok so, there are 4 buttons

vale wing
#

Ok so you are subclassing

dreamy sluice
#

Ye

slate swan
#

you know self.add_item exists too?

vale wing
#

And you want to make a view that you would parse the list of labels to right?

maiden fable
#

!d nextcord.ui.View.add_item

unkempt canyonBOT
dreamy sluice
#

That's a thing?

dry kelp
slate swan
#

always had been

maiden fable
#

No Yes

dry kelp
#

@slate swan

#

u left before seeing my message

maiden fable
#

Rip

slate swan
maiden fable
#

oki ignoring

slate swan
maiden fable
#

Let's ignore oki

dreamy sluice
#

How do I use it?

slate swan
slate swan
maiden fable
#

Who pinged me

slate swan
slate swan
dreamy sluice
slate swan
#

with the kwargs in the button ofc

maiden fable
#

Would love to see when they copy paste that in the code ngl

dreamy sluice
#

So View is the class instance?

maiden fable
#

No

slate swan
vale wing
#

It is better to subclass the Button and overwrite the callback inside of it

slate swan
dreamy sluice
#

okeh

vale wing
#

Rather than just parsing raw class instance with no callback

maiden fable
dreamy sluice
#

what is callback?

vale wing
#

A function that gets called on interaction with an element

maiden fable
#

!d nextcord.ui.Button.callback

unkempt canyonBOT
#

await callback(interaction)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

The callback associated with this UI item.

This can be overridden by subclasses.
maiden fable
#

Every button type except link buttons have those

vale wing
maiden fable
#

Now you know (:

dreamy sluice
#

O-o

karmic lintel
#

whenever i type my bot returns id of message not the content what to do?

vale wing
#

Return the message.content lol?

karmic lintel
dreamy sluice
maiden fable
#

Yea, replace the ... with the params like custom id, style etc

dreamy sluice
#

okeh

#

thanks, how do I add the executing statements tho?

vale wing
#

But idk about nextcord

slate swan
maiden fable
slate swan
#

!d discord.ui.Button.callback

unkempt canyonBOT
#

await callback(interaction)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

The callback associated with this UI item.

This can be overriden by subclasses.
vale wing
unkempt canyonBOT
#

class disnake.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.

New in version 2.0.
maiden fable
vale wing
#

There's no such param

#

I am talking about param in constructor MCK_neutralface

slate swan
maiden fable
#

!d nextcord.ui.Button

unkempt canyonBOT
#

class nextcord.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.

New in version 2.0.
vale wing
maiden fable
#

@vale wing same with nextcord (:

#

Ah I see

slate swan
#

iirc

maiden fable
vale wing
#

Since there's no such param you can't just add

Button(..., callback=some_func)```
vale wing
slate swan
#

ah you meant that

vale wing
#

Yeah

#

So gotta do a subclass

maiden fable
#

@vale wing

unkempt canyonBOT
#

discord/ui/item.py line 119

async def callback(self, interaction: Interaction):```
maiden fable
#

Wait nvm

#

You are correct lol

final iron
#

dead chat

slate swan
#

its my bdayπŸ₯³

royal oar
#

I wanna make a command say when i right a message it will save it to the json file, And a command will send the message from the json file to a specific channel, And then i wanna update it so it will delete the old message and replace it with a new one, Does anyone have any ideas on how yo go about this?

royal oar
slate swan
royal oar
#

all good

slate swan
slate swan
#

!d discord.TextChannel.fetch_message

unkempt canyonBOT
#

await fetch_message(id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

Retrieves a single [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") from the destination.
slate swan
#

im going to go to sleep gn guys have a good day or night pithink

graceful mulch
#

hi

pine crown
#

why is slash commands not appearing

slate swan
#

it takes 1 hr to appear

#

if global

pine crown
slate swan
#

show your code

pine crown
#

ok

#

like the whole code?

pine crown
slate swan
#

atleast the part where you make the slash

#

also, what library are you using , if its something like discord-py-slash-commands you really should not

pine crown
#

ill send the hole code

slate swan
#

dont use all those 3rd party libraries

#

just use a fork like disnake or nextcord

pine crown
#

well but if i use disnake its like messing up my buttons code

#

and nobody explains clearly to me how to make the button with disnake

slate swan
#

uh?

#

How do I have more than 1 optional parameter?

#

dont use any of the 3rd party libraries

#

forks give all of that already

pine crown
#

Buttons

slate swan
slate swan
unkempt canyonBOT
#

class disnake.ui.Button(*, style=<ButtonStyle.secondary: 2>, label=None, disabled=False, custom_id=None, url=None, emoji=None, row=None)```
Represents a UI button.

New in version 2.0.
slate swan
#

it already has it , dont use 3 rd party libraries

pine crown
#

Butts

#

ok

#

But

#

ts

pine crown
oak warren
#

see examples

#

i guess

slate swan
#

^^^

pine crown
#

ok

royal oar
royal oar
#

I want so say i do !announce it saves the message in a json file, it then when someone uses my bot by saying !alert it will send the message from the announce command

pine crown
royal oar
#

i made it sound so confusing

slate swan
#

you dont need to import anything

pine crown
slate swan
#

disnake.ui.Button , just import disnake

pine crown
pine crown
slate swan
#

uh?

slate swan
#

you dont make classes like that bruh

#
class disnake.ui.Button()
``` ![mehh](https://cdn.discordapp.com/emojis/916940053131968552.webp?size=128 "mehh")
#

check examples

slate swan
slate swan
#

Lol

slate swan
#

like the cogs , bot ( if you subclass it to be cool ) , views etc all needs knowledge about classes

#

Yeah yeah

soft juniper
#

.

slate swan
#

Everything new in forks or 2.0, you mean?

#

exactly lol

brazen raft
loud marsh
loud marsh
#

Why no print in same line

slate swan
loud marsh
#

It needs to print in a different line

brazen raft
slate swan
slate swan
loud marsh
#

What?

loud marsh
#

Why?

slate swan
loud marsh
#

Ok am smart and this question is not simple fuck you

slate swan
#

For your lovely words

#

Is it just me or people are getting more toxic day by day

#

;-;

sage otter
#

Line breaks is one of the first things you learn when doing python.

loud marsh
#

Ok thats why am asking for help

forest beacon
#

Trying to make a bot that prints a confirmation string every two seconds. What am I doing wrong?

@tasks.loop(seconds=2)
async def foo():
    print(β€œloop print”)```
sage otter
#

Consider looking into "\n"

royal oar
#

How would i put messages into a Json file? The command can only be used by me but i want it to save the message that comes after

royal oar
slate swan
#

And?

royal oar
#

I mean like i have only ever saved numbers not messages

slate swan
#

Huh

#

Its the same

forest beacon
heavy radish
#
@bot.command()
async def giveaway(ctx, level=None, time=None, winner=int):
  embed  = discord.Embed(title=f"Boosted Miniboss Lvl{level}", description=f"React with πŸŽ‰ to enter! \n Winners: **{winner}** \n Hosted By: {ctx.author.mention} \n Duration: **{time}** ")
  embed.add_field(name="**Extra Entries**", value="The Loyalist - **2x** Entries \n Server Boosters -  **3x** Entries")
  embed.set_thumbnail(url = "https://cdn.discordapp.com/attachments/833178138372472852/845056821110505513/ezgif-2-cb3480aa155f.gif")
  gaw_msg = await ctx.send(embed = embed)
  time_convert = {"s":1, "m":60, "h":3600, "d":86400}
  gawtime = int(time[0]) * time_convert[time[-1]]
  
  await gaw_msg.add_reaction("πŸŽ‰")
  await asyncio.sleep(gawtime)

  new_gaw_msg = await ctx.channel.fetch_message(gaw_msg.id)

  users = await new_gaw_msg.reactions[0].users().flatten()
  users.pop(users.index(bot.user))

  winner = random.choice(users)

  await ctx.send(f"Congrats to {winner.mention} πŸŽ‰")
``` Why am I getting rate limited?
slate swan
#

sleep

heavy radish
#

Sleep?

heavy radish
#

yes

slate swan
# heavy radish Sleep?

using sleep for a giveaway command is very bad and unreliable
for some reason if the bot disconnects it wont continue the task

forest beacon
#

Api is using seconds for task.loop. Can I use minutes or hours? Or do o have to convert them. Wanting to send Covid information hourly to server s

slate swan
#

and by sleep i mean asyncio.sleep

slate swan
heavy radish
#

What other way is there? All videos say to use asyncio.sleep

forest beacon
#

Sweet.

#

I really want to just rewrite the discord.py documentation but with examples for everything.

heavy radish
#

Lmao

forest beacon
#

That’s part of what’s stopping me. The other part is I don’t know all of the api to do that lol

slate swan
heavy radish
slate swan
forest beacon
slate swan
#

thats what a tutorial means

slate swan
heavy radish
#

Hmm

heavy radish
slate swan
heavy radish
#

Its for a custom purpose

slate swan
#

uhuh

heavy radish
#

Its for a bot. I need to reply of the GA to be specific

heavy radish
# slate swan uhuh

The BOT (Not mine) has a command for miniboss. It requires 10 people including hosts. When high leveled host want to pick people, they start a ga to make it fair for everyone

slate swan
#

I never asked for that explanation-

heavy radish
royal oar
#

Im trying to save the message to be saved but im getting an error i dont understand?

@commands.command()
    @commands.is_owner()
    async def save(self,msg:str):
        if msg.author == self.bot.user:
            return
        with open("C:/Users/OzLaptops/OneDrive/Desktop/TTS python/cogs/news.json") as f:
            users = json.load(f)
        users[str(msg.author.id)]['message'] = msg
        with open('C:/Users/OzLaptops/OneDrive/Desktop/TTS python/cogs/news.json', 'w') as f:
            json.dump(users, f)

But im getting this error?
TypeError: Object of type Context is not JSON serializable

slate swan
heavy radish
#

Damn

slate swan
slate swan
#

Uhuh, then

royal oar
#

indeed

royal oar
slate swan
slate swan
slate swan
#

;-;

slate swan
royal oar
#

it worked before

boreal ravine
#

bruh

#

use the path of the file

royal oar
#

now

boreal ravine
#

only use the name if the file your editing is in the same directory as the other file

slate swan
#

Thats what I meant ;-;

#

Anyways, I'm out

royal oar
#

k

royal oar
slate swan
slate swan
#

and you cant dump it into a json!

#

time to rewrite my bot for the 4th time

#

mehh wish me luck

slate swan
slate swan
slate swan
#

Only 4th? πŸ˜„

slate swan
slate swan
#

Lmao

slate swan
slate swan
#

i feel like my code gets boring with time

slate swan
slate swan
slate swan
#

ive been doing this for like 1.7 yrs now

#

oldest application

slate swan
slate swan
#

cannot be me

#

Lol

maiden fable
slate swan
#

Lmao

#

well , it got flagged since it was added on top.gg and added to many sneaky servers

#

Lol

slate swan
#

hunter the "great" pepe_blush

slate swan
#

yes

maiden fable
slate swan
unkempt canyonBOT
maiden fable
#

Lol

slate swan
pine crown
#

how to send a url button with disnake

velvet tinsel
#

pithink whats going on

maiden fable
unkempt canyonBOT
maiden fable
velvet tinsel
#

nice

slate swan
#

cause hunter is cool

#

same , i just worded it differently

slate swan
#

.topic

lament depotBOT
#
**What feature would you like to see added to the library? What feature in the library do you think is redundant?**

Suggest more topics here!

slate swan
#

if its about hikari i'd love to see discord.py like views

velvet tinsel
#

r/holup

slate swan
#

this channel is dedicated to ot convo

velvet tinsel
slate swan
#

given the nature of people from the dpy server, i'm not surprised

cerulean quest
#

can somone please help im trying to make my bot say a joke, and i want it to pick 1 out of the 10 jokes but idk how to add it. can somone please help

slate swan
#

i was banned for immaturity too, that should say something about most of us

velvet tinsel
velvet tinsel
velvet tinsel
wary ice
cerulean quest
slate swan
#

put the 10 jokes inside a list (as a string each) and then use the .choice() function from the random module

#

^^

unkempt canyonBOT
#

random.choice(seq)```
Return a random element from the non-empty sequence *seq*. If *seq* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError "IndexError").
velvet tinsel
#

pithink huh, can you iterate through a str? they didn't typehint anything

slate swan
#
import random

jokes = ['you suck', 'u have big fat nose']

random.choice(jokes)  # picks random one
slate swan
slate swan
velvet tinsel
#

shit

slate swan
#

what

#

Cute

velvet tinsel
#

!e

import random

print(random.choice("helloooo"))
unkempt canyonBOT
#

@velvet tinsel :white_check_mark: Your eval job has completed with return code 0.

o
slate swan
#

Β―_(ツ)_/Β―

velvet tinsel
#

nice

#

I didn't know that

pine crown
#

why i get this eror

slate swan
#

oh

#

anything which can be indexed is an iterable

velvet tinsel
#

I learn more here than the shit I learn in school

slate swan
slate swan
#

Lmao

#

capital

pine crown
#
class Button(disnake.ui.view):
    def __init__(self):
        super().__init__()

        self.choice = None

    @disnake.ui.button(label="hi", style=disnake.Color.blurple)
    async def hi(self, button: disnake.Button, inter: disnake.MessageInteraction):
        self.choice = True

        self.stop()

    @disnake.ui.button(label='bye', style=disnake.ButtonStyle.red)
    async def bye(self, button: disnake.Button, inter: disnake.MessageInteraction):
        self.choice = False
        self.stop()


@client.command()
async def test(ctx):
    start = disnake.Embed(
        description="Click a button below!",
        color = disnake.Color.blurple()
    )

    button = Button()

    await ctx.send(embed=start, view=button)

    await button.wait()

    if button.choice:
        hi = disnake.Embed(
            description="Hello",
            color=disnake.Color.blurple()
        )
    
        await ctx.edit_original_message(embed=hi, view=None)

    elif not button.choice:
        bye = disnake.Embed(
            description="Bye",
            color=disnake.Color.red()
        )

        await ctx.edit_original_message(embed=bye, view=None)

thats the code

slate swan
#

a string is just a sequence of individual strings (kind of)

cerulean quest
#
jokes = ["what did the cat say to the dog?", "why was the big tiger hungry?", "what do you call two bannana peels?"]
slate swan
#

lol i just realized my "jokes" were just a couple of insults

#

jokes = ['my life' , 'my life again']

velvet tinsel
slate swan
#

;-;

slate swan
velvet tinsel
#

I got a good joke

slate swan
pine crown
#

why i get this error

velvet tinsel
#

m....my life

slate swan
slate swan
pine crown
#

!e

pip install disnake
unkempt canyonBOT
#

@pine crown :x: Your eval job has completed with return code 1.

001 |   File "<string>", line 1
002 |     pip install disnake
003 |         ^^^^^^^
004 | SyntaxError: invalid syntax
pine crown
#

how to send url button with disnake

slate swan
slate swan
cerulean quest
#
jokes = ["what did the cat say to the dog?", "why was the big tiger hungry?", "what do you call two bannana peels?"]
pine crown
#

how to send url button with disnake

#

how to send url button with disnake

#

how to send url button with disnake

cerulean quest
#

i have it imported

slate swan
pine crown
#

how to send url button with disnake ):

#

😭

#

😒

slate swan
slate swan
slate swan
#

b is being printed as None , without any errors

#

and if it dont supply any of them

pine crown
unkempt canyonBOT
#

@slate swan :white_check_mark: Your eval job has completed with return code 0.

None None
slate swan
#

both are None

pine crown
#

!e
p

slate swan
#

Oh wow! Thanks!

slate swan
#

!d disnake.ButtonStyle.url

unkempt canyonBOT
pine crown
#

!e
print("why did the chicken cross the road?")
answer = "to get to the other side"
print(answer)

unkempt canyonBOT
#

@pine crown :white_check_mark: Your eval job has completed with return code 0.

001 | why did the chicken cross the road?
002 | to get to the other side
pine crown
#

!e
e= (input("[answer]: "))

unkempt canyonBOT
#

@pine crown :x: Your eval job has completed with return code 1.

001 | [answer]: Traceback (most recent call last):
002 |   File "<string>", line 1, in <module>
003 | EOFError: EOF when reading a line
quick gust
#

#bot-commands please

pine crown
#

cuz i copied the example from the disnake github and

#

its like not work

slate swan
#

show your code

pine crown
#
class Google(disnake.ui.View):
    def __init__(self, query: str):
        super().__init__()
        # we need to quote the query string to make a valid url. Discord will raise an error if it isn't valid.
        query = quote_plus(query)
        url = f"https://www.google.com/search?q={query}"

        # Link buttons cannot be made with the decorator
        # Therefore we have to manually create one.
        # We add the quoted url to the button, and add the button to the view.
        self.add_item(disnake.ui.Button(label="Click Here", url=url))




@bot.command()
async def google(ctx: commands.Context, *, query: str):
    """Returns a google link for a query"""
    await ctx.send(f"Google Result for: `{query}`", view=Google(query))
slate swan
#

add type = disnake.ButtonStyle.url in the Button

slate swan
#
    @commands.is_owner()
    ^
IndentationError: unexpected unindent```
#

anyone?

unkempt canyonBOT
#

Indentation

Indentation is leading whitespace (spaces and tabs) at the beginning of a line of code. In the case of Python, they are used to determine the grouping of statements.

Spaces should be preferred over tabs. To be clear, this is in reference to the character itself, not the keys on a keyboard. Your editor/IDE should be configured to insert spaces when the TAB key is pressed. The amount of spaces should be a multiple of 4, except optionally in the case of continuation lines.

Example

def foo():
    bar = 'baz'  # indented one level
    if bar == 'baz':
        print('ham')  # indented two levels
    return bar  # indented one level

The first line is not indented. The next two lines are indented to be inside of the function definition. They will only run when the function is called. The fourth line is indented to be inside the if statement, and will only run if the if statement evaluates to True. The fifth and last line is like the 2nd and 3rd and will always run when the function is called. It effectively closes the if statement above as no more lines can be inside the if statement below that line.

Indentation is used after:
1. Compound statements (eg. if, while, for, try, with, def, class, and their counterparts)
2. Continuation lines

More Info
1. Indentation style guide
2. Tabs or Spaces?
3. Official docs on indentation

cerulean quest
#

can i use colorama to give my discord bot colored text?

oblique cobalt
cerulean quest
#

macOS

oblique cobalt
#

i dont know if macOS has ansi injected by default

#

but if you use colorama, it'll inject it itself

#

so you can use colorama, it works too

cerulean quest
#

alright

oblique cobalt
#

what you mean with colored text ?

#

colored text in console or sending colored text in messages?

cerulean quest
#

elif user_message.lower() == "!color":
await message.channel.send((Fore.RED + 'some red text'))
return

#

it gives colored text in the console

#

although not in the dc chat

#

is there anyway to add that to discord chat?

vale wing
#

This

slate swan
#

anyone had the error in last line like this ever?

#

appreciate?

#

I mean whats the issue

misty quest
#

How'd you make a bot that streams something (a webpage or something) 24/7 ideally? Through a VPS?

misty quest
#

Accounts? I've seen similar stuff on some servers

slate swan
#

uhuh, try using a try and except and print the exception

slate swan
misty quest
#

I don't think that constitutes a self bot since it'll use default OAuth API if its done through a VPS

slate swan
misty quest
#

no

#

I just want some user to stream 24/7

slate swan
#

if you are looking for a human being then this is not the right channel

misty quest
#

I would be an account, not a bot

misty quest
#

selfbots are only impermissible when it uses api outside of oauth

slate swan
#

lmao

misty quest
#

Automating normal user accounts (generally called "self-bots") outside of the OAuth2/bot API is forbidden, and can result in an account termination if found.

slate swan
misty quest
#

that wouldn't be a self bot

slate swan
#

tysm sarthak

misty quest
#

js

#

If I join a voice chat and decide to screen share for 24/7, that wouldn't be a self bot lol

misty quest
#

ok

slate swan
misty quest
#

Not what I asked tho but ok

slate swan
#

any kind of automation , or something which edits the client is against tos.

misty quest
slate swan
misty quest
#

My guess is that they have some VPS on AWS and just run it 24/7

misty quest
slate swan
#

if you mean youtube together , its a discord feature

slate swan
#

ive never seen any bot doing that

misty quest
#

Check any crypto server, they use accounts not bots

slate swan
tawdry perch
slate swan
#

its exactly not screensharing but uhhhh welp

misty quest
#

what does this share tho?

#

never seen this before, i only know discordtogether

slate swan
misty quest
#

client on 1st deployment

slate swan
#

lmao

#

the activities bot with discordtogether is pretty good

#

written in ts iirc

misty quest
#

ye

slate swan
#

@misty quest what you're trying to do is not legit and we cannot help you as your problem corresponds to rule 5 in #rules

misty quest
#

It is not against TOS to share screen on voice chat

slate swan
slate swan
#

i'd just !rule 5 mehh

slate swan
slate swan
#

but writing a bot the 4th time is more pain

#

rate my imports tho all it actually is import hikari , lightbulb

tawdry perch
slate swan
#

purple vscode theme-

tawdry perch
#

!pypi lightbulb

unkempt canyonBOT
slate swan
tawdry perch
#

hm

#

what is hikari?

slate swan
#

!pypi hikari

unkempt canyonBOT
slate swan
#

!pypi hikari-lightbulb

unkempt canyonBOT
tawdry perch
slate swan
slate swan
pine crown
#

hgow to make url buton with disnake

tawdry perch
#

hikari seems very very very weird

slate swan
slate swan
#

any example how is the being weird?

slate swan
tawdry perch
#

syntax is veryyy weird compared the other libs

slate swan
#

how is that so ?lol

#

yeah its toooooo weird

#

its just not made as a "easy to use api wrapper" thonk

tawdry perch
slate swan
#

the forks? ahem

#

no one ever listens to me
why am I always ignored ;-;

tawdry perch
slate swan
slate swan
#

I wanted you to tell me the exception it provides ;-;

slate swan
# tawdry perch

dont see anything weird here , its just a different implementation which was not copied from discord.py so it feels weird

#

there was nthing?

maiden fable
#

Rip, fork discussion

slate swan
#

funny how people find this ```js
const { Client, Intents } = require('discord.js');
const { token } = require('./config.json');

// Create a new client instance
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });

// When the client is ready, run this code (only once)
client.once('ready', () => {
console.log('Ready!');
});

// Login to Discord with your client's token
client.login(token);``` effective and another python library weird

slate swan
#

yep

maiden fable
#

Thought so

slate swan
#

thats just basic javascript Β―_(ツ)_/Β―

maiden fable
#

Mhm

slate swan
slate swan
#

its just js being js

#

ofcourse , but it does not use naming like on_ready , on_connect etc

slate swan
#

just the function is same

#

for all events

#

maybe

slate swan
#

lmao

slate swan
#

its same as how listeners work

#
@bot.listen(eventclass)
async def my_listener(event):
  ...
pine crown
#

can anyone send the code to make a url button with disnake?

slate swan
#

cof cof someone was rewriting their reaction roles

slate swan
unkempt canyonBOT
slate swan
unkempt canyonBOT
pine crown
slate swan
#

you need to pass it inside the button

slate swan
#

lol

slate swan
slate swan
#

ill do something like carl bot most probably

#

!rr add message-id role-id emoji

#

yeah, this is actually useful

pine crown
slate swan
#

my my

#
@bot.command()
@commands.has_permissions(manage_channels=True)
async def giveaway(ctx):
    # Giveaway command requires the user to have a "Giveaway Host" role to function properly

    # Stores the questions that the bot will ask the user to answer in the channel that the command was made
    # Stores the answers for those questions in a different list
    giveaway_questions = ['Which channel will I host the giveaway in?', 'What is the prize?', 'How long should the giveaway run for (in days)?',]
    giveaway_answers = []

    # Checking to be sure the author is the one who answered and in which channel
    def check(m):
        return m.author == ctx.author and m.channel == ctx.channel
    
    # Askes the questions from the giveaway_questions list 1 by 1
    # Times out if the host doesn't answer within 30 seconds
    for question in giveaway_questions:
        await ctx.send(question)
        try:
            message = await bot.wait_for('message', timeout= 30.0, check= check)
        except asyncio.TimeoutError:
            await ctx.send('You didn\'t answer in time.  Please try again and be sure to send your answer within 30 seconds of the question.')
            return
        else:
            giveaway_answers.append(message.content)

    # Grabbing the channel id from the giveaway_questions list and formatting is properly
    # Displays an exception message if the host fails to mention the channel correctly
    try:
        c_id = int(giveaway_answers[0][2:-1])
    except:
        await ctx.send(f'You failed to mention the channel correctly.  Please do it like this: {ctx.channel.mention}')
        return
    
    # Storing the variables needed to run the rest of the commands
    channel = bot.get_channel(c_id)
    prize = str(giveaway_answers[1])
    time = int(giveaway_answers[2])

    # Sends a message to let the host know that the giveaway was started properly
    await ctx.send(f'The giveaway for {prize} will begin shortly.\nPlease direct your attention to {channel.mention}, this giveaway will end in {time} days')

    # Giveaway embed message
    give = discord.Embed(color = 0x2ecc71)
    give.set_author(name = f'GIVEAWAY TIME!', icon_url = 'https://i.imgur.com/VaX0pfM.png')
    give.add_field(name= f' {prize}!', value = f'React with Γ°ΒŸΒŽΒ‰ to enter!\n Ends in {time} days!', inline = False)
    end = datetime.datetime.utcnow() + datetime.timedelta(days= time)
    give.set_footer(text = f'Hosted By {ctx.author.name}')
    my_message = await channel.send(embed = give)
    
    # Reacts to the message
    await my_message.add_reaction("Γ°ΒŸΒŽΒ‰")
    await asyncio.sleep(time)

    new_message = await channel.fetch_message(my_message.id)

    # Picks a winner
    
    users = await new_message.reactions[0].users().flatten()
    users.pop(users.index(bot.user))
    
     
  winner = random.choice(users)

    # Announces the winner
    winning_announcement = discord.Embed(color = 0xff2424)
    winning_announcement.set_author(name = f'THE GIVEAWAY HAS ENDED!', icon_url= 'https://i.imgur.com/DDric14.png')
    winning_announcement.add_field(name = f'Γ°ΒŸΒŽΒ‰ Prize: {prize}', value = f'ðŸΒ₯Β³ **Winner**: {winner}\n 🎫 **Number of Entrants**: {len(users)}', inline = False)
    winning_announcement.set_footer(text = 'Thanks for entering!')
    await channel.send(embed = winning_announcement)

i get error on last part

#

could have been easier if i had a dashboard , but who learns html

#

any ideas?

slate swan
#

i didn't embed any files iirc

#

what line do you get error at , dont handle the error , and send what you get in console

#

ah right

slate swan
#

whats so hard innit?

pine crown
#

cuz i use

#

disnake

slate swan
#

its for disnake

pine crown
#

it just erros

#

button is not defined

slate swan
#

bro i just mentioned the class

#

you need to use disnake.Button

#

poor Sarthak

pine crown
#

it doesnt work tho

slate swan
slate swan
slate swan
slate swan
slate swan
slate swan
pine crown
slate swan
#

i did it only once

slate swan
slate swan
#

"only"

slate swan
pine crown
#

poop happens

slate swan
#

show your erroring code

#

nvm

#

got it

#

umm what

pine crown
#

i will rest and be back

slate swan
#

just comment it out

#

okay done

#
button = disnake.Button(style=disnake.ButtonStyle.url,label="Invite Bot",url=ctx.bot.invite_url, emoji=":link:"  )``` @pine crown an example ( dont copy it or you'll break your stuff)
#

lemme try running again