#discord-bots
1 messages Β· Page 773 of 1
How many commands do you have
2
even if they have like 50 commands, it wont take more than 1 second to get returned
oh wait
Just taking sure they don't have an absolute fuck ton
imagine not being lazy enough to do that π
does anyone have a server banner where i can test my new antinuke check?
Couldn't you technically have like 10k+ commands if you write to a file in loop?
Server banner, antinuke check
yep
What do those have it do with each other
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
I don't think people will just let you invite you bot
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
Never heard of wick
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
Whats the issue?
r u talkin to me?
Yep
How do I create a list of channel ids from channels: commands.greedy[discord.TextChannel]
I tried but dont really understand 
did i ever said that i have a issue or smth like that?
I just asked, ;-;
my bad
uhuh
does anyone have a server that has a server banner?
ashley do u?
wym
dude ong
Lmao
is just a antinuke check 1 OF THE ANTINUKE CHECKS jesus christ
but you need a server banner?
i mean , noone keeps a test server boosted to level 2
it can be even a main server
who would lol
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
Patience, dear
you can just try the same thing with the server's icon , they work similar π
server icon works
or maybe just dont give any user perms to edit the guildπ§
if it works with icon , would work with banner too
yes pls
idk how the loop would react
then dont give them itπ§
Admins
dude do u even know what's the point of the antinuke?????
dont give them anythingπ§
make everyone a moderator , so everyone follows rules 
Good question
who the heck would nuke a server banner
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
Lmao
who the heck would hire a 12 year old mod
@slate swan server owner
Use the security bot
did i ever say a child?
my guy cant even follow tos LMAO
mine is faster
This discord hired a 13 year old mod
jokes apart ,i've seen people doing that by changing server banners to something "funny"
My My
exactly
Good luck
Yeah but i mean like discord tos
age requirement
Rick @slate swan 
i said "12" as a RANDOM age
isnt it astley?
no its rick and morty
do u really take everything serious?
Cmmon dude

@slate swan
lemme tell u why i wanna test it more exactly
cuz u said that it should work if icon works
im just making sure cause im confused
loop? or the if statement?
it will release a error in that loop
Look, people aren't going to invite your random bot
is a loop if u see the entire code
is not ab the if statement
that works perfectly fine
the bot it's already in some huge servers
but the owners are offline
i wouldn't be here if they were offline tbh
who the heck would add a "antinuke" bot that isnt even verified seems secure doesnt it
bcuz

is not just ab antinuke
did i ever say just antinuke???
u guys are just saying shit without knowing what the bot is capable to do
it it was some opensourced bot it could have maked more sense ( because of transparency)
@slate swan Didn't say it's just antinuke either
you cant even subclass the bot class ok
I don't see why that matters
holy fuck π
You could have anything implemented in that bot
We don't know that
Mee6 is kinda broken rn
I would not add mee6 
Old joke, make a new one, ping me in any ot channel
almost 6 am rn
Could be faked and it doesn't matter
HOW COULD IT BE FAKE
You were chatting at that moment π
jesus fuck
What is the best way to hide source code from people?
keep it on your computer
Don't post the source code
My My, lol sorry
Discord uses electron
yess but if u want to publsh it so people can use it
You can inspect element
π
Create a hidden folder, put a password on it, lmao
dude
who knows a good obf for python?
Obf?
You don't have to
obf lmao what
Obfuscator
yes
oh ok
obf\
still does anyone have a server with a server banner where i can test the antinuke check?
Too smart
sketchy
legit
maybe ask a friend but i doubt a server owner would let you
uhuh, go sleep, dont cry
they will ... they are just offline
then wait
blonde girls joke
Ouch
i just can't lol
then don't do dum jokes
We are reaching smartness levels tht shouldn't even be possible

Then wait...
so childish
never seen someone wanna push to github so bad
That's not how we treat others here
I-
I never made a joke, wtf
@dry kelp if could be better if you may wait for some time instead of arguing with people here
JUST WAIT jeez
Yep
Why would you publish a obfuscated discord bot to GitHub
im not arguing at all
they are just acting dumb
wait
blonde girls jokes π€·ββοΈ
Oh God
guys, chill
lets talk about how smart and cool sir okimii is
oh gosh no'
No
πββοΈ
yes thank you
Why do i always come at the wrong time
and yes hunter with the !ot
yes pls
Okimii Worshipper
Cause u hunt too much

indeed , he's a god
Do u know, RPing is allowed, but only in OT channels???

!ot
it really does
Seriously guys, please go to an OT channel if u wanna RP lol
What do you expect from weird people
Idk. I don't expect anything from myself
thats what im saying , from a code test to figuring out things about a bot
Role Playing
we all make discord bots what isnt weird about us
oh so blonde girls jokes getting even worse?
um , im out
bye

Wtf stop
Don't start with this please
it's just pissing me off
you real funny @dry kelp

i felt like she called me weird
everyone is weird here
we make discord bots for a living
especially people who like ruby
π

Okay, seriously this just went South. Just take this to an OT channel or am pinging the mods
cough
π
TAKE THAT BACK NOW
LMAO
π
c# 
SQL > all prove me wrong
no its assembly
yes
will this return stop the error caused by the asset if it was not found?

yea , if that statement is not true the function wont execute further
awesome
it doesn't have to execute further
so it's good
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
i didn't know that u could call the same event twice in different files
U can call in the same file too
you surely can do that with listeners , but not event.
Facts
I don't know why the event deco even exists
fax
to confuse ppl
listeners > events
thats why people worship me i only speak faxs
And then bully them in the discord.py server
+1 lmfao
DON'T start with it again
π³


#aoc-bot-commands
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 π
What u even doing...
How do I assign name of multiple buttons in accordance to a list? (Nextcord)
custom_id
O-o
me?
How do I do that?
!d nextcord.ui.Button.custom_id
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.
Mhm
BTW you know... member.banner also returns their global banner in case they don't have a guild banner...
member?
!d discord.Member.banner
property banner```
Equivalent to [`User.banner`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.banner "discord.User.banner")
How do I pass in list elements?
nope
Rip sorry
you should use is to compare with None and not operators and pep8 is screaming
all g
!e
banner = None
if not banner:
print("RIP, No Banner")
@maiden fable :white_check_mark: Your eval job has completed with return code 0.
RIP, No Banner
^
why tf im leaking my commands π
For loop, ig?
Local error handler 
no i ment
if a == None:
just do
if not a:
or
if a is None:
wym
@dreamy sluice you mean parse a list to a command?
No like
For the second one, it should be not a
I am trying to add buttons with nextcord,
oh yeah
and I want to make the labels of the different buttons to be according to a list I will pass to the instance
I meant, file organization
it's good wys
List indices?
Not sure how are views done in nextcord
No
uhuh
@dreamy sluice mind showing an example???
Just iterate through the list of label names and add items to the view perhaps?
One second
Don't think that'll work
lemme show my code
Alright
#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
Ok so you are subclassing
Ye
you know self.add_item exists too?
And you want to make a view that you would parse the list of labels to right?
!d nextcord.ui.View.add_item
add_item(item)```
Adds an item to the view.
always had been
No Yes
Rip
i mean personal prefrence lol
oki ignoring
sorry
Let's ignore oki
How do I use it?
π§βπ¦―
who that
Who pinged me
very funny
:o
with the kwargs in the button ofc
self.add_item*
Would love to see when they copy paste that in the code ngl
So View is the class instance?
No
i wrote View and i meant the class by that ;)
It is better to subclass the Button and overwrite the callback inside of it
for u , its self
okeh
Rather than just parsing raw class instance with no callback
Or just do
async def callback(...):
# Some Stuff
# in a View class
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.add_item(Button(..., callback=callback)
what is callback?
A function that gets called on interaction with an element
!d nextcord.ui.Button.callback
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.
Every button type except link buttons have those
Does that param exist
I didn't know
Now you know (:
O-o
whenever i type my bot returns id of message not the content what to do?
Return the message.content lol?
message.content
nice ty
and here, I can just add the button parameters?
Yea, replace the ... with the params like custom id, style etc
Well seems like it doesn't exist in disnake
But idk about nextcord
wdym , it does
Bro, buttons are available from discord.py 2.0
!d discord.ui.Button.callback
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.
!d disnake.ui.Button
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.

^^
its a method , not a parameter
!d nextcord.ui.Button
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.
And here he uses it as a param
What? Lol
Since there's no such param you can't just add
Button(..., callback=some_func)```
I am not talking about this lol
ah you meant that
@vale wing
https://github.com/Rapptz/discord.py/blob/master/discord/ui/item.py#L119
Button is a subclass of Item
discord/ui/item.py line 119
async def callback(self, interaction: Interaction):```
dead chat
its my bdayπ₯³
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?
happy birthday
thank you!
all good
happy birthday okimii ,
hope you become more smarter
thank you
fetch the message and use .delete() to delete it , for that you would need to save the channel as well as the message's id
!d discord.TextChannel.fetch_message
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.
im going to go to sleep gn guys have a good day or night 
hi
why is slash commands not appearing
show your code
?
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
ill send the hole code
its discord_slash the library
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
uh?
How do I have more than 1 optional parameter?
dont use any of the 3rd party libraries
forks give all of that already
are you using the optional typing ? or parameter = None
!d disnake.ui.Button
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.
it already has it , dont use 3 rd party libraries
how to make slash command with disnake
see examples
i guess
^^^
ok
Can someone pls help me make this im completely lostπ
wat u mean "right"
write*
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
whta the import for thsat
i made it sound so confusing
you dont need to import anything
well it errors at
disnake.ui.Button , just import disnake
its eror
uh?
Look at some examples first-
you dont make classes like that bruh
class disnake.ui.Button()
``` 
check examples
^^^
And learn OOP?
i feel like screaming hard
Lol
indeed , if youre making a discord bots its one of the requirements
like the cogs , bot ( if you subclass it to be cool ) , views etc all needs knowledge about classes
Yeah yeah
.
Another requirement is asynchronous programming knowledge
Guys
very cool
Why no print in same line
mhm , i just stated one of them
It needs to print in a different line
Me too
i do that only because i want to add dozens of properites to the bot object , and global checks
End argument
What?
Big brain people. Amen
Why?
This is not the appropriate channel, go to #python-discussion for simple questions
Ok am smart and this question is not simple fuck you
You too, tysm
For your lovely words
Is it just me or people are getting more toxic day by day
;-;
It is simple. You just donβt know python.
Line breaks is one of the first things you learn when doing python.
Ok thats why am asking for help
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β)```
In the wrong channel.
Consider looking into "\n"
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
Start the task loop
Use the json mosdule
I have that
And?
I mean like i have only ever saved numbers not messages
Thanks. The api is using classes and im coding in a module level. Definitely did not look at the init
Aw, its fine, welcome
@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?
sleep
Sleep?
replit?
yes
using sleep for a giveaway command is very bad and unreliable
for some reason if the bot disconnects it wont continue the task
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
and by sleep i mean asyncio.sleep
use kill 1 in shell and rerun your repl
What other way is there? All videos say to use asyncio.sleep
you can use minutes and hours
Sweet.
I really want to just rewrite the discord.py documentation but with examples for everything.
Lmao
You cant
Not all alone
Thatβs part of whatβs stopping me. The other part is I donβt know all of the api to do that lol
oof
you probably are watching the bad ones ,
you should use a database or something which saves datetimes of when a giveaway ends along with a task
What about downtime issues-
print("loop print")
Offt. All videos used asyncio
@slate swan figured it out already
?
they are just an example ...
thats what a tutorial means
uhuh, I'm just too dumb
Hmm
It wont be a problem. Max a GA happens is 1min
;-; whats the point of making it then
Its for a custom purpose
uhuh
Its for a bot. I need to reply of the GA to be specific
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
I never asked for that explanation-
IDK the uhuh sounded questionable
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
uhuh means okay, ||for me||
Damn
First of all, you dont need the full path if the json files are in the same dir
i get an error usually
Uhuh, then
indeed
FileNotFoundError: [Errno 2] No such file or directory: 'news.json'
Screenshot the dir pwease
You cant see the error?
There's no point, no one reads their errors or is willing to
;-;
with open(r"C:Users/your_path_to_file/file json")
i did that ashley told me to use the name of file
it worked before
Nvm
only use the name if the file your editing is in the same directory as the other file
k
but can someone pls help me with this error?
the msg parameter is the Context argument currently
bro u miss the ctx arg
^^
and you cant dump it into a json!

time to rewrite my bot for the 4th time
wish me luck
4th?
yes
bot in a single file -> shifted to cogs -> disnake for slash/buttons -> hikari
Havent you gone mad doing all that
Lmao
thats the open source part
well , yes but i love doing that
i feel like my code gets boring with time
You want to keep it "interesting"?
more like up-to-date
uhuh
ive been doing this for like 1.7 yrs now
oldest application
My My
Totally @slate swan
Lmao
well , it got flagged since it was added on top.gg and added to many sneaky servers
Lol
Hunter
yes
Hunter The "Loser"
!ot revenge
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
Lol

how to send a url button with disnake
whats going on
!d disnake.ButtonStyle.link
Represents a link button.
Same usual shit
nice
Suggest more topics here!
π which library though? lol
if its about hikari i'd love to see discord.py like views
r/holup
I was quoting it in Sarthak's words, not mine lmao
this channel is dedicated to ot convo
bro you should have seen what it was like before - this place was a warzone and it was locked 3 days in a row
Lmao fr?
given the nature of people from the dpy server, i'm not surprised
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
i was banned for immaturity too, that should say something about most of us
yeah π¬ after that this place fell apart
Random module's choice method
I touched a nerve on danny, I think I upset him
My My
random.choice()
most of the OGs who used to be helping here a lot left to do other stuff
why
ye but want function do i call?
uhuh
put the 10 jokes inside a list (as a string each) and then use the .choice() function from the random module
^^
!d random.choice
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").
oooh ok! π
huh, can you iterate through a str? they didn't typehint anything
import random
jokes = ['you suck', 'u have big fat nose']
random.choice(jokes) # picks random one
I doubt this command's existence everytime for no reason lmao
a str object is an iterable, so yes
import random
print(random.choice("helloooo"))
shit
!e
import random
print(random.choice("helloooo"))
@velvet tinsel :white_check_mark: Your eval job has completed with return code 0.
o
why i get this eror
I learn more here than the shit I learn in school
Hard luck
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
a string is just a sequence of individual strings (kind of)
jokes = ["what did the cat say to the dog?", "why was the big tiger hungry?", "what do you call two bannana peels?"]
lol i just realized my "jokes" were just a couple of insults
jokes = ['my life' , 'my life again']
lol
LMAO
Jokes are supposed to have a meaning
;-;
dont roast me pls
I got a good joke
Welp
why i get this error
m....my life
I'm weird and crazy and possibly a psycho, welp
ok
uhuh, tru tru
!e
pip install disnake
@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
how to send url button with disnake
Parameter = None
so it would be like ```py
def function(parameter1=None , parameter2=None):
jokes = ["what did the cat say to the dog?", "why was the big tiger hungry?", "what do you call two bannana peels?"]
how to send url button with disnake
how to send url button with disnake
how to send url button with disnake
@slate swan this is my example list. how would i add jokes using the random module?
i have it imported
Can you have 2 of them as None? iirc that doesnt work right?
stop spamming and maybe ask in their support?
!e ```py
def check(a = None , b=None):
print(a, b)
check()
ok
@slate swan :white_check_mark: Your eval job has completed with return code 0.
None None
both are None
!e
p
Oh wow! Thanks!
type kwarg in Button
!d disnake.ButtonStyle.url
!e
print("why did the chicken cross the road?")
answer = "to get to the other side"
print(answer)
@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
!e
e= (input("[answer]: "))
@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
#bot-commands please
can u send code for it
cuz i copied the example from the disnake github and
its like not work
show your code
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))
add type = disnake.ButtonStyle.url in the Button
Read the error
!indents
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
can i use colorama to give my discord bot colored text?
yeah, you can also build your own color library with ANSI escape sequences without colorama (that is if you are on windows 10+)
macOS
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
alright
wait
what you mean with colored text ?
colored text in console or sending colored text in messages?
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?
This
anyone had the error in last line like this ever?
appreciate?
I mean whats the issue
How'd you make a bot that streams something (a webpage or something) 24/7 ideally? Through a VPS?
bots cant screenshare
Accounts? I've seen similar stuff on some servers
uhuh, try using a try and except and print the exception
self-bots break discord's TOS
I don't think that constitutes a self bot since it'll use default OAuth API if its done through a VPS
you want to add a bot to a user account, right?
bots cant screenshare ;-;
if you are looking for a human being then this is not the right channel
I would be an account, not a bot
selfbots are only impermissible when it uses api outside of oauth
lmao
idk, i'm out
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.
self bots are no way allowed to use
that wouldn't be a self bot
tysm sarthak
js
If I join a voice chat and decide to screen share for 24/7, that wouldn't be a self bot lol
ok
but we dont give human beings here for free ;-;
Not what I asked tho but ok
any kind of automation , or something which edits the client is against tos.
It doesn't edit anything, I've seen identical stuff in servers that partner with Discord π
there's a bot that can screenshare
My guess is that they have some VPS on AWS and just run it 24/7
nah mate it was an account
if you mean youtube together , its a discord feature
no comments then, go ahead and make it, we wont stop
ive never seen any bot doing that
Check any crypto server, they use accounts not bots
better not answer now, people arent willing to listen
a bot can't do that
im out , they add members even with selfbotting and dm-ing ppl
its exactly not screensharing but uhhhh welp
π« same
client on 1st deployment
ye
@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
It is not against TOS to share screen on voice chat
My My, no comments
π dont tell me you were typing this all the time lol
i'd just !rule 5 
no lol, I was typing something else for discordtogether, and deleted the whole paragraph
pain
indeed
but writing a bot the 4th time is more pain
rate my imports tho all it actually is import hikari , lightbulb
no comments
hikari and lighbulb should be seperated? and few unused imports. Otherwise kinda good
purple vscode theme-
!pypi lightbulb
yea they are different libraries
!pypi hikari
!pypi hikari-lightbulb
oh I see
A "sane" discord api wrapper, you know, SANE
ill use the unused imports later
hgow to make url buton with disnake
hikari seems very very very weird
atleast it does not use a callable , just to return an integer discord.Intents.all() coughs)
still no comments
well , there's nothing which makes it weird
any example how is the being weird?
yeah though never thought of this, its just...weird
syntax is veryyy weird compared the other libs
how is that so ?lol
yeah its toooooo weird
its just not made as a "easy to use api wrapper" 
what other libraries are we talking about?
the forks? ahem
no one ever listens to me
why am I always ignored ;-;
ye kinda
how would they be different ? its just like people are too eased up with discord.py and feel it hard to learn a new library.
cof cof maintained forks suck
||useless unmaintained discord.py forked repos >>>>>||
I wanted you to tell me the exception it provides ;-;
dont see anything weird here , its just a different implementation which was not copied from discord.py so it feels weird
there was nthing?
Rip, fork discussion
so, cof cof ||hikari uwu?||
lol
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
its fine, tbh
Isn't that discord.js?
yep
Thought so
thats just basic javascript Β―_(γ)_/Β―
Mhm
it was about the event thing providing argument instead of function names as events
thats a function too Β―_(γ)_/Β―
its just js being js
ofcourse , but it does not use naming like on_ready , on_connect etc
but it sure takes the ready string
just the function is same
for all events
maybe
hikari too needs you to typehint the event , thats it
lmao
uhuh, better
its same as how listeners work
@bot.listen(eventclass)
async def my_listener(event):
...
can anyone send the code to make a url button with disnake?
cof cof someone was rewriting their reaction roles
!d disnake.ButtonStyle.url
!d disnake.ButtonStyle.url 3rd time
but its not working π
you need to pass it inside the button
you're gonna get that deep to the brain, huh?
lol
im still stuck on how to save the data lol
π« good luck, you'll pass
ill do something like carl bot most probably
!rr add message-id role-id emoji
yeah, this is actually useful
its not how to change it into a url button, i want to know how to create it
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
this
any ideas?
embed.files?
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
how do i create a url button?
Button(url=link , type=ButtonStyle.url , lable=label)
whats so hard innit?
its for disnake
it doesnt work tho
cry about it
say that again , and ill break my keyboard
dumb question but how do i 'not handle the error'
you're the one wasting money
do you have an error handler(on_command_error) event? add raise error in the first line insid eit
i wont do that actually
ok ):
i did it only once
Β―_(γ)_/Β―
π« shit happens
this?
poop happens
i will rest and be back









