-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
3,619 additions
and
2,885 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from typing import Optional | ||
from enum import Enum | ||
|
||
|
||
class MessageType(Enum): | ||
UNKNOWN = 0 | ||
CLIENTS_STATUS = 1 | ||
CLIENTS_CONNECT = 2 | ||
SERVER_ID_REQUEST = 3 | ||
SERVER_ID_RESPONSE = 4 | ||
|
||
|
||
class Message: | ||
message_type: MessageType = MessageType.UNKNOWN | ||
payload: Optional[object] | ||
|
||
def __init__(self, message_type: MessageType, payload: Optional[object] = None): | ||
self.message_type = message_type | ||
self.payload = payload | ||
|
||
|
||
class MessageConSatus: | ||
steam: str | ||
dota: str | ||
|
||
def __init__(self, steam: str, dota: str): | ||
self.steam = steam | ||
self.dota = dota | ||
|
||
|
||
class MessageServerIdRequest: | ||
account_id: str | ||
|
||
def __init__(self, account_id: str): | ||
self.account_id = account_id | ||
|
||
|
||
class MessageServerIdResponse: | ||
server_id: int | ||
|
||
def __init__(self, server_id: int): | ||
self.server_id = server_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from dota_notes.data.database import Setting | ||
|
||
|
||
class Settings: | ||
|
||
gsi_port: int = 58765 | ||
software_mode: str = "Client" | ||
proxy_url: str = "https://dota-notes.the-cluster.org" | ||
proxy_api_key: str = "" | ||
steam_user: str = "" | ||
steam_password: str = "" | ||
steam_api_key: str = "" | ||
|
||
TO_IMPORT_EXPORT = ["software_mode", "proxy_url", "proxy_api_key", "steam_user", "steam_password", "steam_api_key"] | ||
|
||
def import_from_database(self, session): | ||
|
||
for at in self.TO_IMPORT_EXPORT: | ||
row = session.get(Setting, at) | ||
if row is not None: | ||
setattr(self, at, row.value) | ||
else: | ||
session.add(Setting(at, getattr(self, at))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.