#discord-bots
1 messages · Page 9 of 1
Yes.
Just look up an aiohttp tutorial
to the person who executes the cmd
I did and it didnt work
Pls @ me when ur done :)
Outdated videos,codes
Seems too general and beyond the scope of this channel, this isn't really a discord question
First, create a command
Then in what the command does make the request
I cant really get help from that I need an example
@slate swan
session = aiohttp.ClientSession()
response = session.get(API_ENDPOINT)
then what are you trying to do? outpuut the response data to the discord channel? @slate swan
Yes
dont do that.
use context managers
I know this but can you actually explain the benefit?
Client.command():
async def main():
async with aiohttp.ClientSession() as session: async with session.get('http://httpbin.org/get') as resp: print(resp.status) print(await resp.text())
Does it close the session auto at the end?
Will this work
No because you're not printing, you need the method to send a message into a discord channel
it closes the connections when needed and doesnt keep a unclosed connection opened
no
Gotcha
@slate swan can u show me??
How
Say I had code where I was closing connections, does it matter? Is it cleaner to add extra nesting vs the closing line? I understand I'd have to close potentially in many scenarios including if an exception is thrown
@slate swan can y make an example pls
You're giving like zero context dude
Look up how to send a message in a discord channel with a bot command
Then pass in the response to that
Bro I tried i cant
@bot.command()
async def addrole(ctx: commands.Context) -> None | discord.Message:
if ctx.guild is None:
return await ctx.send("Cannot invoke command in a DM")
await ctx.author.add_roles(id)
iirc
https://account.fyremc.hu/api/player/Zoli
I need this api when I run command .stats so the api responds the stuff
Is the -> meant to be there
!pep 484
a return annotation, it shows the return value of the function
annotations
Ah okay
@slate swan help pls
Im so confused
it's okay lol
a return annotation, it shows the return value of the function
And the | ?
same thing pretty sure, i only use -> so you'd have to ask okimii
Someon help
If they're confusing so much this is the same thing without the annotations,
@bot.command()
async def addrole(ctx: commands.Context):
if ctx.guild is None:
return await ctx.send("Cannot invoke command in a DM")
await ctx.author.add_roles(id)
its better as it handles the connections over closing it yourself per each request
make a request and call json() on it then just parse it for the info you need
Can u make example
sure gimme a few
@slate swan not working.
@bot.command()
async def verify(ctx: commands.Context):
await ctx.reply(f"{ctx.author} successfully verifed ✅")
if ctx.guild is None:
return await ctx.send("Cannot invoke command in a DM")
await ctx.author.add_roles("989994149954592798"")
im new tbh
because the id has to be an int
how?
remove the quotes
@client.command()
async def request(ctx) -> None:
async with aiohttp.ClientSession() as cs:
async with cs.get("https://account.fyremc.hu/api/player/Zoli") as r:
res = await r.json()
username = res["data"]["username"]
print(username)
@slate swan, note you should probably make one single session locally
await ctx.author.add_roles("989994149954592798"")
why double ""?
y9 what did we talk about opening sessions per each command call >:(
Add_roles takes an arbitrary amount of discord.Objects
You can either get the role representation, or use discord.Object
Which is much simpler
I'm too lazy
@client.command()
@commands.has_permissions(administrator=True)
async def addrole(ctx, role: discord.Role, user: discord.Member):
await user.add_roles(role)
embed = discord.Embed(color=0xff0000)
embed.add_field(name="Role added to user",
value=f"Role: {role.mention} User: {user.mention}",
inline=True)
embed.set_author(name=ctx.author.display_name,
icon_url=ctx.author.avatar_url)
embed.set_footer(text=f"Popsmoke")
await ctx.send(embed=embed)
@cold tide
😭
where do i define the role id? @slate swan
the argument naming😔
Isn't it response.status_code?
Someone help??
@bot.command()
async def verify(ctx, user: discord.Member, role: discord.Role):
await user.add_roles("989994149954592798")
await ctx.send(f"Successfully verifed ✅ {ctx.author.name}, has been giving a role called: {role.name}")
@slate swan when I typed the command it didnt respond in channel and it said only the name in console "Zoli" it didnt say the other things
someone help 🙏
because that's all the code I gave you does...
How can I make it say it in channel and other stuff too
user.add_roles(user="id") ?
how can i manage the permissions of a channel, so a user can't send messages?
i've tried:
overwrites = {
ctx.guild.default_role: discord.PermissionOverwrite(view_channel=False),
ctx.author: discord.PermissionOverwrite(
view_channel=True,
read_messages=True,
send_messages=False
)
}
await ctx.channel.edit(overwrites=overwrites, topic=f"{ctx.author.id} - (CLOSED)")```
but this isn't working for some reason
@slate swan ???
I'm convinced you don't know discord.py or basic python..
await ctx.send
Ik but I want it to send everything
await ctx.send("enter")
@slate swan still says missing user
@slate swan
Code is
A user was not passed when executing the command
How do i fix it?
How do you use the command?
@slate swan i managed to do it one by one but how can I do it so it sends all the data in 1 command
f strings.
f"{variable} {variable}" etc..
What about those
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
I'm not convinced you understand basic python.
this is pretty basic stuff your asking for help on.
Do I put every data below each other ?
Like username =
Rank =
Etc
You can define new variables which return different information yes.
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Dude, for your own sake go learn python and programming before trying to interact with an api or library like discord. You're shooting yourself in the foot here. If you don't understand variables, parameters, types, classes, objects, etc it is going to be very hard to help you with a library that assumes you know basic programming
Whenevery i try and run a function inside a on_submit it just can't start the bot. Any ideas or similar errors why?
How can i make a event that runs every frame?
What do you mean by "frame"?
Are you talking about gaming modules? Since modules like arcade and pygame have those events
Nah, nvm i thought there was smth like that
@paper sluice i kinda fixed the dict thing but some ppl with that role see it
I wonder whats the prob
do they have roles higher than the edited role u assigned with the bot?
No
Just a member
The bot only has that
hmm wait a sec lemme check the docs
Instead of authorPerm, i also tries ctx.author: discord.....
Okay
I'm trying to add a role to all members of my server, but doing guild.members only returns a list with the bot as the only member
members intent?
@bot.event
async def on_ready():
logging.info('We have logged in as {0.user}'.format(bot))
guild = bot.get_guild(277684407806984194)
role_one = guild.get_role(1002344541724094524)
role_two = guild.get_role(1002344976975417395)
role_three = guild.get_role(1002346994460786708)
role_four = guild.get_role(1002346309296083037)
for member in guild.members:
await member.add_roles(role_one, role_two, role_three, role_four)
my code
Bot has administrator privileges
no intent from dev page
What intent do I set to?
intents=discord.Intents.default()
I'd recommend against API requests in on_ready
Agreed but it's just a quick one time use thing
yes so intents which are needed is members and message intent
Using a real bot so I don't have to readd to my server lol
so enable them in dev page and in code
Any idea how in code?
intents=discord.Intents.members is a no go since that's a flag
!intents
Using intents in discord.py
Intents are a feature of Discord that tells the gateway exactly which events to send your bot. By default discord.py has all intents enabled except for Members, Message Content, and Presences. These are needed for features such as on_member events, to get access to message content, and to get members' statuses.
To enable one of these intents, you need to first go to the Discord developer portal, then to the bot page of your bot's application. Scroll down to the Privileged Gateway Intents section, then enable the intents that you need.
Next, in your bot you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:
from discord import Intents
from discord.ext import commands
intents = Intents.default()
intents.members = True
bot = commands.Bot(command_prefix="!", intents=intents)
For more info about using intents, see the discord.py docs on intents, and for general information about them, see the Discord developer documentation on intents.
@smoky cedar 
Thank you sir
Send your whole 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.
Wdym?
^^
I'm trying to set up my bot on heroku but it isn't showing in the site. When I do git push heroku master it works fine but it says "Procfile declares types -> (none)" in the middle. Anyone know the solution?
Only that?
what? I'm asking you to paste your code.
Oh
Wait
@bot.command()
async def CreateTeam(ctx):
if f"{ctx.author.display_name}'s team" not in [roles.name
for roles in ctx.author.roles]:
roles= await ctx.guild.create_role(name=f"{ctx.author. display_name}'s team", reason=None)
embed = discord.Embed(title="Team Succesfully Created!", description=("Use $AddMember @User to add a member"), colour = 0xb0305c)
await ctx.author.add_roles(roles)
#authorPerm = discord.utils.get(ctx.guild.roles, name =f"{ctx.author.display_name}'s team")
#overwrites = {ctx.author: discord.PermissionOverwrite(view_channel=True), guild.user: discord.PermissionOverwrite(view_channel=False)}
channel = await ctx.guild.create_text_channel(name=f"{ctx.author.display_name}'s team", reason=None, overwrites =None)
await channel.set_permissions(f"{ctx.author.display_name}'s team", view_channel=True,overwrites=None)
await ctx.channel.send(embed=embed)
if f"{ctx.author.display_name}'s team" in [roles.name
for roles in ctx.author.roles]:
await ctx.channel.send("You Already Have A Team!")
@slate swan ..
?
the error quite says it all, types dont match😅 🤷♂️
Do i put ctx.author.roles()?
property roles```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role") that the member belongs to. Note that the first element of this list is always the default [‘@everyone](mailto:'%40everyone)’ role.
These roles are sorted by their position in the role hierarchy.
yeah, its not...
anyone with experience on hosting bots on heroku?
How would i put roles there then?
Yeah me
did your bot appear on the site the first time?
Yep it worked
you just followed the tutorial in the site?
!d discord.TextChannel.set_permissions @slate swan
await set_permissions(target, *, overwrite=see - below, reason=None, **permissions)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sets the channel specific permission overwrites for a target in the channel.
The `target` parameter should either be a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role") that belongs to guild.
The `overwrite` parameter, if given, must either be `None` or [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite"). For convenience, you can pass in keyword arguments denoting [`Permissions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions "discord.Permissions") attributes. If this is done, then you cannot mix the keyword arguments with the `overwrite` parameter.
If the `overwrite` parameter is `None`, then the permission overwrites are deleted.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to use this...
No
dont forget about ClassNaming which is in UpperWord
How would i now which channel to change perms
yeah my fault
docs are layed out by classes and attributes!
@slate swan Can't he set the target as the role ID?
has to be an object
and i got to go, i need to work on something😭
Okay see ya later
👋
whats the best way to implement per-server and per-user settings for a discord bot?
Anyone?
Okay wait
Isnt that the same?
i'm trying to run my bot on a macos but i get this: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')] Does anyone know why?
@thorn grove try this
@thorn grove try this actually
@bot.command()
async def CreateTeam(ctx) -> None:
if f"{ctx.author.display_name}'s team" not in [roles.name for roles in ctx.author.roles]:
roles= await ctx.guild.create_role(name=f"{ctx.author.display_name}'s team", reason=None)
embed = discord.Embed(title="Team Succesfully Created!", description="Use $AddMember @User to add a member", colour = 0xb0305c)
await ctx.author.add_roles(roles)
#authorPerm = discord.utils.get(ctx.guild.roles, name =f"{ctx.author.display_name}'s team")
#overwrites = {ctx.author: discord.PermissionOverwrite(view_channel=True), guild.user: discord.PermissionOverwrite(view_channel=False)}
channel = await ctx.guild.create_text_channel(name=f"{ctx.author.display_name}'s team", reason=None, overwrites=None)
channel = discord.utils.get(ctx.guild.channels, name=f"{ctx.author.display_name})
channel_id = channel.id
await channel.set_permissions(bot.get_channel(channel.id), view_channel=True, overwrites=None)
await ctx.channel.send(embed=embed)
if f"{ctx.author.display_name}'s team" in [roles.name for roles in ctx.author.roles]:
await ctx.channel.send("You Already Have A Team!")
Okay
try that instead
@slate swan
paste your code
actually
wait
channel = discord.utils.get(ctx.guild.channels, name=f"{ctx.author.display_name}")
replace that line with this
@slate swan yeah you forgor "
that was my bad, I forgot the last quotation mark
you sure the channel was created?
invite me to the server
You forgor 's team
Still shows error
what error
That
Idk your code is really sloppy but just get the channel object and put it instead of what I put
Okay ಥ‿ಥ
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
I didn't even check
I assumed it would be a channel
and yeah I just confused myslef
It is role object
So i need to get the role id?
rolename = discord.utils.get(ctx.guild.roles, name="ROLENAME")
What would i put in set_permissions then?
I made a batch file that would automatically activate my bot but now I can't close it???
I tried Ctrl + C on the CMD but it's still online
What's the code you used
for the batch?
I treid rolename as the target but the error says invalid permissions
yes
I don't feel like helping with that rn lmao it's all over the place
did you enable intents
ಥ╭╮ಥ okay
No, is that a permission or smth?
it doesn't let you close the .bat file?
yeah, try adding this
so when I Ctrl + C on the bat file's CMD
press the X?
it gives me that Y/N option and if I press Y then it goes out
oh wait
...the bot's off
lmao I think it just lagged for a long time
sorry
I use commands, and how would intents help me?
if u have all then why do u need intents.members=True💀
I don't know much myself tbh, I just heard that you need to manually enable intents to subscribe to certain events
so when I see "invalid permission" I just assume it has to do with intents
I think I added it at the beginning when I was getting errors and forgot to remove it 💀
if it doesn't work then you might have to enable privileged intents on Discord Developer Portal
Sedಥ_ಥ
Lemme try
I dont see it in 0Auth
it's in Bot
Okay
you don't see this?
Oh wait
@slate swan its on
Still shows error
ಥ╭╮ಥ ill just scrap this idea
Sed
can some one help me when i put my code together some of the scripts dont work cause on_message is blocking them i puted on_message as last script and then it worked but then i codet somthing new and its not working anymore
idk if its cause of on_message ore idk if i run it solo it works just not if i put it in the same file
devastating
Hey, can someone help me rq?
@app_commands.checks.has_role(requiredrole)
@app_commands.guilds(999122105281036319)
async def sendticketmessage(interaction: discord.Interaction):
view = TicketButtons()
embedd=discord.Embed(title=":tickets: Tickets", description="To create a ticket, please click one of the buttons below..\n\n**:art: Commissions**\n\n**:writing_hand: Applications**\n\n:envelope: **Support**", colour=0x33ECFF)
await interaction.response.send_message(embed=embedd, view=view)
@sendticketmessage.error
async def sendticketmessage_error(interaction: discord.Interaction, error: app_commands.AppCommandError):
if isinstance(error, app_commands.MissingRole):
embed=discord.Embed(title=":no_entry: No permission", description="You do not have the required permission to run this command!", colour=0xff1100)
embed.add_field(name="Role required:", value=requiredrolemention)
await interaction.response.send_message(embed=embed)
return
raise error```
The cog is loading yet this cmd wont load
sed
Super confused now lmao, been messing with it for a while. It worked fine in another server but i just moved it and now it wont. Other cmds work fine
@app_commands.command(name="sendticketmessage", description="ADMIN | Send ticket message.") #View added
@app_commands.checks.has_role(requiredrole)
@app_commands.guilds(999122105281036319)
async def sendticketmessage(interaction: discord.Interaction):
view = TicketButtons()
embedd=discord.Embed(title="🎟️ Tickets", description="To create a ticket, please click one of the buttons below..\n\n**🎨 Commissions**\n\n**✍️ Applications**\n\n✉️ **Support**", colour=0x33ECFF)
await interaction.response.send_message(embed=embedd, view=view)
@sendticketmessage.error
async def sendticketmessage_error(interaction: discord.Interaction, error: app_commands.AppCommandError):
if isinstance(error, app_commands.MissingRole):
embed=discord.Embed(title="⛔ No permission", description="You do not have the required permission to run this command!", colour=0xff1100)
embed.add_field(name="Role required:", value=requiredrolemention)
await interaction.response.send_message(embed=embed)
return
raise error
Oh sorry i forgot py
did u sync?
I didnt send all the code as theres 1k+ lines
Just the cmd, rest is views
Cog is loaded tho
^^
Wdym
have u used classes before?
Yea, u dont need self for that
🗿
!e
class A:
x = 7
def foo(self):
print(self.x)
b = A()
b.foo()
@shrewd apex :white_check_mark: Your 3.11 eval job has completed with return code 0.
7
it's a command in a cog 😔
Letme just
# Imports
import asyncio
import discord
from discord.ext import commands
from discord import app_commands
import json
# Cog subclass
class TicketCore(commands.Cog):
def __init__(self, bot):
self.bot = bot # Allows us to use the bot outside of the __init__ function
self.bot.tree.add_command(sendticketmessage) # Register the slash command in our bot
global botglobal
botglobal = bot
configjson = open("config.json")
# config should be file name, () gotta be var above
config = json.load(configjson)
serverid = int(config["serverid"])
requiredrole=int(config["roles"]["ticketstaffrole"])
requiredrolemention = "<@&" + str(config["roles"]["ticketstaffrole"]) + ">"
commissioncategory = int(config["channels"]["ticketcategorys"]['commissions'])
applicationcategory = int(config["channels"]["ticketcategorys"]['applications'])
supportcategory = int(config["channels"]["ticketcategorys"]['support'])
artpostchannel = int(config["channels"]["artpostchannel"])
fursuitpostchannel = int(config["channels"]["fursuitpostchannel"])
layoutartistdict = config['artistdict']
configjson.close()
@app_commands.command(name="sendticketmessage", description="ADMIN | Send ticket message.") #View added
@app_commands.checks.has_role(requiredrole)
@app_commands.guilds(999122105281036319)
async def sendticketmessage(interaction: discord.Interaction):
view = TicketButtons()
embedd=discord.Embed(title="🎟️ Tickets", description="To create a ticket, please click one of the buttons below..\n\n**🎨 Commissions**\n\n**✍ Applications**\n\n✉ **Support**", colour=0x33ECFF)
await interaction.response.send_message(embed=embedd, view=view)
@sendticketmessage.error
async def sendticketmessage_error(interaction: discord.Interaction, error: app_commands.AppCommandError):
if isinstance(error, app_commands.MissingRole):
embed=discord.Embed(title="⛔ No permission", description="You do not have the required permission to run this command!", colour=0xff1100)
embed.add_field(name="Role required:", value=requiredrolemention)
await interaction.response.send_message(embed=embed)
return
raise error
async def setup(bot):
bot.add_view(TicketButtons())
bot.add_view(UserQuoteView(channelvar=None, options=[]))
bot.add_view(ArtistReplyButtonDisabled())
bot.add_view(UserReplyButtonDisabled())
bot.add_view(UserQuoteButtonDisabled())
bot.add_view(ArtistReplyButton(channelvar=None))
bot.add_view(UserReplyButton(channelvar=None, artist=None))
bot.add_view(ArtButtons(channelvar=None))
How to open a file thru py??
and what 😔
Again, its the same code and this worked
and what happens now is interaction becomes the new self
just wanna know lol
In another server
Only broke once i moved it to the new server
Where @app_commands.checks.has_role(requiredrole)
should be fine, i use it in other cmds
ohkay
And the guild is right
i see what
if that's ur indentation in ur code that command is not even in a cog
Yea it is?.. lol
and it's the first time i am seeing someone need global while in a class
# Imports
import discord
from discord.ext import commands
from discord import app_commands
import platform
import psutil
import json
# Cog subclass
class BotInfo(commands.Cog):
def __init__(self, bot):
self.bot = bot # Allows us to use the bot outside of the __init__ function
self.bot.tree.add_command(botinfo) # Register the slash command in our bot
configjson = open("config.json")
# config should be file name, () gotta be var above
config = json.load(configjson)
serverid = int(config["serverid"])
configjson.close()
# note!! need to change to cmd groups
@app_commands.command(name="botinfo", description="Get infomation about the bot.")
@app_commands.guilds(serverid)
async def botinfo(interaction: discord.Interaction):
# code
commands = [cmd.name for cmd in interaction.client.tree.walk_commands(guild=discord.Object(id=811284392156725339))]
embed = discord.Embed(title=f":tools: {interaction.client.user.name} bot details", colour=0x33ECFF)
embed.add_field(name="• Bot details:",
value=f"> Uptime: <t:{interaction.client.uptime.timestamp():.0f}:R>\n> Commands loaded: ``{len(commands)}``\n> Cogs: ``{str(len(interaction.client.cogs))}``")
embed.add_field(name="• Softwere details:",
value=f"> Python version: ``{platform.python_version()}``\n> Discord version: ``{discord.__version__}``")
embed.add_field(name="• Server details:",
value=f"> CPU: ``{psutil.cpu_percent()}%``\n> RAM: ``{round(psutil.virtual_memory().available * 100 / psutil.virtual_memory().total)}%``")
embed.add_field(name="• Developers:", value="> @indigo pilot\n> @west estuary")
await interaction.response.send_message(embed=embed)
# Sets up the cog
async def setup(bot):
await bot.add_cog(BotInfo(bot))```
same indentation as this and this cmd loads fine
Needed it for on_timeout

Im litterly so confused, the cog is loaded but this single cmd wont sync
at start i thought maybe its due to discord mobile but the command is not in the cog ur indentations is wrong
But it is? Again the botinfo cmd i sent, its the same indentations and that cog and cmd loads fine
just adding stuff inside a class keyword without care about indentation dosent add the command in the cog
self.bot.tree.add_command(botinfo)
its this line which is adding the command in the cog
the command itself is not in the class
and thats not even the way to use cogs
Js layout >
nvm when u actually have time read up on how to use classes and oop
Yea just tested this was the issue lol
Anyways thanks 4 trying
cya
what service or technologies do bots like MEE6 Bot use to generate customized images for each guild/server & users ?
wait i'll show you
if they are coded in python only best choices are pillow and opencv
@silk fulcrum
then this @glossy shore
ok thank you (:
Hii
iiH
Like i want command work on every possible case in small and capital letters, if command name is ban , or aliases is the only option 🤔
Like it work on Ban , BAN. , bAN , BaN
Etc....
there is a case insensitive kwarg use that
you could do that to all commands by doing case_insensitive=True in Bot definition
class discord.ext.commands.Bot(command_prefix, *, help_command=<default-help-command>, tree_cls=<class 'discord.app_commands.tree.CommandTree'>, description=None, intents, **options)```
Represents a Discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
Unlike [`discord.Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client"), this class does not require manually setting a [`CommandTree`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.CommandTree "discord.app_commands.CommandTree") and is automatically set upon instantiating the class.
async with x Asynchronously initialises the bot and automatically cleans up.
New in version 2.0.
Not for a single command? 🤔
all commands
Is it a good way to design a bot ? Just asking
mostly use lower case
:lemao: I have to use 2 more tables in db because those 2 are lists
What's tree class here ?
Ohhh k k 👀 👀
is it worth using discord.py 1.x or should I use 2.0?
i recommend 2.0 in case you'll use it some time in future, and if you won't, i can't give advice, but i'd use 2.0 cus to me it's easier to understand
?
okay, thanks
just for example, instead of this, you could just use else
I'm hosting my bot on heroku so idk if the 2.0 will work there
it should
that's just same pip install, but instead of discord, it's git+https://github.com/Rapptz/discord.py
But im talking about the problem
i already said
it's read_messages
not view_messages
are there any major changes between 1 and 2.0?
yes
@silk fulcrum did you help out melon
no i dont understand whats wrong
it does
can someone help with this
Sed ಥ╭╮ಥ
it takes kwargs and not positional args use a keyword to specify
also by default overwrite is set to role everyone so there is no way u can have overwrite=None
noone loves me(

i wish still far off
no one knows who are kwargs :lemao:
keyword arguments
heeey
did u go through the example I sent before
it had basically the code written down 🗿
that was the biggest secret

so which part of it did u not understand?
Can you resend it again
asher how print hello world?
I cant see it
import __hello__```
print(__import__("random").choice(["project1", "project2"]))
😳 one liner python project chooser
!e
p = lambda x: ( -13214 * x**11 + 956318 * x**10 - 30516585 * x**9 + 564961485 * x**8
- 6717043212 * x**7 + 53614486464 * x**6 - 291627605005 * x**5
+ 1074222731065 * x**4 - 2606048429424 * x**3 + 3927289106268 * x**2
- 3265905357360 * x + 1116073728000 ) // 19958400
print(bytearray(map(p, range(1, 13))))
@shrewd apex :white_check_mark: Your 3.11 eval job has completed with return code 0.
bytearray(b'Hello World!')
Why
simply
?
I would have liked to make a command that allows to modify the permissions of a particular text channel discord with discord.py. For example, disable sending messages in a specific channel.
I look...
Okay thanks
😳 stoverflow
Whats the default role?
@ everyone role
you can't edit the default role
The target parameter should either be a Member or a Role that belongs to guild.
^
discord.utils.get(ctx.guild.roles, name="ROLENAME")
I assume
@shrewd apex clarify for them
did you use it correctly?
Yes
How do you execute the command?
Idk how to help you man... you don't really have any basic knowledge here
(っ˘̩╭╮˘̩)っ i understand ಥ‿ಥ
prefixcmdname @echo steeple
I think my Discord is having a problem
https://capy-cdn.xyz/rKiN2xpP75L0.png I'm pretty certain there can't be this time gap in this channel
lmaoo
role = discord.utils.get(guild.roles, name='idk')
overwrites = {
guild.default_role: discord.PermissionOverwrite(read_messages=False),
user: discord.PermissionOverwrite(read_messages=True),
support_role: discord.PermissionOverwrite(read_messages=True) # or whatever permissions the role should have
}
category = guild.get_channel(id).category
await category.create_text_channel(name=f'{user.display_name}', topic=f"{user.display_name}'s Support Channel", overwrites=overwrites)
LOL
no ones gonna talk about the name of the function and how return annotations are being uses but argument annotations arent?
I added his return annotations 😭
🗿
What that?
bro what
?
from __future__ import annotations
import logging
import asyncio
log = logging.getLogger(__name__)
def rest(endup: Hellofier):
asyncio.run(endup.cursed(bruh=False, coolity='hello world'))
class Hellofier:
def __init__(self, *args, **kwargs):
log.info(args)
log.info(kwargs)
@staticmethod
async def cursed(bruh: bool = True, coolity=None):
if bruh:
return 'not cursed'
print(coolity)
if __name__ == '__main__':
var = Hellofier(['boop'], {1: 'beep'})
rest(var)
Asher is literally telling you how to do it. read the code?
Yeah
Just asked who it is for
Simplest way 👌
yes
so this is what you were typing up. 🤣
)))
I think okimii can do a harder one 😳
it works, also
Pause
wait you guys dont get the byte version of your text and then encode it in utf-8 and then print it?
my beginner mistake
oh bruh
get out of the house and say hello to the world better
oh you dont want to know
@slate swan
I do
sarth dont say it like you go outside
real
I do, I have a life
you guys are making me wanna learn java
sup how did it go?👀
Java > all
You can still be a programmer and go outside, just take your computer with you 
I'm at the centre
Benefits of having a laptop instead of a PC setup
afternoon batch?
its a good language
go revise
phone...
what about pascal
yeah 3-6
Why is it that everytime I come into this chat it just goes off topic
try Haskell
too old
No
why is everyone here from codejam, i know they're so smart, and i feel me is too dumb

and no one loves me
they are smart
smartypants
I still don't understand what code jam is
So you're not alone
it's kinda like a.. code.. jam..
a team challenge
.topic
codejam is a jam where u code best explanation
sending off-topic messages
fr
explanation of what? of jam?
hello world
Shows an error noe
error..
bye heaven
no i don't like jam in general
Unexpected indent, but i cant seem to find it, line 24
Nutella or peanut butter so much better
you are literally coding in notepad or something, 😭 paste your code
Wait
Lemme just re do my code
I got what you mean
!paste
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.
he gets it
Right?
can i disable and enable a single comand
@commands.command?
@dapper cobalt you code html, css?
here you go https://paste.pythondiscord.com/ifuxikewor
profile banner
learn html is kinda nothing
It's easy
!d discord.ext.commands.Command
class discord.ext.commands.Command(*args, **kwargs)```
A class that implements the protocol for a bot text command.
These are not created manually, instead they are created via the decorator or functional interface.
But not
... 💸
!d discord.ext.commands.Command.update
update(**kwargs)```
Updates [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") instance with updated attribute.
This works similarly to the [`command()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.command "discord.ext.commands.command") decorator in terms of parameters in that they are passed to the [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") or subclass constructors, sans the name and callback.
!e
print("".join([chr(int(binary, 2)) for binary in "01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001".split(" ")]))
@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.
Hello World!
just do enabled=False
!d discord.ext.commands.Command.enabled
A boolean that indicates if the command is currently enabled. If the command is invoked while it is disabled, then DisabledCommand is raised to the on_command_error() event. Defaults to True.
oh no our table, its broken😔
@slate swan
mines better 
yours uses bytes, mines uses bits😳
dafuq
where ?
bits and bytes go well together😳
I care to know your font family and that alert icon extension
which decorator ?
Idk what the font is
👀
is that so?
yes indeed

Check it in the settings
The code
Okay
fetch the command object
then do .update(enabled=False)
Sf-mono
Anyone know where?
You need to call Intents() in line 8
Okay, just reformatted the code to make it look better
cant understand
import discord
from discord.ext import commands
class modcommand(commands.Cog):
def __init__(self , client):
self.client = client
@commands.command()
@commands.has_permissions(manage_messages=True)
async def sm(self , ctx, seconds: int = 0):
await ctx.channel.edit(slowmode_delay=seconds)
await ctx.reply(f"Set the slowmode delay in this channel to {seconds} seconds!")
@sm.error
async def sm_error(self,ctx , error):
await ctx.send('use correctly' , delete_after = 2)
def setup(client):
client.add_cog(modcommand(client))```
in this command where ?
kinda cheating imo
import discord
from discord.ext import commands
class modcommand(commands.Cog):
def __init__(self , client):
self.client = client
@commands.command()
@commands.has_permissions(manage_messages=True)
async def sm(self , ctx, seconds: int = 0):
await ctx.channel.edit(slowmode_delay=seconds)
await ctx.reply(f"Set the slowmode delay in this channel to {seconds} seconds!")
@sm.error
async def sm_error(self,ctx , error):
await ctx.send('use correctly' , delete_after = 2)
@commands.command()
@commands.is_owner()
async def disable(self, command: commands.Command):
await command.update(enabled=False)
await ctx.send(f'Disabled {command.name}')
def setup(client):
client.add_cog(modcommand(client))
@shrewd apex
!e
print(type("Hello World", (), {"__str__": lambda a:
"".join([chr(int(binary, 2)) for binary in "01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001".split(" ")])})())
```👁️ 👁️
@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.
Hello World!
use map
wouldnt it be slower lol
i think my method is faster not sure
also spilt splits at space by default right?
yeah
.split(" ") u wrote 3 chars extra 🗿
it returns a list which then you would iterate through each string and convert it to a binary number with the int class with base 2 which then i use char to return the unicode form lol
wait does split have a default?
why not🤷♂️
yeah
more chars > better code😳
coz i am lazy
b = "0110100001100101011011000110110001101111001000000111011101101111011100100110110001100100"; a = "".join([chr(int(b[i:i+8],2)) for i in range(0,len(b),8)]); print(a)
@slate swan best I could do..
print('Hello World!') golfed
overrated
you couldve used the walrus operator😔
!e
print("".join(list(map(lambda i: chr(int(i, 2)), "01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001".split()))))
@shrewd apex :white_check_mark: Your 3.11 eval job has completed with return code 0.
Hello World!
lets timeit
!timeit
print("".join(list(map(lambda i: chr(int(i, 2)), "01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001".split()))))
@shrewd apex :white_check_mark: Your 3.11 timeit job has completed with return code 0.
50000 loops, best of 5: 4.5 usec per loop
!timeit
b = "0110100001100101011011000110110001101111001000000111011101101111011100100110110001100100"; a = "".join([chr(int(b[i:i+8],2)) for i in range(0,len(b),8)]); print(a)
@slate swan :white_check_mark: Your 3.11 timeit job has completed with return code 0.
50000 loops, best of 5: 5.01 usec per loop
!timeit
print("Hello World")
@slate swan :white_check_mark: Your 3.11 timeit job has completed with return code 0.
500000 loops, best of 5: 522 nsec per loop
I win.
!timeit
print("".join([chr(int(i, 2)) for i in "01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001".split()]))
@shrewd apex :white_check_mark: Your 3.11 timeit job has completed with return code 0.
50000 loops, best of 5: 4.05 usec per loop
no walrus operator 😔
list comp won wow
!timeit
!e
print(type("Hello World", (), {"__str__": lambda a:
"".join([chr(int(binary, 2)) for binary in "01001000 01100101 01101100 01101100 01101111 00100000 01010111 01101111 01110010 01101100 01100100 00100001".split(" ")])})())
@slate swan :white_check_mark: Your 3.11 timeit job has completed with return code 0.
10000 loops, best of 5: 13.7 usec per loop
yeah maps with lambdas are slower than just calling using or calling a function or method
hmm rip
hmm any other ways
!e
print([[[[[[[[[["Hello World!"]]]]]]]]]][0][0][0][0][0][0][0][0][0][0])
@slate swan :white_check_mark: Your 3.11 eval job has completed with return code 0.
Hello World!
'function' object has no attribute 'update' 🤔
!d discord.ext.commands.Command.update
update(**kwargs)```
Updates [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") instance with updated attribute.
This works similarly to the [`command()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.command "discord.ext.commands.command") decorator in terms of parameters in that they are passed to the [`Command`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") or subclass constructors, sans the name and callback.
A boolean that indicates if the command is currently enabled. If the command is invoked while it is disabled, then DisabledCommand is raised to the on_command_error() event. Defaults to True.
raise BadArgument('Converting to "{}" failed for parameter "{}".'.format(name, param.name)) from exc
discord.ext.commands.errors.BadArgument: Converting to "Command" failed for parameter "command".
🤔
import discord
from discord.ext import commands
class modcommand(commands.Cog):
def __init__(self , client):
self.client = client
@commands.command()
@commands.has_permissions(manage_messages=True)
async def sm(self , ctx, seconds: int = 0):
await ctx.channel.edit(slowmode_delay=seconds)
await ctx.reply(f"Set the slowmode delay in this channel to {seconds} seconds!")
@sm.error
async def sm_error(self,ctx , error):
await ctx.send('use correctly' , delete_after = 2)
@commands.command()
@commands.is_owner()
async def disable(self,ctx , command:commands.Command):
await command.update(enabled=False)
await ctx.send(f'Disabled {command.name}')
def setup(client):
client.add_cog(modcommand(client))```
you can create a json for that
there is event funtion
named
on_leave
i think
just like on_ready
discord.on_member_remove(member)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") leaves a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild").
If the guild or member could not be found in the internal cache this event will not be called, you may use [`on_raw_member_remove()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.on_raw_member_remove "discord.on_raw_member_remove") instead.
This requires [`Intents.members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.members "discord.Intents.members") to be enabled.
thats different ,
i talking about bot itself
not about members
!d discord.on_guild_remove
discord.on_guild_remove(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild") is removed from the [`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client").
This happens through, but not limited to, these circumstances...
@slate swan
?
How do you do that thing where it tries to do get_user and if it cant it moves to fetch_user
Is there any way to make a html comamnd
Which runs my html code and shows me preview of website?
check if get_user returns None, if yes then fetch_user
Mmm
no. more like you shouldnt
you can host the html code on replit though and get a screenshot of that
!d discord.on_guild_remove
discord.on_guild_remove(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild") is removed from the [`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client").
This happens through, but not limited to, these circumstances...
Idot
It's the same as dpy
@bot.event
async def on_guild_remove(guild):
print(f"I got kicked from {guild.name}!")
discord.on_guild_join(guild)```
Called when a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild") is either created by the [`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") or when the [`Client`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client "discord.Client") joins a guild.
This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
keywords = ["when", "my", "poo", "cash", "eat", "scam"]
keywords_found = 0
@bot.event
async def on_message(message):
content = message.content
print(content)
for word in content:
if word in keywords:
global keywords_found
keywords_found += 1
if keywords >= 3:
await message.channel.send("Please refrain from using those words")
await bot.process_commands(message)
How to detect multiple keywords in a single message and send a message if a certain number of keywords are found?
use filter
turn the keywords to a set and get the intersection with message.content.split()
filter(lambda x: x in keywords, message.content.split())
keywords = {"when", "my", "poo", "cash", "eat", "scam"}
found = keywords & set(message.content.split())
hey
can some one show me how i can code a bot that delete bad words but without on_message
thats not possible
Why without on_message? I don't even think it is possible without.
if u use on_message u need to put that under everything cause if not its fcking all the other things up sadly
that makes no sense, lol
oh well you'd just need to add
await bot.process_commands(message)
wait thats all ?
ye after the on message thingy like this:
@bot.event
async def on_message(message):
print(message)
await bot.process_commands(message)
lemme try it
okok
if it works u are a angel from heaven
you'd need to put it in every on_message tho
ik but its the only on_message comand that i have in my code
okok
wait idk why but now a other code is not working sorry
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.
hi zeffo
what about if msg.content.startswith
what 
Suggest more topics here!
prefix changer
with slash commands that wont be necessary
👎
one thing a lot of ppl don't seem aware of is mention prefixes will continue to work
they will be forced to soon
what why?
not if they use mentions
discord is killing text prefixes at the end of august
how so? mentions don't seem to trigger any interactions
bro :(
mention prefix can be used to trigger message commands (not slash). Discord isn't disabling using @mentions as a prefix.
interactions are slash only, but you can have both slash (with / as prefix) + message commands (with a mention as prefix). I imagine most bots won't do this (double the code) but it's possible
from where do you have that info?
Privacy and Performance
User privacy is important to us at discord and has guided us in our decisions for the direction of our API. This philosophy lead us to introducing privileged intents to the ...
killing? in the sense?
of disabling them
yes
only exception is if you aren't verified ofc but then you can't join > 100 servers or if you manage to apply for message intents successfully (most bots can't)
Meh, just add an antispam to yr bot and u get access to message content
it's easier to get message content intent than you make it sound lol
one could be what Hunter suggested
https://media.discordapp.net/attachments/343944376055103488/1001623784714948689/unknown.png
any more than 1 parameter in dpy 2.0 slash commands won't come up on the bot. any idea why?
Meh I'm not adding random stuff to my bot just to get an intent
Just use mentions instead 😎
skill issue
How to make commands and event with a database of bad words so that new words can be added to the database using a command
Have you used sql before
sqlite3
they dont for any command?
sqlite3
nope
4. Use English to the best of your ability. Be polite if someone speaks English imperfectly.
sorry
How to make commands and event with a database of bad words so that new words can be added to the database using a command. I'm using sqlite3
huh
oh
@slate swan Accidentally
- set up a database
- Make a command that adds new words to the db
- Make a command that removes existing words from the db
- set up an on_message listener that checks for the certain words in the message by reading from the database record corresponding to the guild
how can i resolve discord.ext.commands.errors.CommandNotFound: Command "pping" is not found error
?
command.error ?
bro
it says the command pping is not found
i know
wait show code
by making the command “pping”
lol
if u already have a command called pping show
apke bs ka nhi h
nope i dont have i want if some type command that i dont have than this error will show again and again
send your code
I would like the database commands themselves. I'm talking about SELECT, SET and so on
if you just don't want that error to appear at all, make an error handler (n ignore the error)
^
yes thats i want ,how i can i do that ?
error handler for ?
CommandNotFound
@bot.error
if isCommandNotFound(ctx):
pass```
??
read the gist
How to fetch a user by id?
use converter
Afaik you can only get them
Nvm fetch_user exists as well
!d discord.Client.fetch_user
await fetch_user(user_id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a [`User`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User "discord.User") based on their ID. You do not have to share any guilds with the user to get this information, however many operations do require that you do.
Note
This method is an API call. If you have [`discord.Intents.members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_user()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Client.get_user "discord.Client.get_user") instead.
Changed in version 2.0: `user_id` parameter is now positional-only.
hi im using replit but i have massive error...
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
what i have to do?
use any other host
Hmm. How.
wdym by "on terminal"?
discord.ext.commands.errors.CommandNotFound: Command "ok" is not found this one
i know i dont have ok command , i want bot ignore this
due to this cant able to find tha errors i want to find
@paper sluicesorry for ping
add an event listerner for on_command_error
@commands.Cog.listener()
async def on_command_error(ctx, error):
if isinstance(error, CommandNotFound):
return
this not working , wots wrong in this
thats in a cog?
async def on_command_error(self, ctx, error):
nope , it should be ?
then just do @bot.listen(), remove the cog part
got it
and ignore it
thanks
mean ?
you would only put "self" if you were in a cog
I thought you were using cogs when I said that
and sorry for my english, i'm from Portugal
no issues btw thanks
@client.command()
@commands.is_owner()
async def enabled(ctx , command: commands.Command):
await command.update(enabled=True)
await ctx.send(f'enabled {command.name}') ```
is it ok ?
all dead ?
Check the pins
because it doesnt have a bank key
@robust fulcrum what ?
literally no way for us to know
there's nothing in that code where you create this dictionary
it appears to be pointing towards another function, so check whatever get_bank_data is
or print users, maybe the key exists but you aren't navigating to it correctly
You can't
:(
you can't and won't be able to in the future too 
why
How can I add check in a button?
no works
because that's the users privacy and there's no reason for bots to access about me
What you mean?
what
"no works" doesnt help, either state your issue properly or dont at all
oh ok ty
NO WORKS!
I told
I not understood :(
File "C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\cog.py", line 684, in _load_from_module_spec
spec.loader.exec_module(lib) # type: ignore
File "<frozen importlib._bootstrap_external>", line 850, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "c:\Users\ToxicPenguin\Desktop\проекты на Python\disocrd bot python\cogs\slash.py", line 5, in <module>
class SlashBot(discord.bot):
TypeError: module() takes at most 2 arguments (3 given)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\Users\ToxicPenguin\Desktop\проекты на Python\disocrd bot python\index.py", line 19, in <module>
bot.load_extension(f"cogs.{filename[:-3]}")
File "C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\cog.py", line 756, in load_extension
self._load_from_module_spec(spec, name)
File "C:\Users\ToxicPenguin\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\cog.py", line 687, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'cogs.slash' raised an error: TypeError: module() takes at most 2 arguments (3 given)```
uh?
I making fight command so i want that like first user1 can use button and then user2
you do know what you are subclassing
so?
@slate swan
which module do I need to install for slash command to work ?
did you even read the gist...?
because if you did not, I'm not helping either
it says there that you need to install it via a git link. But for me, whenever I install it like this, everything breaks down and no longer works
That's dpy 2.0
....just elaborate "no longer works"
@slate swan I remember trying to install a git link discord.py 2.0 and nothing happened. And I had to install it differently
I think the content on the walkthrough is pretty straightforward and easy to understand
install dpy 2.0, what do you even mean by nothing happened
Ashley can you tell again about check in button?
@slate swan is there any more documentation with slash command?
have you checked the examples, they're decent > https://github.com/Rapptz/discord.py/tree/master/examples/views
class MyView(ui.View):
async def interaction_check(self, inter: discord.Interaction) -> bool:
... #return a boolean (True or False)
Hmmm
you want more? 💀
You are welcome. Don't recommend such nonsense. This GitHub author needs his hands torn off for such a bad job
Your docs are readable and even a child can read
Bruh
yes
might as well stop now
fr 💀
Whats fr?
I was unlucky when I took what he had on github
I want a user check
okay. didnt ask
so? you can do that in there too
"for real"
Ok
which docs are not readable all doc's are readable if u can't read that means u dk the same language as the author
Hmmm i not insulting
correct sentence should be ur docs are clear and succint
Ye
👍
don't worry abt me i am just trolling trying to pass time
I not getting time to pass
sed time left u behind then
Is there any docs on button check of dpy?
it does i think in the dpy lib repo itself
it's under an examples folder under views
me omw to argue on the dpy server
she actually has

https://media.discordapp.net/attachments/343944376055103488/1001623784714948689/unknown.png
any more than 1 parameter in dpy 2.0 slash commands won't come up on the bot. any idea why? (commands are synced)
command: commands.Command , its not converting !!
any solution
@client.command()
@commands.is_owner()
async def disable(ctx ,command: commands.Command):
await command.update(enabled=False)
await ctx.send(f'Disabled {command.name}')```
?
its not coming up at all though
how lol
comment out all the slash commands and run the bot once, it'll refresh the commands, then you can sync them again
ah
??
still doesnt work @slate swan
sad, I've no idea
Hey, I'm using py-cord and need to disable all buttons in a view with the click of a single button. How do I do this?
Trying to make a basic test loop, discord.py
@tasks.loop(seconds=5)
async def test(self):
channel = self.bot.get_channel(channel id)
await channel.send("Hello")
I put the self.test.start() in the init. Traceback is AttributeError: NoneType object has no attribute send
I'm pretty sure I'm getting the channel correctly though, and yes it's an int
!d discord.ui.View.children
property children```
The list of children attached to this view.
!d discord.ui.Button.disabled
oh right, forgot about that one 😅
property disabled```
Whether the button is disabled or not.
tysm
👍
maybe try fetch_channel (it needs to be awaited btw)
yeah he can do something like
await (self.bot.get_channel(id) or await self.bot.fetch_channel(id)).send("Hello World!")
Okay, will do
Yeah, fetch channel works. But it's prob bcs I forgot to await it 😆
Thanks guys
By the way, is there a way I can enter a time, maybe a module, so it sends the message at a specific time every day?
nah you used get channel, all get channels are cache lookups and arent coroutines so if the method returns None/the object isnt in cache you would just fetch channel to make a request
a task
I see, I got it somewhat
you'd require a database and an on_guild_join event, check if the guild id exists within the blacklisted db and if it does use Guild.leave() to leave the guild
if it is for multiple servers
A single server won't require a db
Is there something like interaction.user.id in buttons?
yes
this is something I have never used before, could you explain?
Sets are essentially value-less dictionaries,
set1 & set2 is shorthand for set1.intersection(set2) and it gives you the common elements of both sets
Sorry, can you point me towards a direction 😅
Can't seem to comprehend the doc
It's funny, how my bot slowly dies, I left it without any development for already 3 months and my friend is saying step by step smth like ban doesn't work properly, nuke doesn't work, e.t.c
Sad
Bruh
is this what you want me to do?
!d discord.ext.tasks.loop
discord.ext.tasks.loop(*, seconds=..., minutes=..., hours=..., time=..., count=None, reconnect=True)```
A decorator that schedules a task in the background for you with optional reconnect logic. The decorator returns a [`Loop`](https://discordpy.readthedocs.io/en/latest/ext/tasks/index.html#discord.ext.tasks.Loop "discord.ext.tasks.Loop").
Without commands ofc
You'd need to make keywords a set
Just change the square brackets to {}
I still don't get how sets are different from lists
there are still more things wrong with the code because it isn't working still
@tasks.loop(time=datetime.time(16, 0, 0, 0)) ?
It says TypeError: loop() got an unexpected keyword argument 'time'
You'll need to expand on that
Seconds minutes hours
No time
Sets are unordered and can only have hashable objects
I am typing those exact words that I have used in the array and my bot gives no response whatsoever, and nothing is printing
I don't get it
You're typing in lowercase?
yes, all lowercase
what do you get when you print message.content
I just went straight to the time parameter to specify the time
I think it's new in 2.0
nothing, this is what I typed and nothing in the console and no respond from bot
Wtf is discord.Option
Are you on 2.0? You'll need to enable message content intents
Under "new in version 2.0" it says the count and reconnect parameters, I assume those are the ones in beta?
Yes
no python 3
Okay, the time parameter is above it, so I assume it's included in the old version
Discord.py version
Can I paste part of the doc here?
yes
Have no exp with the datetime module
import discord
print(discord.__version__)
wait

