#discord-bots
1 messages · Page 687 of 1
wtf
yes
Nice
@bot.command()
@commands.cooldown(1,60,commands.BucketType.user)
async def rob(ctx, member:nextcord.Member):
robop = ["no","yes"]
s=random.choices(robop)
r = s[0]
await ctx.send(r)
if r == "no":
robcursor = await bot.db.execute("SELECT bal FROM users WHERE user_id=?",(member.id,))
robdata = await robcursor.fetchone()
robmemberbaldata = robdata[0]
robar = await bot.db.execute("SELECT bal FROM users WHERE user_id=?",(ctx.author.id,))
robauthor = await robar.fetchone()
print(robauthor)
robauthordata = robauthor[0]
rr = [for i in range(0, robauthordata)]
robfinee = random.choices(rr)
robfine = int(robauthordata - robfinee)
print(robfine)
await bot.db.execute("INSERT INTO users(bal, user_id) VALUES(?,?)",(robfine,member.id))
await ctx.send(f"Haha! You got caught! You paid a total fine of {robfinee}, Now you have {robfine}")
else:
robcursor = await bot.db.execute("SELECT bal FROM users WHERE user_id=?",(member.id,))
robdata = await robcursor.fetchone()
robmemberbaldata = robdata[0]
robar = await bot.db.execute("SELECT bal FROM users WHERE user_id=?",(ctx.author.id,))
robauthor = await robar.fetchone()
print(robauthor)
robauthordata = robauthor[0]
rr = [for i in range(0,robauthordata)]
robfinee = random.choices(rr)
robfine = int(robauthordata - robfinee)
print(robfine)
await bot.db.execute("INSERT INTO users(bal, user_id) VALUES(?,?)",(robfine,member.id))
await ctx.send(f"Haha! You got caught! You paid a total fine of {robfinee}, Now you have {robfine}")```
Traceback (most recent call last):
File "C:\Python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "c:\Users\admin\.vscode\extensions\ms-python.python-2021.12.1559732655\pythonFiles\lib\python\debugpy\__main__.py", line 45, in <module>
cli.main()
File "c:\Users\admin\.vscode\extensions\ms-python.python-2021.12.1559732655\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 444, in main
run()
File "c:\Users\admin\.vscode\extensions\ms-python.python-2021.12.1559732655\pythonFiles\lib\python\debugpy/..\debugpy\server\cli.py", line 285, in run_file
runpy.run_path(target_as_str, run_name=compat.force_str("__main__"))
File "C:\Python310\lib\runpy.py", line 268, in run_path
code, fname = _get_code_from_file(run_name, path_name)
File "C:\Python310\lib\runpy.py", line 242, in _get_code_from_file
code = compile(f.read(), fname, 'exec')
File "c:\Users\admin\Downloads\underdev.py", line 113
rr = [for i in range(0, robauthordata)]
^^^
SyntaxError: invalid syntax```
flooding the channel fr
fr i just went to my ide
message.txt pls
and then that message popped up wtf?
!paste @prisma spoke
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.
ik
haha wanna see my mess of a code bruh
error is this
status = f"{Fore.RED}DOWN{Style.RESET_ALL}"
version = f"0.1 [{Fore.RED}BETA{Style.RESET_ALL}]"
author = "ADX#5452"
running = False
latestcommit = "ADX#5452"
devpage = "https://discord.com/developers/applications/920685915519717466/bot"
invite = "https://discord.com/oauth2/authorize?client_id=920685915519717466&permissions=8&scope=bot"
website = "adxbot.xyz"
webversion = f"0.0 [{Fore.RED}Development Not Started{Style.RESET_ALL}]"
run = input(f"Start? [{Fore.GREEN}Y{Style.RESET_ALL}|{Fore.RED}N{Style.RESET_ALL}] ")
run = run.lower()
if run == "y":
status = f"{Fore.GREEN}UP{Style.RESET_ALL}"
os.system("clear")
print(f"{Fore.CYAN}ADX Discord BOT \n{Style.RESET_ALL}\nStatus: "+status+"\nVersion: "+version+"\nAuthor(s): "+author+"\nLatest commit by: "+latestcommit+"\nDeveloper tools: "+devpage+"\nInvite link "+invite+"\nWebsite: "+website+"\nWebsite version: "+webversion)
running = True
else:
os.system("clear")
print(f"{Fore.CYAN}ADX Discord BOT \n{Style.RESET_ALL}\nStatus: "+status+"\nVersion: "+version+"\nAuthor(s): "+author+"\nLatest commit by: "+latestcommit+"\nDeveloper tools: "+devpage+"\nInvite link "+invite+"\nWebsite: "+website+"\nWebsite version: "+webversion)
running = False
(start of the code here)
f string would be nice
use f strings
guys, how can you implement a check where it checks where if you have a specific role then execute the cmd
this is my help cmd code
class coolHelpCommand(commands.MinimalHelpCommand):
def __init__(self):
super().__init__(no_category="Commands", dm_help=True)
async def send_pages(self):
destination = self.get_destination()
for page in self.paginator.pages:
emby = discord.Embed(
description=f"{page}", color=discord.Colour.random())
await destination.send(embed=emby)
we dont need the code for such a thing
if message.author.guild_permissions.manage_messages:
just fetch the role and iterate thro member.roles
!rtfm member.roles
@shadow wraith ^
ah wait roles yes
he doesnt need that
perms easier tho
its his requirement bruv
i tried doing self.command_attrs but that just made the help command nonexistent
☠️
fetch the role and then iterate thro member.roles and check if the member has the role
!discord.member.roles
bruh
!d discord.Member.roles
property roles: List[Role]```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.9)") of [`Role`](https://discordpy.readthedocs.io/en/master/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.
bro I didn't read the whole message I just assumed u asked for check permissions thing cuz u were asking about roles
^^
but how will i get the member obj
ctx.author or any member?
Mhmm.
reread, i don't use ctx ☠️
Best forks of discord.py now that it is no longer being worked on?
u can fetch member normally
it's still being worked on, april 2022 is just the dead date
message.author
with discord.Member right? the only way i know how to fetch roles is with guild.get_role() 😓
how is fetching roles related to fetching members?
discord.Member object or message.author or interaction.user for buttons or whatever
not saying it is, but how else would you fetch a role instead of guild.get_role() ☠️
or just make all ur commands in on_message ez
utils
commands overrated
!d discord.Guild.get_member
get_member(user_id, /)```
Returns a member with the given ID.
☠️
This doesn't work it shows no errors but it doesn't work..
they want to fetch a member
hi
whats bot.user?
what else did it do?
isn't it == the operator? learn basic python smh
@prisma spoke oh?
so what's going on?
basically, me trying to implement a check for if the member has a role, exec command but if not don't exec cmd
this
Ah a help command
if i have no context at all. ☠️
I know basic python, but that would give me a syntax error.
Using self.context will get u the ctx
bru, it's if message.content == 'F': or whatever
he doesn't need operator, that if asssumes that its if == True?
that's not what i meant
i mean context as in context not actual discord context
I deleted the starts with.
use if 'F' in message.content.lower()
bruh
'F' is capital in a lowered string?
oh my bad then
if 'f' in str(message.content).lower():
#dostuff
I mean if you have the context , you can use ctx.author to get the author who used the command , and check their roles :)
u dont need str(message.content)
its always string
bru
It gets the user.
Still don't work.
Isn't that what you need?
which user?
try: py if 'f' in message.content.lower(): await message.channel.send('innappropriate') return
The one that typed.
its message.author in ur case
when i said "if you don't have context" i actually meant as in context for wtf is happening, not as in discord bots ☠️
not bot.user
I have message.author its the third one down.
if message.author == bot.user:
The reply was for your actual problem but ok
damn you got super black mode my pfp camouflaging (sort of)
"checks where if you have a specific role"
Is amoled mode
what's your problem tho i don't get it
message.author is the bot.user
no need to add a check there
It doesn't work.
what doesn't work i just joined
ok, if i don't understand all deez solutions (discord.Guild.get_member will probably not work since i have abs no idea how im gonna fetch the member id ☠️ )
Omg if you don't know what were talking about don't try to help unless you now what we are doing.
mind sending ur code again?
okay then can someone else try to explain then?
@bot.event
async def on_message(message):
if message.author == bot.user:
return
if message.content == 'F':
await message.delete()
await message.channel.send('Thats not appropriate')
wait wait...
- ur code is coded wrongly
- theres nothing as bot.user as far as ik
is there a check i can define in the __init__ of my code which checks if the user has a role (if does: exec command, if doesn't: don't exe c command)
yup i am right
!d discord.commands.Bot.user
No documentation found for the requested symbol.
!d discord.Client.user
property user: Optional[discord.user.ClientUser]```
Represents the connected client. `None` if not logged in.
@peak loom rip, bot.user doesn't exist
You just want to check if a member has the role right?
Cool.
ye, because who would want to implement a check which does abs nothing ☠️
also ur code is wrongly coded mate.
No its not.
yes it is, add await bot.process_commands(message) at the end of your bot event
https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#discord.ext.commands.HelpCommand.add_check , just use this and the default has_role check....
otherwise it won't process commands, i made that mistake before :|
Yes. it is.
No it's not.
dude just add it if it doesn't work ctrl+z
U can maker a list of words/letters then iterate thro them and then delete them.
MinimalHelpCommand is a subset of HelpCommand , so add_check works there too
ok but add_check uses lambda functions?
i mean does it support that
make sure to add await bot.process_commands(message) at the end of ur on_message event!
I'm unsure
check=check maybe? and define check?
what do i define check as
Mhm.
def check(msg):
return msg.author == ctx.author and msg.channel == ctx.channel
like this or whatever
o
0.o
ok but do i HAVE to pass a function in check, because i was sure that lambda funcs were allowed in self.add_check()
!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.
Are you on a phone?
no.
Ok.
I just didnt wanna format it that way.
bru dekriel rember my thing
Cuz, I was in a hurry to do smthn.
self.add_check(lambda: self.context.author.roles in staffs)
``` im not sure if this would work :c
What, the JavaScript
mhm
What about it?
yea nvm don't talk about it here
i dont think so.
this is #discord-bots ☠️
ill try
commands.check() also allows lambdas
What the heck is happening
this should work iirc py @commands.check(lambda ctx: ctx.author.id == 1234) @bot.command() async def foo(ctx): ...
reread, we aren't doing @bot.command()
@bot.command()
@commands.check(lambda ctx: ctx.author.id == 1234)
async def foo(ctx): ...```
and we probably aren't 💀
my bad, messed up the order
Cool.
What is happening
sorry, didnt see the original question
i thought it was related to commands
I just found my interest in developing a discord bot for myself, and found out discord.py is not maintained anymore. Is there any other good alternatives I should look at (I really don't want to start at something that is not maintained)
disnake is a good one. I heard.
It’s the only fork so far that Danny hasn’t shit on yet.
Actually he already has, but okay
In the Discord API server, a looong time ago, yes
What did he say about it?
what can i use to see all listeners active on the bot?
Eh, it was something related to comments. One of the contributors (who is a contributor in the repo too) added comments like Time for some real code UwU and stuff and Danny was just making fun of it, with some other people lmao
Istg there was something like that
Nvm, it's cog.get_listeners
That’s not relevant to the actual lib itself.
im not using a cog however?
Could be I just used the internals hehe
Well yea
so how would i do it
I don't think u can ;-;
smh
Sad
well you could in a way
Internals?
orrr you can read the file
There is Bot.extra_events but it's undocumented
Danny being Danny ¯_(ツ)_/¯
He made bot.commands
He made bot.cogs
He didn't make bot.listeners
Whyyyyy
lol
had to check the source code to find that
Danny and his ego ¯_(ツ)_/¯
f
Me and someone else used a command at the same time and switched things in my db, is there a way I can fix that?
What database are you using?
Postgres
If you successfully commit'ed I don't think its reversable
Yea but what if that happens again
Use concurrency or something?
What's that
!d discord.ext.commands.max_concurrency
@discord.ext.commands.max_concurrency(number, per=discord.ext.commands.BucketType.default, *, wait=False)```
A decorator that adds a maximum concurrency to a [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") or its subclasses.
This enables you to only allow a certain number of command invocations at the same time, for example if a command takes too long or if only one user can use it at a time. This differs from a cooldown in that there is no set waiting period or token bucket – only a set number of people can run the command.
New in version 1.3.
In the transaction you can validate the data and rollback the transaction if the data is invalid
How many times a command can be used at a single time
Oh didn't know that was a thing
Like if I set it to 1 and the bucket type is guild, and I am using the AI Chat command, none will be able to use it as long as I don't end/complete it
Iirc that will make it so that one single person can't use in multiple guilds
@kindred epoch Postgres also has this
https://www.postgresql.org/docs/current/continuous-archiving.html
Like I can't use the command in guild 1 as well as guild 2 in user bucket
But in member bucket I can use it in guild 2, even when it's working in guild 1
What's that?
postgres sux i heard
bot._listeners?
Ok then what should I use
I guess yea. But that isn't documented, so, uhh
Idk tbh. Lemme see
Ok
!d discord.ext.commands.BucketType.guild
The guild bucket operates on a per-guild basis.
This ig?
yeah because its supposed to be accessed by the internals only
Mhm
when dispatching
What if they are in the same guild
Who knows ¯_(ツ)_/¯
I guess just make a check yourself with an if statement and use on_command?
Or just add multiple decos lol
what was their question?
Well, it was the db transaction that messed up things
2 max_concurency maybe
Yea
a fork should add a bucket for that
with BucketType.user and guild
Not telling anyone in disnake to add that, the message is most probably gonna get ignored as usual
i never get ignored
So yea, better would be if someone else tells them to do so
make the PR your own 
Nahh, imma pass
sad
sad2
Tbh at this point I feel like making my own wrapper, but uhh, nvm
imma make some PRs
I am too lazy to maintain it ngl
dont be that guy
Also working on other projects with a friend of mine
Not like lazy, but I just don't feel the need to since there are multiple wrappers like hikari and nextcord and stuff
you have a friend who can code unlike me 😔
Bro... I ran an iPython file he gave me, and uhh, it had about 50-60 errors not warnings but errors
Soo uhhh
👋
I wonder what API hasnt got any wrapper yet
My AI API
..
anyways time to sleep
gn cya
I can make a wrapper for it 
At least if you make it public
Gn
Uhhh, then imma pass
Sure I can try. What's up
Once you guys have helped him I would like some service on a problem that just popped up for my bot.
U can go on
Seems like result is None
That error comes when u try to do None[...]
ok thanks
File "/home/runner/NootsCustomBot/main.py", line 61, in on_ready
bot.ticket_configs[int(data[0])] = [int(data[1]), int(data[2]), int(data[3])]
AttributeError: 'Bot' object has no attribute 'ticket_configs'```
this error has just began to pop up and here is my code for what I am doing:
@bot.event
async def on_ready():
async with aiofiles.open("ticket_configs.txt", mode="a") as temp:
pass
async with aiofiles.open("ticket_configs.txt", mode="r") as file:
lines = await file.readlines()
for line in lines:
data = line.split(" ")
bot.ticket_configs[int(data[0])] = [int(data[1]), int(data[2]), int(data[3])]```
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!
U can do something like bot.ticket_configs = [] or whatever the data type is
but here is all of my code, I already defined it earlier but I did something and now it doesnt work:
@bot.command(aliases=["ct", "config_ticket", "configticket"])
async def configure_ticket(ctx, msg: discord.Message=None, category: discord.CategoryChannel=None):
if msg is None or category is None:
await ctx.channel.send("**Failed to configure the ticket as an argument was not given or was invalid.**")
return
bot.ticket_configs[ctx.guild.id] = [msg.id, msg.channel.id, category.id] # this resets the configuration
async with aiofiles.open("ticket_configs.txt", mode="r") as file:
data = await file.readlines()
async with aiofiles.open("ticket_configs.txt", mode="w") as file:
await file.write(f"{ctx.guild.id} {msg.id} {msg.channel.id} {category.id}\n")
for line in data:
if int(line.split(" ")[0]) != ctx.guild.id:
await file.write(line)
await msg.add_reaction(u"\U0001F3AB")
await ctx.channel.send("**Succesfully configured the ticket system.**")
@bot.event
async def on_ready():
async with aiofiles.open("ticket_configs.txt", mode="a") as temp:
pass
async with aiofiles.open("ticket_configs.txt", mode="r") as file:
lines = await file.readlines()
for line in lines:
data = line.split(" ")
bot.ticket_configs[int(data[0])] = [int(data[1]), int(data[2]), int(data[3])]
@bot.event
async def on_raw_reaction_add(payload):
if payload.member.id != bot.user.id and str(payload.emoji) == u"\U0001F3AB":
msg_id, channel_id, category_id = bot.ticket_configs[payload.guild_id]
if payload.message_id == msg_id:
guild = bot.get_guild(payload.guild_id)
for category in guild.categories:
if category.id == category_id:
break
channel = guild.get_channel(channel_id)
ticket_channel = await category.create_text_channel(f"ticket-{payload.member.display_name}", topic=f"A ticket for {payload.member.display_name}.", permission_synced=True)
await ticket_channel.set_permissions(payload.member, read_messages=True, send_messages=True)
message = await channel.fetch_message(msg_id)
await message.remove_reaction(payload.emoji, payload.member)
await ticket_channel.send(f"**{payload.member.mention} Thank you for creating a ticket! Use ``'-close'`` to close your ticket.**")
try:
await bot.wait_for("message", check=lambda m: m.channel == ticket_channel and m.author == payload.member and m.content == "-close", timeout=3600)
except asyncio.TimeoutError:
await ticket_channel.delete()
else:
await ticket_channel.delete()```
No I mean
Where u define your bot instance
bot = commands.Bot(...)
bot.ticket_configs = []
Like this
k hold on
Just set the data type correct. Idk if it's a list or dict*
Oh, hmm
BTW there's a problem
U should connect to the database once on the startup, instead of connecting everytime and store it in a bot var
!botvars
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!
Its like a backup, you need to set it up
im lost
Hm?
bot.ticket_configs[int(data[0])] = [int(data[1]), int(data[2]), int(data[3])] would this already define it?
waited a few hours, still says that :(
@slate swan u need to first populate the list/dict with some values
U r tryna index an empty list/dict
values of what? on ticket reaction it should do this
could I do this in my on ready? py bot.ticket_configs = [int(data[0])] = [int(data[1]), int(data[2]), int(data[3])]
Sure
like this: ```py
@bot.event
async def on_ready():
async with aiofiles.open("ticket_configs.txt", mode="a") as temp:
pass
bot.ticket_configs = [int(data[0])] = [int(data[1]), int(data[2]), int(data[3])]
async with aiofiles.open("ticket_configs.txt", mode="r") as file:
lines = await file.readlines()
for line in lines:
data = line.split(" ")
bot.ticket_configs[int(data[0])] = [int(data[1]), int(data[2]), int(data[3])]```??
@commands.command()
async def meme(self,ctx,Subreddit="memes"):
post = reddit.subreddit(Subreddit).random()
embed = nextcord.Embed(description=f"**[{post.title}]({post.url})**")
embed.set_image(url=post.url)
embed.set_footer(text=f"Thanks to {post.author} for this {Subreddit}.")
await ctx.send(content=None, embed=embed)```why does this post 2 things?
class Cog2(commands.Cog):
def __init__(self,bot):
self.bot = bot
@commands.Cog.listener()
async def on_guild_join(self,guild:discord.Guild):
for channels in guild.channels:
global channel_list
channel_list = await channels.create_webhook(name="Lemontree bot hook")
@commands.command()
async def sudo(self,ctx:commands.Context,member:discord.Member,*,message):
hook = Union(channel_list)
async with ClientSession() as session:
await hook.send(content=message,avatar_url=member.display_avatar,username=member.display_name) ```
dont put logic in on_ready
await ctx.command.invoke(ctx)
File "C:\Users\sony\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\commands\commands.py", line 133, in invoke
await injected(ctx)
File "C:\Users\sony\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\commands\commands.py", line 90, in wrapped
raise ApplicationCommandInvokeError(exc) from exc
discord.commands.errors.ApplicationCommandInvokeError: Application Command raised an exception: NameError: name 'channel_list' is not defined```
u just want a meme cmd ryt?
wait, there is a reddit module?
where did you get that reddit module can i have the repos?
oh praw...
its called praw
i know
i've installed it, never learned how to use it :\
just search it and look at a vid
okay
can I hyperlink something in a footer
commit()```
This method commits the current transaction. If you don’t call this method, anything you did since the last call to `commit()` is not visible from other database connections. If you wonder why you don’t see the data you’ve written to the database, please check you didn’t forget to call this method.
no.
any1?
It’s a Connection method
Not Cursor
It should be db.commit() in your case
Also consider using an async version of SQLite
!pypi aiosqlite
Use that
Hey, how do I get a message out of an embed ?
I tryed to split it but that didnt works
That’s kind of an ambiguous question. Like what part of the embed do you want?
the description
The description of the embed. This can be set during initialisation.
Not subscriptable means you can’t index or slice it.
And you can’t do any of those things with None
Whatever you're trying to splice/index is None
fyi. Splice and Slice are different.
!e
a = "ABCDEFG"
print(a[:-6])
@final iron :white_check_mark: Your eval job has completed with return code 0.
A
that’s slicing.
So would this being splicing or slicing?
Ah
I always thought that was splicing
What is splicing then?
You need to do db.commit() for the changes to apply
thank you Rush for saying the same exact thing I said.
Wait there is an unofficial Discord API too?
no. that doesn’t exist.
I just saw something like that
Did not see your message.
1 min
There’s an Unofficial API support server.
Idk. It’s something that Danny made.
what is bot.user_command and how does it work?
Then I need the link even more badly
Guess I found it
issoke 🙏
Honestly don’t remember.
In the case I’m wrong. It’s probably an alias for slicing.
I asked in general. Let's see if I get a response
i thought danny got handed the server ownership?

nice
There is os.splice https://docs.python.org/3/library/os.html#os.splice,
don't know is that what you are talking about
when you send a request to discord to leave a guild, what does the "lurking" parameter mean?
what lurking parameter
this
I'm trying to make an image command that searchs images in a website, I followed a tutorial.
code: py @bot.command() async def image(ctx, *, search): search = search.replace(' ', '') url = f"https://api.unsplash.com/photos/random/?query={search}&orientation=squarish&content_filter=high&client_id={token}" async with aiohttp.ClientSession.get(url) as r: if r.status in range(200,299): try: data = await r.json() url = data['urls']['regular'] e = discord.Embed( title = 'Aqui esta tu foto', ) e.set_image(url=image) await ctx.send(embed=e) except IndexError: await ctx.send('Imagen no encontrada.') else: await ctx.send(f'Error al hacer la petición. {r.status}')
Traceback: ```Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "main.py", line 43, in image
async with aiohttp.ClientSession.get(url) as r:
TypeError: get() missing 1 required positional argument: 'url'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/ext/commands/core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: get() missing 1 required positional argument: 'url'```
async with aiohttp.ClientSession().get(url) as r:
try this
it works but it says The else Error al hacer la petición. 401
That random/?query= looks weird
client_session: <aiohttp.client.ClientSession object at 0x7fe6ab3583a0>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7fe6ab339940>, 71556.599530096)]']
connector: <aiohttp.connector.TCPConnector object at 0x7fe6ab358160>```
Have you tried random?query=?
same traceback
Wait bones did you just got helper role?
That's not an error
yes, i remember him without the role
oh
Yeah,thats nice
so why it doesnt work xd?
He deserves it ngl
@bot.command()
async def image(ctx, *, search):
search = search.replace(' ', '')
url = f"https://api.unsplash.com/photos/random?query={search}&orientation=squarish&content_filter=high&client_id={token}"
async with aiohttp.ClientSession().get(url) as r:
if r.status in range(200,299):
try:
data = await r.json()
url = data['urls']['regular']
e = discord.Embed(
title = 'Aqui esta tu foto',
)
e.set_image(url=image)
await ctx.send(embed=e)
except IndexError:
await ctx.send('Imagen no encontrada.')
else:
await ctx.send(f'Error al hacer la petición. {r.status}')```
It's a warning that you haven't closed the ClientSession
yes, u need it too
Not really ive done nothing compared to others
so it doesnt matter?
u helped me several times
I try my best
Well it doesn't but you can close it with await r.close()
Actually that won't work lmao
you should use a separate context manager for ClientSession
how i can make the bot send the image instead of this: Error al hacer la petición. 401
async with ClientSession() as session:
async with session.get()
That looks like an error code
^
url thing its like this rn: url = f"https://api.unsplash.com/photos/random?query={search}&orientation=squarish&content_filter=high&client_id={token}"
hmm is the token correct?
yes
Hmm the api is returning that error code I think you have some problem with that endpoint
did a stupid error but same thing
in the embed i did e.set_image(url=image)
but changed it to url
the bot sends same thing f
it's probably just tracking whether or not you are lurking for server statistics
which request was it in?
Guys guys, a question
I have a dictionary (global variable) and it stores data like guild_id = messages, I want to check the number of messages using iteration and if the number of messages exceed the default limit, I want to fetch the guild id, how do I do that?
just put, help_command = None in your bot constructor
!d discord.ext.commands.Bot
class discord.ext.commands.Bot(command_prefix, help_command=<default-help-command>, description=None, **options)```
Represents a discord bot.
This class is a subclass of [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") and as a result anything that you can do with a [`discord.Client`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") you can do with this bot.
This class also subclasses [`GroupMixin`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.GroupMixin "discord.ext.commands.GroupMixin") to provide the functionality to manage commands.
Then restart.
Or
bot.remove_command("help")
Its not a coro right
,-,
Nope but i prefer the kwarg method.
Same
I do the kwarg method it looks cleaner
anybody answering my question?
Or just subclassing the help command the best by far.
I just make a new command lol
Is there a reason why you are using global?
Its just an empty dictionary
main_message_count = {}
@client.event
async def on_message_delete(message):
if message:
if message.guild.id not in main_message_count:
main_message_count[message.guild.id] = 1
return
main_message_count[message.guild.id] += 1
I get that but global is not something i recommend.
Pretty easy lol
I meant.....
Subclassing is the best method of editing the help command -> https://gist.github.com/InterStella0/b78488fb28cadf279dfd3164b9f0cf96
Well you can just len() it right?
could you explain a bit pwease
!e ```py
test = {"test": 1, "yes": 2}
print(len(test))
@cloud dawn :white_check_mark: Your eval job has completed with return code 0.
2
you didnt understand my question ig
Its saying it has 2 pairs of keys and values right
I see but you can't have multiple duplicate keys. So you can't have 2 guild id's
Dict.keys() is a thing ig
ummm.....
i have an if statement for that
NVM i FOUND THE BULK MESSAGE DELETE EVENT, THAT'LL HELP ME
Owo
or 

gang where you at?
h-h-h-h-h-h-h-h-here
average vsc hater

me also 
Fax
anyways, #editors-ides
IDE wise PyCharm. Text editor wise VSC
I use vscode sometimes.
Is honestly use Atom over vsc tbh. If I wanted IDE features I’d use an actual IDE
Off-topic channels
There are three off-topic channels:
• #ot2-never-nester’s-nightmare
• #ot1-perplexing-regexing
• #ot0-psvm’s-eternal-disapproval
Their names change randomly every 24 hours, but you can always find them under the OFF-TOPIC/GENERAL category in the channel list.
Please read our off-topic etiquette before participating in conversations.
I knew you were gonna do that
he knew 
For coding discord bots i use atom

I always do🕴️
Extensions?
#editors-ides also exists tho
🤷♂️

Material theme exists.
Ok that shit actually sucks.
:rooEww:
I been using it for years
Rip nitro
> anything else
Ok
Oh yeah i forgot you nitro was gonna expire
What about ms word
🕴️
In MS word you can give everything a different color AND font, what IDE let's you do that?
Ms word
The one that has a sane design.
That video Joma Tech made on Ms word as an IDE was a bonafide shitpost
Jomu op
sublime +sftp
Poor jupyter notebook
🕴️
sftp is annoying keeps kicking me off after 30 min
ftp king

nvr issues for me
Aww


You guys are using VSC and all that other stuff, but neovim on top
whats this🤔
VSC Insiders
Haha no🕴️
Beta version of vscode
Vim's the best
Ah alr
Vim & neovim, basically the same thing
The emoji says it
Although I prefer neovim more
Meh, cli best
neovim is a cli as well
Notepad is better
If you use cli editors you actually belong in a mental hospital. unless you need to quickly edit something, they have their uses. though if it mattered that much id just use nano or micro
How??
Ms word Op smh
Anyways, #editors-ides
Nah you tripping
Different colors uwu
You really doing
ctrl c + ctrl v
🚶
Different front uwu
bro
I- even my vsc is colorful ngl
bro
indexed chapters, page numbers.
Not the uwu 🚶
Headers, footers, text boxes
Page design
Online editor.
I-
Don't see any cloud editing for vscode
Yall forgot the best editor tbh
Tell me more
Its jupyter notebook ofc
ewwie
Why can't code in discord

Wth
holdon
Made an eval command for my bot and im runnig a bot with a bot🕴️ 
Like discord comes with inbuilt interpreters
Doesn't look like vscode to me
Look at the left side, this is quite literally vscode
Oh you're right.
huh who knew.
😂
Looks cursed to me
I mean fleet has that.
Fleet is basically just vsc but with IntelliJ code processing.
What is neovim😔
Vim fork
Better vim
I made two bot talking together
What is vim🤬
Terminal editor
🚶
Ah okie🚶
What are they talking about?
Taking over humanity


I made a bot that runs a bot with a eval command and the bot im running with the eval is running a bot with a eval command 🕴️
anyone know how to space out embed fields
instead of format, u can do
sql = """SELECT timestamp FROM users WHERE user_id = ?"""
await cursor.execute(sql, (user_id,))
then just do timestamp-10
You can't customise the spacing, that's a discord limitation
Depends, sql has a DATE DATETIME and TIMESTAMP type, so it doesn't always need to be epoch time
@hidden hazel Are you trying to add cooldowns to commands inside on_message..?
I have to give props to the dedication if so.
So why are you using a DB for that..? Seems like a weird solution right now then.
You could also just use discord.py's built in cooldown system to make a custom bucket for message sending cooldowns
@hidden hazel```py
import typing
import discord
from discord.ext import commands
class SomeCog(commands.Cog):
def init(self, bot):
self.bot = bot
self._cd = commands.CooldownMapping.from_cooldown(1, 6.0, commands.BucketType.member) # Change accordingly
# rate, per, BucketType
def get_ratelimit(self, message: discord.Message) -> typing.Optional[int]:
"""Returns the ratelimit left"""
bucket = self._cd.get_bucket(message)
return bucket.update_rate_limit()
@commands.Cog.listener()
async def on_message(self, message):
if "check something":
# Getting the ratelimit left
ratelimit = self.get_ratelimit(message)
if ratelimit is None:
# The user is not ratelimited, you can add the XP or level up the user here
else:
# The user is ratelimited
I get that you want to track the messages to count it but to use a DB to see how many messages got typed in the last 10 seconds is a bit over the top.
Does on_channel_update on_channel_delete and on_channel_create exist?
This is deviating a bit but perhaps a asyncio.Lock and asyncio.sleep here could work as well
yes
tnx
Then you are still using the database. And i suggest using the RAM since it will use less resources then.
in the on_channel_update there is like before, after parameters? or there is another one
@bot.event
async def on_channel_update(before,after):
# Channel Update Logs
channel = bot.get_channel(913158722992373854)
await channel.send(f"🖊️ [{after.created_at.replace(microsecond=0)}] El nombre del canal {after.mention} ha sido editado. \nAntes: `{before.name}`\nDespués: `{after.name}`")```bc this sends nothing
PandaBweer ❤️
no only 1 parameter, and its channel
Called whenever a channel is updated. e.g. changed name, topic, permissions.
Parameters: channel – The Channel that got updated.```
tnx
!d discord.on_guild_channel_update
discord.on_guild_channel_update(before, after)```
Called whenever a guild channel is updated. e.g. changed name, topic, permissions.
This requires [`Intents.guilds`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.guilds "discord.Intents.guilds") to be enabled.
oh there u have another 🙂
thanks!
at least the bot is feeling better now
thanks for helping @honest vessel @cloud dawn
You could, have a temp dict inside of your code, when a user sends a message, store message.created_at that inside of the dict. Have a if statement inside of the on_message callback checking if the created_at exists, if so check if it is 10 seconds behind of datetime.datetime.utcnow(), if it is continue
Idk if I explained that well, but I don't see an error in logic with that method
oh i was checking old API doc 😛
Saves resources as well
Is the legacy even up to date?
i guess not buddy 😄
Then you'd just do ```py
if datetime.datetime.utcnow() >= (stored_timestamp + datetime.timedelta(seconds=10))
And i'm telling you that is not a good way to code it, on each message the person send it will connect to the database. Even with the 10 sec interval i would have made a task for commiting to the DB. Since you are just using bandwith like crazy right now.
You are also not using an async driver for sqlite
maybe his db is on same server
Even then it's inefficient.
and prob not 9999999 users
But, an upside would be that the timestamp persists after the lifetime of the bot ends
E.g if the bot had downtime within those 10 seconds, It would remember that
Assuming it doesn't auto restart it wont be in 10 seconds anyways.
how i can know if a channel its a voice channel or a text one?
Yep, but either way the read and write speeds of sqlite are pretty fast, and it's a database so it is already meant to be queried a lot
If you want you could cache the database for more resources save as well
It shouldn't matter so as long as you use an async driver for sqlite
!d discord.abc.GuildChannel
class discord.abc.GuildChannel```
An ABC that details the common operations on a Discord guild channel.
The following implement this ABC...
tnx
!d discord.ChannelType Every channel type has the attr .type
class discord.ChannelType```
Specifies the type of channel.
I don't agree, just because it can query a lot doesn't mean you should.
How can I send a message to a channel using the channel ID?
Get the channel object first.
!d discord.ext.commands.Bot.get_channel
get_channel(id, /)```
Returns a channel or thread with the given ID.
await fetch_channel(channel_id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a [`abc.GuildChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel "discord.abc.GuildChannel"), [`abc.PrivateChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.PrivateChannel "discord.abc.PrivateChannel"), or [`Thread`](https://discordpy.readthedocs.io/en/master/api.html#discord.Thread "discord.Thread") with the specified ID.
Note
This method is an API call. For general usage, consider [`get_channel()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Bot.get_channel "discord.ext.commands.Bot.get_channel") instead.
New in version 1.2.
channel = self.bot.get_channel(the_id_of_channel_u_want)
msg = await channel.send("Hi")
channel = await bot.fetch_channel("id")
channel.send("message")
would this work?
Best practice is this ```py
channel = bot.get_channel(23232938902) or await bot.fetch_channel(23232938902)
Why are you guys sending the message separately?
No this wouldn't.
makes it easier for him to read?
and also if u wnt to delete msg, u have the variable
Scalability aspect the best option would be a database like right now compared to dict as well as for the data presist; It doesn't really matter whether or not you use a database here it's not a huge deal
how would I send the message then?
Your getting a channel obj just send the message with it
await bot.get_channel(int).send("msg")
okay, so I was right then
Not to mention the database can be used for more than just storing timestamps as well
Although dict getitem is O(1) so it's def faster
You were only fetching the channel
3 different people giving the same exact solution to the same exact person.
No you weren't you just edited it. And .send() is also a coroutine.
Best service
I wasn't.
I edited it before you said that I was wrong
I first try to get it from the cache else fetch it.
well, what I mean is that you were not sending anything to the channel
anyways, I get it now, thanks guys
👍
If your gonna fetch a channel and send a msg with the .send() attr then youll need 2 awaits
Since fetch and .send are both coros
ok
Problem isn't the awaiting though
This won't work btw.
The issue is that you spend 2 ratelimit requests to get a channel, and to send a message
Whilst grabbing from cache spends a net total of 1 request
Wdym
Well you can't send a coroutine object.
They are sending a string though
You arent?
They aren't i recommend testing it out on your own bot
I literally just did Panda.
# Won't work
await bot.get_channel(int).send("msg")
# will work
await (bot.get_channel(int)).send("msg")
await(await bot.fetch_channel(int)).send("msg")
Wouldn't that work
You don't need the parenthesis to manipulate the order of calls here though
You do


@bot.event
async def on_guild_channel_create(channel):
# Channel Create Logs
print(channel.type)
tipo = ""
if channel.type == "text":
tipo = "El canal de texto"
elif channel.type == "voice":
tipo = "El canal de voz"
elif channel.type == "category":
tipo = "La categoria"
elif channel.type == "stage_voice":
tipo = "El escenario"
elif channel.type == "store":
tipo = "La tienda"
elif channel.type == "news":
tipo = "El canal de noticias"
channel2 = bot.get_channel(913158722992373854)
await channel2.send(f"🖊️ [{channel.created_at.replace(microsecond=0)}] {tipo} `{channel.name}` ({channel.id}) ha sido creado.")``` why this only sends the tipo variable empty
Ignoring exception in command test:
Traceback (most recent call last):
File "C:\Users\eboss\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\core.py", line 175, in wrapped
ret = await coro(*args, **kwargs)
File "C:\Users\eboss\Downloads\p.py", line 18, in test
channel = await bot.fetch_channel(814647436575244298).send('test')
File "C:\Users\eboss\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\client.py", line -1, in fetch_channel
TypeError: can't send non-None value to a just-started coroutine
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\eboss\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\bot_base.py", line 560, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\eboss\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\core.py", line 929, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\eboss\AppData\Local\Programs\Python\Python310\lib\site-packages\disnake\ext\commands\core.py", line 184, in wrapped
raise CommandInvokeError(exc) from exc
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: can't send non-None value to a just-started coroutine
==============
@bot.command()
async def test(ctx):
channel = await bot.fetch_channel(814647436575244298).send('test')
what does it print
Yes because fetch_channel is a coro
What okimii sent was get_channel() which is a cache call
Oh i looked wrong
2 coros
Well anyways with a coro it's ```py
await (bot.fetch_channel(814647436575244298)).send('test')
@cold sonnet
Dont you need 2 awaits?
how can i scrape all members from a discord server? i want to make a giveaway bot
hmm lemme test
Try my method
that's all it prints
To
?
Nah my other msg lol
This is the syntax yeah ```py
await (await bot.fetch_channel(814647436575244298)).send('test')
Yup i think so
when i create a text channel: text. voice channel: voice. stage: stage_voice. news: news
?
when i create a text channel the type its text, when i create a voice one its voice, a news one news, a stage channel stage_voice
But yes that's how the syntax is
discord.TextChannel for example
They return strings.
what
how i can make it work
bc i dont know why it doesnt send the tipe
type*
Hmm they are an enum so that's why it is just text
But you can compare them to a string though.
If you want.
can u help me xd, i dont understand
so why don't it enter an if statement
Because hes comparing a string to an Enum
If you want to compare enum to string you need to cast it to str
This should just work though hmm
enumerator
like red = 3
Panda did you even read what Andy just said
!e ```py
from enum import Enum
class A(Enum):
text = 0
print("text" == A.text)
@pliant gulch :white_check_mark: Your eval job has completed with return code 0.
False
But tbh i would just make the response a bit broader like this is a ...
tried but spanish grammatic its different xd
how can i pass enum to str
that's what I'm asking myself
You need to compare an Enum with an Enum, E.g if channel.type is ChannelType.text
I don't know python
ohhh
Don't do that, just do what I just said
they aren't attributes nor methods so I'm out there
okay, thanks bro
u made me think XD, didnt remember that
!d discord.ChannelType
class discord.ChannelType```
Specifies the type of channel.
lol
Tipo means type btw panda
Know because my native language is spanish
Average american
Lol
i should be able to do this right? waiting.insert(0, [userid, 'staff'])
If waiting is a list, yes you can
It isn't a list then
Perhaps you instantiate a new waiting variable that overwrites the previous
nope there isn't anything that makes waiting not a list
Can you show your code
1 sec brb
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.
how can u make it so only the person who runs the command can click the buttons
Run a check with Context.author
in the view?
Well, you assign waiting with e.read(), that would make it a string
You should be doing json.dump
i see
!d discord.Embed.description
The description of the embed. This can be set during initialisation.
i did not know that
can someone say me how this works (i will grab the description out of an embed)
Woops, I meant json.loads
!d json.loads
json.loads(s, *, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw)```
Deserialize *s* (a [`str`](https://docs.python.org/3/library/stdtypes.html#str "str"), [`bytes`](https://docs.python.org/3/library/stdtypes.html#bytes "bytes") or [`bytearray`](https://docs.python.org/3/library/stdtypes.html#bytearray "bytearray") instance containing a JSON document) to a Python object using this [conversion table](https://docs.python.org/3/library/json.html#json-to-py-table).
The other arguments have the same meaning as in [`load()`](https://docs.python.org/3/library/json.html#json.load "json.load").
If the data being deserialized is not a valid JSON document, a [`JSONDecodeError`](https://docs.python.org/3/library/json.html#json.JSONDecodeError "json.JSONDecodeError") will be raised.
Changed in version 3.6: *s* can now be of type [`bytes`](https://docs.python.org/3/library/stdtypes.html#bytes "bytes") or [`bytearray`](https://docs.python.org/3/library/stdtypes.html#bytearray "bytearray"). The input encoding should be UTF-8, UTF-16 or UTF-32.
Changed in version 3.9: The keyword argument *encoding* has been removed.
How can I make a button only viewable to a certain person or role?
epheremal=True
but how do I state the role/person that can only view it
person is just whoever runs the command, role just use a @has_role decorator
can I set any other person?
not just the person who ran the command
dont think so, discord limitation
Just send the message again.
ok, thanks
Would that even work without making a new interaction?
As sending the first message already "responds" to the interaction
no
You can't respond to the same interaction twice
Not unless the first response was a defer
defer not gonna help him tho so idk
Yea, so you can't just simply send the message again
You would need a new interaction
Since, like I said you can't respond to a already responded interaction
And the only way to send ephemeral messages is via an interaction response
@bot.command()
async def profile(ctx, member: disnake.Member):
Code here...
Afaik buttons dont have an ephemeral kwarg
if u set the message to ephemeral then the buttons would also be, no?
No
Only the message will be ephemeral
how can you have permissions for buttons then?
Check the author
!d disnake.ext.commands.MemberConverter
class disnake.ext.commands.MemberConverter(*args, **kwargs)```
Converts to a [`Member`](https://docs.disnake.dev/en/latest/api.html#disnake.Member "disnake.Member").
All lookups are via the local guild. If in a DM context, then the lookup is done by the global cache.
The lookup strategy is as follows (in order)...
Its a member obj
but from a diff persons pov u wont just see random buttons lol
attached to nothing

Ephemeral is only for interaction msgs
interactions can have a view tho
The buttons are attached to the message, so what he means is that, other users won't just see random buttons which are attached to the message that they can't see
Wdym
U can't run 2 bots in a file right ?
You mean attaching buttons on an ephemeral msg?
Can someone link the docs for client.wait_for ? I tried using !d and Python yelled at me :(
Then yes it wouldn't be visible since its attached to the ephemeral msg
Sir that’s illegal
!d discord.Client.wait_for
wait_for(event, *, check=None, timeout=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Waits for a WebSocket event to be dispatched.
This could be used to wait for a user to reply to a message, or to react to a message, or to edit a message in a self-contained way.
The `timeout` parameter is passed onto [`asyncio.wait_for()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.wait_for "(in Python v3.9)"). By default, it does not timeout. Note that this does propagate the [`asyncio.TimeoutError`](https://docs.python.org/3/library/asyncio-exceptions.html#asyncio.TimeoutError "(in Python v3.9)") for you in case of timeout and is provided for ease of use.
In case the event returns multiple arguments, a [`tuple`](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.9)") containing those arguments is returned instead. Please check the [documentation](https://discordpy.readthedocs.io/en/master/api.html#discord-api-events) for a list of events and their parameters.
This function returns the **first event that meets the requirements**...
Ohhh I was doing it wrong, thank you
How can i make a check that makes the intr author the ctx author
hello
Does intr have a author attr?
Never seen one
yes
did you know about pafy library
intr in the sense interaction only na?
Mind sending it?
Yes ofc
yes it has
^
guys
you mean check function?
No
ty
Like the attrs of intr where it says author
check=lambda inter: inter.message.id == message.id and ctx.author.id==inter.author.id
Because ive never seen one idk if im blind but never seen one
This is the #discord-bots channel 👀
yeah this library for discord bot
dude
Does the module interact with the discord API?
no but its have good connect with the lib
!pypi pafy
this lib help you do music bot
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)

btw, going back to the topic of making a button ephemeral. Can't I just make a check if the user interacting with it is a certain user (that I fetch with the user's id). And then send them and ephemeral message saying that the button is not for him or smt, if he tries to interact with it of course?
didn't know d.py had button support
Disnake*
nobody would help you tho
because rule 5
rule 5 ?
well, personally I use pycord. But d.py 2.0 has support for buttons as well
Well if you add a button to an ephemeral msg no need for a check
2.0?
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
Ah yeah it does download video/audio
yeah, but an ephemeral message can only be shown to the user who interacts with the message
dude all people requseting help here
....
why just me
read the rule?
Then make a check with the interaction author and the ctx author
- this is just lib not something break laws
ye it is
yeah, the latest version, you have to get it of github, it isn't on pypi
it breaks TOS
so you said req help its break laws ?
yeah, that's what I was talking about
@cloud dawn is their really an author attr for an interaction?
can i get a link? also how would i view the docs for that?
sure ig
!d disnake.Interaction.author
The user or member that sent the interaction.
just search up discord.py on github, I don't think that I can send links here
for docs just go to readthedocs.io
and find discord.py on there
well, yes, it got archived, but all the stuff is still there, and it works
that doesn't have button support or anything tho, does it?
and that is why people are making forks of it, so that they can keep on working on it, and make updates if something new comes up
but currently, while discord hasn't created any massive api breaking update, it all works perfectly fine
alright
it does
but yeah, it is just better to use one of the forks
It does
It has all components
Oh
Watch him drop a fat explanation 
Maybe later
To bad ig
User Timeout moderation feature is releasing monday 😮
holy fucking shit. I just published my bot, and its already laggy as hell (4gb 2core vds), wtf.
client.latency * 1000 right?
round(client.latency * 1000, 2)
ive had response times of less then 20ms...
