Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Input stream detective for builtin command (Sourcery refactored) #77

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/plugins/HydroRoll/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async def handle(self) -> None:
if cmd.startswith(current_cmd):
if current_cmd != cmd:
flag = True
elif current_cmd == cmd:
else:
HsiangNianian marked this conversation as resolved.
Show resolved Hide resolved
await self.event.reply(f"{cmd}")
flag = False
except GetEventTimeout:
Expand Down
17 changes: 6 additions & 11 deletions example/plugins/HydroRoll/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ async def rule(self) -> bool:
or self.event.group_id in self.config.accept_group
):
return self.str_match(match_str)
elif self.config.handle_group_message:
if self.event.message_type == "guild":
return self.str_match(match_str)
HsiangNianian marked this conversation as resolved.
Show resolved Hide resolved
return False

@abstractmethod
Expand Down Expand Up @@ -153,14 +150,12 @@ def roll_dice(

if streamline:
return str(total)
else:
if len(rolls) > int(threshold):
return str(total)
rolls_str = " + ".join(str(r) for r in rolls)
result_str = (
f"{total} = {rolls_str}" if is_reversed else f"{rolls_str} = {total}"
)
return result_str
if len(rolls) > int(threshold):
return str(total)
rolls_str = " + ".join(str(r) for r in rolls)
return (
f"{total} = {rolls_str}" if is_reversed else f"{rolls_str} = {total}"
)
HsiangNianian marked this conversation as resolved.
Show resolved Hide resolved


def find_max_similarity(input_string, string_list):
Expand Down
Loading