forked from pcjl/mattermost-coffeebot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pair.py
49 lines (40 loc) · 1.42 KB
/
pair.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
from mattermostdriver import Driver
from coffeebot import config, utils
def main():
print("Creating Mattermost Driver...")
driver_options = {
'url': config.URL,
'login_id': config.USERNAME,
'password': config.PASSWORD,
'port': config.PORT,
'token': config.PASSWORD,
'scheme': 'https',
'port': 443,
'verify': True,
'auth': None,
'timeout': 30,
'request_timeout': None,
'debug': False
}
driver = Driver(driver_options)
print("Authenticating...")
driver.login()
driver.users.get_user('me')
print("Successfully authenticated.")
print("Retrieving Coffee Buddies participants...")
team_name = config.TEAM_NAME
channel_name = config.CHANNEL_NAME
members = utils.get_channel_members(driver, team_name, channel_name)
print("Successfully retrieved Coffee Buddies participants.")
print("Preparing participants database...")
utils.create_users(members)
utils.create_pairs(members)
print("Succesfully prepared participants database.")
print("Pairing Coffee Buddies participants...")
pairs = utils.get_pairs(members)
print("Successfully paired Coffee Buddies participants.")
print("Messaging paired Coffee Buddies participants...")
utils.message_pairs(driver, pairs)
print("Successfully messaged paired Coffee Buddies participants.")
if __name__ == '__main__':
main()