-
Notifications
You must be signed in to change notification settings - Fork 0
/
jarvis.py
134 lines (101 loc) · 3.23 KB
/
jarvis.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import os
import random
from discord import RequestsWebhookAdapter, Webhook
BENJI = os.environ['BENJI']
ANDO = os.environ['ANDO']
DANNY = os.environ['DANNY']
DARREN = os.environ['DARREN']
JARVIS_FETISH_LIST = os.environ['JARVIS_FETISH_LIST']
JARVIS_HOBBIES_LIST = os.environ['JARVIS_HOBBIES_LIST']
JARVIS_LIFE_CHOICES_LIST = os.environ['JARVIS_LIFE_CHOICES_LIST']
JARVIS_PROFESSIONS_LIST = os.environ['JARVIS_PROFESSIONS_LIST']
DISCORD_TOKEN_ID = os.environ['DISCORD_TOKEN_ID_JARVIS']
DISCORD_TOKEN = os.environ['DISCORD_TOKEN_JARVIS']
GENDER = random.choice(["M", "F"])
GITHUB_LINK = "https://github.com/benji011/roleplaying-J.A.R.V.I.S"
def get_profession():
"""Get profession."""
with open(JARVIS_PROFESSIONS_LIST) as f:
content = f.read().splitlines()
return random.choice(content)
def get_interest():
"""Get interest."""
interest = ["with a passion in", "that likes", "who loves"]
return random.choice(interest)
def get_hobby():
"""Get hobby."""
with open(JARVIS_HOBBIES_LIST) as f:
content = f.read().splitlines()
return random.choice(content)
def get_addiction():
"""Get addiction."""
addiction = ["has a raging fetish", "with a burning desire", "is addicted"]
return random.choice(addiction)
def get_fetish():
"""Get fetish."""
with open(JARVIS_FETISH_LIST) as f:
content = f.read().splitlines()
return random.choice(content)
def get_age():
"""Get random age."""
MIN_AGE = 23
MAX_AGE = 82
age = random.randrange(MIN_AGE, MAX_AGE)
return age
def get_time_of_day():
time_of_day = ["morning", "afternoon", "evening", "night"]
return random.choice(time_of_day)
def get_gender():
"""Get gender."""
male = {
"SUBJECT_PRONOUN": "he",
"POSESSIVE_ADJECTIVE": "his"
}
female = {
"SUBJECT_PRONOUN": "she",
"POSESSIVE_ADJECTIVE": "her"
}
return male if GENDER == "M" else female
def get_life_choices():
"""Get life choices."""
with open(JARVIS_LIFE_CHOICES_LIST) as f:
content = f.read().splitlines()
return random.choice(content)
def compose_message():
"""Compose message."""
age = get_age()
profession = get_profession()
interest = get_interest()
hobby = get_hobby()
addiction = get_addiction()
fetish = get_fetish()
time_of_day = get_time_of_day()
subject_pronoun=get_gender().get ( "SUBJECT_PRONOUN")
posessive_adjective=get_gender().get ( "POSESSIVE_ADJECTIVE")
life_choices=get_life_choices()
msg = (
f"we can roleplay as a {age} year old {profession} "
f"{interest} {hobby} and {addiction} "
f"for {fetish} but every {time_of_day} "
f"{subject_pronoun} contemplates "
f"{posessive_adjective} {life_choices}."
)
github_url_msg = (
f"\n\nbeep bop I'm a bot\nMy source code is here - {GITHUB_LINK}"
)
msg += github_url_msg
return msg
def send_message(msg):
"""Send message."""
webhook = Webhook.partial(
DISCORD_TOKEN_ID,
DISCORD_TOKEN,
adapter=RequestsWebhookAdapter()
)
webhook.send(msg)
def main():
"""The main function."""
msg = compose_message()
send_message(msg)
if __name__ == "__main__":
main()