property mention: str```
Returns a string that allows you to mention the member.
#discord-bots
1 messages · Page 835 of 1
but I already got my bot that I have spent much time on coding so I dont wanna switch library and having to change all the code. just start over everything, is not disnake pretty much the same as dpy? so I dont have to change all the code
you won't have to change tons of code
but i want to msg it privatly to the {user}
there are some differences like avatar_url to avatar.url i think
ah okay
user.send()
ok
those are dpy 2.0 changes, if you haven't already updated to dpy there might be a bit more breaking changes
I've been trying to change my discord bot's language from javascript to python
from ..utils.converters import TimeConverter gnarly import
so is this correct
@client.command(pass_context=True)
async def rickroll(ctx, user):
await user.send("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
pass_context is old
so how to use it
!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
you can only send dms if the users DMChannel is open
I am trying to patch commands.Context.send before invoking a command. But the patched the patched function does not seem to take effect and it works as if nothing has happened, how do I go about doing this?
This is what I am trying to do :
Patched send :
def send(content=None, **kwargs):
patch_message = "This command was invoked by an edit"
if content is not None:
return commands.Context.send(patch_message + "\n" + content, **kwargs)
return commands.Context.send(patch_message, **kwargs)
Invoke :
@commands.Cog.listener()
async def on_raw_reaction_add(self, payload: discord.RawReactionActionEvent):
for i in self.bot.interim.get_list()[::-1]:
# Traversing through the reversed heap means that
# the first match will be the last edit made to the message
if (
i.id == payload.message_id
and payload.emoji.name == "🔁"
and payload.user_id == i.author.id
):
ctx = await self.bot.get_context(i)
ctx.send = send
await self.bot.invoke(ctx)
But the contents of the command send by the bot through this appears without patch_message, how do I go about solving this?
I am trying to make a easy discord.py bot. It was supposed to send back a Hello message to me. But it didn't respond. I do this in replit.com
Code:
import os
import discord
client = discord.Client()
@client.event
async def on_ready():
print("We have logged in as {0.user}".format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
elif message.content.startswith('!hello'):
await message.channel.send('Hello!')
client.run(os.getenv('TOKEN2'))
Error Code:
Ignoring exception in on_message
Traceback (most recent call last):
File "/home/runner/DuckBot-Ya-Zi-Ji-Qi-Ren/venv/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "main.py", line 16, in on_message
await message.channel.send('Hello!')
File "/home/runner/DuckBot-Ya-Zi-Ji-Qi-Ren/venv/lib/python3.8/site-packages/discord/abc.py", line 1065, in send
data = await state.http.send_message(channel.id, content, tts=tts, embed=embed,
File "/home/runner/DuckBot-Ya-Zi-Ji-Qi-Ren/venv/lib/python3.8/site-packages/discord/http.py", line 248, in request
raise Forbidden(r, data)
discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
import disnake
from disnake.ext import commands
class Timeout(commands.Cog):
"""Mutes/timeouts a user."""
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.slash_command()
async def timeout(self, inter, user: disnake.Member, until = int, reason = None):
"""Mutes/timeouts a member for up to 28 days in the future."""
await member.timeout(duration=until, member=user, reason=reason)
def setup(bot):
bot.add_cog(Timeout(bot))
This doesn't load.
import disnake
from disnake.ext import commands
import os
from dotenv import load_dotenv
load_dotenv()
token = os.environ["token"]
bot = commands.Bot(test_guilds=[938194100639895713])
bot.load_extensions("commands")
@bot.event
async def on_ready():
print(f"{bot.user} is loading into developer mode...")
bot.run(token)
That's the main.py file
hello Hi guys, how are you? I'm new to bot programming and I'm trying to prepare myself on the subject I'm from Brazil but I didn't find anyone who can help me I joined this server and I think something can solve the error who can help me thank you very much I don't know what this error is (the one to the right)
like?
I usually enable all intents
oh and because I only know from the replit :/
and where do I do that in the developer portal? Sorry
oh wait
ok ok
in the bot page
what are you talking about?
thats not a thing, never was
it was like....too dumb, really, no offence
I understand that is the replit does not work?
I'm using google translator and the translation is kinda funny
ok
no lol, replit has nothing to do with the error, visit https://discord.com/developers/applications, go to your application and go to the bot page, scroll down and enable intents
just search up discord dev portal
^
ok
I’m gonna take a break to prevent any dumb stuff from coming out from me 🗿💀
aww, take care
Ty I’ll be back later.
cya
But even though I say dumb shit sometimes I’ve learned a lot here from helping others
same xD
Me who learnt only by seeing other people help others: 
How can I get around a py ImportError: attempted relative import beyond top-level packageerror? I'm trying to import a string from main.pythat I'm thinking the bot can't see.
I have a bot part of my code as well as a dashboard in jango and I want my jango file(s) to be able to import properties from my main bot file (i.e. the bots name) but I'm testing it with a strin rn. This is my file tree https://sourceb.in/gaXkgivbfr and i want to import my bot instance from main.py into the views.py file.
I asked this a little while ago in #help-dumpling and didn't get a response before it went dormant and in that time I have relized I could get certain bot attributes from hikaris RestApp(), couldn't I?
hi
sorry again for bothering you but I was wondering if this "intents" you speak of? I read it and activated
yep
wow ok now i can try again by replit? and I really want to learn about it
yeah sure
Any help?
oh my god thank you so much my bot is up and running thanks for everything Ashley,Moai
it's working ❤️
its alright
who tf is member.timeout
Guys guys, how do I react with custom emojis
hey im having a type error heres my code
import disnake
from disnake.ext import commands
from disnake.utils import get
def is_user(func):
def wrapper(ctx):
return not ctx.author.id == 582279365912559631 or 792112180346355743
return commands.check(wrapper)
class devCommands(commands.Cog):
def __init__(self, bot):
self.client = bot
# SERVERS COMMAND GIVES ALL SERVERS AND IDS
@bot.command(name='servers', help='')
@commands.has_role(938775667452043365)
async def servers(ctx):
lists = []
for guild in bot.guilds:
lists.append(f"{guild.name} (id: {guild.id})")
beepu= ("\n".join(lists))
embed=disnake.Embed(title="Servers", description= beepu, color=0xFF5733)
await ctx.send(embed=embed)
@commands.command(name = 'leave', aliases = ['boot'], help = 'makes the bot leave a server')
@commands.has_role(938773073862217761 or 938775667452043365)
async def leave(self, ctx, guild_id):
await self.client.get_guild(int(guild_id)).leave()
await ctx.send(f"I left: {guild_id}")
@commands.command(name = 'tshoot', aliases = ['ts','t'], hidden = True)
@is_user
async def shoot(self,ctx,shoot_type = None):
if shoot_type == None:
await ctx.send('begining trouble shoot')
Chan_name = []
for channel in ctx.guild.text_channels:
if str(channel.type) == 'text':
Chan_name.append(channel.name)
role_name = []
for channel in ctx.guild.roles:
role_name.append(channel.name)
if "ripple_logs" not in Chan_name:
await ctx.send('ripple loggs ❌ ')
else:
await ctx.send('ripple logs ✅')
def setup(bot):
bot.add_cog(devCommands(bot))
and heres my error
Traceback (most recent call last):
File "/home/container/.local/lib/python3.9/site-packages/disnake/client.py", line 515, in _run_event
await coro(*args, **kwargs)
File "/home/container/bot.py", line 83, in on_ready
raise e
File "/home/container/bot.py", line 79, in on_ready
bot.load_extension(cog)
File "/home/container/.local/lib/python3.9/site-packages/disnake/ext/commands/common_bot_base.py", line 488, in load_extension
self._load_from_module_spec(spec, name)
File "/home/container/.local/lib/python3.9/site-packages/disnake/ext/commands/common_bot_base.py", line 419, in _load_from_module_spec
raise errors.ExtensionFailed(key, e) from e
disnake.ext.commands.errors.ExtensionFailed: Extension 'cogs.devCommands' raised an error: TypeError: Callback must be a coroutine.
any help
granted im a bit confused on what a coroutine is
Just use get emoji or add it in the id:name format
ah oki, and also, how do I use default emojis in an embed :/
dumb question but please just tell lol
I think the emoji's in Win + . (if your on windows) are standard emojis, if not just do \emoji and copy the response \👋
I want to get the emoji from the message
Someone ages ago said it had to be member.timeout
It's not what the command does, it's that it doesn't register to the test guild
idk who that drunk person was
anyone here who can help me
!d disnake.Member.timeout
await timeout(*, duration=..., until=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Times out the member from the guild; until then, the member will not be able to interact with the guild.
Exactly one of `duration` or `until` must be provided. To remove a timeout, set one of the parameters to `None`.
You must have the [`Permissions.moderate_members`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.moderate_members "disnake.Permissions.moderate_members") permission to do this.
New in version 2.3.
oh so user sends a emoji in a message and then you want to do something with it it? I think you'd just want to check if lib.Emoji in message.content to see if it has emoji's then maybe a for emojis in message.content but I'm not sure exactly
infernum, did you even read the above message
i see
which?
I dont see anything wrong
not related to discord bots
to making a assitant
Either way, the command itself doesn't load.
What do mean by assistant?
Do you mean a discord bot or like something like what Siri is on ios or cortana on windows?
Won't work
Since it returns a string only
Not objects of discord.Emoji or smth
if i install enhanced discordpy library do i have to uninstall original rapptz discordpy
It's preferred but not necessary
It's advised to do so
maybe they can use the name attr?
async def cmd(inter, emoji1: disnake.Emoji):
pass
returns this
it works only on custom emoji
maybe try typehint to Union[disnake.Emoji, str]?
Then it will work even when the emoji isn't specified
U will have to use a library
hm yeah, you can check tho if emoji1 is an emoji, or just use try and except on add_reaction
And make an API call whenever the command is invoked? Yea totally a great idea haha
yeah, what do i do :/
rip its not on pypi
!pypi emoji
Another issue
nah nah, its completely different, related to a different command
Okay...?
like whenver I try to upload an emoji, it simply says- expected a Bytes object and says it got a SteamReader object
use BytesIO
I already did
Hmm, I gotta go rn anyways, try looking into it again else will help u in an hour
sure, bai bai, miss
what is the best website for 10 years old kid to learn python
it was me, though he still has user: disnake.Member instead of member: disnake.Member
timeout is a member method
!resources
Resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
well i cant say its your fault anyways
Mind sharing the code?
wow ty
wait
Also would be appreciated if u ask this in #python-discussion next time (:
This is a topical channel
the halo channel
from io import BytesIO
# if you have an image or anything that saves to a stream
buffer = BytesIO()
im.save(buffer, "png") # 'save' function for PIL, adapt as necessary
buffer.seek(0)
# if you have some bytes
buffer = BytesIO(my_bytes)
# if you have some text
my_text = "Don't do drugs kids"
buffer = BytesIO(my_text.encode("utf8")) # change encoding as necessary
await ctx.send(file=discord.File(fp=buffer, filename="whatever.png"))
Take a look at this too, @slate swan
Indeed halo infinite
!d discord.Guild.create_custom_emoji
await create_custom_emoji(*, name, image, roles=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a custom [`Emoji`](https://discordpy.readthedocs.io/en/master/api.html#discord.Emoji "discord.Emoji") for the guild.
There is currently a limit of 50 static and animated emojis respectively per guild, unless the guild has the `MORE_EMOJI` feature which extends the limit to 200.
You must have the [`manage_emojis`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_emojis "discord.Permissions.manage_emojis") permission to do this.

oh I see
@slate swan also try doing
with open(file) as f:
emoji_file = bytes(f)
or smth
!d bytes
class bytes([source[, encoding[, errors]]])```
Firstly, the syntax for bytes literals is largely the same as that for string literals, except that a `b` prefix is added:
• Single quotes: `b'still allows embedded "double" quotes'`
• Double quotes: `b"still allows embedded 'single' quotes"`
• Triple quoted: `b'''3 single quotes'''`, `b"""3 double quotes"""`
Only ASCII characters are permitted in bytes literals (regardless of the declared source code encoding). Any binary values over 127 must be entered into bytes literals using the appropriate escape sequence...
f.read()
It's an image file tho
Well, I found out another way so nvm
Okay then
guys why my pycharm not loading
i uninstalled, restarted, repaired, all twice
still nothing
@quaint epoch also next time #editors-ides
thanks
i was programming a basic bot there isnt any error but the bot isnt replying can someone help me with this
Code
the program: import os
import discord
client = discord.Client()
@client.event
async def on_ready() :
print ('we have logged in as{0.user}'.format (client))
client.event
async def on_message( message):
if message.author == client.user:
return
if message.content.startswith('$hello'):
await message.channel.send ('hello!')
my_secret = os.environ['']
client.run(my_secret)
The token
its there in the code
What u sending
the code
So is it?
In the channel
i feel confused about this chat
Why tho
what token

Lol
Lmao
How would I check if someone has the @ everyone permission in a event listener
You need the member object then check if any of his role has that permission
hey I'm new to this can someone just help me in making a script that count numbers in discord?
you want some kind of countdown?
like 0 1 2 3 4 5
and it edits after every second?
then I will try to make changes on it to learn
nah one by one
like send 1 then 2 then 3
a simple for loop will do, as long as you don't spam
but I really don't know from where to start
learn how to make a simple bot first which responds on commands
from where I can learn that?
thanks ♥️
<@&831776746206265384> this isn't up-to-date anymore, can this be updated / removed from pins?
Erm, could you post this in #community-meta, as this comment will get buried here.
the pins are a messy pile already unfortunately :/
What is outdated about it? Do you have time to write an updated version yourself? If so, you could post it here and get the mods/admins to check it out.
Or you could open an issue on the community meta repository.
hey are you still struggling with this
wdym?
How will I be able to send all bot errors in a channel?
a channel object has a send method
thats complicated
To get the members of a server your bot needs to be in that server
otherwise he can't access the member of the server
Hey, is there a way I can get a Bots Embed Message content? Or like the title or smth?
A list of embeds the message has.
The title of the embed. This can be set during initialisation.
u can then use this
oh ok ty
The post is old for over 1 year, in this time we got more libraries implementing slash commands in a more efficient way not just a workaround
https://libs.advaith.io/
Compares Discord libraries and their support of new API features
you may find something useful in #databases
I'm using repl to host my bot but it is recognizing my bot token as a name because of the periods in it. it there a way to fix it?
This is an ancient way of writing a command
and he missed a @ in the decorator too
Hey Guys, I'm trying to code a message log. If the message gets edited, the bot should send the unmodified message in the channel. How I do that. The "on_message_edit" has no "message" or "ctx"?
discord.on_message_edit(before, after)```
Called when a [`Message`](https://discordpy.readthedocs.io/en/master/api.html#discord.Message "discord.Message") receives an update event. If the message is not found in the internal message cache, then these events will not be called. Messages might not be in cache if the message is too old or the client is participating in high traffic guilds.
If this occurs increase the [`max_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Client "discord.Client") parameter or use the [`on_raw_message_edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.on_raw_message_edit "discord.on_raw_message_edit") event instead.
The following non-exhaustive cases trigger this event...
it takes a before and an after arg as well
It has before and after
yeah, but if I try to send the unmodified message in the channel with await message.channel.send(before.content) it won't works, because the on_message_edit has no message. How I solve this?
before and after are Message object there.
It provides you with before and after though
how would it look like if i send the message in the channel?
@potent spear @hoary cargo I've created an issue for this. If you have time, could you please give your input? https://github.com/python-discord/meta/issues/170
And anyone else is welcome to comment too 👀
before and after has no attribute "send"
👀
assume that the before variable is the "message" before editing and after variable is the "message" after editing, now do your stuff
ooooh now i understand it. I had a misconception 💀 Thank you bro
Help
ticket = await ticket_category.create_text_channel(
f"{ctx.author.name}-{ctx.author.discriminator}", overwrites=overwrites
I get this error:
Ignoring exception in on_component
Traceback (most recent call last):
File "/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py", line 343, in _run_event
await coro(args, kwargs)
File "main.py", line 1650, in on_component
ticket = await ticket_category.create_text_channel(
AttributeError: 'str' object has no attribute 'create_text_channel'
any ideas on how to fix?
It needs to be the object, not the name
wdum
It needs to be the category object, not the name
ok
Do you have the ID of the category?
but I've already defined ticket_category with
TICKET_CATEGORY_NAME = "Active Tickets"
ticket_category = TICKET_CATEGORY_NAME
Yes, use the ID rather than the name
guild.get_channel(ID), will return discord.CategoryChannel
TICKET_CATEGORY_NAME = ticket_category = "Active Tickets".. just a side note 
You don't even need 2 variables for the same thing
ticket_category_id = 12345678912345678
It seemed too obvious... Thought there'd be some reason behind it 
doubtful
What happened?
well its supposed to be a guild obj
not a str
you need to run the method on a discord.Guild object
where's the str?
ticket = await ticket_category.create_text_channel(
f"{ctx.author.name}-{ctx.author.discriminator}", overwrites=overwrites
I need the ticket_category so it creates in within he category
the variable
its a literal str
where do i put the ticket_category?
@bot.command()
async def test(ctx):
if ctx.channel == "943621025495646260":
embed=discord.Embed(title="Channel Check", description="True")
await ctx.send(embed=embed)
else:
lol1 = discord.Embed(title="False",description="",color=0x9208ea,timestamp = datetime.utcnow())
await ctx.send(embed=lol1)
why this code not work?
the attr is from the Guild obj just check its params
because youre comparing a int to a str
it will always be False
you don't need the ", channel.id
get rid of the description=" " lol
make it an int and remove the quotes
since there is no desc
@bot.command()
async def test(ctx):
if ctx.channel == 943621025495646260:
embed1 = discord.Embed(title="True",description="",color=0x9208ea,timestamp = datetime.utcnow())
await ctx.send(embed=embed1)
else:
embed2 = discord.Embed(title="False",description="",color=0x9208ea,timestamp = datetime.utcnow())
await ctx.send(embed=embed2)
no its in the if statement and yeah no need for it
i tried still not working
ctx.channel.id
if ctx.channel.id == 943621025495646260:
like this?
yes
Ty worked
yw
I tried
ticket = await ctx.create_text_channel(ticket_category,
f"{ctx.author.name}-{ctx.author.discriminator}", overwrites=overwrites
)
still has no value "create_text_channel"
ctx doesnt have that attr
I removed it already and still didn't work
!d discord.Guild.create_text_channel
await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.
Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.
The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.
Note
Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
it needs a guild obj which you can use the guild where the context was invoked
no
no category
category=TICKETS
yes
and you can asd the position as well
then no need for the kwarg
bro
it needs a guild obj where are you making the channel and with what obj?
its basic oop
if you want it in the guild where the context was invoked just use ctx.guild which returns a guild object
!d discord.Guild.create_text_channel
await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.
Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.
The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.
Note
Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
a method of the Guild class lol
you probably have 5 instances running or its in a loop
yes
i dont help in dms.
sir Okimii and his private dms

my dms are personal and i dont like helping by myself since i love having so many opinions and options here which is great.
.reply is in a loop lol
the coro should be outside of the loop
!e
for number in range(1, 101):
print(number)
@slate swan :white_check_mark: Your eval job has completed with return code 0.
001 | 1
002 | 2
003 | 3
004 | 4
005 | 5
006 | 6
007 | 7
008 | 8
009 | 9
010 | 10
011 | 11
... (truncated - too many lines)
Full output: https://paste.pythondiscord.com/unifemijeg.txt?noredirect
@unkempt canyonhelp
why are you pinging the bot
on top of your if statements?
just delete a tab or 4 spaces in ctx.reply
how do you type in code block ?
!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.
!code
ok ty
🗿
lol
👋
hey robin can you take this over i wanna play some clash royale
Uh can’t I gotta get going soon
bro stop playing splitgate😤
I’m at school
imagine
yuh, i've been staring at the docs and tutorials but i can't get my cog work
loaded it with:
for file in os.listdir("./cogs"):
if file.endswith(".py"):
bot.load_extension("cogs." + file[:-3])
in the cog py file:
bot.add_cog(SendDM(bot))
print("SendDM loaded;")
it never works duh
discord.ext.commands.errors.CommandNotFound: Command "send" is not found why is this?
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 2, in <module>
003 | AttributeError: 'int' object has no attribute 'timeout'
@slate swan :x: Your eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "<string>", line 1, in <module>
003 | NameError: name 'get_user' is not defined
!d discord.Guild.create_text_channel
await create_text_channel(name, *, reason=None, category=None, position=..., topic=..., slowmode_delay=..., nsfw=..., overwrites=...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`TextChannel`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel "discord.TextChannel") for the guild.
Note that you need the [`manage_channels`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_channels "discord.Permissions.manage_channels") permission to create the channel.
The `overwrites` parameter can be used to create a ‘secret’ channel upon creation. This parameter expects a [`dict`](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.9)") of overwrites with the target (either a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") or a [`Role`](https://discordpy.readthedocs.io/en/master/api.html#discord.Role "discord.Role")) as the key and a [`PermissionOverwrite`](https://discordpy.readthedocs.io/en/master/api.html#discord.PermissionOverwrite "discord.PermissionOverwrite") as the value.
Note
Creating a channel of a specified position will not update the position of other channels to follow suit. A follow-up call to [`edit()`](https://discordpy.readthedocs.io/en/master/api.html#discord.TextChannel.edit "discord.TextChannel.edit") will be required to update the position of the channel in the channel list...
i think I got it nw
A cog is not geting loaded properly
a web crawler attempt huh 
no 💀 still give the same error
🙃 the hell is wrong with my cog code
class SendDM(commands.Cog):
def __init__(self, bot):
self.bot = bot
# commands here
def setup(bot):
bot.add_cog(SendDM(bot))
print("SendDM loaded;")
this is pain, all my commands work on the main file
!d discord buttons
To work with the library and the Discord API in general, we must first create a Discord Bot account.
Creating a Bot account is a pretty straightforward process.
Similar names: discordpy.discord, disnake.discord
lol
hey everyone this is my bot but i have a problem
try to put an actual command maybe and see the error
if you can see the numbers i want commas in it how would i do that
i don't see a problem
show the command, or atleast the decorator and function of the command
hey i installed slash commands and interactions module but pycharm can't find it. any suggestions?
the numbers are not really clear
here is the full command: what's wrong with it that it's not loaded or even run
from core import *
from addon.embed_responses import *
class SendDM(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.command()
@commands.has_role(943902658056552469)
async def send(self, ctx, user: discord.Member, *, message=None):
dmmessage = discord.Embed(color=ecolor, description=message)
dmmessage.set_footer(text=f'from {ctx.author.name}#{ctx.author.discriminator}',
icon_url=ctx.author.avatar_url)
dmmessage.timestamp = dt
await user.send(embed=dmmessage)
messagesent = discord.Embed(description=f'<@{ctx.author.id}>, message has been sent to <@{user.id}>',
color=ecolor)
await ctx.reply(embed=messagesent)
def setup(bot):
bot.add_cog(SendDM(bot))
print("SendDM loaded;")
try {:,}
!d disnake.Button
class disnake.Button```
Represents a button from the Discord Bot UI Kit.
This inherits from [`Component`](https://docs.disnake.dev/en/latest/api.html#disnake.Component "disnake.Component").
Note
The user constructible and usable type to create a button is [`disnake.ui.Button`](https://docs.disnake.dev/en/latest/api.html#disnake.ui.Button "disnake.ui.Button") not this one.
New in version 2.0.
check your current working environment, and using 3rd party libraries is not recommended you would like using some fork instead.
yh but everything else is working fine (discord, tasks, get) just discord_slash is not working
await cyx.send("{:,}").format(1000)
sorry, no await cyx.send("{:,}".format(1000))
@outer parcel ^
or you can just use an f string and make everyone’s life easier.
i like chaos
wut
("{:,}".format(number))
send me ur code for the rank thing
I'll do it
its just printing the user wallet
ik
f strings exist
that is it
and don’t spoon feed
lol
ye i use f string
how to open dm with id
help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.
Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).
This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
Similar names: pdbcommand.help, django.help
doesnt matter.
you cannot name your help command's name help if you make command groups.
use the name kwarg in @command
bro dont you see your error?
just use the name parameter
@bot.group(name="help")
async help_group(ctx):
...
@help_group.command()
async def subcommand(ctx):
...

...
???
subclass the helpcommand.
That's why you read the docs and learn python before Making a bot
he's built different
never
making a new command name help is bad which i do but doing that is just something else
data = BytesIO(await asset.read())
AttributeError: 'str' object has no attribute 'read'
error welp me 😩
error says it all
cool
welp, then sucks to be you!
^
delete then
never
<@&831776746206265384>
SHIT!!!
not so very discord bots related
how can i get a object from the json in a event?
can i give a slash command role permissions?
async def update_data(category_logs, guild):
if not f'{guild}' in category_logs:
category_logs[f'{guild}'] = {}
category_logs[f'{guild}']['id'] = 'None'
category_logs[f'{guild}']['category'] = 'None'
category_logs[f'{guild}']['channel'] = 'None'
@spooky.command()
async def setup(ctx):
with open(test_path, 'r') as f:
category_logs = json.load(f)
#perms = discord.Permissions(administrator=True)
channel = await ctx.guild.create_text_channel(name="Spooky-Logs", reason="Logs Channel")
await update_data(category_logs, ctx.guild.id)
category_logs[f'{ctx.guild.id}'] = {}
category_logs[f'{ctx.guild.id}']['channel'] = f'{channel.id}'
with open(test_path, 'w') as f:
json.dump(category_logs, f)
@spooky.event
async def on_guild_channel_delete(channel):
with open(test_path, 'r') as f:
category_logs = json.load(f)
category_logs.pop(str(channel.guild.id))
with open(test_path, 'w') as f:
json.dump(category_logs, f)
!mute 504311046954156035
:incoming_envelope: :ok_hand: applied mute to @hoary saffron until <t:1645132240:f> (59 minutes and 59 seconds).
how can i get the channel object in the on_guild_channel_delete
thx zig
i gotta check if the channel is being deleted
save the id
i am
I have this code
await interaction.response.send_message('Which component chart would you like to view? Respond with "CPU", "GPU", "RAM" or "all" (20s)', view=view)
async def button_cpu_callback(interaction:discord.Interaction):
await interaction.edit_original_message(content="
This isnt working and i get the error unkown webhook
my question is qhen I use interaction.respond.send_message is there any way to edit or delete this message
already... read the code
im not
trader
huh?
trash
what am i doing wrong 😫
im not gonna read the code that uses json as a db
<@&831776746206265384> trolls lol
i can use what the fuck i want can't i?
can i give a slash command role permissions? like @commands.has_role("ROLE")
if json was a db sure but its not
not toll freedom fighter
what are u so mad about the fact that im using a json as db
who
I was muted for no reson
maybe im not using it as a db
ur mom
im not?
!ban 420962767307145216 Low effort troll
:incoming_envelope: :ok_hand: applied ban to @severe raft permanently.
im using it as a file
good
🤷♂️
can someone help me
anyways
a json is not a db
json isnt a db if you want to fight about it go ahead ill destroy you with reasons
async def update_data(category_logs, guild):
if not f'{guild}' in category_logs:
category_logs[f'{guild}'] = {}
category_logs[f'{guild}']['channel'] = 'None'
@spooky.command()
async def setup(ctx):
with open(test_path, 'r') as f:
category_logs = json.load(f)
channel = await ctx.guild.create_text_channel(name="Spooky-Logs", reason="Logs Channel")
await update_data(category_logs, ctx.guild.id)
category_logs[f'{ctx.guild.id}'] = {}
category_logs[f'{ctx.guild.id}']['channel'] = f'{channel.id}'
with open(test_path, 'w') as f:
json.dump(category_logs, f)
@spooky.event
async def on_guild_channel_delete(channel):
with open(test_path, 'r') as f:
category_logs = json.load(f)
category_logs.pop(str(channel.guild.id))
with open(test_path, 'w') as f:
json.dump(category_logs, f)
and we can refuse to help you if we want
how can i get the channel object in the event?
best "antinuke bot" doesnt even have a proper db?
THIS IS LITERALLY
you can't use json as a db -🤓
seems like a low level bot
give me a reason
you can use json as a db
HOLY FUCK ... MAN I CAN'T TEST SOMETHING?
except, you cant use it well as a db
BRO THIS DUDE IS SO MAD THAT IM DOING SOME TESTS ON A TESTING BOT TESTING THE CHANNEL LOG
BRO STOP BEING SUCH A CRYBABY
sqlite isn’t good either if you’re bot is planning on becoming big
idk i just wanted help this is messed up
how am i mad
ur so mad ab it
i make bots that use dbs easily
u don't even know what my bot does
ah here we go, the daily dose of drama
mongo is limited at 500mb
i prefer using digital ocean databases
where im actually using my bot
.
do u see that im using the command in a cog?
what
Alright guys what’s the problem now
bro
It’s not recommended but no need to get mad over it, let’s keep it civil in here
async def update_data(category_logs, guild):
if not f'{guild}' in category_logs:
category_logs[f'{guild}'] = {}
category_logs[f'{guild}']['channel'] = 'None'
@spooky.command()
async def setup(ctx):
with open(test_path, 'r') as f:
category_logs = json.load(f)
channel = await ctx.guild.create_text_channel(name="Spooky-Logs", reason="Logs Channel")
await update_data(category_logs, ctx.guild.id)
category_logs[f'{ctx.guild.id}'] = {}
category_logs[f'{ctx.guild.id}']['channel'] = f'{channel.id}'
with open(test_path, 'w') as f:
json.dump(category_logs, f)
@spooky.event
async def on_guild_channel_delete(channel):
with open(test_path, 'r') as f:
category_logs = json.load(f)
category_logs.pop(str(channel.guild.id))
with open(test_path, 'w') as f:
json.dump(category_logs, f)
robin i told him json isnt a db and hes throwing a tantrum
no one is mad tho
robin ... im trying to get the channel object in the event
In what event
what im trying to do is to check if the channel is being deleted
if it is to pop the guild id
i don't know how to get the object there
how to check if the channel in the json is being deleted
The channel in the json being deleted?
if it is
You mean on discord?
Json is not a database. If you're confused, check out the pins. There is an explanation. You should be using a real database like sqlite3 (aiosqlite for the async version)
yes lol
this is a testing bot
i want to see how it works
😭
practicing bad practice?
if this makes sense to u
i wasn't talking to u
mind ur own business and i don't need ur help ty
oof
- Use asqlite or aiosqlite
- Don’t do it on_ready
bro
Let’s not please
what's ur problem 
Keep it civil please
now everybody attacking me yall a bunch of children
...?
Make sure you do swap to a real database if you ever take your bot out of the testing phase then
sorry cuz ur "more mature" than us
Wrong reply, my bad
honestly yall ask for help and everything you do is wrong
I guess for a testing bot it's fine but I don't see the point as using sqlite3 would be just as easy as json
seems like i am
oh you scared me already
bro i can do what the fuck i want bruh
Easier than a json
a guy wanting to test stuff and this little loser getting mad about it being a test
whos saying you cant?
Guys please calm down
who even are you bro
basically ur just complaining about my code
youre irrelevant
so STOP doing that
@thorny herald please re-read our code of conduct
and u still saying that ur not mad 😂
bro literally stop it here
block me .
end of conversation
i cant with these toddlers
!shhhhhh
✅ silenced current channel for 12 minute(s).
!mute 637458038915203127 4d Your behaviour in this channel is completely unacceptable. Take a break, and reread our #code-of-conduct. If you have issues with an other user, you contact @novel apex or ping the Moderators role - you don't berate and belittle them.
:incoming_envelope: :ok_hand: applied mute to @slate swan until <t:1645475030:f> (3 days and 23 hours).
!ban 404264989147529217 7d You've been told again and again that this isn't the way to interact with our users. I recommend you take this time to seriously consider whether you wish to be a part of this community again, and if you do, then a serious attitude shift is needed.
:incoming_envelope: :ok_hand: applied ban to @dry kelp until <t:1645734375:f> (6 days and 23 hours).
!warn 901911911170470008 When there's an issue in a channel, you should alert the moderators by contacting @novel apex and/or pinging the Moderators role. Please don't defer yourself to insulting the users in question.
:incoming_envelope: :ok_hand: applied warning to @thorny herald.
✅ unsilenced current channel.
ty

some1 help?
@client.command()
async def test(ctx):
await ctx.reply('Welcome to the shop choose the category you want below',
components=[
Select(placeholder='Select category...', options=[SelectOption(label='Tool',value='tool'),SelectOption(label='Collectible',value='collectible'),SelectOption(label='Power up',value='power up')])
])
e1 = discord.Embed(title="Tools",description="Full of tools")
e1 = discord.Embed(title="Collectible",description="Full of Collectibles")
e1 = discord.Embed(title="Power up",description="Full of Power ups")
while True:
try:
event = await client.wait_for("test_option",check=None)
label = event.component[0].label
if label == "Tool":
await event.respond(
type=InteractionType.ChannelMessageWithSource,
ephemeral=True,
embed=e1
)
elif label == "Collectible":
await event.respond(
type=InteractionType.ChannelMessageWithSource,
ephemeral=True,
embed=e2
)
elif label == "Power up":
await event.respond(
type=InteractionType.ChannelMessageWithSource,
ephemeral=True,
embed=e3
)
except:
print("error")
Well that’s over
for some reason this is not working
its supposed to take it as an interaction
seems like an error with the api.
Looks like the API returned something non-json
but it constantly says interaction failed
it's weird cus i made this command before but without a embed
and it worked, but i can't do it in a embed
does error get printed?
sqlite
no
Well json is not a database, so obviously sqlite
e1 = discord.Embed(title="Tools",description="Full of tools")
e1 = discord.Embed(title="Collectible",description="Full of Collectibles")
e1 = discord.Embed(title="Power up",description="Full of Power ups")
```well this part is completely unnecessary
i use json as a datastore cuz thisbot is small
oh i put them all as e1
e silly me
That's bad practice. Json is not a database
It's more meant for formatting
Check the pins of #databases
Just gonna put this out there but for discord bots use asqlite or aiosqlite rather than sqlite3
postgres 😎
Even better
The database?
mongodb 
which one's rather RAM sparing
no
sqlite is, well, lighter
but
sqlite is more lightweight at the cost of features and security
that wouldn’t be good to use with bigger bots
Nope
ee still does not work
edgedb 😳
what's the outcome
I say this a lot but the way I like to do it is to run a javascript REST API that interfaces with the database using one of their ORMs (typeorm, prisma, etc), and the discord bot can just use aiohttp to send requests, so you don't have to mess with the connectors and sqlalchemy
it keeps on saying interaction failed
but honestly it's just a round about way of doing the same thing
what
!d disnake.ext.commands.has_guild_permissions
basically how would i check if player interacted with the button on dropdown menu
ive never seen someone do thst
could interaction.defer() solve it?
it's the function that tells the bot, that the answer will last more than 3 secs
works out pretty good ¯_(ツ)_/¯
That's just adding more latency at the cost of separating the two you could just have a helper file where you do queries, then the queries would be almost instant
i'm not a fan of the python database connectors like aiosqlite
or is that not even possible the way you do it
im confused
what even is event
Actually, maybe. Not so sure at my first remark if it's localhost
e1 = discord.Embed(title="Tools",description="Full of tools")
e2 = discord.Embed(title="Collectible",description="Full of Collectibles")
e3 = discord.Embed(title="Power up",description="Full of Power ups")
while True:
try:
event = await client.wait_for("test_option",check=None)
label = event.component[0].label
if label == "Tool":
await event.respond(
type=InteractionType.ChannelMessageWithSource,
ephemeral=True,
embed=e1
)
elif label == "Collectible":
await event.respond(
type=InteractionType.ChannelMessageWithSource,
ephemeral=True,
embed=e2
)
elif label == "Power up":
await event.respond(
type=InteractionType.ChannelMessageWithSource,
ephemeral=True,
embed=e3
)
except:
print("error")
this is where everything goes wrong
yeah that works as well, but i think that little bit of latency is honestly worth it for developer experience, writing raw sql is just ugh
what's event
i'm sure it does but i haven't used any of them yet 👀
so as long as you don't use sqlalchemy
Docs
Whats the deal with it?
I haven’t used it yet
i was under the impression sqlalchemy was the most popular one
its the interaction
what's the type of it
wdym
I have to know so I can search it on the docs 
after your wait_for, put
print(type(event))
I don't like it, my friends don't like it, overall I don't like it
There are much better options
Is there a flaw or something
makes sense
I prefer writing raw sql anyways
ok
I’ m curious, nothing else
not to u...
just out of curiosity, what are those better options?
ah ok
okay but what's the type
me ?
yeah
it does not output anythin
Pony ORM, Tortoise ORM, etc
so it doesn't reach that part
oh nice, never heard of those but i'll give it a try
does it even reach the wait_for?
People seem to like sqlalchemy
My friends just don't recommend it from their expirences, and I don't really like their implementation
#databases y'all
ive been testing on debugging
Like the api?
Yea, sure
while True:
try:
print("Hi")
event = await client.wait_for("test_option",check=None)
label = event.component[0].label
if label == "Tool":
await event.respond(
type=InteractionType.ChannelMessageWithSource,
ephemeral=True,
embed=e1
)
elif label == "Collectible":
await event.respond(
type=InteractionType.ChannelMessageWithSource,
ephemeral=True,
embed=e2
)
elif label == "Power up":
await event.respond(
type=InteractionType.ChannelMessageWithSource,
ephemeral=True,
embed=e3
)
except:
print("error")
it does not reach this part
what do you have before the embeds
I usually use daos anyways
@client.command()
async def test(ctx):
msg = await ctx.reply('Welcome to the shop choose the category you want below',
components=[
Select(placeholder='Select category...', options=[SelectOption(label='Tool',value='tool'),SelectOption(label='Collectible',value='collectible'),SelectOption(label='Power up',value='power up')])
])
print(msg)
it prints the msg
and works
is this one of those 3rd party dropdown libraries?
I think i recognize the while True: approach
Ah
I don't even know where it could have went wrong
Though I would recommend the discord.py way to do it over this approach
Use debugger
@client.command()
async def test(ctx):
msg = await ctx.reply('Welcome to the shop choose the category you want below',
components=[
Select(placeholder='Select category...', options=[SelectOption(label='Tool',value='tool'),SelectOption(label='Collectible',value='collectible'),SelectOption(label='Power up',value='power up')])
])
print(msg)
#succesful
e1 = discord.Embed(title="Tools",description="Full of tools")
e2 = discord.Embed(title="Collectible",description="Full of Collectibles")
e3 = discord.Embed(title="Power up",description="Full of Power ups")
#no idea honestly
while True:
#no
Can anyone help me in dms
ask here
Oke
Why dont u ask here
https://pastebin.com/k2DTx7CF how i fix error
Pastebin
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.
With proper syntax
thanks
time.sleep() is blocking, unlike asyncio.sleep()
Oke
?
meaning while you use time.sleep(), the other part of your code will sleep aswell
Basically when you do time.sleep, It’ s basically punching ur bot in the face
just summed the situation
Interesting analogy
Hey enslo
You sleep long enough, your bot won't send heartbeat in time and it will get disconnected by discord
imvery confused on what to do now
If you do asyncio.sleep you just wait in that part of code
Sup
will it?
Yea, you can block the heartbeating
sh
Use asyncio.sleep
bro forgets to breathe
wrong guy
🤨 Sounds like you got some blocking code 👁️ 👁️
Lmao sry
U loose the tcp connection
How fix
mobile coding 👁️ 👁️
with the asyncio sleep
At least he changed it to asyncio.sleep
and you have to use await
I respect the grind though
Bro u can install dpy to pythonista???
I got a flashbang on my mind
Lmao
Ig pc to i just like the magic keyboard more
Elaborate
this is my moment of evening-morning realisations
How i fix this tho
Wdym they work together
https://github.com/an-dyy/Rin/blob/model-rewrite/examples/components/button.py what do you guys think about this example
for loop left the chat
you can do them in the same time
multispam 👁️ 👁️
Not at exactly same time
Async is still one thread
U should learn basic python b4 dpy
can anyone help me with how to check for dropdown menu response
dont use time.sleep
What library u using?
on_dropdown
What should i use then
asyncio
…
im using discord_componenets
It gives me an error at that to
There’s seperate formats look up discord time formatting, uses Unix time
Does it have ui.Views etc.
await asyncio.sleep(20)
how do i make a reminder command?
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
@client.command()
async def test(ctx):
msg = await ctx.reply('Welcome to the shop choose the category you want below',
components=[
Select(
placeholder='Select category...',
options=[
SelectOption(label='Tool',value='tool'),
SelectOption(label='Collectible',value='collectable'),
SelectOption(label='Power up',value='powerup'
)])
])
print(msg)
@client.event
async def on_select_option(interaction):
e1 = Embed(title="Tools",description="Full of tools")
e2 = Embed(title="Collectible",description="Full of Collectibles")
e3 = Embed(title="Power up",description="Full of Power ups")
await interaction.respond(type=6)
if interaction.values[0] == "tool":
await interaction.author.send("tool")
elif interaction.values[0] == "collectable":
await interaction.author.send("collectable")
elif interaction.values[0] == "powerup":
await interaction.author.send("power up")
error is within interaction
Store the reminder and ping the person after some amount of time
A webhook spammer aint agianst tos
Yes it is
No
Pretty obvious you're spamming
I only test on myself
Yeah sure
ohh i totally didnt think of that
Idk what else u need 😂
<t:198392:t>
@slate swan like this right?
ight so ima just remind them after 1 hr about a reminder which was set for 3 hrs
They wait some time between requests and they do it like 6 times so I dont think It’ s that dangerous
It's in a while loop
Store the time
how to i make the bot add reactions and how to reconize them
then?
Imo it's still malicious even if it ain't in a while loop
Check if current time is greater than stored time and if it is ping the mf
Because if multispam == "y"
how?
Ye ig
There's also a file called webhook spammer
help?
If datetime.now > the_time_u_stored:
PINGGGGG()
Do that every couple of minutes in a task
ok
There is a message.add_reactions method or something and slso on_reaction_add event
or take the input from the user regarding time then await asyncio.sleep(time) this is the easy way
that doesn't work if the bot restarts for example
No proof
!shhhh
@sturdy cloud we're not going to help with code that violates ToS, such as a webhook spammer.
✅ silenced current channel for 8 minute(s).
!unshh
✅ unsilenced current channel.
i saw that ad well
Unfortunately not, you might need a database to store the times though, don't know if there's a better approach
It's being handled internally
if i put msg.add_reaction() it says funtion not found
!d discord.Message.add_reactions
Naw.
No documentation found for the requested symbol.
!d discord.Message.add_reaction
k
await add_reaction(emoji)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Add 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.
^
Bosna?
@naive spoke
ok but under the await add_reaction(emoji) can i put await.ctx.send
of course
yeah
You gotta send message first, then add reaction to it
After that you can do whatever u want
or is there another way to send the message and react the message the bot put in
Wdym
i mean does this react to the user message or the bots
Thats the lazy option
like if i say !test and the bot outputs somthing and reacts to its own
Do message.add_reaction
<t:TIMESTAMP:F>
where F is the format yo uwant
<t:198392:t>
how do you write that in code
await message.add_reaction(“😄”)```
May be wrong
Look in docs
there are a lot of tutorials on yt on discord.py reactions just watch those
<t:TIMESTAMP:F>
Actually you may be looking for <t:TIMESTAMP:f>
that only provides the month and not the day
help
put in the unix seconds
That's an API error, make sure the api returns what you expect
seconds since jan 1 1970 iirc
1645133075 would be the unix time now
<t:1645133075:f>
the command is there but its saying its not
@client.command(name= 'test')
async def vir(ctx: commands.Context):
await ctx.send('click here for role')
await message.add_reaction(':check:')
discord.ext.commands.errors.CommandNotFound: Command "test" is not found
the API is working, look, this is a command that returns the api content, i just dont get why i can' put this inside a embed
so the error isn't in the API ;p
Yeah
Line 1 column 1 seems to be where it's at
Maybe it's expecting double quotes instead of single quotes?
yeah
well it's going to be the timestamp when they joined, not the timestamp now
yo anyone help?
<t:TIMESTAMP:R> will provide a relative timestamp
nop, i did a test embed before, look
ik it looks stupid
User joined the server <t:1645133075:R>
No i mean, the API returns single quotes, but .json() might be expecting double quotes
oh ok i'll try
The only options are that or using a db/json to store the time, not worth for just a reminder command that probably no one will use, the sleep method works fine if you know your host don't have problems with the uptime
member.created_at
No, that's a datetime.datetime object
member.created_at.timestamp() will give you the unix time when the user created their account
f'<t:{member.created_at.timestamp()}:f>'
ngl, i like more
member.created_at.strftime("")
since can be in a way or another more customizable
You could, but you can't do that for live relative timestamps
Timestamp allows you to use discord formatting though
Discord timestamps take into account the region the person is in and it updates live
For example, using 24-hour time for europe, 12-hour time in U.S, that sort of thing
@sick birch , i changed description to = id and defined id as id = data.get ("id") and it worked, ty for the support
why is there an unexpected indent?
@bot.command()
async def pages(ctx):
guild = ctx.guild
message = await ctx.send("React To This To Get A Ticket")
await message.add_reaction("📩")
def check(reaction):
return str(reaction.emoji) in [":envelope_with_arrow:"]
while True:
try:
reaction = await bot.wait_for("reaction_add", timeout=None,check=check)
if str(reaction.emoji) == "📩":
await guild.create_text_channel(name=f"{ctx.author}s Ticket",category="TICKETS")
keep_alive()
...
I'm confused
Nothing after that return statement will run
You probably meant to have the while True: outside of check
member.roles[1:]
Yep
the command is there but its saying its not
@client.command(name= 'test')
async def vir(ctx: commands.Context):
await ctx.send('click here for role')
await message.add_reaction(':check:')
discord.ext.commands.errors.CommandNotFound: Command "test" is not found
?
Is there a way to get the time zone of a user?
nope
@bot.command()
async def ticket(ctx):
guild = ctx.guild
message = await ctx.send("React To This To Get A Ticket")
await message.add_reaction("📩")
def check(reaction):
return str(reaction.emoji) in [":envelope_with_arrow:"]
while True:
try:
reaction = await bot.wait_for("reaction_add", timeout=None,check=check)
if str(reaction.emoji) == "📩":
await guild.create_text_channel(name=f"{ctx.author}s Ticket",category="TICKETS")
still bugged
No, but discord timestamps will take that into account automatically if that's what you want
Ah nah, I was doing some sort of "wordle" kind of thing and I wanted to get it out at 12 AM local to that time zone
It would be nice if discord included it
for example <t:1645133075:f> will look different for us depending on where we live
Closest thing I might be able to get to it is locale then I suppose
thats it?
I see, yeah no don't know if that's possible unless you prompt them for it
manual input sucks to convert to but I guess that's my only option
im still having the same error
Unfortunately
I hope Discord adds the timezone of the user someday, could be quite useful
what's the code of the entire file (don't include the token)?
how do u get this to work?
@bot.command()
async def ticket(ctx):
guild = ctx.guild
message = await ctx.send("React To This To Get A Ticket")
await message.add_reaction("📩")
def check(reaction):
return str(reaction.emoji) in [":envelope_with_arrow:"]
while True:
try:
reaction,user = await bot.wait_for("reaction_add", timeout=None,check=check)
if str(reaction.emoji) == "📩":
await guild.create_text_channel(name=f"{ctx.author}s Ticket",category="TICKETS")
client = commands.Bot(command_prefix='?')
@client.command(name='hi')
async def version(ctx):
myEmbed = discord.Embed(title= f"Hello {ctx.author.name}" , color=0x0ff00)
myEmbed.set_footer(text="ur kool")
await ctx.send(embed=myEmbed)
@client.command(name='VVD')
async def virgil(ctx: commands.Context):
await ctx.send("is the best defenda")
@client.command(name='mood')
async def moodd(ctx):
kk = [":grinning:", ":smile:", ":smiley:"]
randemj = random.choice(kk)
await ctx.send(f'your emoji is {randemj}')
@client.event
async def on_message(message):
if message.content == 'why is moazzam dum':
message=("why not")
await client.process_commands(message)
@client.command()
async def test(ctx):
await ctx.send('click here for role')
await message.add_reaction(':white_check_mark:')
message undefined?
actually, unexpected indent
which line
ok
and what's the error again?
send the full traceback please
!tb
+deindent second command
Replit is glitchy
sgtill does not work, wtf
@bot.command()
async def pages(ctx):
guild = ctx.guild
message = await ctx.send("React To This To Get A Ticket")
await message.add_reaction("📩 ")
def check(reaction):
return str(reaction.emoji) in ":envelope_with_arrow: "
while True:
try:
reaction,user = await bot.wait_for("reaction_add", timeout=None,check=check)
if str(reaction.emoji) == "📩 ":
await guild.create_text_channel(f"{ctx.author}s Ticket",category="TICKETS")
Just wondering, is this file tree for my bot a bad layout? https://github.com/SnowyJaguar1034/Wyvern
bot.py in utils is a little confusing. You also have bot folder
convert it to an integer
I dont understand i tested my bot on my pc but if i put it in my vps it not work i mean it cant find or something the folder? (Debian 10 | 3.7.3)
Why is none of my commands working
something in your code is wrong
use int()
something broke
How do I know what did
yeah bot.py is my db connection and is going to be any other functions my bot needs
The bot online
I dont understand i tested my bot on my pc but if i put it in my vps it not work i mean it cant find or something the folder? (Debian 10 | 3.7.3) - Folder Name: Data\
it needs to be an epoch
Hi, still trying a timeout. Is there a way to make the duration be in something other than seconds?
what do you mean by ‘something other’
Minutes, hours, days, etc
Literally anything other than seconds
joined_at returns datetime.datetime
there should be a .epoch() method for datetime
just divide by 60 
Lmao
I dont understand i tested my bot on my pc but if i put it in my vps it not work i mean it cant find or something the folder? (Debian 10 | 3.7.3) - Folder Name: Data\
well created_at also returns datetime.datetime…
you need to add .epoch() method to the datetime object you're getting
may i redirect you to #python-discussion?
Please can anyone help me
``<t:{int(member.created_at.timestamp().epoch())}:f>``
try this. I'm not actually sure this works
but we'll find out now :)
we need a bit more information than this :)
Ignoring exception in command None: discord.ext.commands.errors.CommandNotFound: Command "test" is not found
but on my pc works but if i host it on vps it dont work
is there a directory called accounts?
yes
Mby there aint no folder named accounts
