From 0699ee12384a58745f9c43eaddbcf0a1d783fe3a Mon Sep 17 00:00:00 2001 From: zephyrkul Date: Fri, 24 Jan 2020 12:38:06 -0700 Subject: [PATCH] Clean mention prefixes (#94) Thanks Zeph. --- rndstatus/rndstatus.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rndstatus/rndstatus.py b/rndstatus/rndstatus.py index 9e0f0d8..c44fdc3 100644 --- a/rndstatus/rndstatus.py +++ b/rndstatus/rndstatus.py @@ -1,3 +1,4 @@ +import re import discord from redbot.core import Config, commands, checks from random import choice as rndchoice @@ -115,9 +116,12 @@ class RndStatus(commands.Cog): url = "https://www.twitch.tv/" + streamer if botstats: + me = self.bot.user + pattern = re.compile(rf"<@!?{me.id}>") + clean_prefix = pattern.sub(f"@{me.name}", prefix[0]) total_users = sum(len(s.members) for s in self.bot.guilds) servers = str(len(self.bot.guilds)) - botstatus = f"{prefix[0]}help | {total_users} users | {servers} servers" + botstatus = f"{clean_prefix}help | {total_users} users | {servers} servers" if self.last_change == None: type = await self.config.type() if type == 1: