From fede0c2ee5e73afcdbbfca453e0b2ef4a0128985 Mon Sep 17 00:00:00 2001 From: sgoudham Date: Mon, 17 Aug 2020 19:19:34 +0100 Subject: [PATCH] Added logging for to check for weird ping Made sure that bot members don't do anything when events are called --- bot/__init__.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bot/__init__.py b/bot/__init__.py index 9ed79acc..40658129 100644 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -10,7 +10,11 @@ # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + import datetime +import logging import os import random @@ -22,8 +26,11 @@ from discord import Colour, Embed from discord.ext import commands, tasks from discord.ext.commands import when_mentioned_or -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . +logger = logging.getLogger('discord') +logger.setLevel(logging.DEBUG) +handler = logging.FileHandler(filename='discord.log', encoding='utf-8', mode='w') +handler.setFormatter(logging.Formatter('%(asctime)s:%(levelname)s:%(name)s: %(message)s')) +logger.addHandler(handler) counter = 0 @@ -421,6 +428,8 @@ class Bot(commands.Bot): In the Enso guild, it will send an introduction embed """ + if member.bot: return + # Get the guild guild = member.guild @@ -511,6 +520,9 @@ class Bot(commands.Bot): async def on_member_remove(self, member): """Storing User Roles within Database When User Leaves Guild""" + + if member.bot: return + role_ids = ", ".join([str(r.id) for r in member.roles if not r.managed]) # Setup pool