From 93255783776135013c5ee8b9cb3d642fd05c6140 Mon Sep 17 00:00:00 2001 From: Nyo Date: Wed, 18 May 2016 19:12:46 +0200 Subject: [PATCH] .BANCHO. pep.py modules --- .../clientPackets.py | 6 +- dataTypes.py => constants/dataTypes.py | 0 exceptions.py => constants/exceptions.py | 0 .../fokabotCommands.py | 12 +-- gameModes.py => constants/gameModes.py | 0 .../matchModModes.py | 0 .../matchScoringTypes.py | 0 .../matchTeamTypes.py | 0 matchTeams.py => constants/matchTeams.py | 0 .../messageTemplates.py | 0 packetIDs.py => constants/packetIDs.py | 0 .../serverPackets.py | 16 +-- slotStatuses.py => constants/slotStatuses.py | 0 userRanks.py => constants/userRanks.py | 0 .../cantSpectateEvent.py | 6 +- .../changeActionEvent.py | 8 +- .../changeMatchModsEvent.py | 6 +- .../changeMatchPasswordEvent.py | 4 +- .../changeMatchSettingsEvent.py | 12 +-- .../changeSlotEvent.py | 4 +- .../channelJoinEvent.py | 8 +- .../channelPartEvent.py | 6 +- .../createMatchEvent.py | 10 +- friendAddEvent.py => events/friendAddEvent.py | 4 +- .../friendRemoveEvent.py | 4 +- joinLobbyEvent.py => events/joinLobbyEvent.py | 4 +- joinMatchEvent.py => events/joinMatchEvent.py | 8 +- loginEvent.py => events/loginEvent.py | 16 +-- logoutEvent.py => events/logoutEvent.py | 4 +- .../matchBeatmapEvent.py | 2 +- .../matchChangeTeamEvent.py | 2 +- .../matchCompleteEvent.py | 2 +- .../matchFailedEvent.py | 2 +- .../matchFramesEvent.py | 6 +- .../matchHasBeatmapEvent.py | 2 +- .../matchInviteEvent.py | 4 +- matchLockEvent.py => events/matchLockEvent.py | 4 +- .../matchNoBeatmapEvent.py | 2 +- .../matchPlayerLoadEvent.py | 2 +- .../matchReadyEvent.py | 2 +- matchSkipEvent.py => events/matchSkipEvent.py | 2 +- .../matchStartEvent.py | 6 +- .../matchTransferHostEvent.py | 4 +- partLobbyEvent.py => events/partLobbyEvent.py | 4 +- partMatchEvent.py => events/partMatchEvent.py | 4 +- .../sendPrivateMessageEvent.py | 12 +-- .../sendPublicMessageEvent.py | 10 +- .../setAwayMessageEvent.py | 4 +- .../spectateFramesEvent.py | 6 +- .../startSpectatingEvent.py | 10 +- .../stopSpectatingEvent.py | 6 +- routes.py => handlers/routes.py | 4 +- config.py => helpers/configHelper.py | 0 helpers/consoleHelper.py | 2 +- countryHelper.py => helpers/countryHelper.py | 0 crypt.py => helpers/cryptHelper.py | 0 .../databaseHelper.py | 2 +- .../generalFunctions.py | 0 .../locationHelper.py | 0 packetHelper.py => helpers/packetHelper.py | 2 +- .../passwordHelper.py | 10 +- .../responseHelper.py | 0 systemHelper.py => helpers/systemHelper.py | 4 +- userHelper.py => helpers/userHelper.py | 8 +- banchoConfig.py => objects/banchoConfig.py | 4 +- channel.py => objects/channel.py | 0 channelList.py => objects/channelList.py | 4 +- fokabot.py => objects/fokabot.py | 8 +- glob.py => objects/glob.py | 6 +- match.py => objects/match.py | 18 ++-- matchList.py => objects/matchList.py | 6 +- osuToken.py => objects/osuToken.py | 8 +- tokenList.py => objects/tokenList.py | 4 +- pep.py | 98 +++++++++---------- 74 files changed, 212 insertions(+), 212 deletions(-) rename clientPackets.py => constants/clientPackets.py (97%) rename dataTypes.py => constants/dataTypes.py (100%) rename exceptions.py => constants/exceptions.py (100%) rename fokabotCommands.py => constants/fokabotCommands.py (98%) rename gameModes.py => constants/gameModes.py (100%) rename matchModModes.py => constants/matchModModes.py (100%) rename matchScoringTypes.py => constants/matchScoringTypes.py (100%) rename matchTeamTypes.py => constants/matchTeamTypes.py (100%) rename matchTeams.py => constants/matchTeams.py (100%) rename messageTemplates.py => constants/messageTemplates.py (100%) rename packetIDs.py => constants/packetIDs.py (100%) rename serverPackets.py => constants/serverPackets.py (97%) rename slotStatuses.py => constants/slotStatuses.py (100%) rename userRanks.py => constants/userRanks.py (100%) rename cantSpectateEvent.py => events/cantSpectateEvent.py (86%) rename changeActionEvent.py => events/changeActionEvent.py (88%) rename changeMatchModsEvent.py => events/changeMatchModsEvent.py (92%) rename changeMatchPasswordEvent.py => events/changeMatchPasswordEvent.py (86%) rename changeMatchSettingsEvent.py => events/changeMatchSettingsEvent.py (93%) rename changeSlotEvent.py => events/changeSlotEvent.py (86%) rename channelJoinEvent.py => events/channelJoinEvent.py (93%) rename channelPartEvent.py => events/channelPartEvent.py (91%) rename createMatchEvent.py => events/createMatchEvent.py (88%) rename friendAddEvent.py => events/friendAddEvent.py (81%) rename friendRemoveEvent.py => events/friendRemoveEvent.py (82%) rename joinLobbyEvent.py => events/joinLobbyEvent.py (88%) rename joinMatchEvent.py => events/joinMatchEvent.py (94%) rename loginEvent.py => events/loginEvent.py (96%) rename logoutEvent.py => events/logoutEvent.py (95%) rename matchBeatmapEvent.py => events/matchBeatmapEvent.py (94%) rename matchChangeTeamEvent.py => events/matchChangeTeamEvent.py (93%) rename matchCompleteEvent.py => events/matchCompleteEvent.py (94%) rename matchFailedEvent.py => events/matchFailedEvent.py (93%) rename matchFramesEvent.py => events/matchFramesEvent.py (90%) rename matchHasBeatmapEvent.py => events/matchHasBeatmapEvent.py (70%) rename matchInviteEvent.py => events/matchInviteEvent.py (88%) rename matchLockEvent.py => events/matchLockEvent.py (88%) rename matchNoBeatmapEvent.py => events/matchNoBeatmapEvent.py (71%) rename matchPlayerLoadEvent.py => events/matchPlayerLoadEvent.py (94%) rename matchReadyEvent.py => events/matchReadyEvent.py (93%) rename matchSkipEvent.py => events/matchSkipEvent.py (94%) rename matchStartEvent.py => events/matchStartEvent.py (92%) rename matchTransferHostEvent.py => events/matchTransferHostEvent.py (87%) rename partLobbyEvent.py => events/partLobbyEvent.py (87%) rename partMatchEvent.py => events/partMatchEvent.py (89%) rename sendPrivateMessageEvent.py => events/sendPrivateMessageEvent.py (90%) rename sendPublicMessageEvent.py => events/sendPublicMessageEvent.py (95%) rename setAwayMessageEvent.py => events/setAwayMessageEvent.py (89%) rename spectateFramesEvent.py => events/spectateFramesEvent.py (91%) rename startSpectatingEvent.py => events/startSpectatingEvent.py (91%) rename stopSpectatingEvent.py => events/stopSpectatingEvent.py (91%) rename routes.py => handlers/routes.py (95%) rename config.py => helpers/configHelper.py (100%) rename countryHelper.py => helpers/countryHelper.py (100%) rename crypt.py => helpers/cryptHelper.py (100%) rename databaseHelper.py => helpers/databaseHelper.py (99%) rename generalFunctions.py => helpers/generalFunctions.py (100%) rename locationHelper.py => helpers/locationHelper.py (100%) rename packetHelper.py => helpers/packetHelper.py (99%) rename passwordHelper.py => helpers/passwordHelper.py (81%) rename responseHelper.py => helpers/responseHelper.py (100%) rename systemHelper.py => helpers/systemHelper.py (97%) rename userHelper.py => helpers/userHelper.py (98%) rename banchoConfig.py => objects/banchoConfig.py (96%) rename channel.py => objects/channel.py (100%) rename channelList.py => objects/channelList.py (95%) rename fokabot.py => objects/fokabot.py (91%) rename glob.py => objects/glob.py (71%) rename match.py => objects/match.py (98%) rename matchList.py => objects/matchList.py (95%) rename osuToken.py => objects/osuToken.py (97%) rename tokenList.py => objects/tokenList.py (98%) diff --git a/clientPackets.py b/constants/clientPackets.py similarity index 97% rename from clientPackets.py rename to constants/clientPackets.py index 734cf1f..d6604a4 100644 --- a/clientPackets.py +++ b/constants/clientPackets.py @@ -1,7 +1,7 @@ """ Contains functions used to read specific client packets from byte stream """ -import dataTypes -import packetHelper -import slotStatuses +from constants import dataTypes +from helpers import packetHelper +from constants import slotStatuses """ General packets """ diff --git a/dataTypes.py b/constants/dataTypes.py similarity index 100% rename from dataTypes.py rename to constants/dataTypes.py diff --git a/exceptions.py b/constants/exceptions.py similarity index 100% rename from exceptions.py rename to constants/exceptions.py diff --git a/fokabotCommands.py b/constants/fokabotCommands.py similarity index 98% rename from fokabotCommands.py rename to constants/fokabotCommands.py index 3cedc7a..ec052fc 100644 --- a/fokabotCommands.py +++ b/constants/fokabotCommands.py @@ -1,11 +1,11 @@ -import fokabot +from objects import fokabot import random -import glob -import serverPackets -import exceptions -import userHelper +from objects import glob +from constants import serverPackets +from constants import exceptions +from helpers import userHelper import time -import systemHelper +from helpers import systemHelper """ Commands callbacks diff --git a/gameModes.py b/constants/gameModes.py similarity index 100% rename from gameModes.py rename to constants/gameModes.py diff --git a/matchModModes.py b/constants/matchModModes.py similarity index 100% rename from matchModModes.py rename to constants/matchModModes.py diff --git a/matchScoringTypes.py b/constants/matchScoringTypes.py similarity index 100% rename from matchScoringTypes.py rename to constants/matchScoringTypes.py diff --git a/matchTeamTypes.py b/constants/matchTeamTypes.py similarity index 100% rename from matchTeamTypes.py rename to constants/matchTeamTypes.py diff --git a/matchTeams.py b/constants/matchTeams.py similarity index 100% rename from matchTeams.py rename to constants/matchTeams.py diff --git a/messageTemplates.py b/constants/messageTemplates.py similarity index 100% rename from messageTemplates.py rename to constants/messageTemplates.py diff --git a/packetIDs.py b/constants/packetIDs.py similarity index 100% rename from packetIDs.py rename to constants/packetIDs.py diff --git a/serverPackets.py b/constants/serverPackets.py similarity index 97% rename from serverPackets.py rename to constants/serverPackets.py index 017d226..3a069be 100644 --- a/serverPackets.py +++ b/constants/serverPackets.py @@ -1,12 +1,12 @@ """ Contains functions used to write specific server packets to byte streams """ -import packetHelper -import dataTypes -import userHelper -import glob -import userRanks -import packetIDs -import slotStatuses -import matchModModes +from helpers import packetHelper +from constants import dataTypes +from helpers import userHelper +from objects import glob +from constants import userRanks +from constants import packetIDs +from constants import slotStatuses +from constants import matchModModes import random """ Login errors packets diff --git a/slotStatuses.py b/constants/slotStatuses.py similarity index 100% rename from slotStatuses.py rename to constants/slotStatuses.py diff --git a/userRanks.py b/constants/userRanks.py similarity index 100% rename from userRanks.py rename to constants/userRanks.py diff --git a/cantSpectateEvent.py b/events/cantSpectateEvent.py similarity index 86% rename from cantSpectateEvent.py rename to events/cantSpectateEvent.py index 0b9abc5..8cc0000 100644 --- a/cantSpectateEvent.py +++ b/events/cantSpectateEvent.py @@ -1,8 +1,8 @@ -import glob -import serverPackets +from objects import glob +from constants import serverPackets from helpers import consoleHelper from constants import bcolors -import exceptions +from constants import exceptions def handle(userToken, packetData): # get usertoken data diff --git a/changeActionEvent.py b/events/changeActionEvent.py similarity index 88% rename from changeActionEvent.py rename to events/changeActionEvent.py index 93abab6..61dbf2b 100644 --- a/changeActionEvent.py +++ b/events/changeActionEvent.py @@ -1,8 +1,8 @@ -import glob -import clientPackets -import serverPackets +from objects import glob +from constants import clientPackets +from constants import serverPackets from constants import actions -import userHelper +from helpers import userHelper def handle(userToken, packetData): # Get usertoken data diff --git a/changeMatchModsEvent.py b/events/changeMatchModsEvent.py similarity index 92% rename from changeMatchModsEvent.py rename to events/changeMatchModsEvent.py index b2d1535..3f63d88 100644 --- a/changeMatchModsEvent.py +++ b/events/changeMatchModsEvent.py @@ -1,6 +1,6 @@ -import glob -import clientPackets -import matchModModes +from objects import glob +from constants import clientPackets +from constants import matchModModes from constants import mods def handle(userToken, packetData): diff --git a/changeMatchPasswordEvent.py b/events/changeMatchPasswordEvent.py similarity index 86% rename from changeMatchPasswordEvent.py rename to events/changeMatchPasswordEvent.py index 210d50f..b7bac73 100644 --- a/changeMatchPasswordEvent.py +++ b/events/changeMatchPasswordEvent.py @@ -1,5 +1,5 @@ -import clientPackets -import glob +from constants import clientPackets +from objects import glob def handle(userToken, packetData): # Read packet data. Same structure as changeMatchSettings diff --git a/changeMatchSettingsEvent.py b/events/changeMatchSettingsEvent.py similarity index 93% rename from changeMatchSettingsEvent.py rename to events/changeMatchSettingsEvent.py index d67b7ee..cdd878f 100644 --- a/changeMatchSettingsEvent.py +++ b/events/changeMatchSettingsEvent.py @@ -1,12 +1,12 @@ -import glob -import clientPackets -import matchModModes +from objects import glob +from constants import clientPackets +from constants import matchModModes from helpers import consoleHelper from constants import bcolors import random -import matchTeamTypes -import matchTeams -import slotStatuses +from constants import matchTeamTypes +from constants import matchTeams +from constants import slotStatuses def handle(userToken, packetData): # Read new settings diff --git a/changeSlotEvent.py b/events/changeSlotEvent.py similarity index 86% rename from changeSlotEvent.py rename to events/changeSlotEvent.py index c1a7932..974a4a0 100644 --- a/changeSlotEvent.py +++ b/events/changeSlotEvent.py @@ -1,5 +1,5 @@ -import clientPackets -import glob +from constants import clientPackets +from objects import glob from helpers import consoleHelper from constants import bcolors diff --git a/channelJoinEvent.py b/events/channelJoinEvent.py similarity index 93% rename from channelJoinEvent.py rename to events/channelJoinEvent.py index 6ada57d..75df808 100644 --- a/channelJoinEvent.py +++ b/events/channelJoinEvent.py @@ -2,12 +2,12 @@ Event called when someone joins a channel """ -import clientPackets +from constants import clientPackets from helpers import consoleHelper from constants import bcolors -import serverPackets -import glob -import exceptions +from constants import serverPackets +from objects import glob +from constants import exceptions def handle(userToken, packetData): # Channel join packet diff --git a/channelPartEvent.py b/events/channelPartEvent.py similarity index 91% rename from channelPartEvent.py rename to events/channelPartEvent.py index 849b939..71b645a 100644 --- a/channelPartEvent.py +++ b/events/channelPartEvent.py @@ -4,9 +4,9 @@ Event called when someone parts a channel from helpers import consoleHelper from constants import bcolors -import glob -import clientPackets -import serverPackets +from objects import glob +from constants import clientPackets +from constants import serverPackets def handle(userToken, packetData): # Channel part packet diff --git a/createMatchEvent.py b/events/createMatchEvent.py similarity index 88% rename from createMatchEvent.py rename to events/createMatchEvent.py index e27ebc1..d941472 100644 --- a/createMatchEvent.py +++ b/events/createMatchEvent.py @@ -1,10 +1,10 @@ -import serverPackets -import clientPackets -import glob +from constants import serverPackets +from constants import clientPackets +from objects import glob from helpers import consoleHelper from constants import bcolors -import joinMatchEvent -import exceptions +from events import joinMatchEvent +from constants import exceptions def handle(userToken, packetData): try: diff --git a/friendAddEvent.py b/events/friendAddEvent.py similarity index 81% rename from friendAddEvent.py rename to events/friendAddEvent.py index 9ccf5dd..3ca7919 100644 --- a/friendAddEvent.py +++ b/events/friendAddEvent.py @@ -1,5 +1,5 @@ -import userHelper -import clientPackets +from helpers import userHelper +from constants import clientPackets def handle(userToken, packetData): # Friend add packet diff --git a/friendRemoveEvent.py b/events/friendRemoveEvent.py similarity index 82% rename from friendRemoveEvent.py rename to events/friendRemoveEvent.py index 450d369..b7e794d 100644 --- a/friendRemoveEvent.py +++ b/events/friendRemoveEvent.py @@ -1,5 +1,5 @@ -import userHelper -import clientPackets +from helpers import userHelper +from constants import clientPackets def handle(userToken, packetData): # Friend remove packet diff --git a/joinLobbyEvent.py b/events/joinLobbyEvent.py similarity index 88% rename from joinLobbyEvent.py rename to events/joinLobbyEvent.py index fef37d2..91c3521 100644 --- a/joinLobbyEvent.py +++ b/events/joinLobbyEvent.py @@ -1,5 +1,5 @@ -import serverPackets -import glob +from constants import serverPackets +from objects import glob from helpers import consoleHelper from constants import bcolors diff --git a/joinMatchEvent.py b/events/joinMatchEvent.py similarity index 94% rename from joinMatchEvent.py rename to events/joinMatchEvent.py index d242b52..8075ef9 100644 --- a/joinMatchEvent.py +++ b/events/joinMatchEvent.py @@ -1,9 +1,9 @@ -import clientPackets -import serverPackets -import glob +from constants import clientPackets +from constants import serverPackets +from objects import glob from helpers import consoleHelper from constants import bcolors -import exceptions +from constants import exceptions def handle(userToken, packetData): # read packet data diff --git a/loginEvent.py b/events/loginEvent.py similarity index 96% rename from loginEvent.py rename to events/loginEvent.py index 0d08d76..6f36cfd 100644 --- a/loginEvent.py +++ b/events/loginEvent.py @@ -1,14 +1,14 @@ -import userHelper -import serverPackets -import exceptions -import glob +from helpers import userHelper +from constants import serverPackets +from constants import exceptions +from objects import glob from helpers import consoleHelper from constants import bcolors -import locationHelper -import countryHelper +from helpers import locationHelper +from helpers import countryHelper import time -import generalFunctions -import channelJoinEvent +from helpers import generalFunctions +from events import channelJoinEvent import sys import traceback diff --git a/logoutEvent.py b/events/logoutEvent.py similarity index 95% rename from logoutEvent.py rename to events/logoutEvent.py index 43f991a..c53fdd3 100644 --- a/logoutEvent.py +++ b/events/logoutEvent.py @@ -1,7 +1,7 @@ -import glob +from objects import glob from helpers import consoleHelper from constants import bcolors -import serverPackets +from constants import serverPackets import time def handle(userToken, _): diff --git a/matchBeatmapEvent.py b/events/matchBeatmapEvent.py similarity index 94% rename from matchBeatmapEvent.py rename to events/matchBeatmapEvent.py index 06ddd0b..7ad0445 100644 --- a/matchBeatmapEvent.py +++ b/events/matchBeatmapEvent.py @@ -1,4 +1,4 @@ -import glob +from objects import glob def handle(userToken, packetData, has): # Get usertoken data diff --git a/matchChangeTeamEvent.py b/events/matchChangeTeamEvent.py similarity index 93% rename from matchChangeTeamEvent.py rename to events/matchChangeTeamEvent.py index 915c30e..010bc8e 100644 --- a/matchChangeTeamEvent.py +++ b/events/matchChangeTeamEvent.py @@ -1,4 +1,4 @@ -import glob +from objects import glob def handle(userToken, _): # Read token data diff --git a/matchCompleteEvent.py b/events/matchCompleteEvent.py similarity index 94% rename from matchCompleteEvent.py rename to events/matchCompleteEvent.py index 0a45e18..c488a30 100644 --- a/matchCompleteEvent.py +++ b/events/matchCompleteEvent.py @@ -1,4 +1,4 @@ -import glob +from objects import glob def handle(userToken, packetData): # Get usertoken data diff --git a/matchFailedEvent.py b/events/matchFailedEvent.py similarity index 93% rename from matchFailedEvent.py rename to events/matchFailedEvent.py index b040ad7..d9b01c7 100644 --- a/matchFailedEvent.py +++ b/events/matchFailedEvent.py @@ -1,4 +1,4 @@ -import glob +from objects import glob def handle(userToken, _): # Get usertoken data diff --git a/matchFramesEvent.py b/events/matchFramesEvent.py similarity index 90% rename from matchFramesEvent.py rename to events/matchFramesEvent.py index 50a9ca1..9665e91 100644 --- a/matchFramesEvent.py +++ b/events/matchFramesEvent.py @@ -1,6 +1,6 @@ -import glob -import slotStatuses -import serverPackets +from objects import glob +from constants import slotStatuses +from constants import serverPackets def handle(userToken, packetData): # Get usertoken data diff --git a/matchHasBeatmapEvent.py b/events/matchHasBeatmapEvent.py similarity index 70% rename from matchHasBeatmapEvent.py rename to events/matchHasBeatmapEvent.py index 118afb2..7bf4490 100644 --- a/matchHasBeatmapEvent.py +++ b/events/matchHasBeatmapEvent.py @@ -1,3 +1,3 @@ -import matchBeatmapEvent +from events import matchBeatmapEvent def handle(userToken, packetData): matchBeatmapEvent.handle(userToken, packetData, True) diff --git a/matchInviteEvent.py b/events/matchInviteEvent.py similarity index 88% rename from matchInviteEvent.py rename to events/matchInviteEvent.py index f27ccaa..532b943 100644 --- a/matchInviteEvent.py +++ b/events/matchInviteEvent.py @@ -1,5 +1,5 @@ -import clientPackets -import glob +from constants import clientPackets +from objects import glob def handle(userToken, packetData): # Read token and packet data diff --git a/matchLockEvent.py b/events/matchLockEvent.py similarity index 88% rename from matchLockEvent.py rename to events/matchLockEvent.py index 4041b2e..e25daca 100644 --- a/matchLockEvent.py +++ b/events/matchLockEvent.py @@ -1,5 +1,5 @@ -import glob -import clientPackets +from objects import glob +from constants import clientPackets def handle(userToken, packetData): # Get token data diff --git a/matchNoBeatmapEvent.py b/events/matchNoBeatmapEvent.py similarity index 71% rename from matchNoBeatmapEvent.py rename to events/matchNoBeatmapEvent.py index efbff0d..d0c3ff7 100644 --- a/matchNoBeatmapEvent.py +++ b/events/matchNoBeatmapEvent.py @@ -1,3 +1,3 @@ -import matchBeatmapEvent +from events import matchBeatmapEvent def handle(userToken, packetData): matchBeatmapEvent.handle(userToken, packetData, False) diff --git a/matchPlayerLoadEvent.py b/events/matchPlayerLoadEvent.py similarity index 94% rename from matchPlayerLoadEvent.py rename to events/matchPlayerLoadEvent.py index 449a56b..a94186f 100644 --- a/matchPlayerLoadEvent.py +++ b/events/matchPlayerLoadEvent.py @@ -1,4 +1,4 @@ -import glob +from objects import glob def handle(userToken, packetData): # Get userToken data diff --git a/matchReadyEvent.py b/events/matchReadyEvent.py similarity index 93% rename from matchReadyEvent.py rename to events/matchReadyEvent.py index 7ac992a..77d743d 100644 --- a/matchReadyEvent.py +++ b/events/matchReadyEvent.py @@ -1,4 +1,4 @@ -import glob +from objects import glob def handle(userToken, _): # Get usertoken data diff --git a/matchSkipEvent.py b/events/matchSkipEvent.py similarity index 94% rename from matchSkipEvent.py rename to events/matchSkipEvent.py index c06f114..809063f 100644 --- a/matchSkipEvent.py +++ b/events/matchSkipEvent.py @@ -1,4 +1,4 @@ -import glob +from objects import glob def handle(userToken, packetData): # Get userToken data diff --git a/matchStartEvent.py b/events/matchStartEvent.py similarity index 92% rename from matchStartEvent.py rename to events/matchStartEvent.py index b294229..73ba781 100644 --- a/matchStartEvent.py +++ b/events/matchStartEvent.py @@ -1,6 +1,6 @@ -import glob -import slotStatuses -import serverPackets +from objects import glob +from constants import slotStatuses +from constants import serverPackets def handle(userToken, _): # TODO: Host check diff --git a/matchTransferHostEvent.py b/events/matchTransferHostEvent.py similarity index 87% rename from matchTransferHostEvent.py rename to events/matchTransferHostEvent.py index 4dff540..b7bc300 100644 --- a/matchTransferHostEvent.py +++ b/events/matchTransferHostEvent.py @@ -1,5 +1,5 @@ -import glob -import clientPackets +from objects import glob +from constants import clientPackets def handle(userToken, packetData): # Get packet data diff --git a/partLobbyEvent.py b/events/partLobbyEvent.py similarity index 87% rename from partLobbyEvent.py rename to events/partLobbyEvent.py index a9f2273..d2a45d2 100644 --- a/partLobbyEvent.py +++ b/events/partLobbyEvent.py @@ -1,5 +1,5 @@ -import glob -import channelPartEvent +from objects import glob +from events import channelPartEvent from helpers import consoleHelper from constants import bcolors diff --git a/partMatchEvent.py b/events/partMatchEvent.py similarity index 89% rename from partMatchEvent.py rename to events/partMatchEvent.py index b8b3122..e02036b 100644 --- a/partMatchEvent.py +++ b/events/partMatchEvent.py @@ -1,5 +1,5 @@ -import glob -import serverPackets +from objects import glob +from constants import serverPackets def handle(userToken, _): # get data from usertoken diff --git a/sendPrivateMessageEvent.py b/events/sendPrivateMessageEvent.py similarity index 90% rename from sendPrivateMessageEvent.py rename to events/sendPrivateMessageEvent.py index 46a244a..58082cf 100644 --- a/sendPrivateMessageEvent.py +++ b/events/sendPrivateMessageEvent.py @@ -1,11 +1,11 @@ from helpers import consoleHelper from constants import bcolors -import clientPackets -import serverPackets -import glob -import fokabot -import exceptions -import messageTemplates +from constants import clientPackets +from constants import serverPackets +from objects import glob +from objects import fokabot +from constants import exceptions +from constants import messageTemplates def handle(userToken, packetData): """ diff --git a/sendPublicMessageEvent.py b/events/sendPublicMessageEvent.py similarity index 95% rename from sendPublicMessageEvent.py rename to events/sendPublicMessageEvent.py index c7111e7..6938c23 100644 --- a/sendPublicMessageEvent.py +++ b/events/sendPublicMessageEvent.py @@ -1,10 +1,10 @@ -import exceptions -import clientPackets -import glob -import fokabot +from constants import exceptions +from constants import clientPackets +from objects import glob +from objects import fokabot from helpers import consoleHelper from constants import bcolors -import serverPackets +from constants import serverPackets def handle(userToken, packetData): """ diff --git a/setAwayMessageEvent.py b/events/setAwayMessageEvent.py similarity index 89% rename from setAwayMessageEvent.py rename to events/setAwayMessageEvent.py index 76e8f2a..e4918c4 100644 --- a/setAwayMessageEvent.py +++ b/events/setAwayMessageEvent.py @@ -1,5 +1,5 @@ -import clientPackets -import serverPackets +from constants import clientPackets +from constants import serverPackets def handle(userToken, packetData): # get token data diff --git a/spectateFramesEvent.py b/events/spectateFramesEvent.py similarity index 91% rename from spectateFramesEvent.py rename to events/spectateFramesEvent.py index 6a6b2bf..2d9cb4b 100644 --- a/spectateFramesEvent.py +++ b/events/spectateFramesEvent.py @@ -1,8 +1,8 @@ -import glob +from objects import glob from helpers import consoleHelper from constants import bcolors -import serverPackets -import exceptions +from constants import serverPackets +from constants import exceptions def handle(userToken, packetData): # get token data diff --git a/startSpectatingEvent.py b/events/startSpectatingEvent.py similarity index 91% rename from startSpectatingEvent.py rename to events/startSpectatingEvent.py index d6eaf41..b7e7699 100644 --- a/startSpectatingEvent.py +++ b/events/startSpectatingEvent.py @@ -1,10 +1,10 @@ from helpers import consoleHelper from constants import bcolors -import clientPackets -import serverPackets -import exceptions -import glob -import userHelper +from constants import clientPackets +from constants import serverPackets +from constants import exceptions +from objects import glob +from helpers import userHelper def handle(userToken, packetData): try: diff --git a/stopSpectatingEvent.py b/events/stopSpectatingEvent.py similarity index 91% rename from stopSpectatingEvent.py rename to events/stopSpectatingEvent.py index e558d39..907ce6d 100644 --- a/stopSpectatingEvent.py +++ b/events/stopSpectatingEvent.py @@ -1,8 +1,8 @@ from helpers import consoleHelper from constants import bcolors -import glob -import serverPackets -import exceptions +from objects import glob +from constants import serverPackets +from constants import exceptions def handle(userToken, _): try: diff --git a/routes.py b/handlers/routes.py similarity index 95% rename from routes.py rename to handlers/routes.py index b10df9a..753d427 100644 --- a/routes.py +++ b/handlers/routes.py @@ -3,8 +3,8 @@ WIP feature that will come in the future. Don't import """ import flask -import glob -import exceptions +from objects import glob +from constants import exceptions @app.route("/api/online-users-count") def APIonlineUsersCount(): diff --git a/config.py b/helpers/configHelper.py similarity index 100% rename from config.py rename to helpers/configHelper.py diff --git a/helpers/consoleHelper.py b/helpers/consoleHelper.py index 6195b89..6b781c7 100644 --- a/helpers/consoleHelper.py +++ b/helpers/consoleHelper.py @@ -1,7 +1,7 @@ """Some console related functions""" from constants import bcolors -import glob +from objects import glob def printServerStartHeader(asciiArt): """Print server start header with optional ascii art diff --git a/countryHelper.py b/helpers/countryHelper.py similarity index 100% rename from countryHelper.py rename to helpers/countryHelper.py diff --git a/crypt.py b/helpers/cryptHelper.py similarity index 100% rename from crypt.py rename to helpers/cryptHelper.py diff --git a/databaseHelper.py b/helpers/databaseHelper.py similarity index 99% rename from databaseHelper.py rename to helpers/databaseHelper.py index 43e6a95..518086f 100644 --- a/databaseHelper.py +++ b/helpers/databaseHelper.py @@ -2,7 +2,7 @@ import pymysql from constants import bcolors from helpers import consoleHelper import threading -import glob +from objects import glob class db: """A MySQL database connection""" diff --git a/generalFunctions.py b/helpers/generalFunctions.py similarity index 100% rename from generalFunctions.py rename to helpers/generalFunctions.py diff --git a/locationHelper.py b/helpers/locationHelper.py similarity index 100% rename from locationHelper.py rename to helpers/locationHelper.py diff --git a/packetHelper.py b/helpers/packetHelper.py similarity index 99% rename from packetHelper.py rename to helpers/packetHelper.py index c86e8f3..42f085d 100644 --- a/packetHelper.py +++ b/helpers/packetHelper.py @@ -1,5 +1,5 @@ import struct -import dataTypes +from constants import dataTypes def uleb128Encode(num): """ diff --git a/passwordHelper.py b/helpers/passwordHelper.py similarity index 81% rename from passwordHelper.py rename to helpers/passwordHelper.py index 8523899..13aa68d 100644 --- a/passwordHelper.py +++ b/helpers/passwordHelper.py @@ -1,4 +1,4 @@ -import crypt +from helpers import cryptHelper import base64 import bcrypt @@ -12,24 +12,24 @@ def checkOldPassword(password, salt, rightPassword): return -- bool """ - return (rightPassword == crypt.crypt(password, "$2y$"+str(base64.b64decode(salt)))) + return (rightPassword == cryptHelper.crypt(password, "$2y$"+str(base64.b64decode(salt)))) def checkNewPassword(password, dbPassword): """ Check if a password (version 2) is right. - + password -- input password dbPassword -- the password in the database return -- bool """ password = password.encode("utf8") - dbPassword = dbPassword.encode("utf8") + dbPassword = dbPassword.encode("utf8") return bcrypt.hashpw(password, dbPassword) == dbPassword def genBcrypt(password): """ Bcrypts a password. - + password -- the password to hash. return -- bytestring """ diff --git a/responseHelper.py b/helpers/responseHelper.py similarity index 100% rename from responseHelper.py rename to helpers/responseHelper.py diff --git a/systemHelper.py b/helpers/systemHelper.py similarity index 97% rename from systemHelper.py rename to helpers/systemHelper.py index 0309a8d..dc9d714 100644 --- a/systemHelper.py +++ b/helpers/systemHelper.py @@ -1,5 +1,5 @@ -import glob -import serverPackets +from objects import glob +from constants import serverPackets import psutil import os import sys diff --git a/userHelper.py b/helpers/userHelper.py similarity index 98% rename from userHelper.py rename to helpers/userHelper.py index 23bf85a..e574231 100644 --- a/userHelper.py +++ b/helpers/userHelper.py @@ -1,7 +1,7 @@ -import passwordHelper -import gameModes -import generalFunctions -import glob +from helpers import passwordHelper +from constants import gameModes +from helpers import generalFunctions +from objects import glob def getID(username): """ diff --git a/banchoConfig.py b/objects/banchoConfig.py similarity index 96% rename from banchoConfig.py rename to objects/banchoConfig.py index ecdf05d..36e1fea 100644 --- a/banchoConfig.py +++ b/objects/banchoConfig.py @@ -1,5 +1,5 @@ -import glob -import generalFunctions +from objects import glob +from helpers import generalFunctions class banchoConfig: """ diff --git a/channel.py b/objects/channel.py similarity index 100% rename from channel.py rename to objects/channel.py diff --git a/channelList.py b/objects/channelList.py similarity index 95% rename from channelList.py rename to objects/channelList.py index e0e9a4b..9d91583 100644 --- a/channelList.py +++ b/objects/channelList.py @@ -1,5 +1,5 @@ -import glob -import channel +from objects import glob +from objects import channel class channelList: """ diff --git a/fokabot.py b/objects/fokabot.py similarity index 91% rename from fokabot.py rename to objects/fokabot.py index 40fc873..7a25b20 100644 --- a/fokabot.py +++ b/objects/fokabot.py @@ -1,9 +1,9 @@ """FokaBot related functions""" -import userHelper -import glob +from helpers import userHelper +from objects import glob from constants import actions -import serverPackets -import fokabotCommands +from constants import serverPackets +from constants import fokabotCommands def connect(): """Add FokaBot to connected users and send userpanel/stats packet to everyone""" diff --git a/glob.py b/objects/glob.py similarity index 71% rename from glob.py rename to objects/glob.py index 42a6f93..8467823 100644 --- a/glob.py +++ b/objects/glob.py @@ -1,8 +1,8 @@ """Global objects and variables""" -import tokenList -import channelList -import matchList +from objects import tokenList +from objects import channelList +from objects import matchList VERSION = "0.9" diff --git a/match.py b/objects/match.py similarity index 98% rename from match.py rename to objects/match.py index 83824cc..01797db 100644 --- a/match.py +++ b/objects/match.py @@ -1,15 +1,15 @@ # TODO: Enqueue all -import gameModes -import matchScoringTypes -import matchTeamTypes -import matchModModes -import slotStatuses -import glob +from constants import gameModes +from constants import matchScoringTypes +from constants import matchTeamTypes +from constants import matchModModes +from constants import slotStatuses +from objects import glob from helpers import consoleHelper from constants import bcolors -import serverPackets -import dataTypes -import matchTeams +from constants import serverPackets +from constants import dataTypes +from constants import matchTeams class match: """Multiplayer match object""" diff --git a/matchList.py b/objects/matchList.py similarity index 95% rename from matchList.py rename to objects/matchList.py index c78ac4f..f3e0961 100644 --- a/matchList.py +++ b/objects/matchList.py @@ -1,6 +1,6 @@ -import match -import glob -import serverPackets +from objects import match +from objects import glob +from constants import serverPackets class matchList: matches = {} diff --git a/osuToken.py b/objects/osuToken.py similarity index 97% rename from osuToken.py rename to objects/osuToken.py index eb9b363..0a40afe 100644 --- a/osuToken.py +++ b/objects/osuToken.py @@ -1,12 +1,12 @@ import uuid from constants import actions -import gameModes -import userHelper +from constants import gameModes +from helpers import userHelper import time from helpers import consoleHelper from constants import bcolors -import serverPackets -import logoutEvent +from constants import serverPackets +from events import logoutEvent class token: """Osu Token object diff --git a/tokenList.py b/objects/tokenList.py similarity index 98% rename from tokenList.py rename to objects/tokenList.py index 39a6eac..bed49dc 100644 --- a/tokenList.py +++ b/objects/tokenList.py @@ -1,7 +1,7 @@ -import osuToken +from objects import osuToken import time import threading -import logoutEvent +from events import logoutEvent class tokenList: """ diff --git a/pep.py b/pep.py index 931e34c..ee5f14b 100644 --- a/pep.py +++ b/pep.py @@ -11,58 +11,58 @@ from tornado.ioloop import IOLoop # pep.py files from constants import bcolors -import packetIDs -import serverPackets -import config -import exceptions -import glob -import fokabot -import banchoConfig +from constants import packetIDs +from constants import serverPackets +from helpers import configHelper +from constants import exceptions +from objects import glob +from objects import fokabot +from objects import banchoConfig -import sendPublicMessageEvent -import sendPrivateMessageEvent -import channelJoinEvent -import channelPartEvent -import changeActionEvent -import cantSpectateEvent -import startSpectatingEvent -import stopSpectatingEvent -import spectateFramesEvent -import friendAddEvent -import friendRemoveEvent -import logoutEvent -import loginEvent -import setAwayMessageEvent -import joinLobbyEvent -import createMatchEvent -import partLobbyEvent -import changeSlotEvent -import joinMatchEvent -import partMatchEvent -import changeMatchSettingsEvent -import changeMatchPasswordEvent -import changeMatchModsEvent -import matchReadyEvent -import matchLockEvent -import matchStartEvent -import matchPlayerLoadEvent -import matchSkipEvent -import matchFramesEvent -import matchCompleteEvent -import matchNoBeatmapEvent -import matchHasBeatmapEvent -import matchTransferHostEvent -import matchFailedEvent -import matchInviteEvent -import matchChangeTeamEvent +from events import sendPublicMessageEvent +from events import sendPrivateMessageEvent +from events import channelJoinEvent +from events import channelPartEvent +from events import changeActionEvent +from events import cantSpectateEvent +from events import startSpectatingEvent +from events import stopSpectatingEvent +from events import spectateFramesEvent +from events import friendAddEvent +from events import friendRemoveEvent +from events import logoutEvent +from events import loginEvent +from events import setAwayMessageEvent +from events import joinLobbyEvent +from events import createMatchEvent +from events import partLobbyEvent +from events import changeSlotEvent +from events import joinMatchEvent +from events import partMatchEvent +from events import changeMatchSettingsEvent +from events import changeMatchPasswordEvent +from events import changeMatchModsEvent +from events import matchReadyEvent +from events import matchLockEvent +from events import matchStartEvent +from events import matchPlayerLoadEvent +from events import matchSkipEvent +from events import matchFramesEvent +from events import matchCompleteEvent +from events import matchNoBeatmapEvent +from events import matchHasBeatmapEvent +from events import matchTransferHostEvent +from events import matchFailedEvent +from events import matchInviteEvent +from events import matchChangeTeamEvent # pep.py helpers -import packetHelper +from helpers import packetHelper from helpers import consoleHelper -import databaseHelper -import responseHelper -import generalFunctions -import systemHelper +from helpers import databaseHelper +from helpers import responseHelper +from helpers import generalFunctions +from helpers import systemHelper # Create flask instance app = flask.Flask(__name__) @@ -249,7 +249,7 @@ if __name__ == "__main__": # Read config.ini consoleHelper.printNoNl("> Loading config file... ") - glob.conf = config.config("config.ini") + glob.conf = configHelper.config("config.ini") if glob.conf.default == True: # We have generated a default config.ini, quit server