Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Trevor Cappallo
TE4bot
Commits
d5f5f8d6
Commit
d5f5f8d6
authored
Nov 05, 2021
by
Trevor Cappallo
Browse files
cleanup
parent
ed9d4cf2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
12 deletions
+5
-12
te4.py
te4.py
+5
-12
No files found.
te4.py
View file @
d5f5f8d6
...
...
@@ -14,7 +14,6 @@ reGame = re.compile('\s*([0-9.]+)\s+([0-9a-fA-F]+)\s+"(.*?)"'
reSummary
=
re
.
compile
(
'^\s*(.*)\*\s+([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+'
'([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+([0-9a-fA-F]+)\s+MG\-on.*$'
,
re
.
MULTILINE
)
oldGames
=
[]
games
=
[]
recentlySaid
=
[]
lastData
=
""
...
...
@@ -88,7 +87,7 @@ async def on_ready():
@
tasks
.
loop
(
seconds
=
15.0
)
async
def
status_task
():
global
oldGames
,
games
,
cnt
,
currentGames
,
recentlySaid
global
games
,
cnt
,
currentGames
,
recentlySaid
data
=
requests
.
get
(
"https://www.managames.com/tennis/online/TE4_ServerList.php?Poll=1"
)
info
=
parse_server_poll
(
data
.
text
.
replace
(
'
\n
'
,
' '
))
games
=
info
[
'games'
]
...
...
@@ -114,9 +113,8 @@ async def status_task():
s
=
f
"
{
players
[
0
]
}
started a game with
{
players
[
1
]
}
."
currentGames
[
game
[
'name'
]]
=
game
else
:
# pprint.pprint(game)
try
:
s
=
f
"
{
game
[
'name'
]
}
(elo:
{
game
[
'elo'
]
}
, rep:
{
game
[
'reputation'
]
}
%) wants to play a
{
game
[
'game_info'
][
'nb_set'
]
}
-set match. (
Control mode:
{
control
Strings
[
game
[
'game_info'
][
'
control_mode'
]]
}
. Preview:
{
preview
Strings
[
game
[
'game_info'
][
'
preview
'
]]
}
. Skill
mode
:
{
skillStrings
[
game
[
'game_info'
][
'skill_mode'
]]
}
.)"
s
=
f
"
{
game
[
'name'
]
}
(elo:
{
game
[
'elo'
]
}
, rep:
{
game
[
'reputation'
]
}
%) wants to play a
{
game
[
'game_info'
][
'nb_set'
]
}
-set match. (
Preview:
{
preview
Strings
[
game
[
'game_info'
][
'
preview'
]]
}
. Control:
{
control
Strings
[
game
[
'game_info'
][
'
control_mode
'
]]
}
. Skill:
{
skillStrings
[
game
[
'game_info'
][
'skill_mode'
]]
}
.)"
except
:
pprint
.
pprint
(
game
)
s
=
""
...
...
@@ -128,14 +126,9 @@ async def status_task():
if
len
(
recentlySaid
)
>
5
:
recentlySaid
=
recentlySaid
[
-
5
:]
if
len
(
out
)
>
0
:
pprint
.
pprint
(
out
)
await
ch
.
send
(
"
\n
"
.
join
(
out
))
oldGames
=
[
sorted
([
str
(
y
)
for
y
in
x
.
values
()])
for
x
in
games
]
# oldGames += newGames
# oldGames =
# if (len(oldGames)>10):
# oldGames=oldGames[-10:]
for
line
in
out
:
pprint
.
pprint
(
line
)
await
ch
.
send
(
line
)
if
len
(
games
)
==
0
:
recentlySaid
=
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment