#discord-bots
1 messages · Page 1058 of 1
Yes... yes they can
I'm 99% sure it's on their website somewhere
Poor Ash
you state a privacy policy for that kind of stuff
bruh no f sense im so bad at this stuff
if you're think that everyone's insane here.......why are you still asking
😭
Unless otherwise specified, the terms of use detailed in this section apply generally when using this Website.
Single or additional conditions of use or access may apply in specific scenarios and in such cases are additionally indicated within this document.
By using this Website, Users confirm to meet the following requirements:
There are no restrictions for Users in terms of being Consumers or Business Users; so can i just copy this?
Vscode is screaming at you to format your code that's all
you bot is not a website.....
wait
try that, it might help
If it doesn't help then you just gotta manually fix your indents and tabs
Where did you find that?
this stuff makes no sense lmao , so i must write pages of tos and violations and stuff
yes
🤣
your questions are hellish now, told you it makes sense so it does
OHHHHHH
Where did you find that?
wait so u basically add a guide or whatever for stuff eg if there is stuff u can buy
no-
....
terms of service = how consumers should use your service. Nothing complex about it fam just state what people are allowed to do
use commands
Poor Ash
I'm out
bruh
how consumers should use your service. = use commands ......
a tos is more like protection
basically to protect from getting your app counterfeited
how tho ..... its not like im gonna add anything bad
like it doesnt make sense u get what i mean?
it isnt about your app not being legal, thats completely different and requires a privacy policy
and my app is the bot application right?
yes
so can i copy the tos that people have
depends on you and how you want your app to be consumed
right click
wdym by my app
anywhere or just search for it in vscode
so people can access my app?

your app refers to your bot
do people have access to this?
not unless you share your password with them
wait so uknow the invite link for the bot that i get ... do i share that , is that the only thing they can access
How do I code a bot
they can only use that url to invite your bot
not access it , correct?
What is the bace code I need
I swear I'll have to meditate for 30 minutes today
Ye just access to invite the bot
If i use message
Then it will edit only 1 time
How can I edit it 4 times
uh?
Like i used message.edit(content=anything)
If i want to edit it after 1 second again how can I?
@slate swan I figured it out lol
Just for the Tos tho nothing else rn
Basically talking about ur bot/app
use message.edit again
I feel like crying now
Extended meditation period
so what if I am-
and you sure did waste my time, energy, and my brain cells and the same goes for you
save the message to a variable?
Do i need to change the value of {message} varibale?
you can keep calling .edit() on it
Well not for me … I know what it is 😂
Unless they changed that
sigh
Right now time to fix my bot xD
dude, you're nuts
Pls tell
Ye trust me in real life I’m even worse
I’m a nightmare
500+ questions for 1 thing
Put that on your Linkedin
Sure
Just did
Start of day 7 and my bot is at 59 servers
if it keeps growing exponentially like this...
Nice
Where
@Bot.command
async def foo(ctx: Context):
msg = await ctx.send("...")
for _ in ["edit1", "edit2", "edit3"]:
await msg.edit(_)
await asyncio.sleep(1)
thts how you edit multiple times (using a list is optional though)
Ok
Idr the rate limit though
But I think it's like 15 calls / sec so you should be fine
Do i need to replace _
Congrats fam
😎
Oh i understood
an underscore is valid, it doesnt error
!e
_ = "..."
print(_)
@slate swan :white_check_mark: Your eval job has completed with return code 0.
...
My bot keep adding aiohttp again and again even i installed it
good thing
congrats
just run poetry add aiohttp
or install the specific version it requires
thanks
not sure what to do next to get it to more people
fine
takes time to understand
whats ur bot
its fine, dont be apologetic if you dont understand things
anyways , here is my code https://paste.pythondiscord.com/bemovepova
in my about me
its cool
Ayee i got my code formatted
hey @dull terrace may i ask how long did it take to code ur bot?
around 2 months
I got a question ```@commands.command()
@commands.has_permissions(manage_messages=True)
@commands.cooldown(1, 5, commands.BucketType.guild)
async def mute(self, ctx, member: discord.Member, *, reason=None):
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=False)
embed = discord.Embed(title="Muted", description=f"{member.mention} was muted ", colour=discord.Colour.blue(
), timestamp=datetime.datetime.utcnow())
embed.add_field(name="Reason:", value=reason, inline=False)
await ctx.reply(embed=embed)
await member.add_roles(mutedRole, reason=reason)
await member.send(f"You have been muted from: {guild.name} Reason: {reason}")``` When someone gets muted how do i make it to where the user wont be able to type any message
of daily work pretty much
if that make sense
ok no wonder it has a big descriptions
or send any message in any channel
ill promote ur bot in my 2.3k and 8.2k member server see if it can get verified
/
Hello
that would be awesome, thanks dude
np btw can u give me some tips on what can i add to a bot or how to make it good
Help anyone pls help
My replit is being mad
It keeps downloading aiohtto again and again and not starting my bot
that goofy smile
why's it flying....
as u can see my bio im developing a bot that will be published lol
we cant help u
i mean status
Well ask replit not here
do poetry add aiohttp
I did
refresh
because you went to the side and not down, it would be very difficult to play if you fell going sideways
copy ur code , make a new project lmao
its a nice game though, kinda love it lol
what type of bot are you making
Bruh
thanks, that means a lot, worked so hard 😤
its worth a try
Are you encouragimg me or discouracmging
can see
u may as well leave if ur gonna act like this
dont overthink.
idk , so far what i made was ban command kick mute unmute some helper functions , and in development almost finished my leveling system , i need to finish my enable , disable system then add a leaderboard
How did u even grow yr bot this much 👀
i cant really identify the type yet probs multipurpose
creative pfp
Thanks
like $5 in ads, should be getting $15 in free ads next month if the vote rate stays how it has been
got a wild 20% click through on one of them i spent $1 on
Oh, cool
first of all there is a lot of code that is redundant, trivial, and written with bad practices, most of it is in the on_message event
Still no fix?
now u should make a website and a server
youll be making money
so is it a more general purpose bot? you need something to make it stand out from the others
lemme send all ss of what i coded for the disable / enable . brb
maybe a fun theme
Bro i need to add all packages again
just to be honest, i dont think youll get far with a moderation bot as theres no many already
Hm, my bot is in like 160 servers in || 11 months ||
do u want it to work or not?
already got my server up and running and posted on a couple places
can u send me a link in dms
i can advertise it too
more ppl need to see it
sure
Olie gets lucky 👀
Ngl, I don't really like bot deving much since all the ideas are already taken
both skill and luck
Agreed
and also py @client.group() async def slvl(ctx): return
not that much xd @slate swan
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
not necessarily, depends how you put a twist on it. Like every story has been done but more stories keep being created with just twists on common themes and do well.
im showing ss of what i coded extra so it makes sense
it's a moderation bot but with x
idk ima probs add minigames to my bot along with truth or dares , along with 8 ball and stuff uknow , make the bot full on good
If you're going to make a moderation bot you need your average ban|kick|mute etc. but more importantly you need something really unique that makes it worth it over some of the kings of mod bots like gearbot/zeppelin
@commands.has_permissions(manage_messages=True)
@commands.cooldown(1, 5, commands.BucketType.guild)
async def mute(self, ctx, member: discord.Member, *, reason=None):
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=False)
embed = discord.Embed(title="Muted", description=f"{member.mention} was muted ", colour=discord.Colour.blue(
), timestamp=datetime.datetime.utcnow())
embed.add_field(name="Reason:", value=reason, inline=False)
await ctx.reply(embed=embed)
await member.add_roles(mutedRole, reason=reason)
await member.send(f"You have been muted from: {guild.name} Reason: {reason}")``` When someone gets muted how do i make it to where the user wont be able to type any message
ill send u my code for mute
@client.command(description="Mute the specified user")
@commands.has_permissions(administrator=True)
async def mute(ctx, member: discord.Member, *, reason=None):
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)
await member.add_roles(mutedRole, reason=reason)
bedem = discord.Embed(name="Muted", description=f"{member.mention} has been muted because {reason}", color=0xBFFF00)
await ctx.send(embed=bedem)
await member.send(f"You have been muted in {guild.name} for {reason}")``` basic enough
u must have a role called Muted
Why not use native timeouts?
that's the hard bit
ok well i want it to where it wont let the user from sending a message in a channel
ok one sec
for channel in guild.channels:
await channel.set_permissions(mutedRole, speak=False, send_messages=False)```
this.
that's all been done though
can u recommend something then
you need another await client.process_commands(message) before return
if you're doing something that's already been done, the only way for it to be worth it is to do it better than anything that's been done
can u show me which return
if I think of a good original idea imma keep it for myself 
yo
not too many of those flying around nowadays
im a mysql user
theres nothing new u can make tbf and if there is tell me what
if levelsys and not levelsys[0]:
return
in on_message
cant i set connection attr
so i dont have to connect again and again?
for each cog
Ohh so just change the speak for example to True?
ye
do i put it on the level command or message event
in on_message
ok
idk just connect random stuff together until something makes sense, squid game moderation bot, minecraft truth or dare, coffee server
Well that aint working
whatever you're interested in
?
that would be against tos most of them i think
exactly
ok
i did this in on_ready
try:
db = mysql.connector.connect(user='user', password='password',
host='host',
database='database')
except:
print('Error')
bot.db = db
Still got error object Bot has not attribute db
doesnt work , it blocks the level commands , hmm ima try in level command maybe
no no, it should be before exiting on_message - at the end and before every return
lemme send my current on_message 1 sec
does it work in nextcord?
@warped mirage it still doesnt work
https://paste.pythondiscord.com/evinoroxab @heavy shard
it's not there... before return
ss which return
if levelsys and not levelsys[0]:
return
How can my bot make a send all warnings of a user in one embed?
i have
but then nothing else works
all works
apart leveling
@slate swan
Your command gave me this error
did you use enable leveling command?
YES IT works now
one more issue tho.
doesnt send the message like system has been disabled / enabled
description = ""
for file_line in file_lines:
if member.mention in file_line:
description += str(file_line)
if len(description) > 0:
embed = discord.Embed(description=description)
await ctx.send(embed=embed)```
so i have this code in a module im using
class PyKingError(Exception):
pass
class ApiError(PyKingError):
def __repr__(self) -> str:
return "The API is down"
class InvalidKeyError(PyKingError):
def __repr__(self) -> str:
return "invalid key"
class DailyLimitError(PyKingError):
def __repr__(self) -> str:
return "limit hit"```
what i wanna add in the main code incase a error of these happen:|
```py
except PyKingError(The error name i wanna add it here or specify a action to do for each error)```
You can place the error inside of a variable, then isinstance it. E,g ```py
try:
...
except PyKingError as e:
if isinstance(e, ApiError):
# It's an API error.
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: 'int' object is not subscriptable``` any ideas
@client.command(aliases=["lb", "lvlboard"])
async def leaderboard(ctx):
async with client.db.execute("SELECT levelsys FROM levelSettings WHERE guild = ?",
(ctx.guild.id,)) as cursor:
levelsys = await cursor.fetchone()
if levelsys:
if not levelsys[0] == 1:
return await ctx.send('The leveling system is already disabled')
async with client.db.execute("SELECT level, xp, user FROM levels WHERE guild = ? ORDER BY level DESC, xp DESC LIMIT 10",
(ctx.guild.id,)) as cursor:
data = await cursor.fetchone()
if data:
em = discord.Embed(title="Leaderboard")
count = 0
for table in data:
count += 1
user = ctx.guild.get_member(table[2])
em.add_field(name=f"{count}.{user.name}", value=f"Level -**{table[0]}** | XP -**{table[1]}**", inline=False)
return await ctx.send(embed = em)
return ctx.send("There are no users stored in the leaderboard")``` this is what i coded
@slate swan would u know ? , this is my last thing i need
or @heavy shard
can u have many status playing one after the other in a sub-classed bot class?
ik theres a way to do it the normal way, ie: bot = commands.Bot()
but when the bot is in class, it has the activity arg
What resources would you suggest a beginner for developing bots?
A task is what you need, look for that in documentation
YO
its been a bit
Read the full error
Like I am a beginner any good tutorials?
Learn python first ofc
If you scroll in the pinned messages, there’s a quickstarter
idk tbf this is the last thing i need for my level system , here is my last code ```py
@client.command(aliases=["lb", "lvlboard"])
async def leaderboard(ctx):
async with client.db.execute("SELECT levelsys FROM levelSettings WHERE guild = ?",
(ctx.guild.id,)) as cursor:
levelsys = await cursor.fetchone()
if levelsys:
if not levelsys[0] == 1:
return await ctx.send('The leveling system is already disabled')
async with client.db.execute("SELECT level, xp, user FROM levels WHERE guild = ? ORDER BY level DESC, xp DESC LIMIT 10",
(ctx.guild.id,)) as cursor:
data = await cursor.fetchone()
if data:
em = discord.Embed(title="Leaderboard")
count = 0
for table in data:
count += 1
user = ctx.guild.get_member(table[2])
em.add_field(name=f"{count} - {user.name}", value=f"Level -{table[0]} | XP -{table[1]}", inline=False)
return await ctx.send(embed = em)
return ctx.send("There are no users stored in the leaderboard")```
levelsys[0] == 1: what do you expect?
You still haven’t learned to read errors correctly
bro
int is not subscriptable...
You’re just sending the last lines and hour whole code…
An error traceback contains so much more info
without this code everything else works
so i know what im saying .....
Like I know python but I never created a bot...
Last message still applies
Well, you should be able to pinpoint EXACTLY what line is causing the error thanks to your traceback
Well, have you googled the error first?
change data = await cursor.fetchone() to data = await cursor.fetchall()
hi, i have a little question about discord bot ability. i dont want to be bothersome is anybody here to hear my question?
It's what we all do here the whole day
Sad AND true
Hi @placid skiff thanks for the reply. My question, its possible to give yourself a role without having to put a command in the server?
To use (my own) bot to give me a role
Not very discord bot related
Yeah, manually through discord directly, with a bot you can use some events ore some tasks depends on how you want to do it
the issue: i dont have admin in server but my bot here does
Uh
!d discord.Member.add_roles this one is the method that gives one or more roles to a member
await add_roles(*roles, reason=None, atomic=True)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Gives the member a number of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s.
You must have the [`manage_roles`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.manage_roles "discord.Permissions.manage_roles") permission to
use this, and the added [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role")s must appear lower in the list
of roles than the highest role of the member.
thank you, i will check on this and if i have more questions come back here
and how to say which person you give that role to
class discord.Member```
Represents a Discord member to a [`Guild`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Guild "discord.Guild").
This implements a lot of the functionality of [`User`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User "discord.User")...
There are various ways to retrieve a Member, through an id, through a message, through his name or discriminator it depends on what information do you have in that moment
em.add_field(name=f"{count} - {user.name}", value=f"Level - **{table[0]}** | XP - **{table[1]}**", inline=False)
AttributeError: 'NoneType' object has no attribute 'name'``` any ideas?
so if i put discord.Member= 977931752469311549 above this thats how i can say who it is right
!d discord.Guild.get_member nope to get a member through an id you can use this method
get_member(user_id, /)```
Returns a member with the given ID.
Changed in version 2.0: `user_id` parameter is now positional-only.
guys how do i make a global leaderboard , is it possible or nah
if u want to pay the least its stays yours for 1 year but u can choose how much to stay
custom domains of course
but they dont support all tlds
u can have that
ok
Renew from namecheap, then from some other registrar and so on
Github has free hosting for an account 🤷♂️
thats nothing special lmao
Can u help me make my lb global
So that it’s multi guide I guess
Anyone can
Shall I send code and u help me
try adding int( ... ) -> user = ctx.guild.get_member(int(table[2])) , but i'm just guessing here
No, I’m busy
You gotta TRY first
huh
You have to learn how to debug, do that for half a day and it’ll make you ask 90% less questions here
Bruh it’s probs one fix but idk
Learning what the error means is 1 step in the right direction
AttributeError: 'NoneType' object has no attribute 'name'```
This is the error lmao
.
I already told u where the error comes from
em.add_field(name=f"{count} - {user.name}", value=f"Level - **{table[0]}** | XP - **{table[1]}**", inline=False)
AttributeError: 'NoneType' object has no attribute 'name'``` any ideas?
how to timeout user?
Aight, let’s check what you think is causing this
Why do you think this error occurs? Be as specific as possible
!d discord.Member.timeout
await timeout(until, /, *, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Applies a time out to a member until the specified date time or for the
given [`datetime.timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta "(in Python v3.10)").
You must have the [`moderate_members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.moderate_members "discord.Permissions.moderate_members") permission to
use this...
Traceback (most recent call last):
File "C:\Users\Akai\AppData\Local\Programs\Python\Python38\lib\site-packages\nextcord\client.py", line 417, in _run_event
await coro(*args, **kwargs)
File "c:/Users/Akai/Desktop/Sugari/dashboard.py", line 72, in on_guild_join
cursor.execute('INSERT INTO prefixes (prefix, guild) VALUES (%s, %s)', (',', guild.id))
File "C:\Users\Akai\AppData\Local\Programs\Python\Python38\lib\site-packages\mysql\connector\cursor_cext.py", line 269, in execute
result = self._cnx.cmd_query(stmt, raw=self._raw,
File "C:\Users\Akai\AppData\Local\Programs\Python\Python38\lib\site-packages\mysql\connector\connection_cext.py", line 528, in cmd_query
raise errors.get_mysql_exception(exc.errno, msg=exc.msg,
mysql.connector.errors.DataError: 1264 (22003): Out of range value for column 'guild' at row 1
Hi???
what does this mean
I think it’s because I have ctx.guild
Guild I think is the problem
Nope
i can timeout on any time?
Bruh idk then
Sure
Table ?
Nope
thx
Ctx.guild.get_member
?
Must be in this
you probably need BIGINT type for guild when creating the table
Sure
Is this in a command?
Wait hold on
user = ctx.guild.get_member(table[2])
em.add_field(name=f"{count} - {user.name}", value=f"Level - **{table[0]}** | XP - **{table[1]}**", inline=False)``` can u see the error
your main problem is the following: user is None
Make sure table[2] returns an int, not a string
How to update a table
or get all tables to delete them
ALTER TABLE table_name ALTER COLUMN column_name NEW_TYPE
@potent spear I made it a int and no luck
So ye
Ima check docs but no hope
yo would u know or nah
Is this in a command?
@client.command(aliases=["lb", "lvlboard"])
async def leaderboard(ctx):
async with client.db.execute("SELECT levelsys FROM levelSettings WHERE guild = ?",
(ctx.guild.id,)) as cursor:
levelsys = await cursor.fetchone()
if levelsys:
if not levelsys[0] == 1:
return await ctx.send('The leveling system is already disabled')
async with client.db.execute("SELECT level, xp, user FROM levels WHERE guild = ? ORDER BY level DESC, xp DESC LIMIT 10",
(ctx.guild.id,)) as cursor:
data = await cursor.fetchall()
if data:
em = discord.Embed(title="Leaderboard")
count = 0
for table in data:
count += 1
user = ctx.guild.get_member(table[2])
em.add_field(name=f"{count} - {user.name}", value=f"Level - **{table[0]}** | XP - **{table[1]}**", inline=False)
return await ctx.send(embed = em)
return ctx.send("There are no users stored in the leaderboard")``` i suppose so
Verify that the member id is correct
So I add member.I’d?
@potent spear
Nvm I fixed it all I did was removed .name and kept it user
sigh
Is it possible to react to discord embed using discordpy
how do i like make a command that can only be triggered by one person and no one else
its probably really simple i just havent coded in months
Example of embed
Reaction fraud, identify theft and drug distribution
I still dont understand why people dont use ids 😔
¯_(ツ)_/¯
Guys what’s the appropriate permission for mute members in python
Yo Master, yr issue fixed?
Like how do u do it
!d disnake.Member.timeout is the easiest way
await timeout(*, duration=..., until=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Times out the member from the guild; until then, the member will not be able to interact with the guild.
Exactly one of `duration` or `until` must be provided. To remove a timeout, set one of the parameters to `None`.
You must have the [`Permissions.moderate_members`](https://docs.disnake.dev/en/latest/api.html#disnake.Permissions.moderate_members "disnake.Permissions.moderate_members") permission to do this.
New in version 2.3.
I think so works globally I removed the .name and just kept (user)
o
No no like @commands.has_permissions(administrator=True)
Ah
This is what I mean but for muting members in text channels
!d disnake.Permissions.moderate_members
Returns True if a user can perform limited moderation actions (timeout).
New in version 2.3.
So it’s moderate_members ?
Yes
weird name 😔
an individual timeout_members would be better thouugh
Who knows if discord gonna add more moderation features
But yea, if discord isn't gonna add more, I agree with u
cant think of any more features which can be made though
True tho
how can i make a invite for every guild my bot is in ?
!d discord.TextChannel.create_invite also be ready to become ratelimited
await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates an instant invite from a text or voice channel.
You must have the [`create_instant_invite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.create_instant_invite "discord.Permissions.create_instant_invite") permission to
do this.
Kk
async def ban(self,ctx, user: nextcord.User, *, reason=None):
await ctx.guild.ban(user = user, reason=reason)
try:
await user.send(f'You have been banned.')
except Exception as e:
await ctx.send("Failed to DM the user, oh well.")
embed=nextcord.Embed(title="Banned User", description=f"I have successfully banned `{user}` for the reason of: `{reason}`", color=0xfd9fa1)
await ctx.send(embed=embed)
for some reason my bot cant dm people on ban, does anyone know why?
You can't DM someone if you don't share a server with them, so once they get banned, your bot shares no servers with the user so they cant be DM'd
you cant dm someone whom you dont share... ^
even if i try to dm them before banning?
if you dm them before banning, and they have their dms open, the message gets send
is it fine that i dont define e in the except Exception as e: line
but you are defining e
that line literally means e = Exception
maybe what you should do is run isinstance() on the exception to check if it's actually failing to send the message
otherwise print the unexpected exception to console
okay thank you!
i did
await guildd.create_role(name="zenham", permissions=permissions.all)
and i got
NameError: name 'permissions' is not defined
i know im doing something wrong but what?
How would i send a value from a json format from an API?
!d discord.Guild.create_role
await create_role(*, name=..., permissions=..., color=..., colour=..., hoist=..., display_icon=..., mentionable=..., reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates a [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role") for the guild.
All fields are optional...
did you import permissions from discord?
i just did import discord
then it's discord.Permissions.all
thanks
AttributeError: module 'discord.permissions' has no attribute 'all'
did you capitalize the P?
😮
depends on how you want to format it
Its a format from the api page, i want to then return the value to the user
well that's more specific to the api in question
give me an example of a returned response
{
"status": "ok"
}
And it returns to the user from the bot the value of status
in this case "ok"
it's a dictionary, so you just do
response["status"]
response being whatever you named the variable with the content ofc
Is there a point in redefining both on_message_edit and on_raw_message_edit?
Because I don't see any instances where we would need to redefine both, cause doesn't on_raw_message_edit already perform all the tasks of on_message_edit + it can fetch messages outside of the internal cache.
'Response' object is not subscriptable is the error i got
let me see the code for the web request
np
I was wondering if there is a way to make a slash command with more than 25 choices (by checking the user's input and deciding which choices to use) sorry if this is unclear
um, wrong server?
you mean like autocomplete?
yeah
!d discord.app_commands.autocomplete
@discord.app_commands.autocomplete(**parameters)```
Associates the given parameters with the given autocomplete callback.
Autocomplete is only supported on types that have [`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.10)"), [`int`](https://docs.python.org/3/library/functions.html#int "(in Python v3.10)"), or [`float`](https://docs.python.org/3/library/functions.html#float "(in Python v3.10)")
values.
[`Checks`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.app_commands.check "discord.app_commands.check") are supported, however they must be attached to the autocomplete
callback in order to work. Checks attached to the command are ignored when invoking the autocomplete
callback...
thank you
@bot.command()
async def showguilds(ctx):
for guild in bot.guilds:
for channel in guild.text_channels:
link = await channel.create_invite(max_age=300)
await ctx.send(link)```
it sends links for the amount of channels in every guild that's the only method i found, what other methods can i use to create 1 link for each guild
oh god you're gonna get so ratelimited
that's a bad idea
thats the worst, you shouldnt be doing that, talking besides of ratelimits, you're breaching the privacy of the users
oh shoot right, that too
ik im asking what else can i do, + how am i breaching the privacy of users, this command is limited to me for now but it's a test bot so no one has access to it
dont do it, ease
i mean
if your bot grows
nvm
people invite bots assuming that its just an application, not everyone knows that the developer can just access to invites, and more stuff so easily
so unless you clearly mention that the users should agree with that condition that invites may be created, its a security breach, thats just like breaking into someone's room without permission ;-;
well technically yeah unless i did what u said that the user agrees to conditions
but what can i do about my issue as well
hm, whats your issue
.
i wanna get 1 channel id for each guild to create a invite for each guild
why do you need it?
just use the first index of the Guild.channels list
well that works only if ur bot has invite perms
it's a mod bot and for stuff that requires admin and etc so yeah
!d discord.TextChannel.permissions_for you can check the perms first
permissions_for(obj, /)```
Handles permission resolution for the [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member")
or [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role").
This function takes into consideration the following cases...
what's a way to do that
!e print(["first item", 1,2,3][0]) # 🚶♂️
@slate swan :white_check_mark: Your eval job has completed with return code 0.
first item
.
anyone knows why I can't import it?
u need discord.py 2.0 for that
python -m pip install git+https://github.com/rapptz/discord.py
if u wish to upgrade
python -m pip install -U git+https://github.com/rapptz/discord.py for "updating" it
well, how does on_command_erorr(ctx, error) work then?
i don't work with dpy often
its meant to have context,other events dont
since commands work with context, its obvious that there may be context supplied
alr, gotcha
yeah i just realised how dumb of a question i asked
thats one of the most asked question in this channel xd
oh wow
also, while we are talking abt events how can i get command name? like error.command.name returns none
ctx.command gives you a Command object, you can use its name property, so ctx.command.name is your deal
ohh that's why i was getting none, ic
how can i get authors avatar?
!d discord.Member.avatar
property avatar```
Equivalent to [`User.avatar`](https://discordpy.readthedocs.io/en/latest/api.html#discord.User.avatar "discord.User.avatar")
ctx.author or message.author return the same type of object which is a union of Member and User object
yeah ik
i'm getting member object has no attribute avatar_url
try avatar.url
!d discord.Asset.url
property url```
Returns the underlying URL of the asset.
thanks 😅 , todays not my day for coding
happens, i mostly just take a break maybe go for lunch or a drink that always helps me!
yea, i just put on music or yt
Can anyone explain to me what Guilds are? I'm really confused by the documentation.
guilds are servers
guilds is just an alias for servers
Augh, why wasn't that explained somewhere 
Integrate your service with Discord — whether it's a bot or a game or whatever your wildest imagination can come up with.
bro
Directly mentions it inside of discord.py's documentation
because index.html content points at "css/whatever.css" and yours is located in "src/css/whatever.css"
get directories out of "src"
or put "index.html" inside of src
or just add src/ to the beinning of refs
too deep 🙂 just in /src
yes
ooops so you need to get every folder and index out of /src, to the root level, sorry, i wasn't sure what this interface is for
it should look like
index.html
assets
css
js
not like
src
index.html ... etc
yes all out
woohooo \o/
How do i make pressing a button edit an embed which has been sent in a previous command?```py
class join_ticket(discord.ui.View):
def init(self):
super().init(timeout=None)
@discord.ui.button(row=0, label="Join Request", emoji=':no_entry:', style=discord.ButtonStyle.grey, custom_id="delete_ticket", disabled=False)
async def button_callback2(ctx, message, interaction: discord.Interaction):
guild = bot.get_guild(901481491337465928)
req_embed = discord.Embed(title="Request!", description=f" is looking for a !\nOther Trader: {interaction.user.mention}\n\n**Trade:**\n\n> {interaction.user.mention} has joined the ticket!", color=0x40C96B)
req_embed.set_footer(text=f"Request")
req_embed.set_thumbnail(url=guild.icon)
await interaction.edit_original_message(embed=req_embed)```
guys
i need help making this so u do the prefix and also use | (len(client.guilds)) i need help with this
bot status
f".help | {len(bot.guilds)} servers" is that what youre looking for?
"servers" should be outside the curly bracket
😳
that is so
like the message sent with the view or another message?
the message sent with the view
!d discord.Interaction.edit_original_message
await edit_original_message(*, content=..., embeds=..., embed=..., attachments=..., view=..., allowed_mentions=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Edits the original interaction response message.
This is a lower level interface to [`InteractionMessage.edit()`](https://discordpy.readthedocs.io/en/latest/interactions/api.html#discord.InteractionMessage.edit "discord.InteractionMessage.edit") in case
you do not want to fetch the message and save an HTTP request...
is this what youre looking for?
isnt the way it is telling me to do it, the same way i have been doing it?
Yes
well it seems like yes youre doing it correctly and yes youre replacing the embed correctly so whats the issue😅
Hi. Is there some changelog or gist made in dpy after Danny remaintained it, in master?
discord.errors.NotFound: 404 Not Found (error code: 10015): Unknown Webhook
Windows 10 pro, no python installed, I goto https://www.python.org/ftp/python/3.5.3/python-3.5.3-amd64.exe get version 3.5.3 , install. Start gitbash do python -v get the following as shown in image
I mean this is the basic of the basic , even in cmd python -v just returns the same errors and idk , I uninstalled all python known to man on my pc reinstalled , still same results. Apologizes if this is an incorrect chat room but anyone ever see this or know why its doing it? Is it because Im using an older version? 3.5.3
hitting ! then pressing enter unlocks it and displays what is listed on the last 3rd picture
oof it seems like the webhook doesnt exist did you restarted the bot or something like that?
Thank you
I seem to get the same error in git bash. But try doing it in powershell or cmd, those should work fine
might have to do with it being bash or somethign
honestly, it looks less like errors and more like it's just being overly verbose
hmm it does exist because the view is attached to that embed
maybe im wrong, maybe it is doing what i ask it, I apologize, through all that text , in the end "Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AMD64)] on win32" is displayed, maybe i just assumed all that text was an error , I apologize
@slate swan how to make a mute for a while ? Namely, the very part with time.
await timeout(until, /, *, reason=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Applies a time out to a member until the specified date time or for the
given [`datetime.timedelta`](https://docs.python.org/3/library/datetime.html#datetime.timedelta "(in Python v3.10)").
You must have the [`moderate_members`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.moderate_members "discord.Permissions.moderate_members") permission to
use this...
if you want an event that gets dispatched on timeout you would need the following coroutine
!d discord.on_member_update
discord.on_member_update(before, after)```
Called when a [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member") updates their profile.
This is called when one or more of the following things change...
I see....
so I can't do it
yup!
today I have already used these arguments (before, after) and because of them, my bot did not start
hello
hi
@slate swanas I understand it , it will need to be stuffed into the event ?
it would be something like this
f"Type: {'Mute' if member.is_timed_out else None}\nExpires: {member.timed_out_until}"
thats just a concept
❤️
guys for all servers bot has its {(len(client.guilds))}
how would i do it for users
in a embed
!d discord.ext.commands.Bot.users
!d discord.Client.users
property users```
Returns a list of all the users the bot can see.
property users```
Returns a list of all the users the bot can see.
🗿
🗿
Golfed still
List[User] so this?
no
if you want the len just do len(bot.users)since the property returns a list already
no need for list?
no its return type is already a list
it only counts members for one server
not total
all the users for all the guilds
@commandName.error
async def commandName_error(ctx, error):
...
how can i restart my bot
Ctrl+C and run it again?
with commands
Ah that
Why
What do you need the restarting for
for togglrr on_ready part
is there a way to send a message straight to a channel with only the channel id
Make a new command that runs the code that is inside the on_ready function
Bring the on_ready part to a separated function and call it whenever you'd like to
Or just call on_ready doesn't matter except that's unusual
!d discord.Guild.get_channel
get_channel(channel_id, /)```
Returns a channel with the given ID.
Note
This does *not* search for threads...
that's what I thought. Thank you
!d discord.TextChannel.send
await send(content=None, *, tts=False, embed=None, embeds=None, file=None, files=None, stickers=None, delete_after=None, nonce=None, allowed_mentions=None, reference=None, ...)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Sends a message to the destination with the content given.
The content must be a type that can convert to a string through `str(content)`.
If the content is set to `None` (the default), then the `embed` parameter must
be provided...
youre welcome!
can you explain how?
Do you use cogs?
what are they
what
please talk with me like im 8
that wouldnt work
Ok guess you don't
if it exists why you shouldn't use it
i cant get that things
Global handlers also exist and they are better for this kind of exception
how would it not work lol
dang youre against tos👁️👁️
You'd have to write local handler for every command just to handle missing permissions exception
ik
he wants to restart the bot which on ready wouldnt work because how would it get fired?
@gusty shard just call on_ready if you don't wanna do it better with bringing out its contents to a function
await on_ready()```
No don't do that
I guess you have it defined as an event
yea i do
just have a command that disconnects the client from the websocket and gateway and just run the file again
i will try it thanks
Yes it's a bad practice but I am too lazy too explain how to bring it out to a function
Why would he have a command with that
bro he wants to restart his bot
better off using cogs
Nah, he literally wants to run on_ready
You wouldn't want to do that in a normal situation
Read what he sent above
There's no simple way to do it because there's no reason to
yea
why?
@slate swan
i need a situation on why
on_ready part reads a file
Prolly update presence or smth 😂 this is a weird case anyway
because the event only gets fired on cache population
so just do that in a separate command?
What kind of value?
Is it a configuration file?
Make it read the file in a function and call the function in on_ready and anywhere you'd like to
That's the best method
I would personally make a function to read that file and "store" the values and call it inside on_ready and wherever you need it to
anyway
that works and thats all i need
thank you
Ah yes
Ok but better rework it in the future
Your code will eventually become a nightmare
Cuz this method is cringe
If you keep using stuff because it "works"
dude its just a bot
Don't get defensive lmfao
Guys suggest good slowmode delay for messages per 10 seconds rates
I'm just saying the truth
you probably want to see a doctor if that's the case
Actually @slate swan is right
It's better to write the code in a correct way
Not to confuse yourself in the future
:/
@bot.event
async def on_command_error(ctx, error):
if isinstance(error, CheckFailure):
await ctx.send(embed = discord.Embed(title = f":no_entry_sign: You're missing permissions", color = 0x36393E)
elif isinstance(error, CommandOnCooldown):
await ctx.send(embed = discord.Embed(title = f":no_entry_sign: You're on cooldown", description = f"Please wait another `{round(error.retry_after, 2)}` seconds", color = 0x36393E)
elif not isinstance(error, CommandNotFound):
await ctx.send(embed = discord.Embed(title = f":no_entry_sign: An error occurred", description = error, color = 0x36393E)```
the elif insistance line has a syntax error and i cant find it
kinda slow rn myb
first await ctx.send ... is missing one ) at the end
hmm all of them are
Guys can someone refer me to a warning system with add warns remove warns view warns tut or some tips
Like? Python warnings or discord warnings?
If it's the latter I would recommend implementing them yourself
how can I deduce an error if the participant has no roles ?
ctx.author.roles == []?
wait no
len(ctx.author.roles) == 1
simple question but how to get the channel id from which the user did a command from.
ctx.channel
oh no way
and now in english
man i made 1 spelling error
it's still in development
i thought it was discontinued
I'd prioritize that library tbh
At least, that's what I'm doing
Since (most) other libs are forks...
!d discord.ext.commands.has_permissions
@discord.ext.commands.has_permissions(**perms)```
A [`check()`](https://discordpy.readthedocs.io/en/latest/ext/commands/api.html#discord.ext.commands.check "discord.ext.commands.check") that is added that checks if the member has all of
the permissions necessary.
Note that this check operates on the current channel permissions, not the
guild wide permissions.
The permissions passed in must be exactly like the properties shown under
[`discord.Permissions`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions "discord.Permissions")...
this will raise an error if the author does not have the perms, which you can handler using an error handler
@bot.command()
@commands.bot_has_permissions(*perms)
async def command(ctx, *args) -> None:
...
# using an on_command_error event
@bot.event
async def on_command_error(ctx, error) -> None
if isinstance(error, commands.BotMissingPermissions):
# do your stuff
...
# using a command specific handler
@command.error
async def name_me_anything(ctx, error) -> None:
# same logic as above here
...
^
don't forget the else
how to check if there is a role in a member's roles, and if the role is not in the member's roles?
!d discord.Member.roles
property roles```
A [`list`](https://docs.python.org/3/library/stdtypes.html#list "(in Python v3.10)") of [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role") that the member belongs to. Note
that the first element of this list is always the default [‘@everyone](mailto:'%40everyone)’
role.
These roles are sorted by their position in the role hierarchy.
you can just do
if role in member_instance.roles:
...
role has to be a actual Role object!
how to check that this role is not in the member.roles?
i wonder why a method like Member.has_role(Role) that returns bool isnt a method
just use not

hmm there's Member.get_role(ROLE_ID) ... would return None if Member doesn't have such role
in d.py v2.0a at least
ah cool
yes, it says "new in version 2.0"
omg seriously?! I have been searching for 2 hours for an answer to my question..... im very stupid last time
THX!!
youre welcome❤️
is if X not in Y same as if not X in Y ? hmmm
theyre both syntax correct?
yes
thought so
but 1 makes more sense imo
i always use the 1
same
I prefer the second but both work
the result is same but
if X not in Y ``` is checking if X is not in Y
```py
if not X in Y ``` is checking it "X in Y" is False ```
yeah
its just doing
if True:
...
if not True:
...
I prefer the second because it just fits nicer with the conversational use of not rather than just this off case where you can use it with the in operator
*if False v/s if not True
are you automatically 'friends' with the bot when you share a server with it?
wouldnt that return True as X isnt in Y?
why would that matter? and no
well,no
but bots always have their dms open
what's the point for bot.user.friends then?
thats pointless, thus removed in 2.0
its deprecated iirc
why did discord even add it?
was only useful back when selfbots were supported
@slate swan 👁️ 👁️
It was used for self-boting
Oh that makes sense, so it's now unreachable I assume
in that case it would be if True vs if not False as X in Y is false.
yes, there are more user-bot relation related classes and functions removed which existed in 1.7.3 for self-boting purpose
Did discord actually support selfbots in the past?
it has been against tos from a long time, but since discord.py provided a complete api coverage it used to work
right right
this topic to be specific https://discordpy.readthedocs.io/en/master/migrating.html#removal-of-support-for-user-accounts
was it ever allowed in the past?
i don't think so, though i may be wrong
someone who has been using disocrd api for a long time can answer this better than me
ah I see
my bot can't have friends? it will be so lonely... 😉
sadly no😔
so no friends for your bots😔
how to get all users with role mute?
!d discord.Role.members
property members```
Returns all the members with this role.
idk how to realize it... sorry
what
you just get the role object then do role.members
well its a property that returns a list of members, which its a property of the Role class so you would need a Role object
well you tried to send the list which is a list of member objects!
What is the purpose for a server id if you can't join the server with it's id
try ", ".join([x.display_name for x in role.members])
well the id for guilds is a unique snow flake to identify each guild
could be done better
teach me, senpai 🙂
But discord uses this information, it's not really needed for regular users?
sexy code ❤️
Very
well everything has a id for a reason and its for uniqueness
which is handy for allot of things like getting a specific entity!
Hm I see
How do I create an invite for a server? In d.py ofc
Hi, im trying to get all bans from a server but im getting an error, this is my code:
@app_commands.command(name="testing_command", description="Comando para realizar pruebas." )
async def testing_command(self, interaction: discord.Interaction):
await interaction.response.send_message("Check console!", ephemeral=True)
for i in interaction.guild.bans():
print(i)
TypeError: 'async_generator' object is not iterable
i forgot the dir😔
remember it 🙏
!d discord.TextChannel.create_invite
await create_invite(*, reason=None, max_age=0, max_uses=0, temporary=False, unique=True, target_type=None, target_user=None, target_application_id=None)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).
Creates an instant invite from a text or voice channel.
You must have the [`create_instant_invite`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Permissions.create_instant_invite "discord.Permissions.create_instant_invite") permission to
do this.
you forgot the async keyword
async for ban in interaction.guild.bans():
...
💓
so technically... you can't invite user to a guild, only to a channel in such guild?
well kinda because you joined the guild yes but which channel exactly?
seems fair
i forgot that discord needs a channel for each invite
because yes you joined but on which channel 😅
!d help
help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.
Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).
This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
!d help discord
help([object])```
Invoke the built-in help system. (This function is intended for interactive use.) If no argument is given, the interactive help system starts on the interpreter console. If the argument is a string, then the string is looked up as the name of a module, function, class, method, keyword, or documentation topic, and a help page is printed on the console. If the argument is any other kind of object, a help page on the object is generated.
Note that if a slash(/) appears in the parameter list of a function when invoking [`help()`](https://docs.python.org/3/library/functions.html#help "help"), it means that the parameters prior to the slash are positional-only. For more info, see [the FAQ entry on positional-only parameters](https://docs.python.org/3/faq/programming.html#faq-positional-only-arguments).
This function is added to the built-in namespace by the [`site`](https://docs.python.org/3/library/site.html#module-site "site: Module responsible for site-specific configuration.") module.
!d discord
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.
!d discord.VoiceClient
class discord.VoiceClient```
Represents a Discord voice connection.
You do not create these, you typically get them from
e.g. [`VoiceChannel.connect()`](https://discordpy.readthedocs.io/en/latest/api.html#discord.VoiceChannel.connect "discord.VoiceChannel.connect")...
#bot-commands
anyone have a create invite pseudocode?
@bot.command()
async def create_invite(ctx: commands.Context, *, reason: str = "No reason provided") -> None:
await ctx.channel.create_invite(reason=reason)
how can i manually change what guild is refrenced in ctx.guild
what is the -> None for
its a return annotation
It says that the function will return None
more info here^
!e
def a() -> str:
return "hello im a function that returns a string so im literal to a string so yes my value is a string"
print(a())
@slate swan :white_check_mark: Your eval job has completed with return code 0.
hello im a function that returns a string so im literal to a string so yes my value is a string
any idea on how to do this?
interesting... 3 mins before i only had 3 now 58
WhiskeyBot [Beta]
BOT
— Yesterday at 9:05 PM
WhiskeyBot
Online
Bot Startup and Information
Start Time: May-21-2022 at 09:05:36 PM
Current Uptime: a day ago
Bot account: WhiskeyBot [Beta]
Bot ID: 798201838867578940
Guilds: 3
Users: 3
Disnake Version: 2.5.1
Loaded Cogs: ['developerfeatures', 'events']
Developer: whiskeythefox#7339
Logging System
whiskeythefox — Yesterday at 9:06 PM
$uptime
WhiskeyBot [Beta]
BOT
— Yesterday at 9:07 PM
0 Days 0 hrs 2 mins 14 secs
WhiskeyBot
Online
Bot Startup and Information
Start Time: May-21-2022 at 09:10:18 PM
Current Uptime: a day ago
Bot account: WhiskeyBot [Beta]
Bot ID: 798201838867578940
Guilds: 3
Users: 58
Disnake Version: 2.5.1
Loaded Cogs: ['developerfeatures', 'events']
Developer: whiskeythefox#7339
Logging System
So um guys
Im making a bot that has select on it
but when i select an option it says interaction failed
how to fix it?
Can u show code
are discord.py user arguments always strings
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
@heavy shard :white_check_mark: Your eval job has completed with return code 0.
8
result is always true
Is there anyway to get the channel ID of a guild
which channel?
like for example #discord-bots
by name?
like it there a way for it to get the first channel of a guild
guild.channels[0]
this would get the id of the first channel within that guild?
if would give u the channel object then you can use channel.id
first channel is the channel with channel.position = 0
can I see an example response?
channel = guild.channels[0]
channel.id
i just wonder if guild.channels[0] is always same as discord.utils.get(guild.channels, position=0)
Ooh never knew discord.utils takes a position argument
Given the circumstances I assume so
judging by source code, at least separate categories like text_channels are sorted by position
how do i make my bot so it can only receive inputs within a set channel within a server? i dont particularly want to hard-code it into the bot, as i want to have the ability to put the bot on 2 diff servers (one public one, and one private one for development testing
would that be something i would have to configure a role within that server? and if so, how can i say only see x channel, rather than putting every other channel to private?
i think this would work
@bot.event
async def on_message(message):
if message.channel.id == CHANNEL_ID:
await bot.process_commands(message)
the issue is that is coding it into the bot, and kinda locks it from being able to be used anywhere else
thats how id interpret the above at least
correct me if im wrong
you want to alter the functionality of the bot without altering the bot source code?
i believe so...?
prefereably, id like to make it so the bot can be setup on any server, and then confined to a single channel
atm this would still work, as its only on 2 servers. i can just put an 'or' in there
having the flexibility is preferred, but by no means essential rn
i would give the server manager the ability to setup which channel it should be
like !bind-here used on the channel
i am the server manager, i just dont know to let it see only one channel lol
that would req something in the code wouldnt it?
to lock it to x channel using a command
of course, preferably databases
might try this with an 'or' in there then for now
to do that, how do i find a channel id?
you need to enable developer mode in "Advanced" in discord,
then, when you right click on the channel, there would be "copy id" option at the bottom
mp
will leaving the developer toggle on have any other effects? or would u just leave on
i forgot about it and i've seen no weird behavior, but i'd look at the discord help web page to make sure
alrighty
ty
it says Unresolved Reference 'CHANNEL_ID'
do i need to import somethin so it recognises the term?
ah that 🙂 you need to replace it with real channel id
ohh
like 912784487632484
you need to enter an actual Id there, that was just a pseudocode
i put it afterwards xd
bingo got it
ty
mm not workin, cant get rid of the various errors that r coming up lol
"bot" in @bot.event may be something else, depends how do you named your bot object, i.e. "client"
yeah i renamed that
@client.command(aliases=['av', 'pfp'])
async def avatar(ctx, *, memb : discord.Member=None):
if memb == None:
memb = ctx.message.author
await ctx.message.delete()
embed=discord.Embed(title=f"{memb.name}'s Avatar!",description=f"Link: {memb.avatar_url}",color=0,timestamp=ctx.message.created_at)
embed.set_image(url=memb.avatar_url)
embed.set_footer(text="CREATED BY LUCIFER")
await ctx.send(embed=embed)
anyone?
What's the error?
Isn't it working fine?
f"Link: {memb.avatar_url}" you added the url to the description...
It would cuz there is a description Param in discord.Embed
How can I make it only get the channel ids of channels available to everyone?
@slate swan you probably know how?
i do..., you need to check the permissions or overwrites for the @everyone role in that channel.
How would I do that?
!d discord.TextChannel.permissions_for
permissions_for(obj, /)```
Handles permission resolution for the [`Member`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Member "discord.Member")
or [`Role`](https://discordpy.readthedocs.io/en/latest/api.html#discord.Role "discord.Role").
This function takes into consideration the following cases...
can I see an example, or pseudocode?
for everyone role object, you can do guild.get_role(guild.id)
channels_i_need = []
for channel in all_channels:
if channel.permissions_for(everyone_role).view_channel:
channels_i_need.append(channel)
``` something like this
could I do all_channels[0] to get the first unhidden channel
unhidden, no
the first channel, yes
How would I make it so It only gets the first unhidden channel
@slate swan hm?
help me pls
for bot music
pls
!d
So i want to make a discord bot that auto delete a channel every 5 minutes and itll recreate the channel with a same message in it, also please make it with a link so i can use uptimerbot to ping it
Well that's actually not possible :
The first problem is probably the ratelimit , means that if you recreate channels too often , will get your bot rate limited ( A Temp Ban )
The second one is that you can't copy messages to another channel in discord , that is not possible
@client.command(aliases=['av', 'pfp'])
async def avatar(ctx, *, memb : discord.Member=None):
if memb == None:
memb = ctx.message.author
await ctx.message.delete()
embed=discord.Embed(title=f"{memb.name}'s Avatar!",description=f"Link: [Click Here]({memb.avatar_url})",color=0,timestamp=ctx.message.created_at)
embed.set_image(url=memb.avatar_url)
embed.set_footer(text="CREATED BY LUCIFER")
await ctx.send(embed=embed)
This will change that link into a hyper link
thanks but sir already done
Great job 👍🏻
help pls
#🤡help-banana @maiden fable you prob know
just check the channel the command was run in and compare it to a set id
if str(message.channel.id) == str(yourchannelid)
...
You may use discord.utils.find like this
channel = discord.utils.find(lambda x: x.permissions_for(guild.default_role).send_messages, guild.text_channels)```
!d discord.utils.find
discord.utils.find(predicate, iterable, /)```
A helper to return the first element found in the sequence
that meets the predicate. For example:
```py
member = discord.utils.find(lambda m: m.name == 'Mighty', channel.guild.members)
would find the first Member whose name is ‘Mighty’ and return it.
If an entry is not found, then None is returned...
this would get the first unhidden channeL?
what would it be for the first one?
Why casting to str
It would get only the first one
help me build someone?
the lambda x?
wdym is not nuking is auto deleting one single channel
