#discord-bots
1 messages Β· Page 1005 of 1
async with aiohttp.ClientSession() as session:
async with session.get(str(url)) as resp:
if resp.status != 200:
return await ctx.send('L Bozo')
data = io.BytesIO(await resp.read())
await ctx.guild.edit(icon=data.read())
await ctx.send("π")
I am trying to change the server icon where I give the gif url and it changes the icon to that but i am getting an error ValueError: Unsupported image type given
Can anyone tell what i am fucking up here
you clearly dont have PIL
and why would you do that
anyone pls?
you got it now?
who wanna make a discord bot with me (:
can you print data.read()
alr let me check once again
gives a huge ass html script, what shall i do now?
!ot 
Off-topic channel: #ot2-never-nesterβs-nightmare
Please read our off-topic etiquette before participating in conversations.
Focused on what?
wdym
uh
rate limited
or soft ban
nooo not that
you should only have a discord.File instance
if that were the case my bot wouldn't go online the other commands are working just fine
oh
let me try once again
where do you get the GIF from
Hi
!d discord.Guild.edit
await edit(*, reason=..., name=..., description=..., icon=..., banner=..., splash=..., discovery_splash=..., community=..., afk_channel=..., owner=..., afk_timeout=..., ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the guild.
You must have the [`manage_guild`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_guild "discord.Permissions.manage_guild") permission to edit the guild.
Changed in version 1.4: The rules\_channel and public\_updates\_channel keyword-only parameters were added.
Changed in version 2.0: The discovery\_splash and community keyword-only parameters were added.
Changed in version 2.0: The newly updated guild is returned...
Heey can someone help me?
Any main topic that the bot would be focused on?
Ok
what
icon kwarg accepts byte like objects
No onee can help me?
hmmm i just read that in docs i am running once again
ok ok
you didn't ask anything
makes sense
just if someone will code a bot with you
k
mhm
and there's a high chance nobody will do that
in this channel we talk and help others about discord bot development, usually we don't talk about our projects or ask help for them
What is "Content-Type" header
Case matters: from PIL import Image
you can discuss and ask questions about discord bots here, but this server is not for recruiting people to work with you or to teach you
Okay! Thanks for informing me
Usually contains the extension type of the file.
@daring olive Are you still contributing to @unkempt canyon ?
If you are using disnake you can make / commands with this!
@bot.slash_command(name='')
uhhhhh very occasionally and mostly on small cosmetic things
or things related to moderation
Ahh okay
I justed asked him what content type he has not what does that header mean you didn't get me right
oh 
You had from PIL import image
how do i delete all the messages in a channel
await delete_messages(messages, *, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Deletes a list of messages. This is similar to [`Message.delete()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message.delete "discord.Message.delete") except it bulk deletes multiple messages.
As a special case, if the number of messages is 0, then nothing is done. If the number of messages is 1 then single message delete is done. If itβs more than two, then bulk delete is used.
You cannot bulk delete more than 100 messages or messages that are older than 14 days old.
You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to use this...
nevermind, I was using a www.tenor.com/view/ link which I shouldn't and I was blaming the code
When I gave the image url instead of web url as an argument, it changed the server icon
?
How can I make it reply to the sender's message?
await ctx.reply()
Yea, uhh, that
I need it to respond with a message in a frame
example:
then u make an embed
I don't understand how to do it
can you please edit the code as needed?
@bot.command()
async def avatar(ctx, member: discord.Member = None):
if member == None:
member = ctx.author
await ctx.reply()
embed = discord.Embed(colour=discord.Color.light_grey(), title=f"Avatar of {member.name}", url = member.avatar_url)
embed.set_image(url = member.avatar_url)
await ctx.send(embed = embed)```
@bot.command()
async def avatar(ctx, member: discord.Member = None):
if member == None:
member = ctx.author
embed = discord.Embed(colour=discord.Color.light_grey(), title=f"Avatar of {member.name}", url = member.avatar_url)
embed.set_image(url = member.avatar_url)
await ctx.reply(embed = embed)
@slate swan what is yr ide
Visual Code Studio
Hm do u have two Python installations?
idk
Just see from control panel and programs and features option
see if it shows two Python versions
my friend has a problem
invite him to this server with the link https://discord.gg/python
second
339k π still not much active
Yes
yes ik
I loss many brain cells during making
What's ur issue
No
It's easy
What's hard in that?
Any particular thing?
what have you tried till now?
what is the doc for reacting to a message
!d discord.Message.add_reaction
await add_reaction(emoji, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Adds a reaction to the message.
The emoji may be a unicode emoji or a custom guild [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji").
You must have the [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission to use this. If nobody else has reacted to the message using this emoji, the [`add_reactions`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.add_reactions "discord.Permissions.add_reactions") permission is required.
Changed in version 2.0: `emoji` parameter is now positional-only.
Changed in version 2.0: This function will now raise [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError "(in Python v3.10)") instead of `InvalidArgument`.
ty
How do I add a reaction to a message?
There are a few ways to do it, firstly, you need the emoji you want.
For basic (non custom) emojis, this can be either:
The Codepoint \u2705
The Raw Unicode joy
The Name \N{MAN IN BUSINESS SUIT LEVITATING}
For custom emojis, you will need to specify it in a format similar to:
name:id for static emojis, or a:name:id for animated emojis.
Note that you must NOT have the <> in the reaction.
Or an alternative way,
discord.PartialEmoji(is_animated (True or False), name, id)
How can I use to add a reaction?
await message.add_reaction(<your emoji>)
use R.danny π
Nvm
@unkempt canyon superior
I won't say a word
How can I make my Discord bot ping a pinged person? For example, User1 pings User2 in a punch command, and the bot sends: @User1 punched @User2!. How can I do that? But I also want the bot to send a random answer after that, for example, User2 survived; User2 died and smth. Btw, everything is gonna be in an embed.
Using discord.py
!d discord.Member.mention
property mention```
Returns a string that allows you to mention the member.
@somber heath just add : discord.Member at the end of the arg, that is, typehint it with discord.Member and u can then do user.mention
Back
ur old style was better
?
That bold title
Traceback (most recent call last):
File "c:\Users\Me\Desktop\gnomesbot\Discordbot.py", line 1, in <module>
import discord, asyncio, os
File "C:\Users\Me\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\__init__.py", line 25, in <module>
from .client import Client
File "C:\Users\Me\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\client.py", line 53, in <module>
from .webhook import Webhook
File "C:\Users\Me\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\webhook\__init__.py", line 12, in <module>
from .async_ import *
File "C:\Users\Me\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\webhook\async_.py", line 46, in <module>
from ..channel import PartialMessageable
ImportError: cannot import name 'PartialMessageable' from 'discord.channel' (C:\Users\Me\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\discord\channel.py)
Why am I getting this error? My bot was working earlier and I havent changed anything ;-;
Delete the Python from Microsoft Store and get one from https://python.org
Hi , im on replit and im experiencing this error whenever I try to run my bot . Pls help
dont use replit

Who is this in response to? lol
You were ratelimited
You
Why do I need to reinstall python? it was working earlier.
@drifting arrow u got from Microsoft Store?
Download from google
Well, that is the issue
Delete the one from MS Store and get from https://python.org
go to shell and type kill 1
works for me

I'll do it since then if the issue persists I can say I did it. But I dont believe it could be since everything was fine for the last year..
so why would it suddenly break?
Replit suks
do i have to specify the message id in this code?
if reaction.emoji == 'β
':
print('checkmark detected')
await ctx.send(f'checkmark detected! it is in {msg.id}')
await add_reaction(β
,)
# We break since we already found the check, heading to next message
break
Try running ur bot on more than 10 servers then you'll see
Well, MS Store Python does that many times tbh
I have had a talk with a few ppl before too, who had MS Store Python. Their issue was fixed after getting from https://python.org, tho the reason is still unknown as to why that happened
msg = await ctx.send
await msg.add_reaction()
anyone can copy ur code
who are you talking to lmao
@drifting arrow DMed u smth
i got this error
ββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββ
ββββββββββββββββββββββββββββββ
Whiskey Bot
Developed by: David Powell
Starting Bot
Connecting to Discord API.
Please Wait
Connected!
Bot is ready.
Waiting For Commands
Running Search
$allmsg
GG @flint isle, you just advanced to level 6!
π¦
$allmsg
checkmark detected! it is in 967915351159500892
checkmark detected! it is in 967915351541182545
checkmark detected
Ignoring exception in command allmsg:
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "<string>", line 90, in msg
TypeError: object method can't be used in 'await' expression
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/site-packages/discord/ext/commands/core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "/data/user/0/ru.iiec.pydroid3/files/aarch64-linux-android/lib/python3.9/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: object method can't be used in 'await' expression
show code
oh yeah 1 sec sry
Code art cool
for msg in msgs:
print(msg.content)
if msg.reactions:
for reaction in msg.reactions:
if reaction.emoji == 'β
':
print('checkmark detected')
await ctx.send(f'checkmark detected! it is in {msg.id}')
msg = await ctx.send
await msg.add_reaction('π¦')
# We break since we already found the check, heading to next message
break
agreed
thx i got bored in dnd so I created that in there
Nice bot startup
Console
It looks clean
I meant, msg = await ctx.send() since ctx.send returns a discord.Message object
yeah the code is kinda spagette tho lol
import pause as time
print('ββββββββββββββββββββββββββββββ')
time.sleep(.05)
print('ββββββββββββββββββββββββββββββ')
time.sleep(.05)
print('ββββββββββββββββββββββββββββββ')
time.sleep(.05)
print('ββββββββββββββββββββββββββββββ')
time.sleep(.05)
print('ββββββββββββββββββββββββββββββ')
time.sleep(.05)
print('ββββββββββββββββββββββββββββββ')
time.sleep(.05)
print('ββββββββββββββββββββββββββββββ')
time.sleep(.05)
print('ββββββββββββββββββββββββββββββ')
time.sleep(.05)
print('ββββββββββββββββββββββββββββββ')
time.sleep(.05)
print('ββββββββββββββββββββββββββββββ')
time.sleep(.05)
print('ββββββββββββββββββββββββββββββ')
time.sleep(.05)
print('ββββββββββββββββββββββββββββββ')
time.sleep(.05)
print('ββββββββββββββββββββββββββββββ')
time.sleep(.05)
print('Whiskey Bot')
time.sleep(.1)
print('Developed by: David Powell')
thts what it turned out as
oh i forgot the parenteses didnt i
ngl I hate it when that happens
Yes, u need to send something lol
Wow nice π
wait wait wait
oh sent incompete code origionally
for msg in msgs:
print(msg.content)
if msg.reactions:
for reaction in msg.reactions:
if reaction.emoji == 'β
':
print('checkmark detected')
await ctx.send(f'checkmark detected! it is in {msg.id}')
await msg.add_reaction('π¦')
# We break since we already found the check, heading to next message
break
this should be the final code
since u wanna react to the message with the checkmark reaction, right?
List compre
cba to convert it to a list comp, sorry
yes
yea that should be it
Can you give me an example? I don't really understand
Just use new lines! aahh lol
def noob(arg : discord.Member)
I was programing it to look like an old line by line console
It delays the line so each waits a really short time to print the next
@somber heath
Oh, so I need to specify a user? Or no?
Yea
oof
who will make it async, where ctx, where : in the end
for bots where are the logging events normally sent? If it's all to one file, won't it be clogged up super quick?
maybe clear the file after sometime?
logging events as in?
the logging module events or...
yeah
!src
Ah, well those are sent in the console by default
logging.info when a command is ran or whatever
but won't you want to save them?
hold up, ill look up how @unkempt canyon does it
Best of Luck
bot/log.py lines 56 to 61
if constants.FILE_LOGS:
log_file = Path("logs", "bot.log")
log_file.parent.mkdir(exist_ok=True)
file_handler = handlers.RotatingFileHandler(log_file, maxBytes=5242880, backupCount=7, encoding="utf8")
file_handler.setFormatter(log_format)
root_log.addHandler(file_handler)```
nvm, I'll do it another way
bot/log.py lines 105 to 116
def _set_trace_loggers() -> None:
"""
Set loggers to the trace level according to the value from the BOT_TRACE_LOGGERS env var.
When the env var is a list of logger names delimited by a comma,
each of the listed loggers will be set to the trace level.
If this list is prefixed with a "!", all of the loggers except the listed ones will be set to the trace level.
Otherwise if the env var begins with a "*",
the root logger is set to the trace level and other contents are ignored.
"""```
what is __name__ again?
if __name__ == '__main__'
This is a statement that is only true if the module (your source code) it appears in is being run directly, as opposed to being imported into another module. When you run your module, the __name__ special variable is automatically set to the string '__main__'. Conversely, when you import that same module into a different one, and run that, __name__ is instead set to the filename of your module minus the .py extension.
Example
# foo.py
print('spam')
if __name__ == '__main__':
print('eggs')
If you run the above module foo.py directly, both 'spam'and 'eggs' will be printed. Now consider this next example:
# bar.py
import foo
If you run this module named bar.py, it will execute the code in foo.py. First it will print 'spam', and then the if statement will fail, because __name__ will now be the string 'foo'.
Why would I do this?
β’ Your module is a library, but also has a special case where it can be run directly
β’ Your module is a library and you want to safeguard it against people running it directly (like what pip does)
β’ Your module is the main program, but has unit tests and the testing framework works by importing your module, and you want to avoid having your main code run during the test
so if I have a logging config in my main file, it's carried to other files?
like py logging.basicConfig(level=logging.DEBUG)
This is in my main file, so i have to keep writing it for each cog file?
You could put it in your root namespace file
set the level there
It will carry across all your other package files
wait really?
and if i have 5 cog files and have in each, they all get printed to the same terminal right?```py
log = logging.getLogger(name)
Yea, I remember messing around with the void handler
π€―
Or should be? Iβm not confident so
If you want a singleton logger you should be using loguru
umm how do i refrence a custom emoji when i add a reaction? i forgot how
how do i get that number lmao
^^^ @flint isle
oh so
/"theemoji
mhm
yeah
k thx
short question, how can i make these 2 thogether?
so i would like have a list of "bad words" that trigger the whole action.
umm i dont have nitro how can i get the id for the animaed one?
in that case, ik a way. kinda complicated but yeah..
but for a simple one. just ask any of your friend to do that who've nitro
list_of_bad_words = []
any(word in message.content for word in list_of_bad_words)
@little ivy
please name the param message instead of ctx
personally, i just use the nqn bot to send that emoji and copy the id from the emoji url
is there some code i could program into my bot to pull them all?
cause none of my friends have nitro
yea ofcourse
!d discord.Guild.emojis returns a list of emojis you can use for loop on it
lmao i was about to say the same thing
All emojis that the guild owns.
dont the bad words need to be betweet (" ") instead of []?
just put the words in that list.. or u can even use tuple if u want
anything inside " " is one string, the [] is to store multiple strings inside
bro message.context? did you mean message.content?
I've seen people use log.info in bots, but when it's done all disnake internal events show up also
right mb
How do I make it so users can see a private voice channel?
Donβt make it private
Well I want to lock everybody out from entering it and then add a feature so you can invite people to it
No. thats for text channels.
I want voice channels lol
I want it to be a public feature tho. so I want to add people to the permissions list using a command
idk
The idea is, a user makes a new voice channel using a command, then if they lock it, they can invite people, which basically adds those invited to the permissions list so they can view the channel and join
also idk what stages is
hello there...
import discord
import asyncio
from discord import client
from discord.ext import commands
from pythonping import ping
def delays():
response_list2 = ping('35.158.5.187', size=40, count=10)
ms2 = response_list2.rtt_avg_ms
response_list = ping('168.119.193.207', size=40, count=10)
ms = response_list.rtt_avg_ms
if ms>0 and ms<=33:
desc='π’ Online'
elif ms>33 and ms<66:
desc='π‘ Minor Outage'
elif ms>=66:
desc='π Outage'
else:
desc='π΄ Offline'
if ms2>0 and ms2<=33:
desc='π’ Online'
elif ms2>33 and ms2<66:
desc='π‘ Minor Outage'
elif ms2>=66:
desc='π Outage'
else:
desc='π΄ Offline'
bot = commands.Bot(command_prefix='>')
client = discord.Client()
class Client(discord.Client):
async def on_ready(self):
print('Logged on as {0}!'.format(self.user))
async def on_message(self, message):
print('Message from {0.author}: {0.content}'.format(message))
async def my_background_task():
await client.wait_until_ready()
while not client.is_closed():
message = await client.get_channel(968499225845432330).fetch_message(968499691446755379)
await message.edit(embed=discord.Embed(title="Statuses", description=(f"**RDP**: {desc} - [`{ms}ms`]\n**Database**: {desc} - [`{ms2}ms`]"), color=0x1eff00))
embed.set_thumbnail(url="https://cdn.discordapp.com/attachments/912797781888999438/964829134553493534/Comp_1.gif")
embed.set_footer(text="Updates every 5 seconds")
delays()
await ctx.send(embed=embed)
await asyncio.sleep(5)
bg_task = client.loop.create_task(my_background_task())
client.run('token')
this should update the embed with new ms delay but it doesn't... any ideas why?
but thats for text channels. I'm looking for voice channels.
Change the ; to :
yes
How to send a video that is on a PC to embed?
try with pc path (im not sure)
I tried like this - it doesn't work
!d discord.Embed.set_image
set_image(*, url)```
Sets the image for the embed content.
This function returns the class instance to allow for fluent-style chaining.
how can I create an @command line that can tell the bot that the commando must not work against that role?
Firstly there is only a url kwarg, secondly you can't have videos as image. You can have gifs or webm tough.
Got it
You could use the file attr of send, but max 8mb
Yea, i know
how can I create an @command line that can tell the bot that the commando must not work against that role?
pls guys
Create a check
how?
how?
!d discord.ext.commands.check
@discord.ext.commands.check(predicate)```
A decorator that adds a check to the [`Command`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command "discord.ext.commands.Command") or its
subclasses. These checks could be accessed via [`Command.checks`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Command.checks "discord.ext.commands.Command.checks").
These checks should be predicates that take in a single parameter taking
a [`Context`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.Context "discord.ext.commands.Context"). If the check returns a `False`-like value then
during invocation a [`CheckFailure`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.ext.commands.CheckFailure "discord.ext.commands.CheckFailure") exception is raised and sent to
the [`on_command_error()`](https://discordpy.readthedocs.io/en/master/ext/commands/api.html#discord.discord.ext.commands.on_command_error "discord.discord.ext.commands.on_command_error") event...
There is an example if you click on the link.
@commands.has_role(968314252202999889)
@discord.ext.commands.check(968314247035650139)
role for the members @commands.has_role(968314252202999889)
the command must not work against the role I am indicating with id @discord.ext.commands.check(968314247035650139)
Yeah so you got to make a custom check.
Hi
dunno... try:
path = 'your path'
emb.set_image(attachment://path)
Your wrong lol
path = 'ur path'
embed = discord.Embed(title='')
embed.set_image(url='Ur image url here')
await ctx.send(embed=embed)
try that
@rare saddle
thanks
...
Thanks
(:
thats how it works on webhooks
Can someone help in #help-grapes
dunno if its same on dpy....
@bot.command()
@commands.cooldown(1, 86400, commands.BucketType.user)
async def daily(ctx):
So i have a command named daily with a 24h cooldown. Is it possible to reset the cooldown on midnight every day for everyone?
daily.reset_cooldown(ctx) resets the cooldown for the executing user, right? But not for everyone.
huh
import discord
import asyncio
from discord import client
from discord.ext import commands
from pythonping import ping
def delays():
response_list2 = ping('35.158.5.187', size=40, count=10)
ms2 = response_list2.rtt_avg_ms
response_list = ping('168.119.193.207', size=40, count=10)
ms = response_list.rtt_avg_ms
if ms>0 and ms<=33:
desc='π’ Online'
elif ms>33 and ms<66:
desc='π‘ Minor Outage'
elif ms>=66:
desc='π Outage'
else:
desc='π΄ Offline'
if ms2>0 and ms2<=33:
desc='π’ Online'
elif ms2>33 and ms2<66:
desc='π‘ Minor Outage'
elif ms2>=66:
desc='π Outage'
else:
desc='π΄ Offline'
bot = commands.Bot(command_prefix='>')
client = discord.Client()
class Client(discord.Client):
async def on_ready(self):
print('Logged on as {0}!'.format(self.user))
async def on_message(self, message):
print('Message from {0.author}: {0.content}'.format(message))
async def my_background_task():
await client.wait_until_ready()
while not client.is_closed():
message = await client.get_channel(968499225845432330).fetch_message(968499691446755379)
await message.edit(embed=discord.Embed(title="Statuses", description=(f"**RDP**: {desc} - [`{ms}ms`]\n**Database**: {desc} - [`{ms2}ms`]"), color=0x1eff00))
embed.set_thumbnail(url="https://cdn.discordapp.com/attachments/912797781888999438/964829134553493534/Comp_1.gif")
embed.set_footer(text="Updates every 5 seconds")
delays()
await ctx.send(embed=embed)
await asyncio.sleep(5)
bg_task = client.loop.create_task(my_background_task())
client.run('sussy token here')
why this doesnt update every 5s?
misteak
im not familier with that package you are using but here are somethings you can try instead of ```py
client.get_channel(968499225845432330).fetch_message(968499691446755379)
Use This:
it works alright... just it doesn't update
await (client.get_channel(...)).send(...)
prob put await inside the ()
and also use
@task.loop(...)
@foggy zealot
hi, how can i get the on member update if the username changed print username changed if the nickname nickname changed
hm
!d disnake.on_member_update
disnake.on_member_update(before, after)```
Called when a [`Member`](https://docs.disnake.dev/en/latest/api.html#disnake.Member "disnake.Member") updates their profile.
This is called when one or more of the following things change:
β’ nickname
β’ roles
β’ pending...
i started today so... yeah...its still hard
....
!d discord.on_member_update
u canot make that code in 1 day
discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") updates their profile.
This is called when one or more of the following things change:
β’ nickname
β’ roles
β’ pending...
ty
disnake and discord are mostly the same in terms of api reference and docs
u canot make that code in 1 day
or else u were editing
or copying and pasting
well im not planning to learn d.py now... i just needed this code...
how can I create an @command line that can tell the bot that the commando must not work against that role?
ok...
why not?
what do you mean?
elaborate futher plz
I already told you.
@commands.has_role()
not
must not work
so it should not allow that role to access the command?
!d disnake.ext.commands.check
@disnake.ext.commands.check(predicate)```
A decorator that adds a check to the [`Command`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.Command "disnake.ext.commands.Command") or its
subclasses. These checks could be accessed via [`Command.checks`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.Command.checks "disnake.ext.commands.Command.checks").
These checks should be predicates that take in a single parameter taking
a [`Context`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.Context "disnake.ext.commands.Context"). If the check returns a `False`-like value then
during invocation a [`CheckFailure`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.ext.commands.CheckFailure "disnake.ext.commands.CheckFailure") exception is raised and sent to
the [`on_command_error()`](https://docs.disnake.dev/en/latest/ext/commands/api.html#disnake.disnake.ext.commands.on_command_error "disnake.disnake.ext.commands.on_command_error") event...
just use this
I told him this 
ok...
so i have display name but i need username
kek, take it from here
str(user) is the name#discriminator
The userβs username.
o oke ty
I mean that the bot must not be used against an administrative role i.e. for example I did a dm command only for user warnings etc but it is used for bursts of fun by the staff so I am looking for a way that the bot does not send me messages or be used against me
if someone alr tryed helping you and you did not listen then i will do the same.
like dyno when you use a commando against a staffer of the same role it does nothing
usually you'll just get A 403 when it's against a higher mod
bro,I already did but it didn't work
!d discord.Member.guild_permissions.administrator
No documentation found for the requested symbol.
.
!d discord.Member.guild_permissions
property guild_permissions```
Returns the memberβs guild permissions.
This only takes into consideration the guild permissions and not most of the implied permissions or any of the channel permission overwrites. For 100% accurate permission calculation, please use [`abc.GuildChannel.permissions_for()`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.GuildChannel.permissions_for "discord.abc.GuildChannel.permissions_for").
This does take into consideration guild ownership, the administrator implication, and whether the member is timed out.
Changed in version 2.0: Member timeouts are taken into consideration.
yeah, here you go
!d discord.Permissions.administrator
Returns True if a user is an administrator. This role overrides all other permissions.
This also bypasses all channel-specific overrides.
just run a check
im here
@slate swan
Personally would use hierarchy to check.
yh lol
!d discord.Member.top_role
property top_role```
Returns the memberβs highest role.
This is useful for figuring where a member stands in the role hierarchy chain.
how would i get a message by its id from a dm
@client.command(name='Fancy-Embed')
@commands.has_role(123456789)
async def embed(ctx, imput: str):
embed = disnake.Embed(title=f'{imput}', description='This Is A Fancy Embed ish..', color = disnake.Color.random())
await ctx.reply(embed=embed)
trying to make a fancy embed lol
On what condition?
just the latest message sent
Why not just input why convert it to str?
i have its id so
idk trying make my coolest embed ever
message = discord.utils.get(await message.channel.history(limit=100).flatten(), author=dank_memer)
working with this rn
Ahhh
then i get this
send error
<Message id=968581779214729226 channel=<DMChannel id=968564134918623272 recipient=<User id=770444560215572481 name='Dank Memer' discriminator='8805' bot=True>> type=<MessageType.default: 0> author=<User id=770444560215572481 name='Dank Memer' discriminator='8805' bot=True> flags=<MessageFlags value=0>>
no error
...
it gives me this
what are u trying to do? purge messages?
i need the message's content
do you want it to purge message?
no
Then what
i just need the last message sent in that dm
your gonna need
Are you automating your account?
no
mhm
my account is like 2 years old
looks like it
id rather not have it banned
Why'd you read Dank Memer DM messages in that case?
its an example
π
How get bot developer badge i am one but i don't got it ):
You can't
Anyways it returns a channel object.
y
cant
As simple as that
they stopped giving them out'
They stopped giving it around 2 years ago
):
i see
);
!d discord.DMChannel
class discord.DMChannel```
Represents a Discord direct message channel.
x == y Checks if two channels are equal.
x != y Checks if two channels are not equal.
hash(x) Returns the channelβs hash.
str(x) Returns a string representation of the channel
Due to people spamming the queue with spam bots just because they wanted more pixels on their profile.
?
!d discord.DMChannel.history
async for ... in history(*, limit=100, before=None, after=None, around=None, oldest_first=None)```
Returns an [asynchronous iterator](https://docs.python.org/3/glossary.html#term-asynchronous-iterator "(in Python v3.10)") that enables receiving the destinationβs message history.
You must have [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permissions to use this.
Examples
Usage...
@regal pulsar You can use this the async return messages.
They created a bot, created 76 servers, made the bot join these 76 servers and applied for the verification to get the badge.
k
thx
Actually it was 100
Waiting time to get verified went far too high due to this and they decided to stop giving it.
nice
No, seems like it also was 76
why not give the name lol
i see
ill try it
Because it's not relevant and don't want to "advertise" it
... then send me it in dms
I have DMs closed and it will stay like that
mhm
hmm
@regal pulsar did it help you
trying it
async for msg in DMChannel.history(limit=1):
await DMChannel.send(user, message.content)
so it worked
await client.get_channel(...)
i see
mhm
Did it work for ya?
No need to await when you use get_
oh ok
Only need when you use fetch_
alr
Which makes an API call
ik lol y be so spacific
Because others might not know :)
...
we become friends (:
More specifically the one you were giving that snippet
huh
uh wait
Always good to get some more information 
how do i get the id of the dm channel π
We become friends (:
It's the user ID
Then it's not in cache
Add me please so we can be friends (:
Consider using
c = client.get_channel(...) or await client.fetch_channel(...)
Which will first try to get from cache with get_channel and if it returns None it will use fetch_channel and make an API call.
i see
You ignoring me? ):
No, there's just nothing to say
So will you add me
No, that's also why I have friend requests disabled
im getting an unknown channel error
does there have to be π
I joined the Converso in the middle, may I get an overview of your code right now?
no
If you want to send a private message and you have the user ID, consider using get_user and use .send() on the object.
you need to do this
Guys, how can i make this command to def? So the code and what i want
message_counter = 0
@cord.event
async def on_message(message):
global message_counter
message_counter += 1
So if i write !info the Bot print 1110 message (of every server)
@bot.event
async def on_message(message: discord.Message):
if isinstance(message.channel, discord.DMChannel):
user = await bot.fetch_user(768393728163053619)
channel = await bot.fetch_channel(message.author.id)
async for msg in channel.history(limit=1):
await DMChannel.send(user, msg.content)
That's literally what I've said
oh
it basically forwards the message to me
And the channel is just message.channel, no need to fetch it.
ctx.channel()
Not a function and in an on_message event there is just a message argument being passed
on_messaage sucks use @opaque fiber
how did i waste so much time on that ;/
Not for what they want to do
...
thanks guys π
A command for that won't bring anything
np
No problemo
i challlenge u to a bot competition
on yt
I have other things to do
what
shush
guys how can i get avatar update with on_member_upadte?
and how? before.avatar_url?
Yup
and await ctx.send(f"{before.avatar_url} {after.avatar_url}")?
That will print the avatar before and after the change
Like this
ok i try it
Just note that the avatar URL of before might return error 404 since the avatar will get removed from Discord's CDN
Hello
If I remember correctly MEE6 has a manual caching method to keep it
yeah but deleted it after 30 days (the discord say delete after 30 day this information)
.
principles to make a bot I don't know anything about python or programming itself and I would like to make a discord bot
I think it's more like a few minutes/hours
please tell me there is a differnce between hacking and programing
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Will help you out for learning Python
can i ask a really dumb question?
Any question can be asked 
what's the purpose of slash commands
from below right?
Well you can't anymore depending on if you have your bot verified or not and if you have the message intent
Whereas for slash commands there are awesome things coming like a permission system where the server owner/administrators can set which user can use which command and in what channel.
oh
Basically slash commands provide, and even more later, a better and easier customization for your commands
we just have to enabble that option in developer portal to use it right?
There is no option to enable, you can directly use them
@slate swan would this work?
@client.command(name='message')
async def message(ctx, imput:str, *, member : disnake.Member):
await ctx.send(f"Susscefuly sent a message to {member.mention}")
oh i need to
ohk
Your input would be only one word
I would invert member and input parameters
ok
how would i get the link of a voice channel
!d discord.VoiceChannel.jump_url # Not that it's only in 2.0
property jump_url```
Returns a URL that allows the client to jump to the channel.
New in version 2.0.
!d discord.VoiceChannel.mention # This would mention the channel so that you can click on it to join, kind of same as above
property mention```
The string that allows you to mention the channel.
wait sorry, if i made a command, and i wanted to get the link of the vc that they are in how would i do that?
voice channels don't have URLs...
yes they do
They do
this maybe
https://discord.com/channels/guild_id/channel_id if you want the structure, doesn't seem like there is an attribute for it
Otherwise you can use .mention to get something like #756327105389920306
oh and then i can just use vars to fill in the guild id and chanel id
i want the link because then i can put it into the url of an embed and the user just has to click teh title to get an invite to the call
that's smart
Then yeah, put the variables in the URL structure and you're good
i did it
tahnk you very much

import discord
import asyncio
from discord.ext import commands
from pythonping import ping
bot = commands.Bot(command_prefix='>')
client = discord.Client()
class Client(discord.Client):
async def on_ready(self):
print('Logged on as {0}!'.format(self.user))
async def on_message(self, message):
print('Message from {0.author}: {0.content}'.format(message))
async def my_background_task():
await client.wait_until_ready()
while not client.is_closed():
response_list2 = ping('35.158.5.187', size=40, count=10)
ms2 = int(response_list2.rtt_avg_ms)
response_list = ping('168.119.193.207', size=40, count=10)
ms = int(response_list.rtt_avg_ms)
if ms > 0 and ms <= 33:
desc = 'π’ Online'
elif ms > 33 and ms < 66:
desc = 'π‘ Minor Outage'
elif ms >= 66:
desc = 'π Serious Outage'
else:
desc = 'π΄ Offline'
if ms2 > 0 and ms2 <= 33:
desc = 'π’ Online'
elif ms2 > 33 and ms2 < 66:
desc = 'π‘ Minor Outage'
elif ms2 >= 66:
desc = 'π Serious Outage'
else:
desc = 'π΄ Offline'
message = await client.get_channel(968499225845432330).fetch_message(968499691446755379)
await message.edit(embed=discord.Embed(title="Statuses", description=(f"**Node-01**: {desc} - [`{ms}ms`]\n**Database**: {desc} - [`{ms2}ms`]"), color=0x1eff00))
embed.set_thumbnail(url="https://cdn.discordapp.com/attachments/912797781888999438/964829134553493534/Comp_1.gif")
embed.set_footer(text="Updates every 5 seconds")
await ctx.send(embed=embed)
await asyncio.sleep(5)
bg_task = client.loop.create_task(my_background_task())
client.run('token')
why ms dont update?
OMFG we answered this alr
when
the answer isnt: " dont know how to use this module"
That doesn't seem like a helpful response
-.-
we helped him so many time he is mad bc we wont give him the full code
scroll up
@velvet compass
Then it should be easy to say "Have you tried what I mentioned earlier?" Instead of "Everyone don't help him, don't ask here, read the docs"
how would i only let poeple type commands in a channel
true
client.command()
but if its a message
so like wdym
how would i delete
how to purge messages?
so in 1 channel, you can type a command, but not a message
that is specific, you can only type discord commands in a channel, not random messages such as "asdnhjasbdjhasbadj"
correct
what command do you want ?
!invite
ok
i ahve it workingbut i can type random things in the channel, i dont want that
yes thgat works
you can finish the rest of the code with embeds or ctx.send
async def invite(ctx):```
yh
see? but how do i stop something that is not "!invite"
on_command_erroro
oh my goodness
im need to go
i need someone else
ok ...
cya
cya
Do you have the channel ID?
i have a comamnd and it works, but how do i only let the command get sent int eh channel
There are different ways to do that
what is the easiest
One would be to implement a custom check and the other one would be to simply make a check in your code.
The easy way would be something like
async def ...(ctx, ...):
if ctx.channel.id != <id>:
return
# The command code here
It will basically stop the code from executing if the channel ID is not the one given
no i understand that
please dont leave cuz i rlly wanna finish this today
I have x channel, lets call it "#bot-commands", now if someone says "hello" in the channel it would get deleted,
but if someone says "!invite" it would run the command
basically i only want commands run in there, and if its not a command i want it dleted
i already have this working
Technically you can make the bot delete every message in the channel, if it was a valid command it will get executed
yes and i tried that, but it doesnt let the command work then
Otherwise you'd need to check if the message sent in that channel is a valid command using the on_message event
async def on_message(message):
if message.channel.id == 968596034060156938 or message.channel.id == 968476806141329478:
await message.channel.purge(limit=1)```
You probably haven't processed the. command
this is what i have
Yeah - you're missing await client.process_commands(message)
where do i put that?
Not sure about that but you probably need to use the function and then delete the message
So right before your purge
You could technically just do await message.delete()
property bot```
Equivalent to [`User.bot`](https://discordpy.readthedocs.io/en/master/api.html#discord.User.bot "discord.User.bot")
This returns True if the member is a bot
message.author would be your discord.Member object
If the bot attribute is True then you can return
if message.author != User.bot:
like that or no
sorry i legit started python today lol
You can just do
if message.author.bot:
print("User is a bot")
for some reason it still deletes the bot message
I highly recommend learning more Python before jumping in making a Discord bot 
``
async def on_message(message):
await client.process_commands(message)
if message.author.bot:
return
else:
if message.channel.id == 968596034060156938 or message.channel.id == 968476806141329478:
await message.channel.purge(limit=1)```
The else is not needed
well i know python, i just mean that i just got back to it, i shouldve said again
but it still deletes the bot's messages
bro idk why it wont just do it
You sure you've run the updated version of the file?
yes
async def on_message(message):
await client.process_commands(message)
if message.author.bot:
return
if message.channel.id == 968596034060156938 or message.channel.id == 968476806141329478:
await message.channel.purge(limit=1)```
this is it now
still no luck
Put the bot check at first
You also don't want to execute commands if it is coming from a bot
just did that still deletes it
async def on_message(message):
if message.author.bot:
return
if message.channel.id == 968596034060156938 or message.channel.id == 968476806141329478:
await client.process_commands(message)
await message.channel.purge(limit=1)```
What if you add a print to debug right before deleting the message?
What if you put as check
ifΒ βmessageβ.βauthorβΒ β==βΒ βbotβ.βuserβΒ βorβΒ βmessageβ.βauthorβ.βbotβ:
return
do i need to import something?
Nope
Interesting because it works in my code
Like, that is my code which ignores bot users
β@βbotβ.βevent
βasyncβΒ βdefβΒ βon_messageβ(βmessageβ:Β βdisnakeβ.βMessageβ)Β β->βΒ βNoneβ:
βΒ Β Β Β β"""
βΒ Β Β Β TheΒ codeΒ inΒ thisΒ eventΒ isΒ executedΒ everyΒ timeΒ someoneΒ sendsΒ aΒ message,Β withΒ orΒ withoutΒ theΒ prefix
βΒ Β Β Β :paramΒ message:Β TheΒ messageΒ thatΒ wasΒ sent.
βΒ Β Β Β """
βΒ Β Β Β βifβΒ βmessageβ.βauthorβΒ β==βΒ βbotβ.βuserβΒ βorβΒ βmessageβ.βauthorβ.βbotβ:
βΒ Β Β Β Β Β Β Β βreturn
βΒ Β Β Β βawaitβΒ βbotβ.βprocess_commandsβ(βmessageβ)
"bot.user or message.author.bot:" this shows up as an error
Yeah you probably need to type it manually
There seem to be some issues with the GitHub app which gives weird characters when I'm copying
omg
im gonna kms
async def on_message(message):
if message.author == client.user or message.author.bot:
print("Hi")
return
if message.channel.id == 968596034060156938 or message.channel.id == 968476806141329478:
await client.process_commands(message)
await message.channel.purge(limit=1)```
still no
If you print before .purge()
it prints both "Hi" and "test"
async def on_message(message):
if message.author == client.user or message.author.bot:
print("Hi")
return
if message.channel.id == 968596034060156938 or message.channel.id == 968476806141329478:
await client.process_commands(message)
print("test")
await message.channel.purge(limit=1)```
Wait, both?
yes
Oh yeah, once for your message and once for the bot's message I guess
Doesn't really make sense honestly or I'm tired and can't see what's wrong
What if you print message.author.bot and message.author at the top
Then make sure you don't delete a message somewhere else, just in case
i had message.channel.purge()
it works now
not message.purge()
tysm for the help

TYSM
AttributeError: 'Bot' object has no attribute 'slash_command'. Did you mean: 'add_command'?
tf is this?
Library?
jishaku
yo, it all works, but im getting huge error messages
do u know a fix?
It tries to delete an already deleted message
why tho?
jishaku is a cog, not a library
what should I use then for that code :
do you know how i can fix it @slate swan
bot = commands.Bot(
command_prefix= commands.when_mentioned,
intents= discord.Intents.default()
)
@bot.slash_command(guild_ids=[961585785226821703])
async def hello(ctx):
await ctx.respond(f"Hello {ctx.author}!")
@bot.slash_command(
name="hi"
)
async def global_command(ctx, num: int):
await ctx.respond(f"This is a global command, {num}!")```
What is the code right now?
async def on_message(message):
await client.process_commands(message)
if message.author.bot:
return
if message.channel.id == 968596034060156938 or message.channel.id == 968476806141329478:
await message.delete()
return```
i added return at the end to see if it would fix it
Do you delete the message in the command you use?
Then don't delete it
tysm love you @slate swan
Hi guys, how can i make this with my code?
@commands.Cog.listener()
async def on_member_update(self, before, after):
if before.roles != after.roles:
roles = [role for role in after.roles[1:]]
channel = self.bot.get_channel(server_config[after.guild.id]['server_log'])
embed = discord.Embed(title="Role updates")
embed.add_field(name="Before",value="".join([role.mention + "|" for role in before.roles[1:]]))
embed.add_field(name="After",value="".join([role.mention + "|" for role in after.roles[1:]]))
await channel.send(embed=embed)
thats not a command
And if you want commands to be executed only in those channels put back the process_commands back in the if statement
thats a event @slate swan not a event
Please read the entire conversation before saying that
@slate swan did u know that how?
so i need just the "added" or the "removed" role
Get the difference between the two lists
Then you know which role got added/removed
Check which role got added/removed from the after.roles list
btw by MEE6
o and how can i do this?
For example you could use list(set(x)-set(y)), which will give which role has been removed.
Or you can get the difference by XORing both sets which will give both directly - might be "complex" if you don't know XOR
Easy method would be the first one
!e
a = [1, 2, 3]
b = [1, 2]
print(list(set(a)-set(b)))
@slate swan :white_check_mark: Your eval job has completed with return code 0.
[3]
Here the 3 got removed
Then you know how to invert it and make it the opposite, check if something got removed from a
so i need len the roles, and set the len-1?
To know if it got removed/added?
You can just use a simple if list(set(a)-set(b)): statement for example. Then an element from a got removed
!e
a = [1, 2, 3]
b = [1, 2]
c = [1, 2, 3, 4]
if list(set(a)-set(b)):
print("Removed")
You can check yourself which element has been added to c compared to a
@slate swan :white_check_mark: Your eval job has completed with return code 0.
Removed
and i how to import this to a code?
sorry it's midnight here and i need to sleep: D thanks
gn
after.roles and before.roles would be your lists (a and b for example)
Is anyone familiar with Nextcord and got a minute to look over something for me to see where I am being thick?
Don't ask to ask, just ask :) If someone can help they will do
TLDR is this: I am trying to pass a list of options through to a function within a class. The list flagList is generated within the command and is needed within a decorator of the function (Line 6) to populate the dropdown. Not very familiar with classes and can't figure out if what I am trying is possible and then how to go about it if it is.
Code is here: https://paste.nextcord.dev/?id=1651007066361787
Btw, do you guys perform caching in an another worker or do you just do it along with the bot?
how can i convert a timestamp like that? 1611516336000
yes, but look at the year
and i want to convert it from a string
like: day: {day}, year: {year}
Question:
Is there a way to monitor the server count with a image? Like the picture?
If yes, how?
Yes, store the server count somewhere every X time, usually a database, and then make a diagram using a library - matplotlib might help
thanks for the tip!
<t:1611516336>?
yes, how do you get to this result?
Just get rid of the last 3 numbers (000) which are for timestamp with milliseconds. Discord doesn't like them :)
So use 1611516336 instead of 1611516336000
thank you!

Does anyone know how to fix this error?
await em.add_reaction("\U00002705") TypeError: object NoneType can't be used in 'await' expression
Anyone?
.
ctx.add_reaction("βοΈ")
send code
await ctx.send(embed=em)
emoji = ["\U00002705"]
await ctx.add_reaction(emoji)
is anyone familiar with replit or no
i am
that is so bad
do u know how to keep a bot active 24/7
yes
!d discord.ext.commands.Context.add_reaction
No documentation found for the requested symbol.
...
please tell
pay for it lol
How lol? cant you fix it?
bc the whole code is messed up
Im not sending my whole code as you dont need it
and not readable
await ctx.send(embed=em) emoji = ["\U00002705"] await ctx.add_reaction(emoji)
its readable...
no not rly lol
...
do u even know how to code in discord.py
Yes, do you?
name 5 funtions
bro why r u testing me, do u know how to help me or not
i can but im seing if u even know dpy bc that is literly not readable
they won't help u but ok good luck
It legit not readable
It is π€£ , you just dont know how to fix it
u send embed after the embed code lol
I have the embed code but i dont need to show you it
we dont do that here <@&831776746206265384>
As thats not my problem
I really donβt know what ur trying to do
How is that helpful
No you just don't know it
We do not do that here.
What do you mean? I remember you got muted before π€£
Now let me find a real discord.py programmer that can help me, bye
Stay on topic. if not go to #python-discussion
You're not a mod
No but i am inforcing the rules
Itβs not a rule to make readable code
And I looked at ur GitHub accountβ¦
mod always say to stay on topic
π€£ , this guy doesnt know anything i swear
think what you want kiddo
You literally put them off topic
basic?
where is my code?
I just request help lol for my program
i made 2 discord bot's by hand
GitHub
oh yh i have not used that in a long time
how can i start/call a background task which is located in a different file through a command?
@exotic maple u should help him
Can u please stop
I would but our friend @exotic maple here won't
Bro ur bot has basic help cmd, stop tryna compete
Now leave me alone
Ok can we all stop please
I agree
if you are not gonna be respectful i recomend u leave
You were just disrespecting me π€£
Where?
<@&831776746206265384> @exotic maple
Ok
Ok, i hope u find help somewhere else
What's up?
can u pls look into this convo
I ask for help and this dude is just trying to compete with me and cause drama xd
#discord-bots message - believe this is where you started the heated convo
@hollow badger
So @exotic maple asked for help and then @eager bough kept saying that βitβs not readable no will will help youβ then said to be on topic and also wants the other guy to prove he knows discord.py
Yep.
just seems to be here to troll rather than help
yh pay for it
if u want ur bot to be online
no, heroku
He's just here to criticize others
Not help, i thought that is what this server is for
Nope. Not rlly lol
βFree hostingβ has many down sides
heroku free dyno does the trick
While paying for hosting is indeed an option, you could have avoided coming across as flippant if you explained as such. Also, telling other people their code is bad and demanding they prove their knowledge is also not conducive to a welcoming and respectful environment.
If you don't want to be constructive or helpful, I suggest you don't say anything.
@eager bough
to try help with your original message, await message.add_reaction("π") this is what i used for one of my ticket tools
Alright thanks, ill try it out
how can i start/call a background task which is located in a different file through a command?
__import__("filename").blah blah blah # what in the file
for example
ive imported from the class in my file, but when i call blahblah.task_name.start(args) it returns AttributeError: 'coroutine' object has no attribute 'start'
run maybe?
What is the background task and when do you want to start it
.start() works fine when i start the task in the main folder
Is there an event for on_slash_command in discord.py? on_command doesn't pick them up.
basically a user will run /candy "ID" and that will start a background task to send a message with updated info on a "candymachine"
no use disnake and do..
@bot.slash_command
Donβt tell people what lib to use if they already have picked one
I looked for an event listener, not a lib. Thanks.
So it would run the function in the background?
Please mind your own buissness
yeah, basically
Could you not put it just at the end of the command?
If not then asyncio.create_task
!d asyncio.create_task
asyncio.create_task(coro, *, name=None)```
Wrap the *coro* [coroutine](https://docs.python.org/3/library/asyncio-task.html#coroutine) into a [`Task`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task "asyncio.Task") and schedule its execution. Return the Task object.
If *name* is not `None`, it is set as the name of the task using [`Task.set_name()`](https://docs.python.org/3/library/asyncio-task.html#asyncio.Task.set_name "asyncio.Task.set_name").
The task is executed in the loop returned by [`get_running_loop()`](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_running_loop "asyncio.get_running_loop"), [`RuntimeError`](https://docs.python.org/3/library/exceptions.html#RuntimeError "RuntimeError") is raised if there is no running loop in current thread.
This function has been **added in Python 3.7**. Prior to Python 3.7, the low-level [`asyncio.ensure_future()`](https://docs.python.org/3/library/asyncio-future.html#asyncio.ensure_future "asyncio.ensure_future") function can be used instead...
yeah ill try this, if not ill try the other
i agree. if someone has already chosen a lib, don't go giving help in a lib they're not using.
you're on your last warning @eager bough
!d discord.on_interaction
discord.on_interaction(interaction)```
Called when an interaction happened.
This currently happens due to slash command invocations or components being used...
The command being called from this interaction.
If the interaction is not an application command related interaction or the command is not found in the clientβs attached tree then None is returned.
@mortal dove
Ohh thank you!
You posted it in a public discord server so it's everyones business
i addressed it ages ago, please don't pile on when a moderator has already intervened
any particular reason I should use datetime.datetime.now instead of datetime.datetime.utcnowin my embed timestamps, in converts to the users local time anyway right?
hi
yh i think so
try this.
@client.command(name='clear')
@commands.has_permissions(administrator=True)
async def (ctx, nombre: int):
await ctx.delete(limit = nombre)
Np bro
wait lol
i messed up
@client.command()
@commands.has_permissions(administrator=True)
async def clear(ctx, amount: int):
await ctx.channel.purge(limit = amount)
@slate swan
np
oh


