diff --git a/README.md b/README.md index ad239ac..ebde127 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ * all/everyone - include bots messages * fast: only read cache * fresh: does not read cache + * mobile/mention: mentions users (fix @invalid-user bug) (Sample dates: 2020 / 2021-11 / 2021-06-28 / 2020-06-28T23:00 / today / week / 8days / 1y) ``` @@ -109,6 +110,8 @@ python3 src/main.py ## Changelog +* **v1.14** + * `mobile/mention` arg to fix mobile bug * **v1.13** * improved scan `%words` * remove old and unused logs at start and guild leaving diff --git a/src/main.py b/src/main.py index d2278e5..53d4472 100644 --- a/src/main.py +++ b/src/main.py @@ -33,7 +33,7 @@ emojis.load_emojis() bot = Bot( "Discord Analyst", - "1.13", + "1.14", alias="%", ) diff --git a/src/scanners/scanner.py b/src/scanners/scanner.py index b4a96f1..eb4d30c 100644 --- a/src/scanners/scanner.py +++ b/src/scanners/scanner.py @@ -79,7 +79,9 @@ class Scanner(ABC): ) return if ( - arg not in self.valid_args + ["me", "here", "fast", "fresh"] + arg + not in self.valid_args + + ["me", "here", "fast", "fresh", "mobile", "mention"] and (not arg.isdigit() or not self.has_digit_args) and arg not in str_channel_mentions and arg not in str_mentions @@ -119,6 +121,8 @@ class Scanner(ABC): self.members += [message.author] self.raw_members += [message.author.id] + self.mention_users = "mention" in args or "mobile" in args + if not await self.init(message, *args): return @@ -214,13 +218,18 @@ class Scanner(ABC): logging.info(f"scan {guild.id} > results in {delta(t0):,}ms") response = "" first = True + allowed_mentions = ( + discord.AllowedMentions.all() + if self.mention_users + else discord.AllowedMentions.none() + ) for r in results: if r: if len(response + "\n" + r) > 2000: await message.channel.send( response, reference=message if first else None, - allowed_mentions=discord.AllowedMentions.none(), + allowed_mentions=allowed_mentions, ) first = False response = "" @@ -229,7 +238,7 @@ class Scanner(ABC): await message.channel.send( response, reference=message if first else None, - allowed_mentions=discord.AllowedMentions.none(), + allowed_mentions=allowed_mentions, ) # Delete custom progress message await progress.delete() diff --git a/src/utils/utils.py b/src/utils/utils.py index a439ffd..52d0bd1 100644 --- a/src/utils/utils.py +++ b/src/utils/utils.py @@ -18,6 +18,7 @@ COMMON_HELP_ARGS = [ " - filter before ", "fast - only read cache", "fresh - does not read cache (long)", + "mobile/mention - mentions users (fix @invalid-user bug)", ]