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
d47c384c
authored
2016-01-13 01:18:45 +0000
by
Barry
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Bug fixes for !question
1 parent
f74c5381
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
hellsbot.py
members.json
hellsbot.py
View file @
d47c384
...
...
@@ -586,14 +586,17 @@ Stuff:
for
pod
in
res
.
pods
:
if
pod
.
text
:
pod_text
+=
pod
.
text
client
.
send_message
(
message
.
channel
,
'{} {}.'
.
format
(
message
.
author
.
mention
(),
pod_text
[:
1000
]
))
client
.
send_message
(
message
.
channel
,
'{} {}.'
.
format
(
message
.
author
.
mention
(),
byteify
(
pod_text
[:
1500
])
))
else
:
tagged_sent
=
pos_tag
(
question
.
replace
(
'?'
,
''
)
.
split
())
proper_nouns
=
[
word
for
word
,
pos
in
tagged_sent
if
pos
==
'NNP'
]
wiki_search
=
" "
.
join
(
proper_nouns
)
print
"Looking up {}"
.
format
(
wiki_search
)
wiki_out
=
wikipedia
.
summary
(
wiki_search
,
sentences
=
3
)
client
.
send_message
(
message
.
channel
,
'{} {}.'
.
format
(
message
.
author
.
mention
(),
byteify
(
wiki_out
)))
if
wiki_search
.
strip
()
!=
""
:
print
"Looking up {}"
.
format
(
wiki_search
)
wiki_out
=
wikipedia
.
summary
(
wiki_search
,
sentences
=
3
)
client
.
send_message
(
message
.
channel
,
'{} {}.'
.
format
(
message
.
author
.
mention
(),
byteify
(
wiki_out
)))
else
:
client
.
send_message
(
message
.
channel
,
'I don
\'
t know {}.'
.
format
(
message
.
author
.
mention
()))
return
except
Exception
as
e
:
print
(
format_exception
(
e
))
...
...
members.json
View file @
d47c384
This diff is collapsed.
Click to expand it.
Please
register
or
sign in
to post a comment