Added CF functionality.
This commit is contained in:
parent
cac7b8b892
commit
ca05ef5caf
3 changed files with 62 additions and 2 deletions
20
import_db.py
Normal file
20
import_db.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
def import_cf_words():
|
||||||
|
file = open('word_db.txt')
|
||||||
|
words = file.readlines()
|
||||||
|
word_db = {
|
||||||
|
'c': [],
|
||||||
|
'f': []
|
||||||
|
}
|
||||||
|
for w in words:
|
||||||
|
if(w[0] == 'c'):
|
||||||
|
word_db['c'].append(w.strip())
|
||||||
|
else:
|
||||||
|
word_db['f'].append(w.strip())
|
||||||
|
return word_db
|
||||||
|
|
||||||
|
if(__name__ == '__main__'):
|
||||||
|
word_db = import_cf_words()
|
||||||
|
print(word_db['c'])
|
||||||
|
print(word_db['f'])
|
|
@ -1,5 +1,7 @@
|
||||||
import os
|
import os
|
||||||
import slack
|
import slack
|
||||||
|
import import_db
|
||||||
|
from random import randrange as rr
|
||||||
'''
|
'''
|
||||||
client = slack.WebClient(token=os.environ['SLACK_API_TOKEN'])
|
client = slack.WebClient(token=os.environ['SLACK_API_TOKEN'])
|
||||||
|
|
||||||
|
@ -13,6 +15,8 @@ assert response['message']['text'] == 'Hello, world!'
|
||||||
'''
|
'''
|
||||||
print('I am running.')
|
print('I am running.')
|
||||||
|
|
||||||
|
words = import_db.import_cf_words()
|
||||||
|
|
||||||
@slack.RTMClient.run_on(event='message')
|
@slack.RTMClient.run_on(event='message')
|
||||||
def say_hello(**payload):
|
def say_hello(**payload):
|
||||||
print(payload['data'])
|
print(payload['data'])
|
||||||
|
@ -20,14 +24,14 @@ def say_hello(**payload):
|
||||||
web_client = payload['web_client']
|
web_client = payload['web_client']
|
||||||
rtm_client = payload['rtm_client']
|
rtm_client = payload['rtm_client']
|
||||||
try:
|
try:
|
||||||
if 'Hello' in data['text']:
|
if 'cf' in data['text'].lower():
|
||||||
channel_id = data['channel']
|
channel_id = data['channel']
|
||||||
thread_ts = data['ts']
|
thread_ts = data['ts']
|
||||||
user = data['user']
|
user = data['user']
|
||||||
|
|
||||||
web_client.chat_postMessage(
|
web_client.chat_postMessage(
|
||||||
channel=channel_id,
|
channel=channel_id,
|
||||||
text=f"Hi <@{user}>!",
|
text='CF, also known as: {0} {1}'.format((words['c'][rr(len(words['c']))]).capitalize(), (words['f'][rr(len(words['f']))]).capitalize()),
|
||||||
)
|
)
|
||||||
except:
|
except:
|
||||||
print('lmao wtf')
|
print('lmao wtf')
|
||||||
|
|
36
word_db.txt
Normal file
36
word_db.txt
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
cyborg
|
||||||
|
cradle
|
||||||
|
carnage
|
||||||
|
crab
|
||||||
|
capricorn
|
||||||
|
cabbage
|
||||||
|
cyber
|
||||||
|
cybre
|
||||||
|
crying
|
||||||
|
capital
|
||||||
|
cog
|
||||||
|
corgi
|
||||||
|
correct
|
||||||
|
clam
|
||||||
|
corprate
|
||||||
|
corpral
|
||||||
|
fancy
|
||||||
|
facility
|
||||||
|
faculty
|
||||||
|
failure
|
||||||
|
formality
|
||||||
|
flamboyancy
|
||||||
|
fertility
|
||||||
|
fatality
|
||||||
|
fuckery
|
||||||
|
functionality
|
||||||
|
framentationality
|
||||||
|
fertilization
|
||||||
|
fortification
|
||||||
|
fuzzily
|
||||||
|
fizzy
|
||||||
|
fowlpox
|
||||||
|
flummox
|
||||||
|
freezing
|
||||||
|
foxfish
|
||||||
|
finicky
|
Reference in a new issue