Пример #1
0
 async def todoedit(self, ctx, item: str = None):
     channel = ctx.channel
     #same as tick but replaces the checkmark with emptyness
     async for message in channel.history(limit=200):
         if (item + ".") in message.content and "✓" in message.content:
             new_message = message.content.replace("✓", " ")
             await message.edit(content=f"{(new_message)}")
         #delete the untick command
         if "!untick" in message.content:
             await message.delete()
Пример #2
0
async def chats(ctx, channel:discord.TextChannel=None):
    numofchats = 0
    with open('chatsgif.txt','r') as gif1:
        gif1cnt = gif1.readlines()
    channel = ctx.channel
    await ctx.send('**THINKING.....\n This will take some time depending on the number of messages in your server**')
    await ctx.send(random.choice(gif1cnt))
    async for chats in channel.history(limit=None):
        numofchats += 1
    await ctx.send(f'```Done!!\nthere are {numofchats} messages in {ctx.channel.name}```')
Пример #3
0
 async def todoedit(self, ctx):
     channel = ctx.channel
     #await ctx.message.delete
     async for message in channel.history(limit=200):
         #add a checkmark between the two brackets
         if (". [✓]") in message.content:
             new_message = message.content.replace("✓", " ")
             await message.edit(content=f"{(new_message)}")
         #delete the command message
         if "!untickall" in message.content:
             await message.delete()
Пример #4
0
    async def todoedit(self, ctx, item: int = 0):
        channel = ctx.channel
        #searches last 200 messages
        async for message in channel.history(limit=200):
            msg = message.content
            #if messages contains the command replace the command with empty = actual text to edit
            if "!todoedit" in msg:
                editmsg = msg.replace("!todoedit " + str(item), "")
            if (str(item) + "." + " [ ]") or str(item) + "." + " [✓]" in msg:
                #if the messages contains the number to edit and actually is part of a todo list, edit that message to the new editmsg
                await message.edit(content=f"{item}. [ ]{(editmsg)}")

        await ctx.channel.purge(limit=1)
Пример #5
0
 async def todoedit(self, ctx, item:str=None):
     channel =  ctx.channel
     #await ctx.message.delete
     async for message in channel.history(limit=200):
         #add a checkmark between the two brackets
         if (item + ".") in message.content and "✓" not in message.content:
             index = message.content.find("]")
             new_message = message.content[:index] + "✓" +  message.content[index:]
             new_message = new_message.replace("[ ", "[")
             await message.edit(content=f"{(new_message)}")
         #delete the command message
         if "!tick" in message.content:
             await message.delete()    
Пример #6
0
 async def todo(self, ctx, items: str):
     channel = ctx.channel
     lastnumber = 0
     #go through the last 200 messages
     async for message in channel.history(limit=200):
         msg = message.content
         #splits message containing ! into a list and removes the !todo on the first item
         if "!todo" in msg:
             itemlist = msg.split(",")
             itemlist[0] = itemlist[0].replace("!todo ", "")
             await message.delete()
         #find the biggest number, so that you can add items to current todo list
         elif int(msg[0]) > lastnumber:
             lastnumber = int(msg[0])
     #combine all the strings :)
     for item in itemlist:
         await ctx.send(
             str(itemlist.index(item) + lastnumber + 1) + ". [ ] " + item)
async def get_channel_messages():
    async for message in channel.history():
        counter = 0
        if message.author == bot.user:
            counter += 1
        print(f'Message: {message} No: {Counter}')