Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidWylie-ZUK committed Jan 4, 2024
1 parent 6f38d77 commit f3a7f11
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 22 deletions.
4 changes: 1 addition & 3 deletions roll_witch/dice_bot/event_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
class EventListenerClient(discord.Client):
def __init__(self):
intents: discord.Intents = discord.Intents(
messages=True,
guilds=True,
message_content=True
messages=True, guilds=True, message_content=True
)
super().__init__(intents=intents)

Expand Down
4 changes: 2 additions & 2 deletions roll_witch/rolling/command/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"!r-b": basic,
"!roll": token,
"!r": token,
"!sr": shadow_run
"!sr": shadow_run,
}


Expand All @@ -19,6 +19,6 @@ def get_command(message_content: str):
clean_command_string = clean_command(message_content)
for prefix, op_getter in operations.items():
if clean_command_string.startswith(prefix):
operation_input = clean_command_string[len(prefix):].lstrip()
operation_input = clean_command_string[len(prefix) :].lstrip()
return op_getter, operation_input
return None, message_content
8 changes: 2 additions & 6 deletions roll_witch/rolling/command/shadow_run.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from roll_witch.rolling.input import get_token_parser
from roll_witch.rolling.output import OperationOutputWriter
from roll_witch.rolling.roller import RollResult, RollSpec
from roll_witch.rolling.roller import (
StandardRoller
)
from roll_witch.rolling.roller import StandardRoller
from roll_witch.rolling.roller.operation_result import OperationResult


Expand Down Expand Up @@ -34,7 +32,5 @@ def get_spec(roll_string):
parser = get_token_parser()
roll_spec = parser.parse(roll_string)
if not roll_spec.target_number:
roll_spec.add_part(
RollSpec(target_number=5, operation=None)
)
roll_spec.add_part(RollSpec(target_number=5, operation=None))
return roll_spec
8 changes: 7 additions & 1 deletion roll_witch/rolling/roller/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,10 @@
from .spec import RollSpec
from .operation_result import OperationResult

__all__ = ["StandardRoller", "TargetedRoller", "RollResult", "OperationResult", "RollSpec"]
__all__ = [
"StandardRoller",
"TargetedRoller",
"RollResult",
"OperationResult",
"RollSpec",
]
18 changes: 8 additions & 10 deletions roll_witch/web_app/roller.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@
async def roll(request: Request):
data = await request.post()
try:
roll_operation = data['roll_operation']
if not(roll_operation.startswith('!r')):
roll_operation = data["roll_operation"]
if not (roll_operation.startswith("!r")):
roll_operation = f"!r {roll_operation}"

bot_operation, roll_string = command.get_command(
message_content=roll_operation
)
bot_operation, roll_string = command.get_command(message_content=roll_operation)
print(f"Roll Request: {roll_string}")
if bot_operation:
operation_output = bot_operation.execute(
roll_string=roll_string,
user='',
user="",
)
print(f"Output: {operation_output}")
return {
Expand All @@ -32,8 +30,8 @@ async def roll(request: Request):
return {
"output": {
"error": "Invalid Command",
"roll_request": data['roll_operation'],
"roll_result": "Error"
"roll_request": data["roll_operation"],
"roll_result": "Error",
}
}
except Exception as e:
Expand All @@ -44,7 +42,7 @@ async def roll(request: Request):
return {
"output": {
"error": msg,
"roll_request": data['roll_operation'],
"roll_result": "Error"
"roll_request": data["roll_operation"],
"roll_result": "Error",
}
}

0 comments on commit f3a7f11

Please sign in to comment.