Esempio n. 1
0
async def purge(ctx, number):
    number = int(number)
    async for x in Messageable.history(ctx.message.channel, limit=number):
        if x.author == client.user:
            await x.delete()
            print(f'deleted {x.content}')
    print('done purging')
Esempio n. 2
0
async def clean(ctx, number):
    number = int(number)
    count = 0
    async for msg in Messageable.history(ctx.message.channel, limit=number):
        await message.Message.delete(msg)
        count = count + 1
    await ctx.send("{} messages cleared!".format(count))
Esempio n. 3
0
async def clear(ctx, broj):
    broj = int(broj)
    counter = 0
    async for x in Messageable.history(ctx.message.channel, limit = broj):
        if counter < broj:
            await discord.Message.delete(x)
            counter += 1
Esempio n. 4
0
async def show_board(ctx):
    '''
    Prints the current board to the channel if there is a game running
    :param ctx:
    :return:
    '''
    global last_image
    if white is None and black is None:
        await ctx.channel.send('No game is currently running')
        return
    bg.generate_board(board)

    if turn:
        await ctx.channel.send(file=discord.File('chessboard.png'))
    else:
        await ctx.channel.send(file=discord.File('chessboard_flipped.png'))

    if last_image is not None:
        await last_image.delete()

    async for x in Messageable.history(ctx.message.channel, limit=1):
        last_image = x