async def on_message(self, message): """ Function called when someone sends a message the bot can see. :param message: the discord.Message instance of the message """ # Check if the server is locked, if so only allow me (to unlock) & Didier (to send the message) to talk if self.client.locked \ and message.guild is not None \ and str(message.author.id) != constants.myId \ and str(message.author.id) != constants.didierId: # Auto unlock when someone sends a message past the current time if time.time() > self.client.lockedUntil: return await self.unlock(message.channel) return await self.utilsCog.removeMessage(message) # If FreeGamesCheck failed, remove the message & send the user a DM if not checks.freeGamesCheck(message): await self.failedChecksCog.freeGames(message) # Boos React to people that call him Dider if "dider" in message.content.lower() and str( message.author.id) not in [ constants.myId, constants.didierId, constants.coolerDidierId ]: await message.add_reaction("<:boos:629603785840263179>") # Check for other easter eggs eER = easterEggResponses.control(self.client, message) if eER: await message.channel.send(eER) # Earn XP & Message count stats.sentMessage(message)
async def on_message_edit(self, before, after): """ Function called when a message is edited, so people can't edit messages in FreeGames to cheat the system. :param before: the message before it was edited :param after: the message after it was edited """ # Run the message through the checks again if not checks.freeGamesCheck(after): await self.failedChecksCog.freeGames(after)