#discord-bots
1 messages · Page 483 of 1
yeah like invites it show user invites
change moderation to Invites
@lyric moat
i did
kgood
There trying to import invites. The class is called Invites, with a capital. Im aware they can have capitals lol, I wrote that code lol (Minus customization)
🤷♂️
I really want to finish my invites code
been bugging me for like a day.
honestly might just use yours
The direct answer to this error is it should be from cogs.invites import Invites
But you shouldn't be importing it, it should be loaded via load_extension
same thing
Care to show where you load it?
Fetch it from the database within your command
also i figured that i need an async on for submission in subreddit.top
how can i make it have 2 user id here?
if ctx.author.id == 737448363418452019:
we can barely see that if you know (Suggest send your code)
It's ban_members not ban_member
solarized dark
You don’t, discord.py does not have slash command support iirc 😳
Dpy doesn't have slashes
And since it's discontinued I'd recommended using disnake (a really good fork of dpy that has all the newest features)
Mhm
someone write that down.
It's by far the best fork of dpy that has the newest features and pretty easy to use
Sadly it's not as popular as some other forks that are behind 😔
says utils and core couldnt be found?
How to create webhook with code
!d discord.TextChannel.create_webhook
await create_webhook(*, name, avatar=None, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a webhook for this channel.
Requires [`manage_webhooks`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.manage_webhooks "discord.Permissions.manage_webhooks") permissions.
Changed in version 1.1: Added the `reason` keyword-only parameter.
for user_id in lobby1_team_a_id:
user_ign = get_user_ign(user_id)
user_elo = get_user_elo(user_id)
print(user_elo)
await member.edit(nick=f'[{user_elo}] ' + user_ign)
for user_id in lobby1_team_b_id:
user_ign = get_user_ign(user_id)
user_elo = get_user_elo(user_id)
await member.edit(nick=f'[{user_elo}] ' + user_ign)
the user_elo in the database and printed are all correct. but the ign doesn't change for some reason
how to check if a user is in VC or not ?
I tried this
voice_state = ctx.member.voice
voice_channel = ctx.member.voice_channel.id
if voice_state is None:
await ctx.send("You need to be in a voice channel to run this command")
and this gave me this error
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'Context' object has no attribute 'member'
Use and/or
is there a way to edit nicks with the user ids?
yes
!d discord.ext.commands.MemberConverter
class discord.ext.commands.MemberConverter```
Converts to a [`Member`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Member "discord.Member").
All lookups are via the local guild. If in a DM context, then the lookup is done by the global cache.
The lookup strategy is as follows (in order)...
@bot.command(description="The unpin Command", aliases=['UNPIN','Unpin'])
@commands.has_permissions(manage_channels=True)
async def unpin(ctx, message: discord.Message):
await message.unpin()
``` Whats the problem
!d discord.Message.unpin
await unpin(*, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Unpins the message.
You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to do this in a non-private channel context.
@client.event
async def on_message_edit(message_before, message_after):
channel_id1 = client.get_channel(888763536447250532)
embed = discord.Embed(
colour = 0
)
embed.set_footer(text='By oSeatch#6969')
embed.set_author(name= "Edited", icon_url=message_before.author.avatar_url)
embed.add_field(name='Before Edit:', value=message_before.content, inline=False)
embed.add_field(name='After Edit:', value=message_after.content, inline=True)
embed.add_field(name='Edited By:', value=message_before.author, inline=False)
embed.add_field(name= 'In Channel', value='#what do i put here', inline=False)
await channel_id1.send(embed=embed)``` anyone?
@boreal ravine can you help me out with this ?
Says ..utils and ..core could not be resolved
add a case_insensitive kwarg lol
where
in your bot constructor
ahh
typehint member: commands.MemberConverter to be able to use IDs
..
@boreal ravine any clue mate?
hm
Hello @boreal ravine (Hope you're fine with me pinging you), I have an idea which I need some help for...
"How would i add permissions to a user for a channel so say there is channel-a and user-a has permission for it but user-b does not, i want to have the bot toggle the "read messages" and "send messages" permission toggle for user-b on channel-a"
So in simple words, I need to make a command where if they do !t people who are not added to the channel (which i will do) cant see
Yes, how tho?
Ok
i have a similar code written
F
I guess you could change the channel perms for user b

if (not ctx.author.guild_permissions.read_messages)or whatever the permission is
Skev
Currently in class so cant really help much with your problem
Ik
verified = discord.utils.get(guild.roles, name="NameOfYourRole")
await member.add_roles(verified)
yes
hm
you can't add permissions per user
@heavy radish you just need it as a verification yes?
So lets me put this together
best to have the role named something like Member
oh no. This is private
can i do it with name?
wanna take it to DMs?
yes it will show the name
So like its a public channel and the channel owner can toggle
no but i don't know the channel id
I'll DM u ig
any mistake i have made? it is showing that i started playing but it is not actually playing
yes
no
discordUtils
can anyone help
one min getting the code
anyone?
@tawdry perch py await ctx.guild.create_category('Mailer') await ctx.guild.create_text_channel('Mailer-logs')
i am doing like this is it possible to get the id of the text channel Mailer-logs
Pretty sure creating a new channel returns the channel object
So just store it in a variable
can i do smth like a = await ctx.guild.create_text_channel('Mailer-logs') and do bot.get_id(a)
^
!d discord.TextChannel.mention
mention```
The string that allows you to mention the channel.
Yes it does
thanks
help me pls
it don't provide any error
i thought but no idea
!source
@tawdry perch how do i get category id
hmmm
Need help with the toggle command. To restrict a role from viewing. Someone help?
please
ok
get category id from what? TextChannel?
F
help me! i want the bot to stream a video from youtube, the youtube video should appear as the video of the bot, what should i do
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
it break the rules?
!ytdl yes
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
omg so i know why youtube video isnt downloadable...
no category id
well you can stream non copyrighted music
and i want the bot to kick people and ban people and unban people and tempban people what should i do
or shit
NCS?
ok lemma try
yeah
what
u cant stream anything related to youtube
u can but u cant with a bot
i was told you can stream non copyrighted shit
!d discord.Guild.ban
await ban(user, *, reason=None, delete_message_days=1)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Bans a user from the guild.
The user must meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/stable/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
You must have the [`ban_members`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.ban_members "discord.Permissions.ban_members") permission to do this.
and...
how can i set the bot's status? like "offline, do not disturb, online, idle"?
!d discord.Status
class discord.Status```
Specifies a [`Member`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Member "discord.Member") ‘s status.
!d discord.ext.commands.Bot.activity
!d discord.ext.commands.Bot.change_presence
await change_presence(*, activity=None, status=None, afk=False)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Changes the client’s presence.
Example
```py
game = discord.Game("with the API")
await client.change_presence(status=discord.Status.idle, activity=game)
!d discord.Guild.kick
await kick(user, *, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Kicks a user from the guild.
The user must meet the [`abc.Snowflake`](https://discordpy.readthedocs.io/en/stable/api.html#discord.abc.Snowflake "discord.abc.Snowflake") abc.
You must have the [`kick_members`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions.kick_members "discord.Permissions.kick_members") permission to do this.
class discord.PermissionOverwrite(**kwargs)```
A type that is used to represent a channel specific permission.
Unlike a regular [`Permissions`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions "discord.Permissions"), the default value of a permission is equivalent to `None` and not `False`. Setting a value to `False` is **explicitly** denying that permission, while setting a value to `True` is **explicitly** allowing that permission.
The values supported by this are the same as [`Permissions`](https://discordpy.readthedocs.io/en/stable/api.html#discord.Permissions "discord.Permissions") with the added possibility of it being set to `None`.
`x == y` Checks if two overwrites are equal.
`x != y` Checks if two overwrites are not equal.
`iter(x)` Returns an iterator of `(perm, value)` pairs. This allows it to be, for example, constructed as a dict or a list of pairs. Note that aliases are not shown.
I've spent 1hr on the website with the docs
So
Lets say Role = 12345678909876543
Hm
Let me play with this a bit
Hm
whats a role object?
oh
How do I add that?
let me show current code
@bot.command()
async def toggle(ctx):
Role = ctx.guild.get_role(889398480181800961)
perms = discord.PermissionOverwrite(channel_view=False)
await ctx.channel.set_permissions(Role, overwrites=perms)
Seems wrong
No
I think its a spelling mistake
looking through it rn
Works, now I need to make an else or elif for it
@commands.Cog.listener()
async def on_message(self, message):
if message.channel.name=="Cross-server-chat":
m = message.content
n = message.channel.create_webhook(name=message.author.name,avatar=message.author.avatar_url)
await n.send(content=m)```
What is error in code
!d discord mute
In order 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.
create_webhook() is a coroutine, and your indentation is inconsistent
also the avatar kwarg takes bytes, not a str
Intention is correct no intention error what are others
Anyone know why my discord bot isn't connecting to the vc the person is in?
Code:
@bot.command()
async def vc(self, ctx):
channel = ctx.author.voice.channel
if channel:
print("Joining vc")
player = self.get_player(ctx)
embed = discord.Embed(text="Joining VC, gimme a second...")
await ctx.send(embed=embed)
await player.connect(ctx, channel)
else:
print("Not gonna join vc")
embed = discord.Embed(text="Oops! You're not connected to a voice channel.")
await ctx.send(embed=embed)
see how the red line is longer than the yellow line
Ok
why is there self
Other
Saw a tutorial, and it told to add the player var using self.
I shouldn't?
If its in a cog then yes add self
Ah, I am not using a cog.
If it isnt then remove then self
Mkay
Well, what should I do to make it join then?
This was the older code I used, and it also doesn't seem to do anything.
@bot.command()
async def vc(ctx):
channel = ctx.author.voice.channel
if channel:
print("Joining vc")
embed = discord.Embed(text="Joining VC, gimme a second...")
await ctx.send(embed=embed)
await channel.connect()
else:
print("Not gonna join vc")
embed = discord.Embed(text="Oops! You're not connected to a voice channel.")
await ctx.send(embed=embed)
@boreal ravine
When you ran the command, did it send any messages in the channel?
which one?
ah right, it's because of the way you've created your Embed instance
there is no text kwarg
ah
Oh my bad
it's title
Oki, it also sends the embed.
However, it still doesn't join the vc
@meager chasm
Which embed
The "Joining VC, gimme a second..." one
what error did it send
For some reason, it doesn't execute the else statement
It didn't send any
Yep one second
@bot.command()
async def vc(ctx):
channel = ctx.author.voice.channel
if not ctx.author.voice.channel:
channel = ""
print(channel)
if channel:
print("Joining vc")
embed = discord.Embed(title="Joining VC, gimme a second...")
await ctx.send(embed=embed)
await channel.connect()
else:
print("Not gonna join vc")
embed = discord.Embed(title="Oops! You're not connected to a voice channel.")
await ctx.send(embed=embed)
It doesn't execute the else statement if I am not in a vc, and it also doesn't join the vc in the voice channel if I am there.
hmmm
@tawdry perch How do you connect a bot to a vc?
O_o
does your bot have permissions to join VCs
Hmmm,
How do I check that?
Hi, I'm re-creating (and not forking) discord.py (called Disthon) using the code form discord.py, discord.js and Sapphire framework.
I need programming experts to lend me a hand with the project. If anyone's interested in contributing, please reply to this message
check the permissions for the Bot's roles
you can also check them in your code if you want
Heyy
are you using on_command_error?
yea
I think I have done a madness. Can you see my code and get disappointed?

Lol
@bot.command()
async def t(ctx):
name = ctx.guild.get_role(889398480181800961)
hide = discord.PermissionOverwrite(view_channel=False)
show = discord.PermissionOverwrite(view_channel=True)
if ctx.perms == hide:
await ctx.channel.set_permissions(name, overwrite=show)
await ctx.send("We're now IDK!! Be Respectful")
else:
hide.enabled = not hide.enabled
await ctx.channel.set_permissions(name, overwite=hide)
await ctx.send("We're now IDK!! Be Respectful")
It is what it is
And I can't understand a thing cause I am dumb.
GG
Rip, I got this when I run it while I am not in a vc
Me?
.... And this when I try to connect it to a vc
Can you check my code?
Here
@heavy radish He is talking about my code I think
I guess
can you send the code for that?
@meager chasm
What's that?
the on_command_error code i mean
you don't need PyNaCl to connect to VCs
Oki one second
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, commands.CommandOnCooldown):
embed = discord.Embed(title="HUMAN! YOUR SPEED IS STAGGERING FOR ME! PLEASE WAIT FOR {:.2f} SECONDS!".format(error.retry_after)).set_image(url='http://pa1.narvii.com/6425/fd9a8be05b97ccb2a8ad3402d016039bfcc8531d_00.gif')
await ctx.send(embed=embed)
else:
embed = discord.Embed(title=str(error))
await ctx.send(embed=embed)
(oh and, I also use it for a cooldown system so yea)
attribute problem
embed = discord.Embed(title=str(error))
await ctx.send(embed=embed)
``` raise the error instead ```py
raise error
What does raise do?
Pardon?
sends the traceback to stderr
:0
yes
Would you mind if you could explain more? @meager chasm
utils and core could not be resolved?
you raise unhandled exceptions so you can fix them, using raise will raise an exception
Ah
so it tries to tell you to resolve the error?
it just causes an error normally
ah
Holy flip it joined the vc-
Now I only have 1 issue, it doesn't send the message I want it to send when the user is not in a vc.
Whats the last one? Please use booleans false and true?
Hm
Ok ok
So can I change True for something else?
Like !t public or something like that
hm
ok, will do now
I am not able to fix it ; -;
Ignoring exception in on_command_error
Traceback (most recent call last):
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "d:\Discord Bots\UnderBot Rework\main.py", line 38, in vc
channel = ctx.author.voice.channel
AttributeError: 'NoneType' object has no attribute 'channel'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "d:\Discord Bots\UnderBot Rework\main.py", line 23, in on_command_error
raise error
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'channel
It was the channel = ctx.author.voice.channel line
what if you checked if ctx.author.voice is None rather than adding a error handler for it
That returned None ig
Lemme see
I thought of it but I put NoneType and I got an error
Works only one way
So its becomes true
not false
yes
true works. False doesnt
to check for none you'd use None, NoneType is just the type of None, so like if ctx.author.voice is None: #do_stuff
hm
Wait, is?
Oki I am too rusty with python ;-;
Yes
the perms stayed on True. I checked settings inside channel
so it stayed as Yes. Ticked to the right side for yes (Inside channel perms)
ok
!identity == works too btw
Identity vs. Equality
Should I be using is or ==?
To check if two objects are equal, use the equality operator (==).
x = 5
if x == 5:
print("x equals 5")
if x == 3:
print("x equals 3")
# Prints 'x equals 5'
To check if two objects are actually the same thing in memory, use the identity comparison operator (is).
list_1 = [1, 2, 3]
list_2 = [1, 2, 3]
if list_1 is [1, 2, 3]:
print("list_1 is list_2")
reference_to_list_1 = list_1
if list_1 is reference_to_list_1:
print("list_1 is reference_to_list_1")
# Prints 'list_1 is reference_to_list_1'
I used ==,
Oki the error is still there
Ignoring exception in on_command_error
Traceback (most recent call last):
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "d:\Discord Bots\UnderBot Rework\main.py", line 38, in vc
if ctx.author.voice.channel is None:
AttributeError: 'NoneType' object has no attribute 'channel'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "d:\Discord Bots\UnderBot Rework\main.py", line 23, in on_command_error
raise error
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'channel'
no permission called overwrite
add a return statement in the if statement, so it would not continue to prevent the error
Is there something like on_voice_client_stop or something?
Lemme try
Something like this?
@bot.command()
async def vc(ctx):
if ctx.author.voice.channel is None:
return
else:
channel = ctx.author.voice.channel
if channel:
print("Joining vc")
embed = discord.Embed(title="Joining VC, gimme a second...")
await ctx.send(embed=embed)
await channel.connect()
if channel==None:
print("Not gonna join vc")
embed = discord.Embed(title="Oops! You're not connected to a voice channel.")
await ctx.send(embed=embed)
Now I need to figure out a way to get rid of true and false
but thats a job for another day
Thank You!!
@little ether
Can i use a python file for storing variables?
I assume yes, but that is not for this channel.
You should ask general python questions in #python-discussion
No i am asking for storing discord.py variables
:/
ok ty :/
My code
@client.event
async def on_raw_reaction_add(payload):
msgID = 889401033091067965
guild = client.get_guild(payload.guild_id)
member = guild.get_member(payload.user_id)
voice_state = member.voice
if voice_state is not None:
if payload.emoji.name == "📷" and payload.message_id == msgID:
await member.move_to(channel=889394157595033611)
else:
print("test didnt worked")
Error
voice_state = member.voice
AttributeError: 'NoneType' object has no attribute 'voice'```
So, i am trying to make something where if the user reacts with a emoji he will be dragged to a voice channel
member = payload.member```
Anyone here using hikari? Or just discord.py.
change
if ctx.author.voice.channel is None:
return
to
if ctx.author.voice is None:
return
and it should work, sorry for the late response just some school stuff
@bot.listen(hikari.DMMessageCreateEvent)
async def on_dm_message(event):
if event.message.author.is_bot:
return
guild = await bot.rest.fetch_guild(466101319699136512)
channel = await bot.rest.fetch_channel(815150323986595882)
embed = (
hikari.Embed(
color = bot.colors["blue"],
description = event.message.content
)
.set_author(name = event.message.author, icon = event.message.author.avatar_url)
.set_footer(text = "This was handled using hikari.")
)
await bot.rest.create_message(channel, embed)
Am I doing something wrong? It keeps saying JSON is not serializable at the line where create_message is awaited.
getting this error now
AttributeError: 'int' object has no attribute 'id'```
@river walrus
@commands.command()
async def setup(self, ctx):
a = await ctx.guild.create_category('Mailer')
await ctx.guild.create_text_channel('Mailer-logs',category=a.id)```
why doesn't this work
@tawdry perch
ok
What is vc?
fixed it
Nice
Did anyone here tried cross server chat with webhooks
This is the reason why discord will make message intent privileged🗿
Means
not webhooks, but websockets
is how i made it cross-server
and works between games
how do i check if a channel exists
Means your bot won't be whitelisted for message intents unless you actually need it
if its in 100+ servers iirc
Yep
so if there's a specific channel in the server called mailer logs
so if its not big, no need to worry
it should break
^
im new
welcome
Yep
but why
bc they r his reqirements
ye
good point
but what can i do in the server
???

hello anyone there
what
!d discord.TextChannel
class discord.TextChannel```
Represents a Discord guild text 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 the channel’s name.
Like change the channel name using a command
you can just fetch the channel id
!changename CEO
and change it
channel = 69420
await channel.edit(name=None)```
like this
Hm....but the channel is not set
Like whichever channel i do the command in. I want to change that channel name
Then do channel = ctx.channel
Ok, one sec. Let me grab my charger... Lol
Do ctx.channel lol
Alrighty, Lets do some guess and check
Ah, thanks a lot! Now my bot works perfectly fine.
np
Heyy
So I did this and it worked like twice
then it just gave up
@bot.command()
async def cname(ctx, arg):
channel = ctx.channel
await channel.edit(name=arg)
Dunno how it just gave it lmfao
How can my bot edit its own message?
Its so weird WTH
use Message.edit()
says it no? define the message you want to edit
define message then?
msg=await ctx.send("123")
await msg.edit(content="321")
Because of ratelimits. A channel name can only be changed twice every 10-15 mins
Does certain commands stop when its at high ping? Its at 230 Ping
O makes sense never knew ratelimiting for channels lol
Ahhh
Well, My pin command stopped working as well
I recommend turning off your bot if you haven't already
Okay then
Because it's gonna be ratelimited
Leave your bot offline for like 15mins then start ot back up again and the ratelimits should be gone
Hm okay then
But yeah, you 99% don't want a command to change channel names
Will try
@slate swan literally showed an example
People can do it manually if they really need to change it
so i had to make a purge command in which the bot will display the number of messages purged and will delete its own message after 5 seconds
This won't work. You need to specify which part of the message it is being edited
i did wym
You didn't
literally says content
You need to do edit(content="new content")
read it again
You just edited it lol
what do i do for this
how to check if a user has joined a specific VC ?
I wanted to make a command which can be used when the user joins a specific VC only
check if Member.voice is None
so i had to make a purge command in which the bot will display the number of messages purged and will delete its own message after 5 seconds
!d discord.Member.voice
property voice: Optional[discord.member.VoiceState]```
Returns the member’s current voice state.
wouldnt that be if theyre in any channel?
yeah did that
but how can check if the user is there in a specific VC only ?
ooh ok
If my bots reboots daily can I still use @tasks.loop(hours=24) for a task to happen everyday?
Or is there a easier way?
Heyy, I've got a question. In a command like !add @someone Can i restrict that someone to be a BOT account??
So pinging a user wont do anything...
if member.bot:
# do stuff
or whatever you defined the member as ^
tasks have reconnection logic iirc
I don't think that will help
The server reboots so I dont know if that would help
You will have to check when the task happened last time by storing the time
Ah
I want to avoid databases since I dont really do well with them
you dont really need a db for this
ye
Actually, wait, sounds like you use heroku?
text file
Yes 
Heyy, is this the correct variable? I want to ping someone after the command
async def add(ctx, Member: discord.Member):
why?
then it won't work
follow naming conventions
Use an external db
Heroku is horrendous for hosting discord bots
Pardon?
Its a server specific bot and since I have extra hours it works perfectly
!pep 8
^
Oh yeah I forgot it wont persist
Okay!!
Yeah
all arguments must be lowercase
it should be member not Member
ok
for the argument
Is that right?
Don't name it add too e
So it requires them to ping someone afterwards
gonna ask, why?
I think you can't see the line cut thingie, i for a second thought add was built in then remembered it's from operator.
if it was a builtin, just call it directly
What
globals()['__builtins__'].add()
``` lol
i want to set status of my discord bot what should i do
^ just an example, probably wont work
i know, but im an esoteric python coder, what do you expect from me 😩
It won't
i don’t think thats "esoteric"
eeeee do I have to tell you again, I for some fking reason thought add was builtin, then remembered it was from operator and put a cut there, it will obviously not work
Your "probably won't work" Made me think you didn't get the point
how can i send an attached image through an announcement command?
for an example, -announce <text here> <assume that an image has been attached> (I want the attached image to be sent by the bot in the desired channel)
you could make it work
yeah
@client.event
async def on_message_delete(message):
channel = client.get_channel(880030618275156001)
embed = discord.Embed(title='Message Deleted')
embed.set_author(name=message.author)
embed.add_field(name='Channel', value=f'{message.channel.mention} (`{message.channel.id}`)')
embed.add_field(name='Author', value=f'{message.author.mention} (`{message.author.id})`')
embed.add_field(name="Message", value=f"{message.content}")
embed.timestamp = message.created_at
await channel.send(embed=embed)
``` Wot?
message.content is empty
you’re using both fstrings and concatenation in the same string
The message that I deleted was empty?
!e
import operator
globals()['__builtins__'].__dict__["add"] = operator.add
print(add(3,2))
@grim oar :white_check_mark: Your eval job has completed with return code 0.
5
verry nice!!

check #bot-commands
Yes
Dpy has buttons and select menus
Not slashes
There is no new version
Dpy isn't maintained since last month
how to check the limit of a VC ??
A fork of dpy
a shit fork
It's not shit
it is shit
U haven't even bothered checking it
lol?
@hasty iron
how do you know
What about it is shit
wdym
everything it is just a shit fork
!d discord.VoiceChannel.user_limit
The channel’s limit for number of members that can be in a voice channel.
I can't tell if ur stupid or just stupid
This probably?
thanks
yeah right
having an opinion is stupid
Don't label all the forks as shit bc u tried an actual shit fork
thanks
🤦♂️
smarter than me and u combined
i haven’t tried any infact
i look at the source code
and judge based on that
Disnake > any other fork you've looked over
no
Yes
ok just to make you happy ill look at it again
Yw
nice
disnake has some good programmers.
i looked at it and i already knew it was bad
Bruh 😂
It's the best fork for dpy
i know bad code when i see it, coming from someone that makes bad code
There've been a lot of changes to the code
i looked 2 days ago 😐
Alr
At this point just make your own api wrapper or use a compiled language.
^
try:
user = await self.fetch_user(user_id)
except Exception:
``` seriously? a bare except?
yeah good fork
my point
He is expecting an exception.
wow
There's Exception to shut up flake8
couldve narrowed it down
!d discord.ext.commands.Bot.get_channel
and bare except does nothing?
get_channel(id, /)```
Returns a channel or thread with the given ID.
every exception inherits from Exception
yep
Ok yeah that looks bad but then again in forks quality disnake is at the top of them all if u ignore its popularity
What's that /
makes it a positional only argument
Hmm
But i don't think it's going to survive
I hope it will
Looking at how the pypi website is maintained i'd suggest otherwise.
unban command not working whai
anyone
u sure the if statement doesnt need a bool
also you can just use commands.has_permissions(permission=True)
not working
I said "are u sure"
How do I check the permissions of someone in on_message?
Heyy
@bot.command()
async def add(ctx, member: discord.Member):
add = discord.PermissionOverwrite(view_channel=True)
member = discord.Member
channel = ctx.channel
await ctx.channel.set_permission(member, overwrite=add)
await ctx.send("Welcome {member}, you are now officially appart of {channel}!!" )
Can you check whats wrong?
whats the error
AttributeError: 'TextChannel' object has no attribute 'set_permission'
its .set_permissions
ISTG!!! I spent 30minutes on that?? FFS
did u mention a member though
lol
you can just do ctx.author.mention for the bot to mention the author of who did the command
that is?
Have channel ID's been removed?
InvalidArgument: target parameter must be either Member or Role
No
if i right click i cant see the option
Have u got developers mode on?
try ```py
@bot.command()
async def add(ctx, member: discord.Member):
add = discord.PermissionOverwrite(view_channel=True)
channel = ctx.channel
await ctx.channel.set_permissions(member, overwrite=add)
await ctx.send("Welcome {member}, you are now officially appart of {channel}!!" )
Ok
i get dev license u mean?
Dev licence?
Its a tick in settings
Not sure where it is
@slate swan, looks like you posted a Discord webhook URL. Therefore, your message has been removed, and your webhook has been deleted. You can re-create it if you wish to. If you believe this was a mistake, please let us know.
what about python
This works. but the {member} & {channel} seems to not work
Did I do it right?
maybe try member.name or member.mention
same goes for the channels
discord.py right now as of 2.0 only has buttons (i think though im not sure) so I'd guess about 60-70% of the api?
ah ok
i'm still using discord 1.8.0 something idkl
how do i reset cooldown of a slash command ( discord py interactions )
i havent dont discor bot coding in 3 years, i just got into it recentalty
yes thats the latest one I think excluding 2.0
i cant find it online it shows its in appearance but not for me
myb i hv to get the devloper's license
Nice
add @commands.has_permissions(administrator=True) below @client.command
@commands.has_permissions(manage_messages=True)
@bot.command()
async def clear(ctx, amount=5):
# by default the bot would delete 5 messages
if amount > 100:
await ctx.send(f":x: Can delete a maximum of 100 messages, you are passing the limit")
else:
await ctx.channel.purge(limit=amount+1)
message = await ctx.send(f":white_check_mark: Deleted {amount} messages")
await asyncio.sleep(5)
await message.delete()
this is without cogs yeah
i can create errors using this code
@bot.command()
async def add(ctx, member: discord.Member):
add = discord.PermissionOverwrite(view_channel=True)
channel = ctx.channel
await ctx.channel.set_permissions(member, overwrite=add)
await ctx.send("Welcome {ctx.author.name}, you are now officially appart of {ctx.channel.name}!!" )
So I'm trying to add the members name and the channel which he was added to. Why isnt it not working?
It works.
yeah
So theres a reason why dyno can't delete messages over 14 days old?
i can do 1000 messages just fine
bulk deletion is allowed
API / Discord wont let you
Someone? Please
it's not a for loop of .delete()
Whats the error?
if any
await purge(*, limit=100, check=..., before=None, after=None, around=None, oldest_first=False, bulk=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Purges a list of messages that meet the criteria given by the predicate `check`. If a `check` is not provided then all messages are deleted without discrimination.
You must have the [`manage_messages`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.manage_messages "discord.Permissions.manage_messages") permission to delete messages even if they are your own. The [`read_message_history`](https://discordpy.readthedocs.io/en/master/api.html#discord.Permissions.read_message_history "discord.Permissions.read_message_history") permission is also needed to retrieve message history.
Examples
Deleting bot’s messages...
none. I just need to get player and channel name added
could just clone the channel and delete the old one if its messages are too old
the {channel} & {name} doesnt work
kwarg default is 100 lol
how did u do it
client = commands.Bot(command_prefix="sbs!")
@client.command()
async def on_message(message):
mess = message.content
print(mess)
web = await mesage.channel.create_webhook(balasai,avatar=None,reason=None)
print(web.url)
client.run(os.getenv('Token'))```
Maby restarting too quick or something else.
Can anyone check code
!clear -100 😋
not rlly lel
Can anyone else investigate and help Kayle?
whats the check?
How could someone perform this in a channel if they can't see it initially?
Huh, its to add someone
oh lol
thought user was a kwarg nvm
Hm
im tryna make a choose command, so im using args.split but i want the bot to choose something random. so i need a for loop so the bot can only choose number of args that are split so that i can do args[{number}] but im not so sure how to do it could someone help
is it the right method tho
@jade jolt :white_check_mark: Your eval job has completed with return code 0.
2
@bot.command()
async def add(ctx, member: discord.Member):
add = discord.PermissionOverwrite(view_channel=True)
channel = ctx.channel
await ctx.channel.set_permissions(member, overwrite=add)
await ctx.send("Welcome {ctx.author.name}, you are now officially appart of {ctx.channel.name}!!" )
``` Here it is, again
bruh
yeah
use an f-string
lmao
fstring
ok

i mean i need a for loop so the bot can only choose from the number of split args else it can choose 20+ when i only have 5 split args
explain in dms
okay sure
but its different
try ```py
await ctx.send(f"Welcome {ctx.author.name}, you are now officially appart of {channel.name}!!" )
this checks if the author is a bot (not specifically the bot you have)
I fixed it. But i dont need the author. I need whoever was pinged
this checks if the author is your bot
then ```py
await ctx.send(f"Welcome {ctx.member.name}, you are now officially appart of {channel.name}!!" ) #ctx is optional
!f-string
Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.
>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."
Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.
error
AttributeError: 'Context' object has no attribute 'member'
then use member.name
then why ctx
lel
...
Works but can i get it to ping them? and the channel comes like # in hash form
member.mention
then do channel.mention
and member.mention
That was mention for kayle but yea. thanks
kk
no hate
Heyy, view_channel=True is they can see and view_channel=False they can't. How about Idle. like in the middle? Do i do view_channel=Idle
idk, like i don't want to complete remove them from the channel
As in like they can see if they have the role
Or how do I just remove them from the added permissions??
GG
just None
ahh
?
how to get the number of people connected in a VC ?
Thank You, Sir!!
!d discord.ext.commands.Bot.latency
property latency: float```
Measures latency between a HEARTBEAT and a HEARTBEAT\_ACK in seconds.
This could be referred to as the Discord WebSocket protocol latency.
hello im using slashcommand an i run into some errors when using a command
The error
An exception has occurred while executing command scheduleon:
Traceback (most recent call last):
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_slash\client.py", line 1352, in invoke_command
await func.invoke(ctx, **args)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\discord_slash\model.py", line 210, in invoke
return await self.func(*args, **kwargs)
File "C:\Users\Robin310\Desktop\Shoutout Network\Timeslot\bot.py", line 816, in scheduleon
roles = [role.name for role in ctx.message.author.roles]
AttributeError: 'NoneType' object has no attribute 'author'
@slash.slash(name='scheduleon', description="will enable the schedule", guild_ids=[878637134737735691,859871231335858247])
async def scheduleon(ctx:SlashContext):
roles = [role.name for role in ctx.message.author.roles]
if ADMIN_ROLE in roles:
global schedule
schedule = True
await ctx.send('enabled schedule')
the command
how do i fix this ?
ctx.message is None for some reason
Hi, I'm re-creating (and not forking) discord.py (called Disthon) using the code form discord.py, discord.js and Sapphire framework.
I need programming experts to lend me a hand with the project. If anyone's interested in contributing, please reply to this message
your library probably fucked up something
and you probably shouldn’t use it cuz it’s shit
but with slash command you can see all the commands if you do /
isnt there a way to make it work ?
use dislash
have you tried googling it
yeah
sure
i end up at a github
so you end up at the github and just give up?
no
that’s it, there is nothing more to see?
i get some wierd pages that says dislash 3
i letterly started python last week im sorry
Based on this code i can say that the code is constructed a bit weird anyways
yeah sorry it works tho Xd
cause idk what the correct way of doing it is
so i just use the template of what works
!d discord.ext.commands.ColourConverter
class discord.ext.commands.ColourConverter(*args, **kwargs)```
Converts to a [`Colour`](https://discordpy.readthedocs.io/en/master/api.html#discord.Colour "discord.Colour").
Changed in version 1.5: Add an alias named ColorConverter
The following formats are accepted...
huh that exists
@client.event
async def on_message(message):
username = str(message.author).split('#')[0]
user_message = str(message.content).lower()
message_list = user_message.split
for i in range(0,len(HELLO)):
if username != client.user:
if HELLO[i] in user_message :
general_channel = client.get_channel(GENERAL)
await general_channel.send(f'Hello {username}')
return
``` the bot ends up replying to itself any solutions??
add a if message.author == bot.user: return
Check if user is bot
if message.author.bot: return

So I have a txt file I want to read the top line from the file and send it to a channel everyday, I have the loop etc setup just wondering how I would read the line from the file and delete it so that the next day it reads the next line, I have initialized the file already
k lemme try
readlines and pop probably
Can anyone help me how to use color converter in embeds please
Yeah I got that the question is how 
how to read a file?
or are you talking about the loop?
now it wont respond to me
yes
is that sarcasm?
No-
I actually dont know
!= ??
do you have write access on whatever this bot is gonna be on?
yep
@lusty swallow my ide shows bot is not defined
Please help me
the just do
with open('file.txt', 'r') as data:
x = data.readlines()
pick = x.pop(0)
with open('file.txt', 'w') as data:
data.write(x)
``` or something
I have a doubt,That my bot doesn't work properly and talks back to me and also is evil,I cannot change the settings
I want to make it like the other bots like Wick bot and Mee6
Also:I did create this bot with a website called www.autobotcreator.com and i need to change it
try client instead of bot
so i am now using dislash
@inter_client.slash_command(name='clear', description="the bot will remove the set amount of messages (max 100)", guild_ids=[878637134737735691,859871231335858247])
async def clear(inter, amount: int):
if amount == -1:
await ctx.channel.purge(limit=500)
await ctx.send("cleared everything")
sleep(2)
await ctx.channel.purge(limit=1)
else:
await ctx.channel.purge(limit=amount)
await ctx.send(f"cleared {amount} messages")
sleep(2)
await ctx.channel.purge(limit=1)
it now gives the same error again
Ignoring exception in on_socket_response
Traceback (most recent call last):
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1229, in _on_socket_response
await self._process_interaction(payload["d"])
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1387, in _process_interaction
await self._on_slash_command(inter)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1287, in _on_slash_command
raise err
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1282, in _on_slash_command
await app_command.invoke(inter)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 216, in invoke
raise err
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 212, in invoke
await self._maybe_cog_call(self._cog, interaction, interaction.data)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 37, in _maybe_cog_call
return await self(inter, **params)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\core.py", line 72, in call
return await self.func(*args, **kwargs)
TypeError: clear() missing 1 required positional argument: 'amount'
Also lets say this bot is on heroku and the txt file is on github, I am going to connect github to heroku and then host, Will the pop persist everytime the server reboots?
you forgot ctx, and it didn't get any amount var
probably not you can't write to heroku directly
still no response
I have a doubt,That my bot doesn't work properly and talks back to me and also is evil,I cannot change the settings
I want to make it like the other bots like Wick bot and Mee6
Also:I did create this bot with a website called www.autobotcreator.com and i need to change it
Hm, Would I just be able to read the lines specifically? Eg, Read line 1 on day one, read line 2 on day 2 etc
what's www.autobotcreator.com?
If there's no option then i can create another
client. user refers to bot?
A app that auto codes
property user: Optional[discord.user.ClientUser]```
Represents the connected client. `None` if not logged in.
ooh
never heard of that and website doesn't exists. Do you have a code?
Hmmmm i can show you the code
1min
meaning?
does any dpy fork have full slash command support for cogs?
disnake
it has docs?
@lusty swallow
for i in range(0,len(HELLO)):
if username == client.user:
if HELLO[i] in user_message :
general_channel = client.get_channel(GENERAL)
await general_channel.send(f'Hello {username}')
return ``` pls check this once something wrong regarding the if statement differentiating b/w the user andd the bot
depends on how you made your code. I suggest finding a way to persistently store the data first.
@client.event
async def on_message(message):
username = str(message.author).split('#')[0]
user_message = str(message.content).lower()
message_list = user_message.split
for i in range(0,len(HELLO)):
if username == client.user:
if HELLO[i] in user_message :
general_channel = client.get_channel(GENERAL)
await general_channel.send(f'Hello {username}')
return
```
thank you, kind stranger
try pycord
Anyone help me
np
pycord doesn't have support for slash commands in cogs
o ok
client.user refers to??
These are the Uto commands
the logged in user
Auto*
this is js not py
!d discord.Client.user
property user: Optional[discord.user.ClientUser]```
Represents the connected client. `None` if not logged in.
That's what i wrote on the msg
in my case thats the bot ri8?
ye
.split? What is hello? content already returns a string. Why is indexing 0?
but this is a python server not a javascript server
hm
the git repo is 404
it was in the tut lol
Ok then i will create another bot. Is that okay?
it's up to you
I'd recommend no tutorial...
lol wtf
@client.event
async def on_message(message):
username = str(message.author).split('#')[0]
user_message = str(message.content).lower()
message_list = user_message.split
for i in range(0,len(HELLO)):
if username != client.user:
if HELLO[i] in user_message :
general_channel = client.get_channel(GENERAL)
await general_channel.send(f'Hello {username}')
return ``` here the bot starts talking to itself
and it points to https://github.com/Rapptz/disnake lmao
@client.event
async def on_message(message):
if message.author.bot: return
user_message = str(message.content).lower()
message_list = user_message.split
for i in range(0,len(HELLO)):
if HELLO[i] in user_message :
general_channel = client.get_channel(GENERAL)
await general_channel.send(f'Hello {username}')
return
```try this maybe
weird, here's the link to it https://github.com/EQUENOS/disnake
i still get this error
Ignoring exception in on_socket_response
Traceback (most recent call last):
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1229, in _on_socket_response
await self._process_interaction(payload["d"])
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1387, in _process_interaction
await self._on_slash_command(inter)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1287, in _on_slash_command
raise err
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1282, in _on_slash_command
await app_command.invoke(inter)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 216, in invoke
raise err
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 212, in invoke
await self._maybe_cog_call(self._cog, interaction, interaction.data)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 37, in _maybe_cog_call
return await self(inter, **params)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\core.py", line 72, in call
return await self.func(*args, **kwargs)
TypeError: clear() missing 1 required positional argument: 'amount'
with this code ```py
@slash.command(name='clear', description="the bot will remove the set amount of messages (max 100)", guild_ids=test_guilds)
async def clear(inter, amount):
if amount == -1:
await inter.channel.purge(limit=500)
await inter.send("cleared everything")
sleep(2)
await inter.channel.purge(limit=1)
else:
await inter.channel.purge(limit=amount)
await inter.send(f"cleared {amount} messages")
sleep(2)
await inter.channel.purge(limit=1)
its clear they dont know how to document properly
thank you again
i have tried amount: int
actually, use sphinx properly*
yeah
can someone help fix this code?
@commands.Cog.listener()
async def on_voice_state_update(self, member, before, after):
if before.channel is None and after.channel is not None:
if after.channel.id == 886331304944214077:
for guild in self.client.guilds:
channel2 = guild.create_voice_channel(name='📞 Support')
await member.move_to(channel2)
wahts the error
start with not making a voice channel for every server just because it's required on one of them
the last slash library gave a description and a args this 1 doesnt
Not making a vc? Why though

yeah nope most prolly somethin wrong with the for loop itks
that could get you ratelimited if your bot is in alot of guilds
i meant not create vc for every voice_state_update on all server.
That will create it on every server the bot is in.
it will probably go in a loop too since the bot is moving the user, it will probably also trigger another voice_state_update which will call the function agin
o
can someone help em out ?
this code ```py
@slash.command(name='clear', description="the bot will remove the set amount of messages (max 100)", guild_ids=test_guilds)
async def clear(inter, amount:int):
if amount == -1:
await inter.channel.purge(limit=500)
await inter.send("cleared everything")
sleep(2)
await inter.channel.purge(limit=1)
else:
await inter.channel.purge(limit=amount)
await inter.send(f"cleared {amount} messages")
sleep(2)
await inter.channel.purge(limit=1)
gives this error
Traceback (most recent call last):
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1229, in _on_socket_response
await self._process_interaction(payload["d"])
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1387, in _process_interaction
await self._on_slash_command(inter)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1287, in _on_slash_command
raise err
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_client.py", line 1282, in _on_slash_command
await app_command.invoke(inter)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 216, in invoke
raise err
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 212, in invoke
await self._maybe_cog_call(self._cog, interaction, interaction.data)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\slash_core.py", line 37, in _maybe_cog_call
return await self(inter, **params)
File "C:\Users\Robin310\AppData\Local\Programs\Python\Python39\lib\site-packages\dislash\application_commands\core.py", line 72, in __call__
return await self.func(*args, **kwargs)
TypeError: clear() missing 1 required positional argument: 'amount'
EQUENOS/dislash.py, dislash.py An extending library for discord.py that allows to build awesome slash-commands. ⭐
A Python wrapper for discord slash-commands and buttons, designed to extend discord.py. - GitHub - EQUENOS/dislash.py: A Python wrapper for discord slash-commands and buttons, designed to extend di...
those 2 i read and used
they use the same things tho
did you give it the right arguements when calling?
i did /clear clicked the command and did 10
so /clear 10
but this library doesnt show the args like it used to
this is what it did
this is what it now does
@slash.command(name='clear', description="the bot will remove the set amount of messages (max 100)", guild_ids=test_guilds)
async def clear(inter, amount: int = 500):
if amount <= 0:
amount = 500
await inter.send("cleared everything")
else:
if amount > 1000:
amount = 1000
await inter.send(f"cleared {amount} messages")
await inter.channel.purge(limit=amount)
await asyncio.sleep(2)
await inter.channel.purge(limit=1)
ngl not sure how dislash works. never tried it yet
async def clear(inter, amount:int = 0):
```But try this
how would one convert a message object into a role object? The message will only be 1 argument which will be the tagged role. I am a little stuck now aha
You are using the python IDE to code your bot..?
oof
yes
that 1 works but will return only cleared 0 messages
i started using python last week 😂 idk all the tools yet sorry
@slash.command(
name='clear',
description="the bot will remove the set amount of messages (max 100)",
guild_ids=test_guilds,
options=[
Option("amount", "Enter the amount", OptionType.INTEGER)
]
)
async def clear(inter, amount:int):
if amount == -1:
await inter.channel.purge(limit=500)
await inter.send("cleared everything")
sleep(2)
await inter.channel.purge(limit=1)
else:
await inter.channel.purge(limit=amount)
await inter.send(f"cleared {amount} messages")
sleep(2)
await inter.channel.purge(limit=1)
``` @misty stream try this lol
not sure if it would work tho
it works !!
dislash bad. jk

dislash is complicated tho Xd
time.sleep is blocking
now i need to add py @slash.command( name='clear', description="the bot will remove the set amount of messages (max 100)", guild_ids=test_guilds, options=[ Option("amount", "Enter the amount", OptionType.INTEGER) ] ) async def clear(inter, amount:int):
to the other commands and edit it all Xd
his work not mine. i use asyncio.wait() or was is sleep()

Lib name?
A Python wrapper for discord slash-commands and buttons, designed to extend discord.py. - GitHub - EQUENOS/dislash.py: A Python wrapper for discord slash-commands and buttons, designed to extend di...
O
!pypi dislash.py
ooh
anyone know of code to make it so that I send a message in a discord server channel every hour to beat my friend in the Mee6 money game
bruh
that is against ToS.
Self botting no no
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
I know the code
you could make a 1hr timer in python then go to the channel and then type the message.
bruh
!rule 5
5. Do not provide or request help on projects that may break laws, breach terms of services, or are malicious or inappropriate.
That is tos friendly version.
wow @lusty swallow i have a question
@slash.command(
name='makechannel',
description="the bot create a text and voice channel for the member that executes this command",
guild_ids=test_guilds, options=[
Option("create", "Enter the Channel Name", OptionType.INTEGER),
Option("delete", "Enter the Channel Name", OptionType.INTEGER)
]
)
async def makechannel(inter, channelname):
guild = ctx.guild
member = ctx.author
name = 'Custom Channels'
category = discord.utils.get(ctx.guild.categories, name=name)
overwrites = {
guild.default_role: discord.PermissionOverwrite(read_messages=False),
member: discord.PermissionOverwrite(manage_channels=True , read_messages=True),
}
channel = await guild.create_text_channel(channelname, overwrites=overwrites, category=category)
channel = await guild.create_voice_channel(channelname, overwrites=overwrites, category=category)
await ctx.channel.purge(limit=1)
if i create more options how would i assign those to an other async def or is that not possible ?
Q: anyone know of code to make it so that I send a message in a discord server channel every hour to beat my friend in the Mee6 money game
A: 1. Make a timer for 1 hour in google. 2. Make a timer for 1 hour IRL.
I don't see why not
how would i do that ?
I don't get why you can't just manually create channels they're much more easier to handle though
async def func(self, foo, bar):
return bar
# calling func
await self.func(foo, bar)