#discord-bots
1 messages ยท Page 21 of 1
Whats 2+6 ๐ฟ
,
8
me2
1083 + 1
1084
1000 - 7
993
@slate swan Can you remind me how to use the parent methods in child class? like how do i use add_item() from view class
lmao
can't use self
993
pro
i get it slow :(
How to make 3 prefixes for bot
Well you need the instance if you want to call it's method
you're good at maths
I'm literally doing maths rn and doing that
Hi
๐ I wish
Hi
what is (x + y) - 4 = 10 + (8 x 2)
Bot(command_prefix=list_of_prefixes)
Just pass a sequence of the three prefixes to the command_prefix parameter
you can in __init__
ANY HELP OR ME LEAVE?
command_prefix=("!", ".", ";",)
self.add_item?
those brackets are just completely unneccessary
i know
leave
help or em leave :(
why this called "rude"
bot = commands.Bot(intents=discord.Intents.default())
@bot.hybrid_command()
async def fight(ctx, player1: str, player2: str, health: int, time: int) -> None:
if 20 > health or 500 < health:
await ctx.send('not allowed')
return
whar
How to make a embed message that at end it says server name and serve pfp
easy solution
i told you, you won't understand
take it or leave it ๐
see, you didnt understand
WIAT RETURN???
i was reading
i will back if there are other problem
gl I'll try not to be present
that you put it in wrong place
!d discord.Embed.set_footer
set_footer(*, text=None, icon_url=None)```
Sets the footer for the embed content.
This function returns the class instance to allow for fluent-style chaining.
inside another method or just inside the body?
@disnake.ui.Button
okimii won't like this
use the deco
or he will?
Indent
Thanks
what indent
like this ?
Don't you know what's indent?
inside init
NO
What's indent
!indents
ty
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
I mean to indent it in the function
@slate swan
yo
i hid the content of init so it looked like indent is f-ed
this the code btw bot = commands.Bot(intents=discord.Intents.default()) @bot.hybrid_command() async def fight(ctx, player1: str, player2: str, health: int, time: int) -> None: if 20 > health or 500 < health: await ctx.send('not allowed') return
they aready put :
yeah then you have an await ctx.send() that's already indented wrong
there's actually a good chance that it'll error out again as an unknown interaction 
lol
@slate swan you know java right?
O I UNDERSTAND
forget 100% of it :)
last right code is from 3 years
it would be easier to pick that up and make a bot
SO :)
BY JAVA??
yea, it easier to learn something again rather than learning something new
java is the same as python just different
o hmmm no i want learn python
if not every language than almost all of them are possible to make a discord bot on
then learn python
then learn it
i make a game my guy
don't make discord bots, its not meant to be for beginners
guy* sorry misclick
you can even make your own language and make a discord bot with it
!resources @slate swan
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
this site is werido :(
you just gotta connect to the internet and ask information from discord
and i want hop in bots this make me learn basic
you can do that once you are familiar with python ๐
No, that works for a few people but makes things very difficult in the long run
so what i do
You should get your python and programming fundamentals down before doing this
ah no
bye
WTF WHY No ONE TELL ME ABOUT THIS
didn't callback :(
half of this doesn't have to do anything with dpy
Perhaps not, but it will give you a solid understanding of Python to be exposed to various projects/ideas
that proves that then
mhm
damn, Zeffo do you have an idea how to make sure that user has open the link
or there isn't any other way
Make a redirect and check idk
next time i will back here when i check google and my friend in python :)
^^

did you sync the commands?
No :(
...
how to bttw
then sync them
CommandTree.sync
self.tree.sync() in your case
put it where
o
Thank you
what do you mean by that?
inputs for async?
Like bots taking users inputs
!d discord.Client.wait_for
wait_for(event, /, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.10)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.10)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.10)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/latest/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
import asyncio
async def take_input():
async return await input()
s = aysncio.run(take_input())
print(s)

async return 
returning values asynchronously 
ifs?
very async code
can you show me how you do tha?
show what?
How you use if statments so like if input== etc
๐ฑ
from asyncio import TimeoutError
bot = commands.Bot(...)
@bot.command()
async def gib(ctx: commands.Context) -> None:
try:
message = await bot.wait_for("message", timeout=60, check= lambda d: d.author == ctx.author and d.channel == ctx.channel)
except TimeoutError:
return await ctx.send("ok")
if message.content == "uwu":
print("uwu")
elif message.content == "no":
print("yes")
ewu
Thankyou
how does one typehint lambda arguments
i need help i want to make it so everytime i want to ban someone theres a random reason can i do that
Sure, how do you pick the random reason? Out of a list?
i wqnted to do it out of a list but i wasnt able to
@slate swan how would i execute the code??
because im new to python
smh
you cant...?
Sorry im new to asyncio inputs
when the sad
!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").
Pichu used charm to kick, Pikachu used thunder shock to kick, Raichu used walt switch to kick, Squirtle used water gun to kick, Wartorle used rapid spin to kick, Blastoise used skull bash to kick, Bulbasaur used leaf blow to kick,
Venusaur used solar beam to kick, Charmander used Flame thrower to kick, Charmeleon used metal claw to kick, Charizard used inferno to kick

....?
what do you mean it's a command
and the user will type stuff in discord
so i just use !gib ?
not in the terminal
there are a lot of words so when i move to the next line there is an error
yes
Cool, just pick a random character and a random item, and concatenate it and use it to kick them
@sick birch
And whatโs the error?
x: Callable[[int], str] = lambda n: str(n)
but as sson as i move to second line it shows errors
To avoid having that many words, create a list with all the Pokemons, and another one with all the items they can use. Pick a random from each, concat them
oh thatโs one way
not sure how you'd do it inline
import discord
from discord.ext import commands
import random
client = commands.Bot(command_prefix = '@')
TOKEN = 'token'
@client.event
async def on_ready():
print('{0.user} is on')
@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=random.randrange('Pichu used charm to kick, Pikachu used thunder shock to kick, Raichu used walt switch to kick, Squirtle used water gun to kick, Wartorle used rapid spin to kick, Blastoise used skull bash to kick, Bulbasaur used leaf blow to kick,
Venusaur used solar beam to kick, Charmander used Flame thrower to kick, Charmeleon used metal claw to kick, Charizard used inferno to kick')):
if reason==None:
reason="no reason provided"
await ctx.guild.kick(member)
await ctx.send(f'{reason} {member.mention}')
client.run(TOKEN)
?
it's only going to call randrange once...
you should default it to None, and call randrange inside the function
what to do then?
Set reason to none, and move it inside the function itself
ok
in these await.ctx.send('random.randrange()')
?
!d random.randrange
random.randrange(stop)``````py
random.randrange(start, stop[, step])```
Return a randomly selected element from `range(start, stop, step)`. This is equivalent to `choice(range(start, stop, step))`, but doesnโt actually build a range object.
The positional argument pattern matches that of [`range()`](https://docs.python.org/3/library/stdtypes.html#range "range"). Keyword arguments should not be used because the function may use them in unexpected ways.
Changed in version 3.2: [`randrange()`](https://docs.python.org/3/library/random.html#random.randrange "random.randrange") is more sophisticated about producing equally distributed values. Formerly it used a style like `int(random()*n)` which could produce slightly uneven distributions.
Deprecated since version 3.10: The automatic conversion of non-integer types to equivalent integers is deprecated. Currently `randrange(10.0)` is losslessly converted to `randrange(10)`. In the future, this will raise a [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "TypeError").
are you sure randrange is the right method
exactly aha
async def kick(ctx: commands.Context, member: discord.Member, *, reason=None) -> None:
reason = reason or random.randrange(...)
it's random.choice though
you want random.choice instead i think
and with the arguments provided, an error
but there are a lot of sentences so i moves to the next line and stops working
You need to use choice, so probably this random.choice('blah blah blah'.split()) @pearl shoal
?
pass a list in choice

You can avoid having a lot of words
how
And itโs extra random
can i select a file from notepad and it uses to as reasons>
charmander is not going to use razor blade
?
or leaf blow ar whatever
when did i do that
its flamethrower
guys this is the code @client.tree.command(name="", description="to fight") async def _fight2(ctx, player1: str, player2: str, Health: int, Time: int) -> None: if 20 > Health or 500 < Health: await ctx.send('not allowed') return await ctx.response.send_message("eeee") and this is the error 2022-08-05 15:04:35 INFO discord.client logging in using static token Traceback (most recent call last): File "c:\Users\Ibrah\Desktop\discord bot\Buttom.py", line 21, in <module> client.run("e") File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 882, in run asyncio.run(runner()) File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete return future.result() File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 857, in runner await self.start(token, reconnect=reconnect) File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 790, in start await self.login(token) File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 642, in login await self.setup_hook() File "c:\Users\Ibrah\Desktop\discord bot\Buttom.py", line 10, in setup_hook await self.tree.sync() File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\app_commands\tree.py", line 989, in sync data = await self._http.bulk_upsert_global_commands(self.client.application_id, payload=payload) File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 715, in request raise HTTPException(response, data) discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In 0.options.2.name: Command name is invalid In 0.options.3.name: Command name is invalid any help
nah as I understood it was robin's idea
name cannot be empty, set a name
ok sir

pwes help
Ok done giving me error
File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\app_commands\tree.py", line 989, in sync data = await self._http.bulk_upsert_global_commands(self.client.application_id, payload=payload) File "C:\Users\Ibrah\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 715, in request raise HTTPException(response, data) discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body In 0.options.2.name: Command name is invalid In 0.options.3.name: Command name is invalid
help = ping | no help igore
what you wanna do is
reasons = ["Charmander used that and that", "Pikachu kicked like that", "Raichu used Thunderbolt"]
await ctx.send(f"{random.choice(reasons)} {member}")
I'm real
the yter
in real life I tend to exist
yeah, he is my dad
ohk;
jokelogical
sarcasmlogical
Give me an Idea to add to my bot.
voice receiving
Where do I start
discord API
PokeMod
add PokeMod
For what?
What library should I use?
there's no lib for it
A fun moderation bot which will keep your server safe and secure using Pokemon Attacks!
lame bu ok
I mean people say pycord or nextcord has it, but where's the fun in that
are there any examples?
no
I use pure discord.py
THEN HOW DO I START
same
I respect you for that
Give me another Idea, That I can actually do
if I knew how to do it I would have already and I would help you
A fun moderation bot which will keep your server safe and secure using Pokemon Attacks!
boring

pikachancla
Dockerize your application and set up continuous integration and deployment for easy production server deployment
do some profile picture editing, such at putting text on someone's avatar
Create a simple but extensible bot core
make a snake game
create a command that auto generates ideas using ai
Thatโs reusable for multiple bots
# join a voice channel and record what people say
@client.command()
@commands.has_permissions(administrator=True)
async def record(ctx, channel: discord.VoiceChannel):
# get the voice client
await ctx.message.delete()
await channel.connect()
y = ctx.voice_client
# start recording
await y.source.start()
# wait for the user to say "stop"
await ctx.send("Say \"stop\" to stop recording.")
while True:
msg = await client.wait_for("message")
if msg.content == "stop":
await y.source.stop()
await ctx.send("Recording stopped.")
break
Github Co-Pilot did this
But I'm not sure if it works
I already thought about that and It didn't work
recreate cod in discord
I don't know what this is but I don't like it
while can be blocking iirc
thats like been ur only req for months ๐
Because nobody does it
make a gist
I've done it!
And I wish people did
At least 1 ๐
So what do I do?
People seem to prioritize making commands and functions over having a strong infrastructure
that while is not blocking
wasn't because you proposed it though, it's because I have a few different bots and I was sick of repetition in different repos ๐
make a bot that makes different uwu sounds using ai ๐
stop
Is there something in the current commands.Bot that you'd like to see added?
i am
while is blocking in an async function? if it doesn't have any blocking code?
No
Having a reusable bot core is important! Now you can initialize a new bot project anytime
a drug addict
I don't even know how time.sleep is blocking inside an async function
Iโm not experienced enough with the internals to be able to answer that question ๐
Someone give me an idea for my freaking bot. ffs
A fun moderation bot which will keep your server safe and secure using Pokemon Attacks!
doesn't asnyc create a task of that time.sleep so it doesn't block
you just got like a dozen ideas :/
Except that
event=discord.Embed()
event=discord.Embed(title=f"@everyone ๐{ctx.author} is hosting a event",description="Type ClaimEvent to win picture perms !",color=00FF00)
A fun moderation bot which will keep your server safe and secure using Pokemon Attacks!
What's the issue?
color = 0x00FF00
we don't know either, what's the error
yes
Whats the hex code for green?
wait what
ohhh
Well, you have some grammar issues as well.
how is that invalid syntax
he means a event
yeah lol
Hexadecimal numbers need to be prefixed with a 0x
I spelt it right.
I later wanted to point out the first event definition
it's an event not a event
"A" goes before words that begin with consonants. "An" goes before words that begin with vowels: an apricot. an egg.
Okay that shouldnt stop it though
also, passing an int is wrong, you should pass a discord.Color if I remember correctly
does it otherwise raise a syntax error tho
Just says invalid syntax
no
It should
but it could be a var
As it assumes its a base 10 number
Donโt think variables can start with a number
alright it can be both
dunno
The parser needs to differentiate from a variable and an integer
@client.command()
@commands.has_permissions(administrator=True)
async def event(ctx):
event=discord.Embed(title=f" ๐{ctx.author} is hosting a event", description="Type ClaimEvent to win picture perms!", color="0x00FF00")
await ctx.send(embed=event)
Try this
@cold tide
How to run python script for free on server
well how do you know if 01000111 is a number or a letter
By using ""
Could we avoid spoonfeeding in the future please
binary
Is that an order?
How to run python script for free 24/7 on server
You use 0b
Just a suggestion
Well then, Thanks for suggesting, But I will not stop spoonfeeding. โค๏ธ
๐ญ
just making more work for the rest of us ยฏ_(ใ)_/ยฏ
How to run python script for free 24/7 on server
can we make a bot that adds accounts to a server i need it so i can test kick and ban commands
did it work?
pls ell
no
?
probably against ToS
i just need 1 account
It's used for server backups
to be added again and again
You authorize your bot to your account, And write some code, And then it will join your server automatically
Cuz the bot has access to joining servers for you
Yes it's possible through Oauth2
how...
Good question, I don't know.
ask this guy
i just want a single account to be added again and again to my server hen kicked
This sounds intriguing, being an AWS Infrastructure Engineer, I may ask a few questions around this at a later date!
tell
You're an AWS Engineer?
Or you can make life simple and just create a second account, and use that for testing.
Please do, Iโm more than happy to oblige
Jammy is my computer teachers name ๐
This accoutn I am on is my personal and I have a 2nd one for testing against. ๐
I need an answer ๐๏ธ
but i have to join again and again
boring.
whats that
Don't get invloved
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
who will get banned me or the second acc
Both, if they can tie it back
sad
yeah it's rule 5
But rule 5 so letโs not discuss it here
i have tp rejoin again and again
It's better than getting banned
Yes I am Araso, and will do Robin, still going through my Python course atm to get a better understanding of basics (2ndtime now!)
ye
Ummm, What's your salary?
80,000
Is that really that important?
๐
Yes, I really wanna know
rupees
following the logic of the people who are here with syntax error problems, you should start learning python by making GTA 6 @slate swan
๐
Itโs not, and we donโt need to ask questions like that here as itโs irrelevant in this channel
can we make a command so that we can change prefix of bot
Sure can
Fun fact: I already got the answer
I have made once the prefix comamnd
how'
With lot of struggle
tell pls
Is there a way to use multiple prefixs for one bot?
Cant tell code
!d discord.ext.commands.Bot.get_prefix
await get_prefix(message, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves the prefix the bot is listening to with the message as a context.
Changed in version 2.0: `message` parameter is now positional-only.
I can recommend use a database
pass a list to command_prefix
Can we make a command to change prefix of bot
Ye it's possible
.
tell mee
command_prefix=['?', '!', '>', '<']
Like this?
yes
Is your bot in multiple servers or only 1?
2 mins I'll tell you at dm
Why not tell him here? It might be useful for others.
Lol, it works
of course
Hard for me
Hey @crystal glen!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
That bot looks way to malicious.
I know right?
I just add stuff to my bot
No point to it, The bot's name is Haryad, It's a person who f'd my life.
im just copying the script rq
It's yours
nice
โฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃทโกโ
โ โ โ โ โ โ โ โ ปโฃฟโฃฟโ ฟโ ฟโ โ โ โ ปโฃฟโฃฟโฃโ
โ โ โขคโฃโฃโฃโ โ โขธโฃทโกโ โฃโฃโฃคโฃดโฃฟโฃฟโฃฟโฃ
โ โ โ โ โ นโ โ โ โ โฃฟโฃงโ โ นโฃฟโฃฟโฃฟโฃฟโฃฟโกฟโฃฟ
โ โ โ โ โ โ โ โ โ โ โ ฟโ โขโฃผโฃฟโฃฟโ โขฏโกฟโก
โ โ โ โ โ โ โ โ โ โ โ ฆโ ดโขฟโขฟโฃฟโกฟโ ทโ โฃฟโ
โ โ โ โ โ โ โ โ โฃทโฃถโฃถโฃคโฃคโฃคโฃคโฃคโฃถโฃฆโ โ
โ โ โ โ โ โ โ โขโฃฟโฃพโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโ โ
โ โ โ โ โ โ โ โ โฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโกโ โ
โ โ โ โ โ โ โ โ โ โ โ ปโขฟโฃฟโฃฟโฃฟโฃฟโ
๐
lmao go ahead copy @unkempt canyon's code from github
!src
What is the purpose of your bot? A nuke bot? Beingable to kick all members? Delete all channels, etc?
Nope, Everyone asks that question.
I have 400 members
I just rename all of them to Haryad
And some other things
For example making multiple channels with the name Haryad
i hqve 90000 members
Can I please change everyone's name to Haryad, For only 1 hour?
sure ig]
DMs
and btw its 00009 members
you can but can't without the consent of the members nor without the information that your bot will get blocked from the discord api if there are a nice amount of members
t t t typo
just change tthe token lol'
I already did it to my server
owo?
Then get banned eventually. Great idea, crack on please.
the ip gets blocked not the token
I will just turn on a VPN
does that by any chance relate to what I said. No offence
just shift
jeez im out
just firm it
I didn't understand what u said ๐
Nord ๐
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
Donโt discuss ban evasion techniques
How is that rule 5
Exactly what Robin just said.
janmejay
does somebody know the best wait to implement a sleep in a discord @tasks.loop ?
that's non blocking
ye
asyncio?
!d asyncio.sleep
coroutine asyncio.sleep(delay, result=None)```
Block for *delay* seconds.
If *result* is provided, it is returned to the caller when the coroutine completes.
`sleep()` always suspends the current task, allowing other tasks to run.
Setting the delay to 0 provides an optimized path to allow other tasks to run. This can be used by long-running functions to avoid blocking the event loop for the full duration of the function call.
Deprecated since version 3.8, removed in version 3.10: The `loop` parameter. This function has been implicitly getting the current running loop since 3.7. See [Whatโs New in 3.10โs Removed section](https://docs.python.org/3/whatsnew/3.10.html#whatsnew310-removed) for more information.
Example of coroutine displaying the current date every second for 5 seconds:
It's probably your code
@tasks.loop(seconds = 2)
async def likeThread(channel, apis, tweets, client):
print("Like thread started")
print(client.userList)
for user in client.userList:
asyncio.sleep(5)
....
that's the relevant snippet and it seems to just skip over the sleep and loops again after 2 seconds
@tasks.loop(seconds = 2)
from discord.ext import commands
import random
client = commands.Bot(command_prefix = '@')
TOKEN = 'token'
@client.event
async def on_ready():
print('{0.user} is on')
@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=None):
if reason==None:
reason="no reason provided"
await ctx.guild.kick(member)
await ctx.send(random.choice("Pichu used charm to kick", "Pikachu used thunder shock to kick", "Raichu used walt switch to kick", "Squirtle used water gun to kick", "Wartorle used rapid spin to kick", "Blastoise used skull bash to kick", "Bulbasaur used leaf blow to kick",
"Venusaur used solar beam to kick", "Charmander used Flame thrower to kick", "Charmeleon used metal claw to kick", "Charizard used inferno to kick") )
client.run(TOKEN)
when i kick someone it doesnt respond
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
@crystal glen now tell
Ignoring exception in command kick:
Traceback (most recent call last):
File "C:\Users\Dell\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "c:\Users\Dell\Desktop\LEARN BO\afasasa.py", line 19, in kick
await ctx.send(random.choice("Pichu used charm to kick", "Pikachu used thunder shock to kick", "Raichu used walt switch to kick", "Squirtle used water gun to kick", "Wartorle used rapid spin to kick", "Blastoise used skull bash to kick", "Bulbasaur used leaf blow to kick",
TypeError: Random.choice() takes 2 positional arguments but 12 were given
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Dell\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Dell\AppData\Roaming\Python\Python310\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Dell\AppData\Roaming\Python\Python310\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: TypeError: Random.choice() takes 2 positional arguments but 12 were given
the task loop interval is 2 seconds, while you are sleeping for 5 seconds. what do you expect 
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: Random.choice() takes 2 positional arguments but 12 were given
wtf did u doooooooooooo
?
you pass in an iterable to it, not the options themselves
since, every argument given would be passed into the function's parameters
also await asyncio.sleep()
kick_messages = ["Pichu used charm to kick", "Pikachu used thunder shock to kick", "Raichu used walt switch to kick", "Squirtle used water gun to kick", "Wartorle used rapid spin to kick", "Blastoise used skull bash to kick", "Bulbasaur used leaf blow to kick",
"Venusaur used solar beam to kick", "Charmander used Flame thrower to kick", "Charmeleon used metal claw to kick", "Charizard used inferno to kick"]
(random.choice(kick_messages))
and where should i put this?
overwriting inbuilt class names 
naming var list wont lead to goodies
yes
why is my code not in color
...
That's not related to the question nor is it helpful
thanks that should do it
uh.....
that will not do it
Instant karma 
probably
I hate it when people just cross you off 
be patient
i dont understand what u say
:lemao:
Give me a command suggestion 
import discord
from discord.ext import commands
import random
client = commands.Bot(command_prefix = '@')
TOKEN = 'token'
@client.event
async def on_ready():
print('{0.user} is on')
@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=None):
if reason==None:
reason="no reason provided"
await ctx.guild.kick(member)
kick_messages = ["Pichu used charm to kick", "Pikachu used thunder shock to kick", "Raichu used walt switch to kick", "Squirtle used water gun to kick", "Wartorle used rapid spin to kick", "Blastoise used skull bash to kick", "Bulbasaur used leaf blow to kick",
"Venusaur used solar beam to kick", "Charmander used Flame thrower to kick", "Charmeleon used metal claw to kick", "Charizard used inferno to kick"]
await ctx.send(random.choice(kick_messages))
client.run(TOKEN)
do u get it now?
thanks
Sorry that came off as harsh, what I ment to say.. I don't think the intervals between the execution of my function are relevant to the functions internal execution time
help
lmao not you, what basically you do is
make a list of your options, so opts = ["option1", "option2"]
and then use the random.choice function on the list, so random.choice(opts)
how the code is colorful
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
```py
code
```
ohhohohohohoohoho
i did but no color
.
did it work @pearl shoal
๐
I have a help command
Of course ๐ โค๏ธ
make another one 
type all the commands out manually if you already havent
2 help commands for 1 bot ๐
nah never
Give me an utility command
yeah why not
eval
a command to screenshot 
that did it, thanks a lot
so now ican just do ```squirtle used water gun to kick {member.mention}
?
wb poll?
it is possible, not like I'm joking or smth
@crystal glen
still no ๐
new uwu voice everytime using ai
No
then?
There's a better way to do it
that's the dpy server 
but does this one work?
๐
That's simple selenium
yep
commands.has_perm. . .
And
commands.has_role. . .
Would work in the same command ?
yeah
โฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃทโกโ
โ โ โ โ โ โ โ โ ปโฃฟโฃฟโ ฟโ ฟโ โ โ โ ปโฃฟโฃฟโฃโ
โ โ โขคโฃโฃโฃโ โ โขธโฃทโกโ โฃโฃโฃคโฃดโฃฟโฃฟโฃฟโฃ
โ โ โ โ โ นโ โ โ โ โฃฟโฃงโ โ นโฃฟโฃฟโฃฟโฃฟโฃฟโกฟโฃฟ
โ โ โ โ โ โ โ โ โ โ โ ฟโ โขโฃผโฃฟโฃฟโ โขฏโกฟโก
โ โ โ โ โ โ โ โ โ โ โ ฆโ ดโขฟโขฟโฃฟโกฟโ ทโ โฃฟโ
โ โ โ โ โ โ โ โ โฃทโฃถโฃถโฃคโฃคโฃคโฃคโฃคโฃถโฃฆโ โ
โ โ โ โ โ โ โ โขโฃฟโฃพโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโ โ
โ โ โ โ โ โ โ โ โฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโฃฟโกโ โ
โ โ โ โ โ โ โ โ โ โ โ ปโขฟโฃฟโฃฟโฃฟโฃฟโ
import discord
from discord.ext import commands
import random
client = commands.Bot(command_prefix = '@')
TOKEN = 'token'
@client.event
async def on_ready():
print('{0.user} is on')
@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=None):
kick_messages = ["Pichu used charm to kick", "Pikachu used thunder shock to kick", "Raichu used walt switch to kick", "Squirtle used water gun to kick", "Wartorle used rapid spin to kick", "Blastoise used skull bash to kick", "Bulbasaur used leaf blow to kick",
"Venusaur used solar beam to kick", "Charmander used Flame thrower to kick", "Charmeleon used metal claw to kick", "Charizard used inferno to kick"]
if reason==None:
reason="no reason provided"
await ctx.send(f"{random.choice(kick_messages)} {member.mention}")
await ctx.guild.kick(member)
client.run(TOKEN)
using + to concatenate strings
nice wow thats pretty easy
await ctx.send(f"{random.choice(kick_messages)} {member.mention}")

ill try both
Btw how to use separators?
Or something like
poll (this is the title) | (choice1) | (choice2) |. . . . .
Imma make text generator bot ๐
I always use f-strings, Now I didn't ๐
use slash commands 
I mean, you could catch all that in a for example text argument
and use the split method to get the content chopped off from a delimiter
Wait,
Wb โ โ
These still work ?
def command(ctx, *, a_lot_of_args):
for arg in a_lot_of_args.split('separator')
oooh
async def uwu(ctx: commands.Context, *, text: str) -> None:
option_one, option_two = text.split("|")
#The command could be invoked using -> <prefix>uwu option one uwuwuwuwuwu|option two
How do I set the output for them btw?
didnt work
nice
Woohoo it got to 10th epoch
random.choice(kick_messages) (member.mention)
output as in?
did u use my code?
ashley isnt it ```f''
Just use my code...
not a necessity, strings are strings
ok
ok
' ' and " " are the same using " " is better
ohh
easy 
no need to prove, i know i am wrong
alright forgib
@crystal glen urs didnt work either
error code?

guys what this should be? if Health == str:
how does it kick the person tho
random.choice(kick_messages) (member.mention)
oh
idk
!e py Health = type("amogus") print(Health == str)
@vale wing :white_check_mark: Your 3.11 eval job has completed with return code 0.
True
@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.
True
Yes
This thing makes no sense anyway
guys how to set a var to a text
var = 'text'
depending upon the scope 
whatever you say, Lord
from discord.ext import commands
import random
client = commands.Bot(command_prefix = '@')
TOKEN = 'token'
@client.event
async def on_ready():
print('{0.user} is on')
@client.command()
@commands.has_permissions(kick_members=True)
async def kick(ctx, member: discord.Member, *, reason=None):
if reason==None:
reason="no reason provided"
await ctx.guild.kick(member)
kick_messages = ["Pichu used charm to kick {member.mention}", "Pikachu used thunder shock to kick {member.mention}", "Raichu used walt switch to kick {member.mention}", "Squirtle used water gun to kick {member.mention}", "Wartorle used rapid spin to kick {member.mention}", "Blastoise used skull bash to kick {member.mention}", "Bulbasaur used leaf blow to kick {member.mention}",
"Venusaur used solar beam to kick {member.mention}", "Charmander used Flame thrower to kick {member.mention}", "Charmeleon used metal claw to kick {member.mention}", "Charizard used inferno to kick {member.mention}"]
await ctx.send(f"{random.choice(kick_messages)}")
await ctx.guild.kick(member)
client.run(TOKEN)
this was easy
will this work
Nice formatting
try it
run the code and see it yourself
do you know how to send code colorful
!code
Here's how to format Python code on Discord:
```py
print('Hello world!')
```
These are backticks, not quotes. Check this out if you can't find the backtick key.
let's become the linters of the channel with a subscription 
im in
i dont know why but y bot was off but still responding?
@Moderators 
insanity
??
And this won't work cause AttributeError: int object has no attribute user
In on_ready
i have been tryingg to figure put this for the past 1 hour on this chat
it is kicking the user but no message
Wait actually it's not f string
So doesn't matter it will just print it without format
it wont
oh nvm
.
Made quickpoll what else?
It basically can't kick them without sending a message because the send instruction is before the kick instruction so if send raises an exception the code won't proceed
how does it look like 
Wait wtf
You have 2 kick instructions
1s and 0s
Man what the heck
You need only one after send
guys why this not work :( error discord.ext.commands.errors.CommandInvokeError: Command raised an exception: UnboundLocalError: local variable 'fighttruefalse' referenced before assignment
nice
that is why, you shouldn't copy paste
What, you want me to use buttons?
Copypasta is cringe but i copypasted google tensorflow code
await ctx.guild.kick(member)
i should remove this
buttoms
?
Bottoms 
meh no
help 
!e
def foo():
x + 1
x = 0
foo()
@paper sluice :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 4, in <module>
003 | File "<string>", line 2, in foo
004 | UnboundLocalError: cannot access local variable 'x' where it is not associated with a value
LOl
?
You probably did something like py if amogus: amogus = False
idk
Who developed copy paste?
Larry Tesler, 1945-2020
Lawrence Gordon Tesler passed away on February 16, 2020, aged 74. In seven decades, he created an incredible legacy for the world, with inventions and innovations that have helped shape computers and programming. He's best known for inventing copy-paste alongside his colleague, Tim Mott.
legend
hm
def foo then
OOOOOOOOOOOOOOOOOOOOOOO
wait what def mean
looks good :lemao:
Lemme get my botโs help command
Can't disagree
its a keyword used to define functions
https://realpython.com/defining-your-own-python-function/
i keep forgetting to do <url>
O
Lmao I read Hokker as something else 
+++
๐ณ
what
nvm 
happened
oops
what happened
OH MY GOSSH
?
when i named it I didn't even know about this word...
and now it's fucked up
do I rename my bot? lmao
interesting
lmao you said it
so?
the mods are strict
with pg-13 stuff rule
geinus plan
Looks bad :sad:
idk what all this mean
nice emojis :lemao:
i miss my nitro
Here are the buttons btw
why do people even use bots
you your bot will get a badge, so badge means more relevancy
SEND ME THE CODE
i told you before, you didnt listen
why?
wdym
hooker means like that uhh i cant tell like uhhhhhhhh on you wall idk english well
i want make buttons :)
why
Then make buttons :)
This is not a Modmail thread.
here are my buttons btw
jeez
nice
Buttons ๐
wrong server :lemao:
i just googled
absolutely, do you not see them?
a hook- is a prosti-
โHot Russian singlesโ
wtf even is "lemao" 
Lmao with e
lmao with e
๐
:lemao:
,
hot indian aunts ๐
it's called dropdown menu
what is going on here
๐
sarcasm is not dropdown
k
wait what did i just say
lol
its an anime character
is it
ye
yes, i strive to be an anime protagonist ๐
mos
btw @slate swan :lemao: is this in my server
Hi sarth
it's been eternities since I watched beyblade metal fusion ๐
17 yes old kid
lOL
fine
so?
hello
make game
i kid too
like me :)
I have tic
make minesweeper
i tried :adios:
smart kid
make me 
do you mean that this gen suc....
hard to find 2 of you in this world ;/ you so werido lol
LOL
!mom where it give your house address and they come to your housse when you are gone and your mother is there so they come and cum and cum
Contacting the moderation team via ModMail
@novel apex is a bot that will relay your messages to our moderation team, so that you can start a conversation with the moderation team. Your messages will be relayed to the entire moderator team, who will be able to respond to you via the bot.
It supports attachments, codeblocks, and reactions. As communication happens over direct messages, the conversation will stay between you and the mod team.
To use it, simply send a direct message to the bot.
Should there be an urgent and immediate need for a moderator to look at a channel, feel free to ping the <@&831776746206265384> role instead.

you are too cute, nobody could've made you
<@&831776746206265384>
what
I donโt want to cut my brainโs 0.1% part to make you
cum is short form for come
THEN HE SAY IT
lol
<@&831776746206265384>
download whatsapp
you'll know
rude
2 times ping
dm @novel apex if you have any problems @slate swan
!shhh
โ silenced current channel for 6 minute(s).
!mute 799966293608497193 4h Being disruptive and inappropriately suggestive is not welcome here. Review the #rules and #code-of-conduct before your mute expires please.
:incoming_envelope: :ok_hand: applied mute to @pearl shoal until <t:1659725820:f> (3 hours and 59 minutes).
!unhush
โ unsilenced current channel.
that looks good, gonna make this command in my bot :lemao:
yes me too
Not me
SUs
It's very useful for walking into a situation and needing a hot second to understand context.
Yes
yes 
It shows an @ in the reply person if u pinged
ctx.message.content to get the content of the message that triggered a command
Like what the user says?
yes
This ^
@client.event
async def on_command_error(ctx, error):
await ctx.message.delete()
if isinstance(error, commands.CommandNotFound):
await ctx.send(f'{ctx.author.mention} {ctx.message.content} not found.')```
you need to enable intents.message_content both in the code and dev portal
Yea use ctx.message.content
why this not work error :( discord.ext.commands.errors.CommandInvokeError: Command raised an exception: UnboundLocalError: local variable 'fighttruefalse' referenced before assignment
You copy pasted this again ?
I do think someone replied to this
works ๐
no
Here
Oops sorry forgot to turn off mention
what this mean
You are referencing the variable before assigning it
Yes how!?
Assign the variable before referencing it
Just do this
def foo():
x = 0
x + 1
foo()
fight == 'true'
Defining the variable before using it
what
O
Iโm bad at explaining๐
so this defining the var
gonna play ping pong, bye guys, @slate swan gl in learning
Bye
nice cat
OOOOOOOOOOOOOO LOOOOL
I UNDERstand
if not os.path.isfile(filename):
await ctx.send(f"{filename} does not exist in my sound library.")
return
When I do:
?p haryad, It gives the error
waht
And haryad exists, But it's haryad.mp3
Nvm Buddy
@silk fulcrum
no help me with this
LOl
this not working
you are not referencing it, you are using the equality statement
uwu = 1 this is an assignment
uwu == 1 this is an equality statement
o
this was easy bye
bye-
I once had this code https://media.discordapp.net/attachments/920208233971462234/999697679493894336/unknown.png ๐
it was
# disable a command for a user
@client.command()
@commands.has_permissions(administrator=True)
async def cdis(ctx, member: discord.Member):
await ctx.message.delete()
await member.add_roles(discord.utils.get(ctx.guild.roles, name="Disabled"))
await ctx.send(f"{member.mention} has been disabled from using commands.")
@client.event
async def on_message(message):
# if the message author has the disabled role, delete the message
if discord.utils.get(message.author.roles, name="Disabled"):
await message.delete()
await message.channel.send(f"{message.author.mention} you have been disabled from using commands.")
return
Why this isn't working?
No errors
what isnt working specifically, the command isnt assigning the role or the event isnt working
discord.utils.get() is prolly returning None
I confirm that the event is working
What do I do now?
make a getch
hm?
wait wtf
what?
try restarting your bot, it should work
since caching issues and get methods search the cache
can someone tell me why im getting this error? oauthlib.oauth2.rfc6749.errors.MissingTokenError: (missing_token) Missing access token parameter.
heres my code
def getsession(token=None, state=None, scope=None, redirect_url=redirect_url): return OAuth2Session(client_id=client_id, token=token, state=state, scope=scope, redirect_uri=redirect_url, auto_refresh_kwargs=dict(client_id=client_id, client_secret=client_secret), auto_refresh_url=f"https://discord.com/api/v{api_version}/oauth2/token", token_updater=updatetoken) # this is the function to get session
@app.route("/authorized")
def _2():
discord = getsession(state=flask.session["oauth2_state"])
token = discord.fetch_token(f"https://discord.com/api/v{api_version}/oauth2/token", client_secret=client_secret, authorization_response=flask.request.url) # this is where i got the error
I did 10 times
# give a user a role
@client.command()
@commands.has_permissions(administrator=True)
async def role(ctx, member: discord.Member, role: discord.Role):
role = discord.utils.get(ctx.guild.roles, name="Disabled")
await member.add_roles(role)
await ctx.send(f"{member.mention} has been disabled from using commands.")
Will this work?
it doesn't
Well you arenโt giving the user the role that the author provides
it's the same thing lmao, and why are you taking an extra role argument when you are simply overwriting it to a chosen role of yours rather than the role that was entered by the user
I removed the extra argument and it still doesn't work
Why it doesn't workkkkkkkkk
It doesn't give an error
Or initiate the command at all
It's like the command doesn't even exist
And I don't get an error for invalid command
WTF IS HAPPENING
wait
MY BOT IS NOT WORKING
BECAUSE I DONTHAVE A FUCKING ELSE CONDITION
try printing role and see
.
just ask
i want my bot to send a embed as a responce to my command
like randomly i was -(anything)
and it sends an embed
yes yes
you know the way to it?
prefix commands right?
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='-', intents=discord.Intents.default())
@bot.command()
async def foo(ctx: commands.Context) -> None:
embed = discord.Embed(title='Bar', description='Test', color=discord.Color.random())
await ctx.send(embed=embed)
bot.run('Token')
hello, theres a problem with this code its giving me an error when i run the bot and i dont know why, may someone help me pls?
from discord.ext import commands
class Member(commands.Converter):
async def convert(self, ctx: commands.Context, argument: str):
member_converter = commands.MemberConverter()
member = await member_converter.convert(ctx, argument)
if not member.bot:
return member
raise commands.BadArgument('Member must not be a bot user.')
and what's the error?
the full traceback please




