#discord-bots
1 messages · Page 825 of 1
It is more of a question for #❓|how-to-get-help
gw udah coba tapi gak ada yang bantu anak anjing
......?
Is that manjaro?
yes
Read this...
okey
i tried but it faieled so no
to #help-falafel @slate swan
ModuleNotFoundError: No module named 'dungeon'
and dungeon is da naem of file
show your dir
ok wait
my bot wont be online on the discord but the Consol says its online
Why does this happen?
those your on_ready event get triggered?
those
show code or maybe it has an offline status
nvm, just wrong directory :V
ok
nvm I fixed it
lol
Guys, this code jst send "pepe", anybody idea?
@client.command()
async def emoji(ctx):
await ctx.send(str(":pepe:"))
the id in here but discord not send
why are you making a string a string
idk i found it in stackowerflow
but if i delete its not work again
and send :pepe:
well is pepe an emoji?
!d discord.Client.get_emoji
get_emoji(id, /)```
Returns an emoji with the given ID.
just get the emoji with the id and send it
ok i try it
The new problem is this
This command send:None
guess it couldnt found it and no need for that f string
so its work if the bot in the server where from the emoji, but if i try it in another server print None
!d
#bot-commands
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Oopsie ya I better go
Please help me with my code.
Why the command does not work, it worked for several days, now it doesn’t, there are no errors in the console
@bot.event
async def on_member_update(before, after):
entry = list(await after.guild.audit_logs(limit=1).flatten())[0]
user = entry.user
if after.bot:
return
if before.display_name != after.display_name:
channel = bot.get_channel(935160414965211179)
emb=discord.Embed(title="Изменение ника", description="**__Информация:__**", color=discord.Color.from_rgb(255, 128, 0))
emb.set_footer(text="© Все права защищены The Greatest", icon_url=before.avatar_url)
emb.set_thumbnail(url = before.avatar_url)
emb.add_field(name="**Пользователь ника:**", value=f"**{before.name}**", inline=False)
emb.add_field(name="**Ник до Изменений:**", value=f"`{before.display_name}`", inline=False)
emb.add_field(name="**Ник после Изменений:**", value=f"`{after.display_name}`", inline=False)
emb.add_field(name="**Сменил:**", value=f"**{user}**", inline=False)
await channel.send(embed=emb)
Do you have member intents enabled?
Intents enabled
If you check the message pinned on this channel you can find a guide for that
How do I check if the bot is in the same voice channel as the ctx.author ?
author of what
ctx.author = the person who invoke the command
Isn't obvious lol
what is the command
Hello im back for dumb question bcs im dumb ???
doesn't seem like this is an easy one to do. maybe it is but i have never done anything with voice channels
So how can i process a on_message by a command ?
it doesn't matter what is the command
!d discord.VoiceChannel.members
property members: List[Member]```
Returns all members that are currently inside this voice channel.
Check if ctx.author is in this list
I mean when i do a specific command, a specific on_message are working
can't I compare if ctx.author.voice_channel == self.bot.voice_channel something ?
I just dont remember how to write the self.bot.voice_channel
.me.voice.
There is no such thing as Member.voice_channel
ctx.author.voice.channel
I think i got it now if ctx.author.voice.channel == ctx.guild.me.voice.channel
right ?
is not ==
if not ctx.author.voice.channel is None and ctx.author.voice.channel is ctx.guild.me.voice.channel:
like this ?
Well, sure. But the better option would be ensuring ctx.author.voice is not None
As it can be None when the user doesn't have a voice state
E.g when they aren't in a channel, etc for voice
if not ctx.author.voice.channel is None doesn't this check if ctx.author.voice is None or not ?
Well, no
You're checking an attribute of it
If ctx.author.voice is None you'd get an error
oh ok
Also try to use if ctx.author.voice is not None to be a bit more conventional
Rather than if not ctx.author.voice is None
if not interaction.user.voice is None and interaction.user.voice.channel is interaction.guild.me.voice.channel:
Yea, getting closer. But also guild.me.voice can be None as well
Ok then you're pretty much set
thank you. you are very helpful !
So i maked a on_message but i wanted he start after this: if message.content.startswith('çvoid'):
Wdym?
So its work, but only for 'çvoid'
And?
OH HEY i did it for my trigger message
SO, its just trigger 'çvoid'
And thats it idk why
Yeah, it should work
Did you add the process_commands coroutine in on_messagd?
I see, can you show your on_message event
Uhhhh
Come DM its confidential xddd
I mean, i dont want to show some things..
Wait imma add u, on my main account imma show u first the command
(my name is void)
Ah u didnt open ur request..
ok nvm i got an idea
Rewriting all models I had
Here’s the user rewrite
breaking changes, huh
Oh cool
Okay thanks I don't understand shit
The base model is at least more understandable now compared to the old one
I still need to fix the property annotation
They don’t work with union pipes
I have them up already
Are those even required
People can easily figure out stuff from docstrings and their IDE hehe
Not all the time
Docs are overrated
I only woke up an hour ago
Lmao
I have school soon
Okay
What are those?
Specifically the line that's erroring
Nice spells in line 54
@final iron
What are what
discord_slash....
Right, speech
how the hell do i?
!pypi discord
A mirror package for discord.py. Please install that instead.
Look at pypi
Use pip install *library name mentioned in docs*
that's not the problem xd
😫 rude
Uhh, my eyes are getting weaker or its just my phone
that's what they wrote :V
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
I didn't go anywhere
um how is that off topic?
Lmao
@slate swan
how do i?
In the first line, add fro at the first
And u r fine lmao
and yes, learn basic Python
done.
the amount of people doing discord bots before learning python haunts me
discord_slash
now what?
and install discord_slash if already didnt now, or Ash will kill me
I was one of them an year ago
I would have killed you already if i wanted to, anyways
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
Now Hunter pro
Anyways
hunter the saviour
!ot and no thanks
Hrh
Do I really care: No
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.

hey can anyone see whats wrongs in this code
so what should i do?
Missing the @ before client.command
f i totally missed that
pip install discord_slash
Restart vsc , run the file
where?
Lmao
Command prompt
A slash command handler for discord.py.
discord-py-slash-command devs
same
discord-py-slash-command
pip install discord-py-slash-command
I totally haven't named a lib of mine as hunter's-totally-not-useless-lib-which-never-works
@slate swan @slate swan @slate swan
Just don't use the library tbh, use a fork.
or my nickname is cool already
!pypi rin
!pip hikari
Spoon?
where do i do pip install discord_slash?
I'm out
pip install discord-py-slash-command in terminal.
on sarthak's head?
How should I find member's voice name?
Okay.
Voice name?
The name of the voice.
Member.voice.channel.name if you mean name of channel member is in
No, they asked member's voice name
Restart vsc, and you'll have it
Okay.
.
hey @next snow, i would prolly learn more python and about pip before continuing with the bot. it will do you good
are you like forking it or something?
he made the bot for me.
I should start learning python too, ig
oh
💀 🗿
@slate swan give me a simple program to make in python. maybe computing some stuff
i already did a program that generates a random list of ints and computes the mean, median, mode and range
For example there is a voice channel called: Voice ch #1
and I joined it. How can I find the voice name ?
For example:
!voice --> The member found in: Voice ch #1.
huhh idk, I'm not good at suggestions and advice
🗿
Should I learn python before making a discord bot 
no
yes
heres my little program btw
I see
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
Without learning python I directly jumped on a pre made discord bot and tried to understand the function of each line and in one week, I got the basics of python cleared!
@slate swan, I brought an explanation.
Context.author.voice.channel.name
will return the name
of the voice channel
U do know that the stats module exists, right?
!d statistics
New in version 3.4.
Source code: Lib/statistics.py
This module provides functions for calculating mathematical statistics of numeric (Real-valued) data.
The module is not intended to be a competitor to third-party libraries such as NumPy, SciPy, or proprietary full-featured statistics packages aimed at professional statisticians such as Minitab, SAS and Matlab. It is aimed at the level of graphing and scientific calculators.
ik
but thats boring having premade functions
wanted to do it myself
Then I got a program for u
uhh nitemare
Make a script to find the largest and the second largest number from the list WITHOUT using the max function
Idk, never used it tbh
how do i add slash commands in cogs
Which lib
can it be a random generated list?
eh thats easy
disnake
https://gist.github.com/akabinds/25ca2ef5ee3fe75a368a9fa97c195117#file-computing_statistics-py-L93
Could have used list comprehension
computing_statistics.py line 93
for integer in int_list:```
Can be anything
true
Ik
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
please read this- https://pythondiscord.com/pages/resources/guides/off-topic-etiquette/

Guidelines on conversation etiquette.
Now I regret coming here
stop being cringe
@bot.event
async def on_message(m):
if PYTHON_DISCORD_WEBSITE in m.content:
await m.author.read_that()
Ezzz
`msg' is undefined.
Just saw lol
'PYTHON_DISCORD_WEBSITE' is undefined
bot is undefined, PYTHON_DISCORD_WEBSITE is undefined
It's a constant 😌
@maiden fable is undefined
fren of variable
U know that he's trolling, right?
Yeah I do
thats why I replied stupid 
btw
!ot
Off-topic channel: #ot2-never-nester’s-nightmare
Please read our off-topic etiquette before participating in conversations.
rushes behind God Hunter
Weird
same
i get the same problem, is not only you, discord made a new update i think
Looks like you haven't supplied a description for your dropdown option
i don't have dropdown its simple command
maybe a dropdown from another command
nope i only have one command
i just started working on this bot
it don't give error when i use full on option
like this
B4 you were missing a field that’s required
It says here
Update Disnake
pip install -U disnake
i was already on 2.3
Do it.
i did that
now 2.3.2
And now it works :)
^^^
ohh
@client.command()
async def voice(ctx, *, member: discord.Member):
if ctx.member.mention is None:
await ctx.reply("**❌ You have to mention a member!**")
if ctx.member.voice is None:
await ctx.reply("**❌ The user has not connected to VoiceChannel!**")
vc = ctx.member.voice.channel.name
await ctx.send(f"User is in: `{vc}`.")
❌ Member is a required argument that is missing.
what do you mean? @quick gust
you must invoke it like !voice @xZap
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Context' object has no attribute 'member'
@buoyant quail look
I think the error is clear
It doesn't have a member attribute
!d discord.ext.commands.Context
class discord.ext.commands.Context(*, message, bot, view, args=..., kwargs=..., prefix=None, command=None, invoked_with=None, invoked_parents=..., invoked_subcommand=None, ...)```
Represents the context in which a command is being invoked under.
This class contains a lot of meta data to help you understand more about the invocation context. This class is not created manually and is instead passed around to commands as the first parameter.
This class implements the [`Messageable`](https://discordpy.readthedocs.io/en/master/api.html#discord.abc.Messageable "discord.abc.Messageable") ABC.
@final ironI did ctx.author.voice.channel.name but what if I want to do it on other members? not only me..
i know that isn't camelCase
lol imagine normal non-programmer people with actual lives, reading this chat about us arguing over camelCase and CamelCase, when the correct punctuation is Camel case
CamelCase is actually PascalCase when written in this form
well, they wouldn't be able to spell it as Camel case bc they are not pro-grammers
That is a very, very small explanation
get it? pro and grammer?
Please leave 😂
weird purge command
Slash commands are these very weird but powerful things
what's weird is something wrong in that command
Context class has no member attribute
U mean ctx.author
ctx.author is for the author. I want it for the member that i'll mention.
How to get voice channel by name
why using options, also, instead of sleeping you can just use an ephemeral confirming that the messages are deleted
imo, also not having a clear limit could result in maybe deleting over 1k messages or more by mistake
Sarthak help
You should know what a constant means if you have been coding for a consider period of time tho
Elaborate
getting a channel named something?
Yes
!d discord.utils.get use this with Guild.voice_channels
discord.utils.get(iterable, **attrs)```
A helper that returns the first element in the iterable that meets all the traits passed in `attrs`. This is an alternative for [`find()`](https://discordpy.readthedocs.io/en/master/api.html#discord.utils.find "discord.utils.find").
When multiple attributes are specified, they are checked using logical AND, not logical OR. Meaning they have to meet every attribute passed in and not one of them.
To have a nested attribute search (i.e. search by `x.y`) then pass in `x__y` as the keyword argument.
If nothing is found that matches the attributes passed, then `None` is returned.
Examples
Basic usage...
I don't
Maybe I actually do know but just don't know it's called a constant
¯\_(ツ)_/¯
It's basically a variable you don't ever want to change the value of
a constant it's pretty self explanatory imo, does have a constant value, means it remains the same all time
Yea
Okay
What do you mean?
what dpy ver you use
3.10.2
How would you find the description of a command in every cog?
dpy version, not python
i dont know.
for cmd in cog:
desc = cmd.description```
cmd is the command object and cog is the cog object
ah okay
Then you shouldn't be making a discord bot. It's not even close to a good beginner project
print(discord.__version__) i think
someone made me the bot.
not me.
ask them to fix the error
he is telling me to do it.
Then get them to fix the issue?
"cog is not defined"?
Whoever you got to make a bot doesn't really know what they're doing
u need a cog object
Ah Okay.
Thank you.
i will beat him
u can do cog = bot.get_cog("name")
!d discord.ext.commands.Bot.cogs
property cogs: Mapping[str, discord.ext.commands.cog.Cog]```
A read-only mapping of cog name to cog.
Would this work?
!d discord.ext.commands.Cog.walk_commands returns a list of all commands in the cog
for ... in walk_commands()```
An iterator that recursively walks through this cog’s commands and subcommands.
why would you want to have the same description to all of your commands though
use that yeah
i want to add all command descriptions to a value in an embed field
you said command's description, and now cog descriptions?
it's one or another
and also that was just an example to show u how it works
How do I make a cog description?
u can use it however u want
command sorry
So is the only way to do it is to use doc strings?
class MyCog(Cog):
"""My sweet description"""
#or
def __init__(self):
self.description ="this too"
Yeah, so a doc string
docstrings are nice
Would it be like:
for cog in walk_commands():
#Find the cog description
no, you just dont copy paste the exact thing
cog : Cog
for command in cog.walk_commands():
# do your stuff
``` this is the max i can tell.
ok
firstly, async for. second it shouldcommand not cog, third it should be cog.walk_commands
u can use for aswell?
yep!
what does cog: Cog do?
since cog.walk_commands() returns an iterable
its a typehint to your cog object
ah okay
i did it to identify that the cog variable is a Cog class
command.cog.walk_commands
ty
is it inside class?
yesh
may i see the full code?
ngl it's something nice to have, just for style yk
ah, you didnt provided an extension while using the command, <prefix>load <extension>
import disnake
from disnake.ext import commands
class Admin(commands.Cog):
def __init__(self, client):
self.client = client
# load extension command
@commands.command()
async def load(self , ctx, extension):
self.load_extension(f'cogs.{extension}')
await ctx.send('Cogs loaded')
# unload extension command
@commands.command()
async def unload(self, ctx, extension):
self.unload_extension(f'cogs.{extension}')
await ctx.send('Cogs unloaded')
# reload extensions command
@commands.command()
async def reload(self, ctx, extension):
self.unload_extension(f'cogs.{extension}')
self.load_extension(f'cogs.{extension}')
await ctx.send('Cogs reloaded')
def setup(client):
client.add_cog(Admin(client))
will be the syntax
^^^
where?
while using the cmd on discord
tbh, i would recommend using these commands in the main file not a cog
now it's showing more errors
self.client.unload_extension
lmao, i just noticed that they don't have the isowner stuff
and same for all other load/unload
self.unload_extension(f'cogs.{extension}')
self.load_extension(f'cogs.{extension}')
#relace this with
self.client.reload_extension(...```
i would have just added it as a cog check tbh, since the cog is an admin cog
@client.slash_command(description='', guild_ids=[])
@commands.is_owner()
async def reload(inter, extension: str = commands.Param(choices=[''])):
client.reload_extension(f'cogs.{extension}')
await inter.response.send_message(f'Cog reloaded ! and can be used. ', ephemeral=True)
for me it's easier to use it like this
adding choices i save time from typing the cog name
How do I check if the member is in the voice?
🏃♂️ BotApp.load_extensions_from()
!d discord.Member.voice is Not none if the member is in a voice channel
property voice: Optional[discord.member.VoiceState]```
Returns the member’s current voice state.
contents = [self.client.cogs]
pages = len(contents) / 4
This works but why the extra numbers / text and how to remove it?
I want contents to shall all names of my cogs
extra numbers 
class Kakashi(BotApp):
def __init__(self, token):
super().__init__(
token=token,
intents=Intents.ALL,
prefix=when_mentioned_or(PrefixHandler.prefix_getter),
help_slash_command=True,
)
tasks.load(self)
initialise_databases()
self.boot_datetime = datetime.now()
self.load_extensions("lightbulb.ext.filament.exts.superuser")
self.load_extensions_from("kakashi/plugins")
``` totally not ez stuff
contents variable is already a list of cog names
didnt understand
what part did you not understand? what a variable means? what a list means? or what a cog name means?
yeah but this loads all of them, which they load automatically anyway when you start the bot
yea thats intentional
would this work?
fair
because i want 4 commands per page
no it doesnt work
so i keep getting this error ```Ignoring exception in on_command_error
Traceback (most recent call last):
File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\site-packages\disnake\client.py", line 515, in _run_event
await coro(*args, **kwargs)
File "C:\Users\shake\AppData\Local\Programs\Python\bot.py", line 1760, in on_command_error
await ctx.send(embed=embed)
File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\site-packages\disnake\abc.py", line 1438, in send
data = await state.http.send_message(
File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\site-packages\disnake\http.py", line 297, in request
kwargs["data"] = utils._to_json(kwargs.pop("json"))
File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\site-packages\disnake\utils.py", line 536, in to_json
return json.dumps(obj, separators=(",", ":"), ensure_ascii=True)
File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\json_init.py", line 238, in dumps
**kw).encode(obj)
File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\json\encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\json\encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "C:\Users\shake\AppData\Local\Programs\Python\Python310\Lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type CommandInvokeError is not JSON serializable
it says i tried to write an Error object into .json?
you can't put objects in json file
i didn't lol
in fact, i was actually pulling data, not putting it
show code.
and the json structure
jsons are quite bad for storing stuff ngl
@bot.command(aliases=('get_warns', 'pull_warns', 'warns'))
@commands.has_permissions(view_audit_log=True)
async def fetch_warns(ctx, member_id: int = None):
with open('warns.json', 'r') as json_file:
data = json.load(json_file)
try:
dictionary = data[str(ctx.guild.id)]
except KeyError:
await ctx.send(f'{ctx.author.mention} no warns from this server.')
return
else:
if member_id is None:
for member in dictionary.keys():
with open('Warns.txt', 'a') as file:
file.writelines(f'{(await ctx.guild.fetch_member(int(member)))} has {dictionary[member]} warns.')
file = discord.File(
r'C:\Users\shake\AppData\Local\Programs\Python\Warns.txt')
await ctx.author.send(content=f'{ctx.author.mention} warns from current bot session in **{ctx.guild}**:', file=file)
else:
try:
await ctx.send(f'{ctx.author.mention}, {(await ctx.guild.fetch_member(dictionary[str(member_id)])).mention} has **{dictionary[str(member_id)]}** warns.')
except KeyError:
await ctx.send(f'{ctx.author.mention} there are no warns in this server for {(await ctx.guild.fetch_member(int(member_id))).mention}.')``` json structure is ```json
{"guild_id": {"member_id": "number of warns for this member", "member_id": "number of warns for this member"}, "guild_id": {"member_id": "number of warns for this member", "member_id": "number of warns for this member"}}```
ew json
i used to store the guild ids and custom prefixes in a json, good now i switched to slash, i don't need to do that shit anymore
Just don't use json?
Json isn't meant to be used as a database, that's why it's so unfriendly for that purpose
Now if you used something like sqlite3, your life would of been much easier
Even with slash commands you would have to use a database
The category name.
how to get a member with userID
!d discord.Guild.fetch_member
await fetch_member(member_id, /)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Retrieves a [`Member`](https://discordpy.readthedocs.io/en/master/api.html#discord.Member "discord.Member") from a guild ID, and a member ID.
Note
This method is an API call. If you have [`Intents.members`](https://discordpy.readthedocs.io/en/master/api.html#discord.Intents.members "discord.Intents.members") and member cache enabled, consider [`get_member()`](https://discordpy.readthedocs.io/en/master/api.html#discord.Guild.get_member "discord.Guild.get_member") instead.
@frozen elk
I do I get the member's category channel?
for example im in: Voice ch #1 in a category called: HANGOUT
and when I press the command I want to see: User in HANGOUT category!
is there like a list of websites you can use for bot API
well, i don't use a prefix anymore so i don't really have what to store
like a website that shows dog pictures for example
Any moderation, settings, and a lot of others
Prefix is not the only thing that gets stored
If it is, your bot is very small and has very little commands
i kinda have 8 cogs and a total of 40 commands maybe or even more, didn't actually count tbh
See here some of the API's you can use in your discord bot or anything - API's.md
Makes sense
wow, i just checked, my bot has 73 commands, not too shabby
!d discord.ext.commands.Bot.commands
property commands: Set[discord.ext.commands.core.Command[discord.ext.commands.core.CogT, Any, Any]]```
A unique set of commands without aliases that are registered.
Use len() on it to see how many you have
print(len(bot.commands))
See, things like that makes dpy really interesting to me
Imo it's a really interesting and well developed library
But I've never dived in to the internals
So for all I know it's an absolute mess
get_channel(channel_id, /)```
Returns a channel with the given ID.
Note
This does *not* search for threads.
@quaint epoch
how would you find a user in a category?
i mean you might be able to do that for a channel
What do you mean?
can i multiply a int with discord.py?
to find member's voice i did: member.voice.channel.name what about category?
what are you trying to find when you say category
category name
you mean like 10 * discord
you can just get the category directly, you don't need a member
async def mute(self, ctx, member: discord.Member, time: int=0, *, reason="No reason given."):
im trying to convert the time based on what letter is that the end, (e.g d = days, m = mins, h = hours)
if "m" in time:
time * 60
elif "h" in time:
time * 3600
elif "d" in time:
time * 86400
await asyncio.sleep(time)
you can't loop through an int
you dont' update variables lol
you clearly copied someone else's discord bot if u cant solve this error yourself
time * 60, where is =
well i didnt.
send the whole command
but thanks for trying to help, dick.
did you try to use discord builtins timeout?
@commands.cooldown(1, 5, commands.BucketType.user)
@commands.has_permissions(manage_messages=True, administrator=True, kick_members=True, ban_members=True)
async def mute(self, ctx, member: discord.Member, time: int=0, *, reason="No reason given."):
guild = ctx.guild
mutedRole = discord.utils.get(guild.roles, name="Muted")
if not mutedRole:
mutedRole = await guild.create_role(name="Muted")
for channel in guild.channels:
await channel.set_permissions(mutedRole, speak=False, send_messages=False, read_message_history=True, read_messages=True)
try:
embed = discord.Embed(description=f"{member.mention} was muted.", colour=0xEC9D75)
await ctx.send(embed=embed)
except:
await ctx.send("The member was muted. But please give me the embed links permission.")
try:
await member.add_roles(mutedRole, reason=reason)
except:
await ctx.send("I do not have the required permission to mute this member!")
try:
await member.send(f" You have been muted from: {guild.name} For: {reason}")
except:
await ctx.send("Member muted, I could NOT dm them the reason..")
if "m" in time:
time * 60
elif "h" in time:
time * 3600
elif "d" in time:
time * 86400
await asyncio.sleep(time)
await member.remove_roles(mutedRole, reason="User was unmuted | (Time finished)")
embed = discord.Embed(description=f"Unmuted: {member.mention}",colour=discord.Color.random())
embed.set_footer(text=f"Muted by {ctx.message.author}")
await ctx.send(embed=embed)
"5m" * 60 what will this produce?
5m (string) 60 times
im using discord.py, only way to use timeout is by using this https://stackoverflow.com/questions/70459488/discord-py-timeout-server-members , which im trying to avoid
just duplicates it
yes so you're doing asyncio.sleep("5m5m5m5m5m5m5m5m5m")
yeah
this doesn't work
are you ok buddy?
thats whats happening, u need to give it an int
!d asyncio.sleep
coroutine asyncio.sleep(delay, result=None)```
Block for *delay* seconds.
If *result* is provided, it is returned to the caller when the coroutine completes.
`sleep()` always suspends the current task, allowing other tasks to run.
Setting the delay to 0 provides an optimized path to allow other tasks to run. This can be used by long-running functions to avoid blocking the event loop for the full duration of the function call.
Deprecated since version 3.8, removed in version 3.10: The `loop` parameter. This function has been implicitly getting the current running loop since 3.7. See [What’s New in 3.10’s Removed section](https://docs.python.org/3/whatsnew/3.10.html#whatsnew310-removed) for more information.
Example of coroutine displaying the current date every second for 5 seconds:
? im not even doing that lmfao
maybe try and help instead of just being an asshole.
btw, the delay is in seconds
there are 3 people here trying to help you
are you okay?
thats what i convert into
if "m" in time implies time is string
and then u proceed to multiply string
tiem is a string
my guy thats someone else
are u okay?
you try to use in with int. you can't do it
and you don't update time variable
you are obviously the only one, tooru is talking to someone else and proceeding to say i stole the code.
who?
you multiplied and int by string
"Enthusiast"
how do i get the message link of a message like
"[see original message](#message link goes here)"
so it won't work, you have to strip the string and convert it to an int
oh i confused your names
comm kid moment
thats literally not even my code for fucks sake
HANGOUT
|
Voice Ch #1
|
xZap
!in_voice @xZap
Now it will show: The user is in: (HANGOUT) - Voice Ch #1
@quaint epoch
message.jump_url
i had a question. So my friend made a custom gif and i want my bot to send it in an embed. can i use embed.set_image() here or am i supposed to do it some other way?
i can do message.id.jump_url?
so, your just trying to find what voice channel the user is int?
no, just message.jump_url
can you do (12345).jump_url?
i dont think ints have such attribute
thanks. this is literally all i needed. thanks for actually helping me and making this alot easier than the other people trying to either not help at all, be rude and make assumptions, or just try and explain something that i am not even using and isnt even relevant.
you can do it
I did the voice channel, but now I want to know the category
alr
\👍

just use a bit of comp logic and find the category this channel is in
my man didnt even try do debug
!d discord.TextChannel.category
property category: Optional[CategoryChannel]```
The category this channel belongs to.
If there is no category then this is `None`.
same for discord.VoiceChannel
and you didnt even try to help, whats your point
just check if it's NoneType and your good to go
!d discord.VoiceChannel.category
property category: Optional[CategoryChannel]```
The category this channel belongs to.
If there is no category then this is `None`.
didnt i explain what the error was
you seem ignorant
sent a photo with the error.
xd
didnt seem like you saw it and immediately jumped to conclusion
!d discord.ext.commands.command
if you fail to spot this error immediately, this whole code is probably someone else's
!d disnake.ext.commands.slash_command
no other explanation
!d disnake.ext.commands.slash_command
@disnake.ext.commands.slash_command(*, name=None, description=None, options=None, default_permission=True, guild_ids=None, connectors=None, auto_sync=True, **kwargs)```
A decorator that builds a slash command.
disnake does
i think beta version does
I was just checking if it contain dpy 2.0's data
but yeah just use disnake or pycord
but whos going to use dpy beta instead of disnake
and..?
- you make assumptions that im stealing code
- you make assumptions about my experience
- you are assuming that im always looking at chat and not mentioning me so i can see it.
- you are calling me ignorant when i know it duplicates the string and you are telling me exactly what my question was.
- you gave no clear answers and confused me on what i was to do, while others just helped me and moved on
pycord are the quickest to implement new features
i prefer disnake because dis+nake
- you literally gave me 1 - 2 answer sentences and you mention the wrong person who didnt even have a question then proceed to get mad at me calling me ignorant.
well, we can't help directly, they gave you what was most likely the error and told you fix it. because at pydis we don't spoonfeed.
- you gave no clear answers.
Completely false
proof?
pycord is a sin
wasnt asking for spoonfeed. i was asking for a completely vague and easy to follow answer with a good idea on what i did wrong and how i can prevent it further
does it have modals yet? "Stable"
im comparing dpy forks btw, i didnt include interactions.py
how do i set a letter limit for strings lol
@client.command()
async def thingy(ctx, lol : str = None [anything with a limit lol]):
Me neither
they told you the error very simply, slept on a string, not an int and this was where you made that string.
Compares Discord libraries and their support of new API features
!d disnake.ui.Modal
class disnake.ui.Modal(*, title, components, custom_id=..., timeout=600)```
Represents a UI Modal.
New in version 2.4.
they couldve at least mentioned me so i could see the actual answer, and then said i was ignorant.
if len(string) > (10):
print('this is too long')```
where find
pycord have modals yes
stable? And send docs.
woah, pycord beat disnake at one column

still not switching over though
Only the api version, and that's false for people using the master version
I'm not a fan of forks but I prefer Disnake
aswell as immediately being toxic towards me after i was stuck on one error that i could not figure out (documentation did not have any answers, searched google, and came here completely last.) aswell as not giving me the easier approach of int(time) which i just figured out.
Dissnake == js??
god no
!pip Disnake
Python
I mean functionslity
there is like 8 million different discord.py forks now
No
Oh yea I remember seeing one of the maintainers asking a discord developer for early access to modals and getting it
not a fan of forks in general?
actually?
yes.
Yep

As any nickname suggests
damn
Why the command does not work, it worked for several days, now it doesn’t, there are no errors in the console
@bot.event
async def on_member_update(before, after):
entry = list(await after.guild.audit_logs(limit=1).flatten())[0]
user = entry.user
if after.bot:
return
if before.display_name != after.display_name:
channel = bot.get_channel(935160414965211179)
emb=discord.Embed(title="Изменение ника", description="**__Информация:__**", color=discord.Color.from_rgb(255, 128, 0))
emb.set_footer(text="© Все права защищены The Greatest", icon_url=before.avatar_url)
emb.set_thumbnail(url = before.avatar_url)
emb.add_field(name="**Пользователь ника:**", value=f"**{before.name}**", inline=False)
emb.add_field(name="**Ник до Изменений:**", value=f"`{before.display_name}`", inline=False)
emb.add_field(name="**Ник после Изменений:**", value=f"`{after.display_name}`", inline=False)
emb.add_field(name="**Сменил:**", value=f"**{user}**", inline=False)
await channel.send(embed=emb)
Forks like Disnake , pycord, enhanced dpy has more stuff
Imma write a "why not use pycord" gist soon
cough cough slash commands cough
pycord changed too much to be easy enough to just use right away
damn what a miserable life you're living if you dont like forks
Help
expected output vs output
and how did it change, and when
for literally 0 reason probably
Is pycord has totally different from discord py
surely, but that's what every fork did
thats why im gonna keep using discord.py until its deprecated
they changed exactly nothing btw
veteran till the end
then why do i change
you dont even need to change your imports
exactly
What?
because they're using master branch of dpy
but this is dpy's change not pycord's
Hikari is 4x faster , better cache , better codebase than discord.py itself , more pythonic
We r hoping the same for rin too.
im sticking with discord.py 2.0 until it doesnt work
Who
k gotta get off my pc, it's break time
has nothing to do with forks 
he was talking about dpy forks
nah i asked if he meant forks in general
he said yes
i agree but sadly cant switch hikari at this point because codebase is not small
"better than discord.py itself" and none of the forks changed any internals ( othr than pycord playing needlessly with discord.ext.commans.Bot)
Another thing I don't like about pycord is having so many devs but too slow in implementing stuff
did disnake make dpy's master branch stable?
A long time ago.
The maintainers behind the scene are not very professional
Probably my main reason
thats good
how can I give a feedback when user input args are missing? What is the exeption
what about nextcord
MissingRequiredArgument
I thought nextcord was from scratch, they changed to being a fork?
Disnake on the other hand is maintained by our lovely Equenos , who developed dislash.py ( yes the library you used with discord.py to make slash commands)
nextcord was always a fork, no?
i think it was
Weird I have a specific memory of it being from scratch
nextcord is a fork, I love their voice recieve feature ( which is still in beta ig?)
wat
i wanna make a starboard cmd but it aint working
voice packets from discord to the bot
error? code?
okk waitt
Capturing the UDP packets are easy, the hard part is decoding them
not yet
Pycord also has voice receive, although they just stole the PR of voice receive from discord.py
payLoad
no error nothing
pycord stole pr from discord.py 
isnt that what fork literally means 
add it to rin and show them how to do it 😳
Btw with the changes in internals( the models you are Rewriting) is it gonna effect any old code for a bot?
The PR wasn’t even pushed yet though, it would make sense if it was actually finalized
Yes the model rewrite is a breaking change
wut shud i do tho
mhm I'll assume that for someone who typehint a lot of stuff yes , me
Oh right, the base models property decorator isn’t typehinted correctly
It won’t work for complex types like Generics, Union pipes
Well, some generics are supported. Only the builtins
message was deleted when the event arrived to u
hmm
async def languagelist(ctx):
lan_list = ["german", "english"]
await ctx.send(f"The current available languages are ")
``` how can i get every language in lan_list into the ctx.send seperated with a comma ?
", ".join(lan_list)
Do !join and ! f-string in #bot-commands
wait where do i put that in lol
async def languagelist(ctx):
lan_list = ["german", "english"]
await ctx.send(f"The current available languages are {', '.join(lan_list)}")
ahhhhh
Wrong m8
!e ```py
lan_list = ["german", "english"]
print(f"The current available languages are {", ".join(lan_list)}")
@slate swan :x: Your eval job has completed with return code 1.
001 | File "<string>", line 2
002 | print(f"The current available languages are {", ".join(lan_list)}")
003 | ^
004 | SyntaxError: f-string: expecting '}'
bad choice of quotes
uh what do i do lol
use single quotes inside the {}
is it possible making a command like delete add <user> and the bot will keep deleting the messages of the user when they send them untill we do delete remove <user> its like a mute or something but annoying.
which will stop working if the bot restarts
on_message:
if msg.author in deletion_list:
msg.delete
database then
yeah
that would be kinda complicated, good to begin with a list
yeah
Sqlite3 exists
just make MVP and then change things as u need them like adding a database
if 'color' in data[str(user.id)]:
color = data[str(user.id)]['color']
if 'color' not in data[str(user.id)]:
color = "light_grey"
embed = disnake.Embed(
title = f"{user.name}'s Profile",
color = disnake.Color.color()
)
```will this work lol
like the embed color part
Terrible idea
okay idea for proof of concept
halp
quit being so over-the-top "professional"
i alr did

im sry if i did something wrong
idk maybe the bot just fails to fetch the message for some reason
ohh
which generally shouldnt happen
File "C:\Users\Niclas\Desktop\Other\Python\NcZ Discord Bots\Disnake\NcZ\main.py", line 558, in <module>
async def language(ctx, mode : str = None, language : str = None):
File "C:\Users\Niclas\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\core.py", line 1377, in decorator
self.add_command(result)
File "C:\Users\Niclas\AppData\Local\Programs\Python\Python39\lib\site-packages\disnake\ext\commands\core.py", line 1228, in add_command
raise CommandRegistrationError(command.name)
disnake.ext.commands.errors.CommandRegistrationError: The command language is already an existing command or alias.``` the thing is: i dont have any other command called language, what do i do ?
use channel = bot.get_channel(payload.channel_id)
if you want it to work in general
@gaunt ice
maybe in another cog?
lemme check
no
@commands.has_permissions(manage_roles=True)
async def embed(ctx):
if ctx.message.author.id == 800287056940236821:
def check(message):
return message.author == ctx.author and message.channel == ctx.channel
await ctx.send('What should be the title?')
title = await client.wait_for('message', check=check)
await ctx.send('What should be the description?')
desc = await client.wait_for('message', check=check)
embed = discord.Embed(title=title.content, description=desc.content, color=0x72d345)
await ctx.send(embed=embed)
else:
await ctx.send('**Command not Found**')```
no i want it ina specific channel for it to send
else:
await ctx.send("bla bla")
It’s saying invalid syntax for the else:
Indents are not right
@client.command()
@commands.has_permissions(manage_roles=True)
async def embed(ctx):
if ctx.message.author.id == 800287056940236821:
def check(message):
return message.author == ctx.author and message.channel == ctx.channel
await ctx.send('What should be the title?')
title = await client.wait_for('message', check=check)
await ctx.send('What should be the description?')
desc = await client.wait_for('message', check=check)
embed = discord.Embed(title=title.content, description=desc.content, color=0x72d345)
await ctx.send(embed=embed)
else:
await ctx.send('**Command not Found**')
There
omg, how can you code when you don't know about indenting?
eeeeee hlep me
what happens if you cythonize this code 🧐
import disnake
from disnake.ext import commands
bot = commands.Bot(...)
@bot.command()
async def ping(ctx):
await ctx.reply("Pong!")
bot.run(...)
Didnt work either
error ?
well, even blind people sometimes find the right path
fix indent
@client.command()
@commands.has_permissions(manage_roles=True)
async def embed(ctx):
if ctx.message.author.id == 800287056940236821:
def check(message):
return message.author == ctx.author and message.channel == ctx.channel
await ctx.send('What should be the title?')
title = await client.wait_for('message', check=check)
await ctx.send('What should be the description?')
desc = await client.wait_for('message', check=check)
embed = discord.Embed(title=title.content, description=desc.content, color=0x72d345)
await ctx.send(embed=embed)
else:
await ctx.send('**Command not Found**')
if and that else shud be in a same line
AAAAA
@bot.command()
async def deleteadd(ctx, user: discord.User):
deletion_list = []
await deletion_list.append(user.id)
await ctx.send("Done.")
@bot.event
async def on_message(msg):
if msg.author in deletion_list:
await msg.delete()``` I just thought of this code, will it work?
what is that shit?
delete-add is a mathematical operation
Worked thanks g
AH NVM I FOUND IT
fixed there
i indented his code
yes it will work, but you need to fix the delete method and the indent
>>> [].add
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'list' object has no attribute 'add'
list.append
:/ imagine learning python
if 'color' in data[str(user.id)]:
_color = data[str(user.id)]['color']
if 'color' not in data[str(user.id)]:
_color = "light_grey"
embed = disnake.Embed(
title = f"{user.name}'s Profile",
color = disnake.Color._color()
)
disnake.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: type object 'Colour' has no attribute '_color'
``` i have been struggling with that one... how do i do that ? lol
fixed can you check again please
halp ples
hmm
Wont work
oh sryy
how do i make that work then
now you are appending string "{user}"
Oopsie
hm?
(user)?
now should work
change the colors using if else
well u still didnt fix indent issue
where
nah i dont wanna do that
find it yourself
is there any way i can make this work ?
You can do
ummm
hm
nvm, idk
Why ppl use replit
there has to be a way
because a lot of tutorials recommend it which they shouldnt
fixed again
is there a way i can make a command that can show a random instagram post from a specific account?
instagram api
Oh.
how so?
Can i use yt api for youtube video notifications??
is there a video i can use as a guide?
docs exist
is user alr or shall I use user.id?
ah alright! where can i find these docs?
id
since they can have byte or special characters in their name
or emojis
I was making prvc aka private voice channel
- Figure out if you have hands
-------Applicable if you do------- - Open Google Chrome
- Search Instagram API
Lol
LMFAIWJSH THE FIRST STEP
ok google exists too ¯\_(ツ)_/¯
nah but i need a specific doc that can show me how to do it 😭
use third party docs/examples
okok
now I highly recommend you to use your eyes and see the channel name
Search for it in compe programming none will help u
nextcord
I use discord.py 
“discord-bots” yea
why this issue
@slate swan this is the code
Best lib in python for dc bots??
deletion_list is not available in the scope of on_message since you defined it in deleteadd
!d discord.ShardInfo
class discord.ShardInfo```
A class that gives information and control over a specific shard.
You can retrieve this object via [`AutoShardedClient.get_shard()`](https://discordpy.readthedocs.io/en/master/api.html#discord.AutoShardedClient.get_shard "discord.AutoShardedClient.get_shard") or [`AutoShardedClient.shards`](https://discordpy.readthedocs.io/en/master/api.html#discord.AutoShardedClient.shards "discord.AutoShardedClient.shards").
New in version 1.4.
i got everything ryt but if i mention the if payload.emoji.id it aint working
Next cord??
see, if you dont wanna get made fun of, dont use python, even the maintainer of discord.py does not recommend pycord, use nextcord instead, disnake or hikari or lefi are better
Imagine using replit in pc
shall I shift the deleteion_list above everything
cmon dont bully me im a peasant
#bot-commands thanku dear
now just help me
Pls suggest the best lib so i can switch
Ah ok
I'm gonna cry if you say pycord
disnake
disnake or hikari
disnake is a fork so, it has the same syntax as dpy
hikari is a completely made-from-scratch discord api python wrapper
halp ;-;
I want the BEST
ig then hikari
Lol
hikari

