property bot```
Equivalent to [`User.bot`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.bot "discord.User.bot")
#discord-bots
1 messages Β· Page 1028 of 1
@spring flax
how do i make button when person press it to make private channel and there person can write his report
can you stop pinging me please? just ask the question and wait for someone to help
k
!d discord.Guild.create_text_channel
await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=..., default_auto_archive_duration=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.
Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission
to create the channel...
You can pass overwrites kwarg as a mapping of role: PermissionOverwrite
Hm hold on
!d discord.PermissionOverwrite
class discord.PermissionOverwrite(**kwargs)```
A type that is used to represent a channel specific permission.
Unlike a regular [`Permissions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions "discord.Permissions"), the default value of a
permission is equivalent to `None` and not `False`. Setting
a value to `False` is **explicitly** denying that permission,
while setting a value to `True` is **explicitly** allowing
that permission...
.topic
when i run >close_bot code is ```py
@commands.command(description="Terminates the bot's connection to the API", brief="Terminates the bot's connection to the API")
@commands.is_owner()
async def close_bot(self, ctx):
await bot.close()
it goes offline then online again
how to my bot send user name of member
Can i run two bots on one token?
no
why
cuz its diffrent token
No it's the same token
It's working fine for me
I have a music bot and an economy bot using the same token but different prefix
do u know how to my bot send nickname of a member when he type cmd?
like ctx.send(f"user.name.member")?
and how to make slash command?
like my prefix is "." but i want a slash command like /
for normal command its
await ctx.send(ctx.author.name)
for slash cmd
await interaction.response.send_message(interaction.user.name)
!d discord.Member.nick
The guild specific nickname of the user.
i dunno if it returns the user username or None if the member nick is not set
Read the source and it should return None
disnake/member.py line 359
self.nick: Optional[str] = data.get("nick")```
!d discord.Member.display_name
property display_name```
Returns the userβs display name.
For regular users this is just their username, but
if they have a guild specific nickname then that
is returned instead.
can anyone help
i just made a bot and i made few comamnds and the bot doesn't respond and i'm sure it is online and everything is alright
do you have an on_message event
nope
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
how would you format this to make it look cleaner and take up less space 
it's currently cutting off the very top on mobiles because it's so much text
Download lyrics and metadata from Genius.com
use somerandomapi π you dont need a token for that like lyricsgenius
api key*
how did u maked buttons?
π€ but i already have two, they're seperated by something specific
you can add a field with an empty character in it (" " will not work, you need some unicode character)
.
use the embed description if you already aren't
how to my bot send message who sended command like nick and ctx.author.member.nick?
already am
Ollie 
use a \n
.....?
uh
like
Bruh you condemned us
command .Nickname and bot send his nickname
!d discord.Member.display_name
await ctx.send("ctx.author.member.nick")
property display_name```
Returns the userβs display name.
For regular users this is just their username, but
if they have a guild specific nickname then that
is returned instead.
what is it for
what
smth like this i need
offers a bunch of stuff
lmao
doesnt work
isn't work
this don't works
@slate swan what do u need again
I-
Blvck will help you
like when u send command .Nickname bot send ur nickname of server
HAHAHAHAHA
LMFAO
π brhh
what py version are u using
!e
var = "aeiou"
print(f"var")
print(f"{var}")
@placid skiff :white_check_mark: Your eval job has completed with return code 0.
001 | var
002 | aeiou
idk if it changed or not i would have to check but
uh im working on replit
and that's it
isn't ctx.send("ctx.author.display_name")?
what
she's completely ignoring me 
π
^
Uhm so
first of all before working on d.py or relevant forks you need to now python and OOP concepts
change your code to
await ctx.send(β{ctx.author.display_name}β)
You can just directly pass ctx.author.display_name since it's already a str
There is no need for that f-string
no "
k
forgot it
yh
See @slate swan ? that's why I told that you condemned us
they are both different sign
This is a comedy
ur using repl i see why its doing that
i copyed this
remove it and reput β
^
simply send it without using a f string await ctx.send(ctx.author.display_name)
i doed that
doed
what happened then?
it sended ctx.author.display_name
lmao
π
show code
again, you don't need to use " " copy paste what i sent.
now works @pulsar bay thanks
await ctx.send(fβur display name is {ctx.author.display_name}β)
i reputed it
nice
''"
two different symbols

do u know how do i put gif in message like
(gif)```
;-;
what'd I dooo uhh
Ignore
just pretend that you're uwu or something
are you mad at me....? π
no
Nah i'm not mad 
lol
!resources will help @slate swan for learning python
Resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
@slate swan how to make like .nick @slate swan and bot sends ur nickname
your not mine

!d discord.Member.display_name
property display_name```
Returns the userβs display name.
For regular users this is just their username, but
if they have a guild specific nickname then that
is returned instead.
i just gived him whole code
@slate swan
k
:D
so no ctx?
no ctx
right?
k
await ctx.send(f"{discord.Member.display_name}")
yes
?
k
replace discord.Member with ur member var
bruh my bot don't wanna to run
try this
no i delted command i will back command when i fix this
.
deleted*
show ur whole code
Congo,you just got ratelimited.
ikr xD
type kill 1 in shell

but token
yes
dm @slate swan cuz token
bruh lmao
for 15 mins-_-
he just dmed me the token π
dont share ur token to anyone else he will misuse it
ik
i think to u are good person π
dont think that π
lol
OKAY
so can u help me?
We could really make a sitcom about this 
uhm.. is that legal? 
this?
raise errors.ExtensionFailed(key, e) from e
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.covid' raised an error: ImportError: cannot import name 'time_calc' from 'utils' (/home/runner/mv/venv/lib/python3.8/site-packages/utils/__init__.py)
why am i not able to load ?
copy ur code and paste in other project
?
nvm
sparky im using 3.10.4 version
instaling*
installing*
how do i make button?
her*
!d discord.ui.button
discord.ui.button(*, label=None, custom_id=None, disabled=False, style=<ButtonStyle.secondary: 2>, emoji=None, row=None)```
A decorator that attaches a button to a component.
The function being decorated should have three parameters, `self` representing the [`discord.ui.View`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.ui.View "discord.ui.View"), the [`discord.Interaction`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.Interaction "discord.Interaction") you receive and the [`discord.ui.Button`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.ui.Button "discord.ui.Button") being pressed.
Note
Buttons with a URL cannot be created with this function. Consider creating a [`Button`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.ui.Button "discord.ui.Button") manually instead. This is because buttons with a URL do not have a callback associated with them since Discord does not do any processing with it.
that is normal
can i remove it somehow?
I don `t like it
idk
that is normal
thats because of your theme..
That's vscode's theme
That isn't related to discord bots
i made this discord command
async def meow(ctx):
await ctx.send('rawr')```
and when i use the command it doesn't work even thought im doing everything and writing everything right
Show all your code please
from discord.ext import commands
import time
bot = commands.Bot(command_prefix='!')
@bot.event
async def on_ready():
print(f"Bot is online!")
@bot.command()
async def meow(ctx):
await ctx.channel.send('rawr')
@bot.event
async def on_message(message):
with open('blacklistedwords.txt', 'r+') as file:
swearwords = file.read()
author = message.author
if message.content in swearwords:
await message.delete()
await message.channel.send('You cant send this here! <@' + str(author.id) + '>' , delete_after=3.0)
bot.run('')```
change bot.event to bot.listen()
my issue is the commands not the events
Well I see it
k do it yourself
I LOVE that emoji
You have an on_message event which overrides the command
You need to add await bot.process_commands(message)
At the end on the on_message event
Yes i know
!d discord.ext.commands.Bot.listen
@listen(name=None)```
A decorator that registers another function as an external
event listener. Basically this allows you to listen to multiple
events from different places e.g. such as [`on_ready()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_ready "discord.on_ready")
The functions being listened to must be a [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine "(in Python v3.10)").
Example...
Use this if you don't want to put the process_commands code
Use f-strings, they're cleaner
how to make my anti ban more fast?
what is more fast?
taskpool 5 threaded bans gives 50 bans bypassing my antinuke i want my antinuke to ban the nuker / stop the nuker at less than 50 bans
i used aiohttp then httpx then the fastest one aiosonic to call discord api more fast to stop the nuker
still giving 50 bans
resp = httpx.get(f'https://discord.com/api/v9/guilds/{guild.id}/audit-logs?limit=1&action_type=22', headers={"Authorization": f"Bot {client.http.token}"})
i tried loggin audit more faster btw didnt work it made it more slow
async for entry in guild.audit_logs(limit=1,
after=datetime.datetime.now() -
datetime.timedelta(minutes=2),
action=disnake.AuditLogAction.ban):
this one giving 50 bans
ok.. here idk how to make it fast
lmao and btw next time use
!code when pasting 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.
that does look weird
vsc right
its your theme
he's prolly using some extension
or some extension
yeah
^
@slate swanresp = httpx.get(f'https://discord.com/api/v9/guilds/{guild.id}/audit-logs?limit=1&action_type=22', headers={"Authorization": f"Bot {client.http.token}"}) this is working btw more slower
who has the deep knowledge of py and dpy
using aiothtp is a better way.. that's wht i can suggest
i need him
aiosonic more faster than aiohttp
!d discord.Guild.create_role
await create_role(*, name=..., permissions=..., color=..., colour=..., hoist=..., display_icon=..., mentionable=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role") for the guild.
All fields are optional...
i used everything
and the limit. seems more related to discord API limit to me
i see π€
what do i pass for permissions
if the nuker can ban 50 bans why cant i stop it at less than 50 ban why do i get limited
its supposed to be a permissions integer
!d discord.Permissions
but
class discord.Permissions(permissions=0, **kwargs)```
Wraps up the Discord permission value.
The properties provided are two way. You can set and retrieve individual
bits using the properties as if they were regular bools. This allows
you to edit permissions...
ah
:>
can anybody help me with launching bot on heroku?
I don't know how to install this Heroku CLI
anybody?
idk also
nvm hosted it its easy
nc
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = 'dbl_token' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
if message.channel.type == discord.ChannelType.private:
return
if message.channel.id == 970895283250675813:
data = message.content.split(" ")
user = re.sub("\D", "", data[4])
hehehe = bot.get_user(user) or await bot.fetch_user(user)
hehehe = hehehe.id
db[f'{hehehe}cooked_pogchop'] += 42
db[f'{hehehe}voteCount'] += 1
voteCount = db[f'{hehehe}voteCount']
if voteCount < 10:
role = message.guild.get_role(971310924478705695)
elif voteCount < 18:
role = message.guild.get_role(971310601668288512)
elif voteCount < 69:
role = message.guild.get_role(971311031555072020)
elif voteCount < 100:
role = message.guild.get_role(971311323658977281)
elif voteCount < 420:
role = message.guild.get_role(971311024051486742)
elif voteCount >= 420:
role = message.guild.get_role(971311028694577162)
else:
role = message.guild.get_role(905626727005454457)
await message.author.add_roles(role)
await bot.process_commands(message)
```nothing is working
and where do i define message
Uh guys,
?
you put it as
color=0xhexcode
without the hashtag
If i want to check if members have a certain amount of messages, is it better to check every single member all the time if they have a certain amount of messages or once they send a message to check if they sent a certain amount of messages
uhm colors object in discord doesn't take hex
They can
help?
Oh ok.
!d discord.Colour
class discord.Colour(value)```
Represents a Discord role colour. This class is similar
to a (red, green, blue) [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.10)").
There is an alias for this called Color...
||alt f4|| jkjk
Since I added new commands
.-.
Both work
Can you help?
!d function
A series of statements which returns some value to a caller. It can also
be passed zero or more arguments which may be used in
the execution of the body. See also parameter, method,
and the Function definitions section.
Similar names: label.function, scikit_learn.function
bump
class TopGG(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.token = 'dbl_token' # set this to your DBL token
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
@commands.Cog.listener()
async def on_dbl_vote(self, data):
if message.channel.type == discord.ChannelType.private:
return
if message.channel.id == 970895283250675813:
data = message.content.split(" ")
user = re.sub("\D", "", data[4])
hehehe = bot.get_user(user) or await bot.fetch_user(user)
hehehe = hehehe.id
db[f'{hehehe}cooked_pogchop'] += 42
db[f'{hehehe}voteCount'] += 1
voteCount = db[f'{hehehe}voteCount']
if voteCount < 10:
role = message.guild.get_role(971310924478705695)
elif voteCount < 18:
role = message.guild.get_role(971310601668288512)
elif voteCount < 69:
role = message.guild.get_role(971311031555072020)
elif voteCount < 100:
role = message.guild.get_role(971311323658977281)
elif voteCount < 420:
role = message.guild.get_role(971311024051486742)
elif voteCount >= 420:
role = message.guild.get_role(971311028694577162)
else:
role = message.guild.get_role(905626727005454457)
await message.author.add_roles(role)
await bot.process_commands(message)
```nothing is working
and where do i define message
someone help ;-;
bro
no error
stop copy pasting ur shit
What do I put in here? Im trying to update the bot after adding new commands, hosting it on heroku by git.
:/
you dont even have ur dbl tkn, etc
is refresh_token intended to become a string?
well app
bruh is there really noone that can help me?
according to docs,
oo ok
I think once they send a message but im not sure
1: dont use tools you dk how to use, 2. research
- shut up
- I tried, no help so Im fucking asking here.
Just help or don't speak at all
bro π you dk what a commit msg is
I don't.
Chill up guys
If you didn't know it doesn't make sense to me
Basically itβs the message the tells what happened in the commit
And how do I get it?
What do I do?
I only use git the terminal section of pycharm and not pycharms built in way so Iβm not sure how it works
I can use the terminal section too?
Probably
I would recommend using git on a standalone terminal, I've never had luck with built in tools for it
So what do I do with terminal section
it sjust a fucking comment to know what u changed
Keep it civil please
.
so I just type I changed this..
and I press push and commit?
yes.
.
idfk all the files in ur folder
self.dblpy = dbl.DBLClient(self.bot, self.token, webhook_path='/dblwebhook', webhook_auth='password', webhook_port=5000)
```what is webhook_path
This video is intended to cover how you can use Git graphical user interface inside Pycharm to clone your projects from GitHub and work with them using PyCharm.
Topics covered in this video:
- Creating a project in Github
- Cloning remote repositories from Github
- How to use Git to track your file changes
- Making commits to Git
- Pushing cha...
my webhook website?
what folder man?
file*
def get_new_token(old_token): # gets new refresh_token
headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}
data = {
'client_id': CLIENT_ID,
'client_secret': CLIENT_SECRET,
'grant_type': 'refresh_token',
'refresh_token': old_token
}
r = requests.post(
f"{API_ENDPOINT}/oauth2/token",
data=data,
headers=headers
)
print(f"\n\n{r.status_code}:{r.text}\n\n")
return r.json()
my function, which returns this:
400:{"error": "invalid_grant"}
my code seems identical to the docs sample (https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-access-token-response)
i have no clue what im doing wrong
;-;
then choose which one u wanna commit:/
Honestly terminal is easier
how?
how?
just use vsc
legit
ok so pop up the terminal
ok
and navigate to the folder with the source
how.
Are you passing the refresh token or access token? Sometimes these can be different things after the Oauth dance
bruh 
yes
No idea
On the button thereβs like a few buttons
did you use pycharm to create the project
Yes
Click terminal
done, what else
has the built in terminal opened?
Then enter the git commands
PS C:\Users\korisnik\PycharmProjects\PRCBot> git commands
git: 'commands' is not a git command. See 'git --help'.
Yes.
git add . # add all files in current directory
git commit -m "Useful message"
git push <remote name> <branch name> # commonly origin main
or just uh, follow that
what are those two <remote name> <branch name>
are you using github
yes
have you made a repository through the website yet
I did it all through terminal
git create and all that
ok so you'll need to set the origin URL
otherwise git push will fail
open the github website
The remote is the name of the github hosted remote git repository, commonly called origin. The branch is the git repo branch you are working on, and the target of where you want to push your commit to.
Also, yes, you will need to create a GitHub repo on their website before pushing anything from your local repo
actually maybe we should take this somewhere else
@modern fiber claim a help channel #βο½how-to-get-help i don't want to pollude this chat
and @ me there
Okay, I'll add you and do it later . Have to go yo school right now sadly, but thanks.
Really appreciated bro.
no problem, just remind me when you need help
@midnight gorge please don't ghost ping and remember our #code-of-conduct .
def get_new_token(old_token): # gets new refresh_token
headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}
data = {
'client_id': CLIENT_ID,
'client_secret': CLIENT_SECRET,
'grant_type': 'refresh_token',
'refresh_token': old_token
}
r = requests.post(
f"{API_ENDPOINT}/oauth2/token",
data=data,
headers=headers
)
print(f"\n\n{r.status_code}:{r.text}\n\n")
return r.json()
my function, which returns this:
400:{"error": "invalid_grant"}
my code seems identical to the docs sample (https://discord.com/developers/docs/topics/oauth2#authorization-code-grant-access-token-response)
i have no clue what im doing wrong
Are you passing the refresh token or access token? Sometimes these can be different things after the Oauth dance
oAuth dance lol
lemme dbuole check
hm it seems as if i am passing refresh
this question belongs to #965291516031549500 tho π
ooh never saw that channel tbh lol
how to add 2 url buttons in a embed ?
view = discord.ui.View()
view.add_item(button1)
view.add_item(button2)
userids is a list of authorized user ids
ty
button1 and button2 being discord.ui.Button objects
How to make sure that it does not go beyond the scope and does not fill up too quickly
wdym doesnt fill up too quickly
The fact that for a new level you need 233 exp, but 151 is typed and the bar is already full
And even went beyond
hmm
That is a math problem, not even directly programming
233 is 100% of the bar, 151 is x% of the bar.
Fill the bar with the x percentage
Which would be around 63% I believe
Anyone have any resources or advice on how to get started?
The documentation is your way to go
How about a percent sign?
I divide the amount of exp earned by the desired amount and multiply by 100 percent
!e
p = 100
x = 7331
y = 1337
print(f"Percentage: {100*y/x}")
@slate swan :white_check_mark: Your eval job has completed with return code 0.
Percentage: 18.23762106124676
Okay, thanks
@slate swan does lightbulb allow timing members out? π
uhhh nvm not required, forgot that discord has an in-built command for that
hikari does
hikari.Member.edit
hm thanks, I'd need the edit method later, but thanks a lot uwu
How do I disable a button?
And specify the button
!d discord.Button.disabled
Whether the button is disabled or not.
set this to True
i am getting this error please help
It says the value can only be read
How can I add when someone is using a slash command the bot also send that the user used the command?
@bot.event
async def on_command_completion(ctx):
channel = bot.get_channel(972146584852770856)
ce = discord.Embed(title=f"**Command used**", description=f"The command ``{ctx.command.name}`` was used by {ctx.author.mention}", color=discord.Color.blue(), timestamp=ctx.message.created_at)
await channel.send(embed=ce)
await asyncio.sleep(5)
where?
you need to create buttons with discord.ui.Button , not discord.Button
Where would that go? I dont have discord.button anywhere in my code
Ill try to send code
Hey @slate swan!
You either uploaded a .txt file or entered a message that was too long. Please use our paste bin instead.
I import from discord.ui import View, button
How to find the rank (Determined by level)?
is the rank global?
No, for each server separately
well, you will have to iterate through the records and check each record's level in that case
line 8, button.disabled=True
Create one instance and use that lol
class HelpDropdown(nextcord.ui.Select):
def __init__(self, help_command: "PaginatedHelpCommand", options: List[nextcord.SelectOption]):
super().__init__(placeholder="Choose a category", min_values=1, max_values=1, options=options)
self.help_command = help_command
async def callback(self, interaction):
embed = await self.help_command.cog_help_embed(self.help_command.context.bot.get_cog(self.values[0].lower()))
pages = HelpButtonMenuPages(
ctx=self.help_command.context,
source=HelpPageSource(self.help_command, self.help_command.embed_fields),
disable_buttons_after=True
)
await pages.start(self.help_command.context)
this sends a new message but i want it to edit the embed
nextcord-ext-menus btw
hm
how can i make it edit current message...
wait_time=3.0?
Anyone know how a bot command can create a list in json
i think your code is just going to fast
i think pages.start sends message not edits lol
so what you're trying is to make the code edit an embed?
Traceback (most recent call last):
File "C:\Users\Akai\AppData\Local\Programs\Python\Python38\lib\site-packages\nextcord\ui\view.py", line 371, in _scheduled_task
await item.callback(interaction)
File "C:\Users\Akai\Desktop\Sugari\cogs\info.py", line 13, in callback
pages = HelpButtonMenuPages(
File "C:\Users\Akai\Desktop\Sugari\cogs\info.py", line 67, in __init__
super().__init__(**kwargs)
File "C:\Users\Akai\AppData\Local\Programs\Python\Python38\lib\site-packages\nextcord\ext\menus\menu_pages.py", line 304, in __init__
super().__init__(source, **kwargs)
File "C:\Users\Akai\AppData\Local\Programs\Python\Python38\lib\site-packages\nextcord\ext\menus\menu_pages.py", line 32, in __init__
ButtonMenu.__init__(self, **kwargs)
File "C:\Users\Akai\AppData\Local\Programs\Python\Python38\lib\site-packages\nextcord\ext\menus\menus.py", line 837, in __init__
Menu.__init__(self, timeout=timeout, *args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'wait_time'
yup edit embed through dropdown
to send cog help
i'm still learning python so i am not sure
ask someone higher than me or wait for them to respond to this
you passed and extra keyword argument
yup ik removed it
@slate swan i need help here^
!d nextcord.Interaction.edit_original_message
await edit_original_message(*, content=..., embeds=..., embed=..., file=..., files=..., view=..., allowed_mentions=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the original interaction response message.
This is a lower level interface to [`InteractionMessage.edit()`](https://nextcord.readthedocs.io/en/latest/api.html#nextcord.InteractionMessage.edit "nextcord.InteractionMessage.edit") in case you do not want to fetch the message and save an HTTP request.
This method is also the only way to edit the original message if the message sent was ephemeral.
wait it's a paginator
Which library are you using?
await self.help_command.cog_help_embed(self.help_command.context.bot.get_cog(self.values[0].lower()))


π
It's heading for a total rewrite so yeah
you aren't even using embed and pages
is it actually?????
I found it, it should be on_application_command_completion
π
wdym im using
async def cog_help_embed(self, cog: commands.Cog) -> nextcord.Embed:
embed = nextcord.Embed(
title=f"{cog.qualified_name} Commands", colour=self.COLOUR
)
if cog.description:
embed.description = cog.description
filtered = await self.filter_commands(cog.get_commands(), sort=True)
for command in filtered:
name=f"> `{self.get_command_signature(command)}`"
value=command.short_doc or "..."
self.embed_fields.append((name, value))
embed.set_footer(text=f"Type {self.context.clean_prefix}help <command> for more info on a command.")
embed.set_author(name=f"{cog.qualified_name.capitalize()} Help", icon_url=self.context.bot.user.display_avatar)
return embed
async def send_cog_help(self, cog: commands.Cog):
"""implements cog help page"""
prefix = self.context.clean_prefix
invoked_with = self.invoked_with
embed = await self.cog_help_embed(cog)
pages = HelpButtonMenuPages(
ctx=self.context,
source=HelpPageSource(self, self.embed_fields),
disable_buttons_after=True
)
await pages.start(self.context)
bro i recommended disnake to do a total rewrite so they can be the best fork but i think im gonna contribute to nextcordπ³
is there any tutorial for making a website for discord bot settings ?
not sure how the website is able to access the server list etc.
inside help command @heady sluice
Yes
ill take a look at thatπ
but not these
Do you know what your code does?
Idk I have so many questions
which part?
cog_help_embed
its help embed function for cog?
Ask in #python-discussion
who knows about coding here
what kind of question is that
oh shi its appending the embed_fields everytime the command is ran
wrong server
whatβs up
dms
isnt there way to append it only once lol
π
hey krypton
^meh
is there any tutorial for making a website for discord bot settings ?
not sure how the website is able to access the server list etc.
hyd 
seen you allot here lately
terrible, got exams coming and i feel like i know nothing 
you?
sends a new message if the same button is clicked or when the paginator is clicked?
thats sad, well im still relaxing because i mostly finished school
it sends a new mesage when i select an option from dropdown
and i found another error
pog
I just got until the 10th of June
Then bye bye 
cog_help_embed appends embed_fields it everytime the function is run
disable the dropdown
yes but now i have anxiety that im not going to join the electronic course in my schoolπ
people won't be able to select another option once one was selected
just be confident, you probably tried your best and you can't do more
@commands.Cog.listener()
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
x = round(error.retry_after, 2)
await ctx.reply(f"Slow down, you can retry after {x} seconds")
```My codee
just like me for the military, i applied at the swiss armed forces but not sure if i will get in - but i tried my best
that has got nothing to do with no setup function
what is it then?
you've got no setup function
well im the only student in my class that knows about computers and programming so i have a bigger chance but i write like a five year old and it doesnt look professional π
but how do do setup for a listener?
you do setup for the cog
its not in a cog
writing is most likely not the only thing they take attention to honestly
just a setup function in the file
oh wow
even if i disabled dropdown under callback it will still send a mssage not edit
pls help im dumb
yeah i hope they dont judge it
how do i ddo that?
but you cant assume people these days
ah edit THAT
bro π
import discord
from discord.ext.commands import *
from googlesearch import search
import danksearch
import asyncio
from discord.ext import commands
@commands.Cog.listener()
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
x = round(error.retry_after, 2)
await ctx.reply(f"Slow down, you can retry after {x} seconds")```
a picture of a waifu?π€¨
what i do here
that's not how the library works
if you have references, projects or similar you can most likely get a chance
than ho do i put listeners in another file?
i was asking how to do that only lmfao
oh so i cant use extension?
pages.start sends not edits
that's probably what might get myself in the swiss armed forces honestly
well not really but i have told what im able to do and ive had vouches from allot of my teachers
yes you can... with cogs
pages.edit does not exist
no like without having a class
no
rip
probably enough
how long until you know?
@slate swan How do i purge the last 50 messages in a channel since the delete_messages method requires an iterable with message ids and I don't got those ids otherwise I'll have to get the history and dew it
make a start like that but not like that
how then?
Use the purge method
!d discord.TextChannel.purge
await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Purges a list of messages that meet the criteria given by the predicate
`check`. If a `check` is not provided then all messages are deleted
without discrimination...
I'm using hikari
you could like copy paste the start method and edit the part you don't like
Doesn't it have something similar?
nope, it doesnt
also embed_fields was getting appended multiple times which can be fixed by set() but uh how do i remove {}?
check the docs idk
That's yikes
I did, its only got delete_message and delete_messages
and its requiring an iterable for the ids which only means extra requests for grabbing the message objects by fetching the history
don't use a set
just self.embed_fields = [] at the start of cog_help_embed
oh alright
so it's reset
Suprisingly, discord.py does something similar to purge: https://github.com/Rapptz/discord.py/blob/master/discord/abc.py#L135
discord/abc.py line 135
iterator = channel.history(limit=limit, before=before, after=after, oldest_first=oldest_first, around=around)```
thanks, but im still confused with the edit part
do you have any example?
π
π
this is what i found
messages = (
await bot.rest.fetch_messages(channel_id)
.take_until(lambda m: datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(days=14) > m.created_at)
.limit(count) # Limit the messages to the amount you want deleted
)
# Where channel ID is the channel you are deleting the messages from
await bot.rest.delete_messages(channel_id, messages)```
slaps you back
fuck i hate mobile lol
I know-
ye then idk
that's not a slap
π
It's like hi π
not hi π (hi take slap )
from . import (
utils as utils,
opus as opus,
abc as abc,
ui as ui,
app_commands as app_commands,
)
lmao what
ikπ
Sus relative import
Huh??
the relative imports with parenthesisπ
Ye I see
from.
(. )
that just means from the current folder
.. means from the parent folder and so on

no thats not the problem, why is it import xyz as xyz
i need help
Ask
And that's for what this channel is for, just ask.
https://github.com/Rapptz/discord.py/blob/master/discord/__init__.py#L46-L52 danny is smoking diff stuff
discord/__init__.py lines 46 to 52
from . import (
utils as utils,
opus as opus,
abc as abc,
ui as ui,
app_commands as app_commands,
)```
why does this work
How to find the maximum level among all participants on the server? MongoDB
but this wont
wtf was danny onπ
Ye?
sparky = 1
I've already reached out but no one is answering.
are u in inter or commanf
Is this thing a command
Or event
it doesnt work in event nor does it work in command
Sorry but this channel is not really a suitable place to ask, you may try to use a personal help channel
Show ur code
Good, thanks
Because there are different things you have access to
ctz. Autor
Id
I hate typing in mobile
lol
There's no event called "balance" what are you trying to do
im tryna make an economy boy
It's supposed to be a command, decorate it with command
bot?
bot
?
okay
ill try fixing it again but if it doesnt work ill come back
ok
thanks for helping
.
sparky how do i put gif in messgae?
message*
like
here gif```
ctx.send("gif link")
uh
not that
?
like i wanna to but some rainbow line down and up message
ctx.send("message\n\nurl")
!e
print("message \n \n \n gif" )
@slate swan :white_check_mark: Your eval job has completed with return code 0.
001 | message
002 |
003 |
004 | gif
To purge messages you need to:
- fetch the history of the channel you want to purge
- bulk delete all fetched messages (after filtering)
# bulk delete only allows deleting messages younger than 14 days
bulk_delete_limit = datetime.datetime.now(datetime.timezone.utc) - datetime.timedelta(days=14)
iterator = (
bot.rest.fetch_messages(channel_id)
.take_while(lambda message: message.created_at > bulk_delete_limit)
.filter(lambda message: ...)
.limit(500) # remember to set a reasonable limit to avoid ratelimits
)```
```py
# simple but slow, fetches the entire history before deleting
await bot.rest.delete_messages(channel_id, await iterator)
# with chunking, deletes progressively
async for messages in iterator.chunk(100):
await bot.rest.delete_messages(channel_id, messages)
# with chunking and tasks, deletes concurrently but won't stop at the first error
tasks = []
async for messages in iterator.chunk(100):
task = asyncio.create_task(bot.rest.delete_messages(channel_id, messages))
tasks.append(task)
await asyncio.wait(tasks) # this is optional```
sarthak really
in this message with ```
im gonna die
and down is like gif
that line
sarthak should be a teacher π
thankeeeee Sarthak
up is message and down is line
no
i just did /tag purge, and copy pasted the output here
LOL
π« thanks, I'll ask in the hikari server next time to not disturb you every time
sarthak is such a lovely friend
very
πΆββοΈ its fine though
sarthak
ye
i connected to the gateway successfully yesterday with my implementation
oh damn
yea i saw in the thread
best feeling ever it felt like i made my first botπ
I don't like disturbing you π
im back
I read that as boy
i still cant fix this thing
im free most of the time so yea
bro, u got an exam tomorrow
await ctx.send('msg/nlink')
πΏ bro, i've been studying for 3 days straight
not today.
damn
Then sleep and ace in chem tomorrow
yea but when i put link it send the link gif dosen't load
url of gif*
sarthak wont fail hes an indian lad!
and all the indian lads are smart!
i don't think im gonna sleep today
racist
ok download the gif then send it as discord.file
π
here to send?
its not racist i ment my lads
yours
so hunter and sarthak are my indian lads
read the docs
#?
he is
check his github πΏ
ahem
he lied π
he said hes indian so he identifies as indian
π³
makes sense
that stays there
robin isnβt an indian name therefore heβs not indian
the message is just as bad as his dropdown examples
neither hunter is
π
!e discord.ui.button
!d discord.ui.button
discord.ui.button(*, label=None, custom_id=None, disabled=False, style=<ButtonStyle.secondary: 2>, emoji=None, row=None)```
A decorator that attaches a button to a component.
The function being decorated should have three parameters, `self` representing the [`discord.ui.View`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.ui.View "discord.ui.View"), the [`discord.Interaction`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.Interaction "discord.Interaction") you receive and the [`discord.ui.Button`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.ui.Button "discord.ui.Button") being pressed.
Note
Buttons with a URL cannot be created with this function. Consider creating a [`Button`](https://discordpy.readthedocs.io/en/master/interactions/api.html#discord.ui.Button "discord.ui.Button") manually instead. This is because buttons with a URL do not have a callback associated with them since Discord does not do any processing with it.
average thoughts prior exam day
lmao
i want to go through nextcords because sifte told me theyre doing a total rewrite which i think im gonna commit to it but i cant rn because im having issues with my ispπΏ π
π€‘ i should be not, but am confident thats its gonna be a 30+/35
can someone help me for style of button?
wish you the best of luck π«
style=ButtonStyle.green?
Yea
!d discord.ui.Button has the style kwarg
class discord.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.
!d discord.ButtonStyle.green
idk if im getting ignored allot or if my client cant send messages i cant tellπ
thats gonna be interesting
yeah ill probably commit allot to it because i told disnake about it and they didnt like the idea
would that be still a fork-ish library, or completely different
help to make it
probably a completely different
i told disnakes team to rewrite the old codebase but they disagreed so ill probably check out nextcords
i hate the old codebase its so old and bad
lol what
we dont have enough time to rewrite everything from scratch
We?
heyo i have a problem with bot.process_command can someone help?
Anyone help me with uni work?
It's better for us to just upgrade the existing codebase and switch out the bleh bits
Yes
Yeah I'm a disnake admin 
Itβs hard haha
Wo cool
code and error?
It mostly consists of @vast gale telling me to review stuff 
summer is coming up so better start
#help-apple if you want to help π
Summer is more busy for me than not summer lol
I don't have school/uni, so summer is when I do actually do things - holidays
then better get started before summer comes up
But we're already rewriting nextcord from scratch 
π
I can't do more 
ill contributeπ³
honestly most of the process rn is waiting for epic to rewrite http for the 17th time so it's perfect
seems pretty cool and i like the idea
and then epic finds something else they dont like and rewrites it again 
ugh just like meπ
i rewrote my gateway implementation like 7 times already
hello
how do u check the src in vsc?
hello
π
I'm on my uh... 13th discord lib I'm writing
what is up with creating wrappers from scratch? why is it so popular, instead of adding new features to existing ones
I have issues
yes you do
dpy's backend is not the most amazing code ever, it's nice to replace it with shiny modern code
okimii typo confirmed?
how do you even get name ideas for them
btw vco didn't you have the helper role?
I have a list of words and a call to random.choice() 
π³
Yup, now I dont :P
π³ where does that list come from
the internet
why not?
I just got a big list and saved it
ow
Reasons I don't really wanna go into
ah thats fine
pitch: So you know the two most popular forks right?
client: no
pitch: disnake and pycord
Client: mhm
pitch: so what if, we name our fork the first part of disnake and the last of pycord?
Client: (thinks) wait b-
pitch: DISCORD, we'll name our new fork discord!
ez
technically the 2 most popular are nextcord and pycord
shhh

hey wait, we can name our fork, the first part of nextcord and the last of pycord, NEXTCOR- wait
log π
=π§log π

yeah but nextcords implementation isnt as bad as pycords
.topic
**What feature would you be the most interested in making?**
Suggest more topics here!
idk
pycake
I've made most of them at this point, most interesting was ai based automod
us programmers have no creativity, we do whatever stupid shit the client wants
nice
the amount of times i have pressed shift+i in discord to get the start of the line is unreal
start of the line?
vim
oh lol
shift+i takes cursor to start
shift+a takes it to the end
my brain just completely didnt register what line meant lmao
vco?
thats me
i know
vco
ah lol
What's going on here
π³ procastination
Can i ask for help vco?
ya sure
what is vco
no
async def ban(ctx, user: discord.Member, *, reason=None):
if reason == None:
reason = f"{user} banned by {ctx.author}"
await ctx.user.send(f'You have been banned for Reason: {reason}')
await ctx.guild.ban(user, reason=reason)
ctx.author
just user.send
its a ban command and hes trying to message the person thay has been bannedπ
sure, I might not be the one to answer but you're welcome to ask here
i just read the last line π
Imagine ban msg and can't ban
π
it ignores the prefix at bot.process_command
I did the opposite on a server I moderated once, it ran a check to see if I could ban myself and sent a message saying "You can't ban yourself" but i forgot the return statement
It banned me
lmao
that's bullshit
Lol
wait you made the tutorial didn't u
I did indeed
I still hate what you said
In case you think I mean biggest libs I specifically mean biggest forks of dpy
from the very deep of my heart
vcokltfre can you say me why?
restart ide maybe?
from onMessage import hackMessage π³
yeah with v3 we're completely removing discord namespace
@vocal plover were u a helper b4 in this server?
im loving this server
when does that message supposed to be sent?
yeah he was
ya i remember that log status π
that's a selfie of me
Why is it ignoring the prefix?
I use bot.process_command (nextcord)
dont ask how i got it
hecker
u dont have hands, u can't code ....
(dont say tts)
stt
fuck
huh?
i knew i messed up, though it would slip past
speech to text coding
ur bot doesn't have any attr called db, make it b4 using lol
bot.db = ...
do exit()
Python allows you to set custom attributes to most objects, like your bot! By storing things as attributes of the bot object, you can access them anywhere you access your bot. In the discord.py library, these custom attributes are commonly known as "bot variables" and can be a lifesaver if your bot is divided into many different files. An example on how to use custom attributes on your bot is shown below:
bot = commands.Bot(command_prefix="!")
# Set an attribute on our bot
bot.test = "I am accessible everywhere!"
@bot.command()
async def get(ctx: commands.Context):
"""A command to get the current value of `test`."""
# Send what the test attribute is currently set to
await ctx.send(ctx.bot.test)
@bot.command()
async def setval(ctx: commands.Context, *, new_text: str):
"""A command to set a new value of `test`."""
# Here we change the attribute to what was specified in new_text
bot.test = new_text
This all applies to cogs as well! You can set attributes to self as you wish.
Be sure not to overwrite attributes discord.py uses, like cogs or users. Name your attributes carefully!
)()
they need a better fuzzy matching for tags ...
read the tag
I will translate it to you in German if I really have to
jk I won't
or will I
by before that i dont the previous line, i mean before u use bot.db define it somewhere
bro, how did u write code to stuff with dc without initializing the stuff for db
wait, imma pull out that message
but the guy in the tutorial has something like bot.db = connectshit
I don't know aiosqlite
no I'm assuming from the fact that he uses bot.db
@slate swan
DB_SETTINGS = {
'host': '...',
'port': ...,
'database': 'postgres',
'user': 'pi',
'password': '...'
}
bot.db = bot.loop.run_until_complete(asyncpg.create_pool(**DB_SETTINGS, ssl='require'))
```look it looks like this in my bot
yes....
but my internet got shut down once, now I can't start or connect to my db
