from discord.ext import commands


class Ouat(commands.Cog):
    def __init__(self, client):
        self._last_member = None
        self.client = client

    @commands.Cog.listener()
    async def on_message(self, message):
        if self.client.get_channel(message.channel.id) == self.client.get_channel(507386320604102696):  # ouat auto mod
            letter_number = 0
            number_of_periods = 0
            place_of_period = 0
            for letter in message.content:
                letter_number += 1
                if letter == '.':
                    number_of_periods += 1
                    place_of_period = letter_number
            if number_of_periods > 1 or not (place_of_period == len(message.content)) or number_of_periods == 0:
                await message.delete()
        await self.client.process_commands(message)


def setup(client):
    client.add_cog(Ouat(client))
