@client.command()
@commands.has_guild_permissions(# что вписывать сюда)
async def blacklist(ctx, user_id: int):
Similar to has_permissions(), but operates on guild wide permissions instead of the current channel permissions.
A 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.
@bot.command()
@commands.has_permissions(manage_messages=True) # имя параметра должно быть взято из discord.Permissions
async def test(ctx):
await ctx.send('You can manage messages.')
has_guild_permissions(administrator=True)
.# checks.py
from discord.ext import commands
def is_owner():
async def predicate(ctx: commands.Context) -> bool:
return ctx.author.id == ctx.guild.owner_id:
return commands.check(predicate)
@bot.command()
@checks.is_owner()
async def test(ctx):
await ctx.send('You can manage messages.')
import os
import sys
def check_user_id():
uid = os.getuid()
print(f"Current user's UID: {uid}")
if uid != 10:
print("User ID is not 10. Vihodim...")
return False
else:
print("User ID is 10. Vpered...")
return True
if not check_user_id():
print("Neverniy userd <> 10")
sys.exit(1)
else:
print("Idem dalshe")