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
5963966f
authored
2015-12-03 17:53:35 +0000
by
Barry
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Added whoplayed to list games played.
1 parent
9d7c0982
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
hellsbot.py
members.json
hellsbot.py
View file @
5963966
...
...
@@ -196,6 +196,7 @@ You can ask compound or questions and I will choose. Example: HellsBot Rui is a
!msg <username> on 12/22/2015 Happy Birthday!
!games <username> - Returns a list of games played for a username.
!gameslist - Returns a list of the top 20 games and the number of people who have played that game.
!whoplayed <gamename> - Returns a list of players who have played the game.
!lastseen <username> - Returns info on when the user was last seen and their status.
!addfortune <fortune> - Adds a new fortune.
!fortune - Returns your fortune
...
...
@@ -276,6 +277,35 @@ You can ask compound or questions and I will choose. Example: HellsBot Rui is a
client
.
send_message
(
message
.
channel
,
'I don
\'
t have any data on {} yet {}'
.
format
(
username
,
message
.
author
.
mention
()))
return
if
message
.
content
.
startswith
(
'!whoplayed'
):
member_data
=
None
try
:
json_data
=
open
(
member_status
)
.
read
()
member_data
=
json
.
loads
(
json_data
)
except
ValueError
:
pass
if
not
member_data
:
client
.
send_message
(
message
.
channel
,
'I am a bit confused right now.. maybe I need more data. {}!'
.
format
(
message
.
author
.
mention
()))
else
:
game_name
=
message
.
content
[
11
:]
json_data
=
open
(
games_file
)
.
read
()
data
=
json
.
loads
(
json_data
)
game_id
=
0
for
game
in
data
:
if
game
[
'name'
]
.
lower
()
==
game_name
.
lower
():
game_id
=
game
[
'id'
]
if
game_id
==
0
:
client
.
send_message
(
message
.
channel
,
'I don
\'
t have any data on {} yet {}'
.
format
(
game_name
,
message
.
author
.
mention
()))
matched_usernames
=
[]
for
username
in
member_data
:
if
'games_played'
in
member_data
[
username
]:
for
id
in
member_data
[
username
][
'games_played'
]:
if
id
==
game_id
:
matched_usernames
.
append
(
username
)
client
.
send_message
(
message
.
channel
,
'I have seen {} playing: {}'
.
format
(
', '
.
join
(
matched_usernames
),
game_name
))
return
# !msg joe in 5 minutes YOU ARE A DICK
if
message
.
content
.
startswith
(
'!msg'
):
try
:
...
...
members.json
View file @
5963966
This diff is collapsed.
Click to expand it.
Please
register
or
sign in
to post a comment