mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 15:48:29 +02:00
Translate slash command
This commit is contained in:
parent
358f8693dd
commit
ef547a7090
10 changed files with 96 additions and 16 deletions
|
|
@ -5,7 +5,7 @@ from datetime import datetime
|
|||
from enum import Enum
|
||||
from functions.timeFormatters import fromString
|
||||
from functions.scrapers.sporza import getJPLMatches, getJPLTable
|
||||
from functions.stringFormatters import leadingZero
|
||||
from functions.stringFormatters import leading_zero
|
||||
import re
|
||||
from requests import get
|
||||
import tabulate
|
||||
|
|
@ -103,7 +103,7 @@ class Match:
|
|||
|
||||
# No score to show yet, show time when the match starts
|
||||
if not self._hasStarted():
|
||||
return "{}:{}".format(leadingZero(str(self.start.hour)), leadingZero(str(self.start.minute)))
|
||||
return "{}:{}".format(leading_zero(str(self.start.hour)), leading_zero(str(self.start.minute)))
|
||||
|
||||
return "{} - {}".format(self.homeScore, self.awayScore)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
def titleCase(string):
|
||||
def title_case(string):
|
||||
return " ".join(capitalize(word) for word in string.split(" "))
|
||||
|
||||
|
||||
|
|
@ -8,7 +8,7 @@ def capitalize(string):
|
|||
return string[0].upper()
|
||||
|
||||
|
||||
def leadingZero(string, size=2):
|
||||
def leading_zero(string, size=2):
|
||||
string = str(string)
|
||||
while len(string) < size:
|
||||
string = "0" + string
|
||||
|
|
|
|||
|
|
@ -161,14 +161,14 @@ def fromString(timeString: str, formatString="%d/%m/%Y", tzinfo=pytz.timezone("E
|
|||
|
||||
|
||||
def fromArray(data: List[int]) -> datetime:
|
||||
day = stringFormatters.leadingZero(str(data[0]))
|
||||
month = stringFormatters.leadingZero(str(data[1]))
|
||||
day = stringFormatters.leading_zero(str(data[0]))
|
||||
month = stringFormatters.leading_zero(str(data[1]))
|
||||
year = str(data[2])
|
||||
|
||||
if len(data) == 6:
|
||||
hour = stringFormatters.leadingZero(str(data[3]))
|
||||
minute = stringFormatters.leadingZero(str(data[4]))
|
||||
second = stringFormatters.leadingZero(str(data[5]))
|
||||
hour = stringFormatters.leading_zero(str(data[3]))
|
||||
minute = stringFormatters.leading_zero(str(data[4]))
|
||||
second = stringFormatters.leading_zero(str(data[5]))
|
||||
|
||||
return fromString(f"{day}/{month}/{year} {hour}:{minute}:{second}", formatString="%d/%m/%Y %H:%M:%S")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue