Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

discord.py how to use permissions

from discord import Member
from discord.ext.commands import has_permissions, MissingPermissions

@bot.command(name="kick", pass_context=True)
@has_permissions(manage_roles=True, ban_members=True)
async def _kick(ctx, member: Member):
    await bot.kick(member)

@_kick.error
async def kick_error(error, ctx):
    if isinstance(error, MissingPermissions):
        text = "Sorry {}, you do not have permissions to do that!".format(ctx.message.author)
        await bot.send_message(ctx.message.channel, text)
Comment

how to change role permissions in discord.py

#edit permissions of role
permissions = discord.Permissions()
permissions.update(kick_members = False)
await role.edit(reason = None, colour = discord.Colour.blue(), permissions=permissions)
Comment

PREVIOUS NEXT
Code Example
Python :: python string reverse 
Python :: round tuple 
Python :: python string contains 
Python :: how to save dataframe as csv in python 
Python :: disbale tkinter textbox 
Python :: python get current class name 
Python :: pandas normalize columns 
Python :: how to extract domain name from url python 
Python :: django model form 
Python :: add tensorflow to conda 
Python :: use django taggit in template 
Python :: import system in python 
Python :: multiple lines input python 
Python :: python text color 
Python :: flatten list python 
Python :: get user django 
Python :: python tkinter label 
Python :: print random integers 
Python :: connect mysql sql alchemy 
Python :: Make Rotation matrix in Python 
Python :: how to merge rows in pandas dataframe 
Python :: Visualize Decision Tree 
Python :: python try except continue loop 
Python :: pandas exclude rows from another dataframe 
Python :: list files in http directory python 
Python :: python input float 
Python :: how to create staff account in django 
Python :: pd.get_dummies 
Python :: Get current cursor type and color Tkinter Python 
Python :: bs4 innerhtml 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =