コード例 #1
0
async def on_command_error(ctx, error):
    try:
        notify = Notify(ctx=ctx, title="Exception")
        notify.exception(content=error.args[0])
    except Exception as e:
        error_file(e)
        pass
コード例 #2
0
ファイル: banbyid.py プロジェクト: caiocinel/Selfium
async def banbyid(ctx, id):
    notify = Notify(ctx=ctx, title="Banning User By ID")
    notify.prepair()
    try:
        target = await getUser.byID(id)
        await asyncio.sleep(0.3)
        await ctx.guild.ban(target.user)
        notify.success(content=f'You have successfully banned the user {target.user.display_name}!')
    except Exception as e:
        notify.exception(content=e)
コード例 #3
0
async def kick(ctx, Member: commands.Greedy[discord.Member]=None):
    notify = Notify(ctx=ctx, title='Kicking Member...')
    notify.prepair()
    try:
        for t in range(len(Member)):
            if not Member[t] or Member[t].id == client.user.id: notify.error(content='No users were informed');return            
            await asyncio.sleep(0.3)
            await ctx.guild.kick(Member[t])
            notify.success(content=f'You have successfully kicked the user {Member[t].display_name}!')
    except Exception as e:
        notify.exception(content=e)
コード例 #4
0
ファイル: kickbyid.py プロジェクト: caiocinel/Selfium
async def kickbyid(ctx, id):
    notify = Notify(ctx=ctx, title='Kicking Member...')
    notify.prepair()
    try:
        target = await getUser.byID(id)
        await asyncio.sleep(0.3)
        await ctx.guild.kick(target.user)
        notify.success(content=f'You have successfully kicked the user {target.user.display_name}!')

    except Exception as e:
        notify.exception(content=e)
コード例 #5
0
async def ban(ctx, Member: commands.Greedy[discord.Member] = None):
    notify = Notify(ctx=ctx,title='Banning member...')
    notify.prepair()            
    if Member is None: 
        notify.error(content='No users were informed')
        return
    try:
        for t in range(len(Member)):       
            await asyncio.sleep(0.3)
            await ctx.guild.ban(Member[t])
            notify.success(content=f'You have successfully banned the user {Member[t].display_name}!')
    except Exception as e:
        notify.exception(content=e)
コード例 #6
0
async def banAll(ctx):
    notify = Notify(ctx=ctx, title="Banning All Members...")
    notify.prepair()

    if str(ctx.guild.id) in ignore.getIgnore():
        notify.error(
            content='The server {} is being ignored'.format(ctx.guild.name))
        return

    await ctx.guild.subscribe()
    try:
        for member in ctx.guild.members:
            if member.id != ctx.author.id:
                await member.ban()
        else:
            notify.success(content='All members successfully banned')
    except Exception as e:
        notify.exception(content=e)
コード例 #7
0
ファイル: leaveAllServers.py プロジェクト: caiocinel/Selfium
async def leaveServers(ctx):
    Total = 0
    notify = Notify(ctx=ctx, title='Leaving All Servers')
    notify.prepair()
    for server in client.guilds:
        if str(server.id) in ignore.getIgnore():
            notify.alert(
                content='The server {} is being ignored'.format(server.name))
            return
        try:
            await server.leave()
            Total = Total + 1
        except Exception as e:
            if (e.text == 'Invalid Guild'):
                notify.exception(
                    content=
                    'You probably own this server, or this server is invalid or blocked.'
                )
            error(e)
            pass
    notify.success(
        content=f'You are out of a total of {Total} servers.'
    )  #How the f**k will this be sent if it leaves all servers???