Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import praw, enchant
- from PyDictionary import PyDictionary
- reddit = praw.Reddit(
- client_id ='jtSGr_Wpj4TlaA',
- client_secret ='U1IZmN0jv42-2F6aEVzXKK7XzQM',
- username ='spell_bot_20',
- password ='nope',
- user_agent='spellbot by /u/Relationship_Terry'
- )
- subreddits = reddit.subreddit(
- 'test'
- )
- keyword = '!spellbot '
- dictionary = PyDictionary()
- d = enchant.Dict('en_US')
- def isWord(word):
- return d.check(word)
- for comment in subreddits.stream.comments():
- if keyword in comment.body:
- word = comment.body.replace(keyword, '')
- try:
- if isWord(word):
- words = dictionary.meaning(word)
- reply = [item[0] for item in words.values()]
- comment.reply(word + ': this is spelled correctly.')
- print('posted')
- else:
- reply = "Hmm, I don't think that's a word."
- comment.reply(reply)
- print('posted')
- except:
- print('wot')
Add Comment
Please, Sign In to add comment