fresh argument to invalidate cache
This commit is contained in:
@@ -38,6 +38,7 @@ class GuildLogs:
|
||||
target_channels: List[discord.TextChannel] = [],
|
||||
*,
|
||||
fast: bool,
|
||||
fresh: bool,
|
||||
) -> Tuple[int, int]:
|
||||
global current_analysis
|
||||
if self.log_file in current_analysis:
|
||||
@@ -123,7 +124,7 @@ class GuildLogs:
|
||||
f"Reading new history...\n0 messages in 0/{max_chan:,} channels\n(this might take a while)",
|
||||
)
|
||||
for channel in target_channels:
|
||||
if channel.id not in self.channels:
|
||||
if channel.id not in self.channels or fresh:
|
||||
loading_new += 1
|
||||
self.channels[channel.id] = ChannelLogs(channel)
|
||||
start_msg = len(self.channels[channel.id].messages)
|
||||
|
||||
@@ -52,7 +52,7 @@ class Scanner(ABC):
|
||||
elif re.match(r"^<#!?\d+>$", arg):
|
||||
arg = arg[3:-1] if "!" in arg else arg[2:-1]
|
||||
if (
|
||||
arg not in self.valid_args + ["me", "here", "fast"]
|
||||
arg not in self.valid_args + ["me", "here", "fast", "fresh"]
|
||||
and (not arg.isdigit() or not self.has_digit_args)
|
||||
and arg not in str_channel_mentions
|
||||
and arg not in str_mentions
|
||||
@@ -93,7 +93,7 @@ class Scanner(ABC):
|
||||
allowed_mentions=discord.AllowedMentions.none(),
|
||||
)
|
||||
total_msg, total_chan = await logs.load(
|
||||
progress, self.channels, fast="fast" in args
|
||||
progress, self.channels, fast="fast" in args, fresh="fresh" in args
|
||||
)
|
||||
if total_msg == CANCELLED:
|
||||
await message.channel.send(
|
||||
|
||||
@@ -12,6 +12,7 @@ COMMON_HELP_ARGS = (
|
||||
+ "* @member/me - filter for one or more member\n"
|
||||
+ "* #channel/here - filter for one or more channel\n"
|
||||
+ "* fast - only read cache\n"
|
||||
+ "* fresh - does not read cache (long)\n"
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user