Answers for "discord py create bot permissions on every channel"

3

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)
Posted by: Guest on October-10-2020
7

create a role with discord.py

@client.command(aliases=['make_role'])
@commands.has_permissions(manage_roles=True) # Check if the user executing the command can manage roles
async def create_role(ctx, *, name):
	guild = ctx.guild
	await guild.create_role(name=name)
	await ctx.send(f'Role `{name}` has been created')
Posted by: Guest on September-29-2020
0

set permissions role discord.py

server = ctx.message.server
perms = discord.Permissions(send_messages=False, read_messages=True)
await client.create_role(server, name='NoSend', permissions=perms)
Posted by: Guest on September-05-2020

Code answers related to "discord py create bot permissions on every channel"

Python Answers by Framework

Browse Popular Code Answers by Language