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
468100b5
authored
2015-12-04 21:52:32 +0000
by
Barry
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Added alises to the bot.
1 parent
2639440f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
hellsbot.py
members.json
hellsbot.py
View file @
468100b
...
...
@@ -304,7 +304,7 @@ You can ask compound or questions and I will choose. Example: HellsBot Rui is a
for
game
in
games_sorted
:
#print('%s' % game)
out_string
+=
' {} - {}
\n
'
.
format
(
game
[
1
],
game
[
0
])
client
.
send_message
(
message
.
channel
,
'The games I have seen people playing are:
\n
{}'
.
format
(
out_string
))
return
...
...
@@ -319,8 +319,11 @@ You can ask compound or questions and I will choose. Example: HellsBot Rui is a
client
.
send_message
(
message
.
channel
,
'I am a bit confused right now.. maybe I need more data. {}!'
.
format
(
message
.
author
.
mention
()))
else
:
username
=
message
.
content
[
9
:]
.
replace
(
'@'
,
''
)
.
lower
()
if
username
.
strip
()
==
''
:
client
.
send_message
(
message
.
channel
,
'{} please provide a username. !aliases <username>'
.
format
(
message
.
author
.
mention
()))
return
if
username
in
data
and
'aliases'
in
data
[
username
]:
client
.
send_message
(
message
.
channel
,
'{} has the following aliases:'
.
format
(
username
,
', '
.
join
(
data
[
username
][
'aliases'
])))
client
.
send_message
(
message
.
channel
,
'{} has the following aliases:
{}
'
.
format
(
username
,
', '
.
join
(
data
[
username
][
'aliases'
])))
else
:
client
.
send_message
(
message
.
channel
,
'No known alises for {} yet {}'
.
format
(
username
,
message
.
author
.
mention
()))
return
...
...
@@ -341,6 +344,9 @@ You can ask compound or questions and I will choose. Example: HellsBot Rui is a
if
'aliases'
not
in
data
[
username
]:
data
[
username
][
'aliases'
]
=
[]
data
[
username
][
'aliases'
]
.
append
(
alias
)
jdata
=
json
.
dumps
(
data
,
ensure_ascii
=
False
)
open
(
member_status
,
'wb+'
)
.
write
(
jdata
.
encode
(
'utf8'
))
client
.
send_message
(
message
.
channel
,
'{} has been added to your aliases'
.
format
(
alias
))
else
:
client
.
send_message
(
message
.
channel
,
'Something horrible happened and it is all your fault.'
)
...
...
members.json
View file @
468100b
This diff is collapsed.
Click to expand it.
Please
register
or
sign in
to post a comment