Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Barry
/
discordbot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
aba82c68
authored
2016-01-15 08:59:33 +0000
by
Barry
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fixed games listing / display
1 parent
64f770f2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
5 deletions
hellsbot.py
members.json
hellsbot.py
View file @
aba82c6
...
...
@@ -90,10 +90,11 @@ def on_socket_raw_send(payload, binary=False):
@client.event
def
on_status
(
member
):
print
(
"Status Changed
%
s"
%
(
member
,))
#
print("Status Changed %s" % (member,))
try
:
json_data
=
open
(
member_status
)
.
read
()
data
=
json
.
loads
(
json_data
)
print
(
json_data
)
except
ValueError
:
data
=
{}
if
not
data
:
...
...
@@ -145,7 +146,7 @@ def on_status(member):
'games_played'
:
games_played
,
'aliases'
:
aliases
}
print
(
'Status Change:
%
s'
%
(
data
,))
#
print('Status Change: %s' % (data,))
jdata
=
json
.
dumps
(
data
,
ensure_ascii
=
False
)
except
Exception
as
e
:
print
(
'Error saving status change:
%
s'
%
(
e
),)
...
...
@@ -159,9 +160,14 @@ def get_game_names(game_id_list):
data
=
json
.
loads
(
json_data
)
result
=
[]
for
game_id
in
game_id_list
:
if
isinstance
(
game_id
,
str
)
and
not
game_id
.
isdigit
():
result
.
append
(
game_id
)
continue
name_set
=
False
for
game
in
data
:
if
game
[
'id'
]
==
game_id
:
result
.
append
(
game
[
'name'
])
name_set
=
True
return
result
def
get_mention_status
(
mention
):
...
...
@@ -187,7 +193,7 @@ def check_msg_queue():
data
=
{}
if
not
data
:
data
=
{}
print
(
"Data:
%
s"
%
data
)
#
print("Data: %s" % data)
new_data
=
{}
for
username
in
data
:
for
author
in
data
[
username
]:
...
...
@@ -215,7 +221,7 @@ def check_msg_queue():
new_data
[
username
][
author
]
=
data
[
username
][
author
]
jdata
=
json
.
dumps
(
new_data
,
ensure_ascii
=
False
)
print
(
"New Data:
%
s"
%
new_data
)
#
print("New Data: %s" % new_data)
open
(
deliveries_file
,
'wb+'
)
.
write
(
jdata
.
encode
(
'utf8'
))
return
...
...
@@ -467,7 +473,7 @@ Stuff:
for
username
in
member_data
:
if
'games_played'
in
member_data
[
username
]:
for
id
in
member_data
[
username
][
'games_played'
]:
if
id
==
game_id
:
if
id
==
game_id
or
id
==
game_name
:
matched_usernames
.
append
(
username
)
client
.
send_message
(
message
.
channel
,
'I have seen {} playing: {}'
.
format
(
', '
.
join
(
matched_usernames
),
game_name
))
...
...
@@ -579,6 +585,9 @@ Stuff:
if
message
.
content
.
startswith
(
'!question'
):
question
=
message
.
content
[
10
:]
if
"is it gay"
in
question
:
client
.
send_message
(
message
.
channel
,
'Yes {}, it is gay.'
.
format
(
message
.
author
.
mention
()))
return
res
=
wolf
.
query
(
question
)
try
:
if
len
(
res
.
pods
):
...
...
members.json
View file @
aba82c6
This diff is collapsed.
Click to expand it.
Please
register
or
sign in
to post a comment