Skip to content

Commit

Permalink
Merge pull request pyhoneybot#69 from RiceAbove/master
Browse files Browse the repository at this point in the history
fixed dictionary
  • Loading branch information
Abdur-rahmaanJ authored Apr 3, 2019
2 parents c1fa92f + 29f32aa commit cb75d32
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
4 changes: 2 additions & 2 deletions honeybot/PLUGINS.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
greet
username
joke

dictionary
maths
calc
caesar_cipher
Expand All @@ -13,4 +13,4 @@ password_generator
wikipedia
weather
mail
translate
translate
6 changes: 3 additions & 3 deletions honeybot/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self,
owners=['appinventorMu', 'appinv'],
password='',
friends=['haruno', 'keiserr', 'loganaden'],
autojoin_channels=['##bottestingmu']
autojoin_channels=['#ltch']
):
self.server_url = server_url
self.port = port
Expand Down Expand Up @@ -115,7 +115,7 @@ def join(self, channel):
def load_plugins(self, list_to_add):
print("\033[0;36mLoading plugins...\033[0;0m")


to_load = []
with open('PLUGINS.conf', 'r') as f:
to_load = f.read().split('\n')
Expand All @@ -130,7 +130,7 @@ def load_plugins(self, list_to_add):

self.plugins = list_to_add
print("\033[0;32mLoaded plugins...\033[0;0m")


def methods(self):
return {
Expand Down
19 changes: 7 additions & 12 deletions honeybot/plugins/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,20 @@
returns meaning of the word specified
"""

import PyDictionary

from PyDictionary import PyDictionary

class Plugin:
def __init__(self):
pass

def __dictionary(self, word):
return PyDictionary().meaning(word).get('Noun')

def run(self, incoming, methods, info):
try:
# if '!~' in info['prefix']:
# print(info)
msgs = info['args'][1:][0].split()
if info['command'] == 'PRIVMSG':
if len(msgs) > 1:
if msgs[0] == '.dictionary':
word = msgs[1]
methods['send'](info['address'], Plugin.__dictionary(self, word))

if info['command'] == 'PRIVMSG' and msgs[0] == '.dictionary':
dict = PyDictionary()
word = str(msgs[1])
defin = dict.meaning(word)['Noun']
methods['send'](info['address'], '{}'.format(defin))
except Exception as e:
print('woops plug', e)

0 comments on commit cb75d32

Please sign in to comment.