コード例 #1
0
async def movechannel(cmd, message, args):
    if not args:
        await cmd.bot.send_message(message.channel, cmd.help())
        return
    else:
        if check_man_chan(message.author, message.channel):
            position = int(args[0])
            pos_pre = message.channel.position
            try:
                await cmd.bot.move_channel(message.channel, position)
                response = await cmd.bot.send_message(
                    message.channel, 'Channel **' + message.channel.name +
                    '** was moved from **' + str(pos_pre) + '** to **' +
                    str(position) + '**.')
            except Exception as e:
                response = await cmd.bot.send_message(message.channel, str(e))
            await asyncio.sleep(10)
            await cmd.bot.delete_message(response)
        else:
            response = await cmd.bot.send_message(
                message.channel,
                'Only a user with the **Manage Channels** permission can use this command. :x:'
            )
            await asyncio.sleep(10)
            await cmd.bot.delete_message(response)
コード例 #2
0
ファイル: setchannelname.py プロジェクト: Glidzha/apex-sigma
async def setchannelname(cmd, message, args):
    if not args:
        await cmd.bot.send_message(message.channel, cmd.help())
        return
    else:
        if check_man_chan(message.author, message.channel):
            name_input = (' '.join(args)).replace(' ', '_').lower()
            name_pre = message.channel.name
            await cmd.bot.edit_channel(message.channel, name=name_input)
            embed = discord.Embed(color=0x66CC66, title='#' + name_pre + ' renamed to #' + name_input)
            await cmd.bot.send_message(message.channel, None, embed=embed)
        else:
            out_content = discord.Embed(color=0xDB0000,
                                        title=':no_entry: Insufficient Permissions. Manage Channels Permission Required.')
            await cmd.bot.send_message(message.channel, None, embed=out_content)
コード例 #3
0
ファイル: settopic.py プロジェクト: valeth/apex-sigma
async def settopic(cmd, message, args):
    if not args:
        await message.channel.send(cmd.help())
        return
    else:
        if check_man_chan(message.author, message.channel):
            topic = ' '.join(args)
            await message.channel.edit(topic=topic)
            embed = discord.Embed(color=0x66CC66)
            embed.add_field(name='✅ #' + message.channel.name + ' topic changed to:',
                            value='```\n' + topic + '\n```')
            await message.channel.send(None, embed=embed)
        else:
            out_content = discord.Embed(type='rich', color=0xDB0000,
                                        title='⛔ Insufficient Permissions. Manage Channels Permission Required.')
            await message.channel.send(None, embed=out_content)
コード例 #4
0
async def setchannelname(cmd, message, args):
    if not args:
        await cmd.bot.send_message(message.channel, cmd.help())
        return
    else:
        if check_man_chan(message.author, message.channel):
            name_input = (' '.join(args)).replace(' ', '_').lower()
            name_pre = message.channel.name
            try:
                await cmd.bot.edit_channel(message.channel, name=name_input)
                response = await cmd.bot.send_message(message.channel, 'The name of **' + name_pre + '** was set to **' + name_input + '**.')
            except Exception as e:
                response = await cmd.bot.send_message(message.channel, str(e))
            await asyncio.sleep(10)
            await cmd.bot.delete_message(response)
        else:
            response = await cmd.bot.send_message(message.channel, 'Only a user with the **Manage Channels** permission can use this command. :x:')
            await asyncio.sleep(10)
            await cmd.bot.delete_message(response)
コード例 #5
0
async def movechannel(cmd, message, args):
    if not args:
        await message.channel.send(cmd.help())
        return
    else:
        if check_man_chan(message.author, message.channel):
            position = int(args[0])
            pos_pre = message.channel.position
            await cmd.bot.move_channel(message.channel, position)
            embed = discord.Embed(color=0x66CC66,
                                  title='✅ ' + message.channel.name +
                                  ' moved from ' + str(pos_pre) + ' to ' +
                                  str(position))
            await message.channel.send(None, embed=embed)
        else:
            embed = discord.Embed(
                type='rich',
                color=0xDB0000,
                title=
                '⛔ Insufficient Permissions. Requires Manage Channels Permission Only.'
            )
            await message.channel.send(None, embed=embed)
コード例 #6
0
async def settopic(cmd, message, args):
    if not args:
        await cmd.bot.send_message(message.channel, cmd.help())
        return
    else:
        if check_man_chan(message.author, message.channel):
            topic = ' '.join(args)
            try:
                await cmd.bot.edit_channel(message.channel, topic=topic)
                response = await cmd.bot.send_message(
                    message.channel, 'The topic of **' + message.channel.name +
                    '** was set to ```' + topic + '```')
            except Exception as e:
                response = await cmd.bot.send_message(message.channel, str(e))
            await asyncio.sleep(10)
            await cmd.bot.delete_message(response)
        else:
            response = await cmd.bot.send_message(
                message.channel,
                'Only a user with the **Manage Channels** permission can use this command. :x:'
            )
            await asyncio.sleep(10)
            await cmd.bot.delete_message(response)