Skip to content

Commit

Permalink
Fix localhost hardcode (#22)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
RealistikDash and pre-commit-ci[bot] authored Nov 10, 2024
1 parent fd71146 commit 40e4dc8
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 28 deletions.
3 changes: 2 additions & 1 deletion peppy/adapters/performance_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def __init__(
self._timeout = timeout

def __make_performance_request(
self, calculation_requests: list[PerformanceRequest],
self,
calculation_requests: list[PerformanceRequest],
) -> list[dict[str, Any]]:
respone = requests.post(
self._base_url + "/api/v1/calculate",
Expand Down
2 changes: 1 addition & 1 deletion peppy/common/ripple/userUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,7 @@ def silence(userID, seconds, silenceReason, author=None):
targetUsername,
seconds,
silenceReason,
)
),
)
else:
log.rap(author, f"has removed {targetUsername}'s silence", True)
Expand Down
18 changes: 12 additions & 6 deletions peppy/constants/fokabotCommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def getPPMessage(userID, just_data=False):
currentAcc = token.tillerino[2]

# Send request to LETS api
url = f"http://localhost:5002/api/v1/pp?b={currentMap}&m={currentMods}"
url = f"{settings.USSR_URL}/api/v1/pp?b={currentMap}&m={currentMods}"
if currentAcc != -1:
url += f"&a{currentAcc}"
resp = requests.get(url, timeout=10)
Expand Down Expand Up @@ -1159,8 +1159,9 @@ def report(fro, chan, message):
token.enqueue(serverPackets.notification(msg))
return False


@registerCommand(
"!mp pp",
"!mp pp",
)
def mpPPCompetition(fro, chan, message):
"""Automatically calculates every member's PP for scoring during the match."""
Expand All @@ -1175,14 +1176,17 @@ def mpPPCompetition(fro, chan, message):
return "Only the host can enable or disable PP competition."

_match.pp_competition = not _match.pp_competition
return f"PP competition has been {'enabled' if _match.pp_competition else 'disabled'}!"
return (
f"PP competition has been {'enabled' if _match.pp_competition else 'disabled'}!"
)


@registerCommand(
"!mp start",
"!mp start",
)
def mpStart(fro, chan, message):
"""Starts the match after an optional countdown."""

def _start():
matchID = getMatchIDFromChannel(chan)
success = glob.matches.matches[matchID].start()
Expand Down Expand Up @@ -1219,7 +1223,7 @@ def _decreaseTimer(t):
token = glob.tokens.getTokenFromUsername(fro)
if token is None:
return False

if _match.hostUserID != token.userID:
return "Only the host can start the match."

Expand Down Expand Up @@ -1249,6 +1253,7 @@ def _decreaseTimer(t):
"or you might receive a penalty."
)


@registerCommand(
trigger="!mp",
syntax="<subcommand>",
Expand Down Expand Up @@ -1851,7 +1856,8 @@ def bless(fro: str, chan: str, message: str) -> str:
"░░░░░░░░░░░░░░▀▄▄▄▄▄░░░░░░░░█░░\n"
)

NANAHIRA_COPYPASTA = "I really love Nanahira. Like, a lot. Like, a whole lot. You have no idea. I love her so much that it is inexplicable, and I'm ninety-nine percent sure that I have an unhealthy obsession. I will never get tired of listening that sweet, angelic voice of hers. It is my life goal to meet up her with her in real life and just say hello to her. I fall asleep at night dreaming of her holding a personal concert for me, and then she would be sorry tired that she comes and cuddles up to me while we sleep together. If I could just hold her hand for a brief moment, I could die happy. If given the opportunity, I would lightly nibble on her ear just to hear what kind of sweet moans she would let out. Then, I would hug her while she clings to my body hoping that I would stop, but I only continue as she moans louder and louder. I would give up almost anything just for her to look in my general direction. No matter what I do, I am constantly thinking of her. When I wake up, she is the first thing on my mind. When I go to school, I can only focus on her. When I go come home, I go on the computer so that I can listen to her beautiful voice. When I go to sleep, I dream of her and I living a happy life together. She is my pride, passion, and joy. If she were to call me \"Onii-chan,\" I would probably get diabetes from her sweetness and die. I wish for nothing but her happiness. If it were for her, I would give my life without any second thoughts. Without her, my life would serve no purpose. I really love Nanahira."
NANAHIRA_COPYPASTA = 'I really love Nanahira. Like, a lot. Like, a whole lot. You have no idea. I love her so much that it is inexplicable, and I\'m ninety-nine percent sure that I have an unhealthy obsession. I will never get tired of listening that sweet, angelic voice of hers. It is my life goal to meet up her with her in real life and just say hello to her. I fall asleep at night dreaming of her holding a personal concert for me, and then she would be sorry tired that she comes and cuddles up to me while we sleep together. If I could just hold her hand for a brief moment, I could die happy. If given the opportunity, I would lightly nibble on her ear just to hear what kind of sweet moans she would let out. Then, I would hug her while she clings to my body hoping that I would stop, but I only continue as she moans louder and louder. I would give up almost anything just for her to look in my general direction. No matter what I do, I am constantly thinking of her. When I wake up, she is the first thing on my mind. When I go to school, I can only focus on her. When I go come home, I go on the computer so that I can listen to her beautiful voice. When I go to sleep, I dream of her and I living a happy life together. She is my pride, passion, and joy. If she were to call me "Onii-chan," I would probably get diabetes from her sweetness and die. I wish for nothing but her happiness. If it were for her, I would give my life without any second thoughts. Without her, my life would serve no purpose. I really love Nanahira.'


@registerCommand(
trigger="!troll",
Expand Down
32 changes: 16 additions & 16 deletions peppy/constants/serverPackets.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,22 +379,22 @@ def match_all_skipped():


def match_frames(
time: int,
slot_id: int,
count_300: int,
count_100: int,
count_50: int,
count_geki: int,
count_katu: int,
count_miss: int,
total_score: int,
max_combo: int,
current_combo: int,
perfect: int,
current_hp: int,
tag_byte: int,
using_score_v2: int,
) -> bytes:
time: int,
slot_id: int,
count_300: int,
count_100: int,
count_50: int,
count_geki: int,
count_katu: int,
count_miss: int,
total_score: int,
max_combo: int,
current_combo: int,
perfect: int,
current_hp: int,
tag_byte: int,
using_score_v2: int,
) -> bytes:
return packetHelper.buildPacket(
packetIDs.server_matchScoreUpdate,
(
Expand Down
8 changes: 4 additions & 4 deletions peppy/logger.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from __future__ import annotations

from typing import Any
from typing import Optional

import logging
from pythonjsonlogger import jsonlogger
import os
import sys
import time
from enum import IntEnum
from typing import Any
from typing import Optional

from pythonjsonlogger import jsonlogger

DEBUG = "debug" in sys.argv
__all__ = (
Expand Down
1 change: 1 addition & 0 deletions peppy/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def _parse_int_list(value: str) -> list[int]:
REDIS_DB = int(os.environ["REDIS_DB"])

PERFORMANCE_SERVICE_URL = os.environ["PERFORMANCE_SERVICE_URL"]
USSR_URL = os.environ["USSR_URL"]

DISCORD_RANKED_WEBHOOK_URL = os.environ["DISCORD_RANKED_WEBHOOK_URL"]

Expand Down

0 comments on commit 40e4dc8

Please sign in to comment.