-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresponses.py
273 lines (264 loc) · 14 KB
/
responses.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
# from random import choice, randint
#
#
# def get_response(user_input: str, https=None) -> str:
# lowered: str = user_input.lower()
# keywords: list[str] = user_input.lower().strip().split()
#
# if lowered == "":
# return "Well, I can't respond to nothing, can I?"
# elif lowered == "hi":
# return "Hello bbg!"
# elif lowered == "bye":
# return "Goodbye bbg!"
# elif lowered == "roll dice":
# return f"You rolled a {randint(1, 6)}!"
# elif lowered == "flip a coin":
# return choice(["Heads!", "Tails!"])
# elif lowered == "how are you":
# return "I'm doing fine bbg, tell me about yourself!"
#
# # redirecting to language specific resources
#
# # cpp
# elif ("cpp" or "c++") and ("resources" or "resource") in keywords:
# return f"C++ is a general-purpose programming language created by Bjarne Stroustrup as an extension of the C programming language, or 'C with Classes'. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1035869217074978886}"
# # python
# elif "python" and ("resources" or "resource") in keywords:
# return f"Python is an interpreted, high-level and general-purpose programming language. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1035869711004618834}"
# # java
# elif "java" and ("resources" or "resource") in keywords:
# return f"Java is a class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1045022001762418779}"
# # javascript
# elif ("javascript" or "js") and ("resources" or "resource") in keywords:
# return f"JavaScript is a high-level, interpreted programming language that conforms to the ECMAScript specification. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1045027084717797436}"
# # golang
# elif ("golang" or "go") and ("resources" or "resource") in keywords:
# return f"Go is a statically typed, compiled programming language designed at Google. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1192175876213833799}"
# # rust
# elif "rust" and ("resources" or "resource") in keywords:
# return f"Rust is a multi-paradigm system programming language focused on safety, especially safe concurrency. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1038338641421938738}"
# # typescript
# elif ("typescript" or "ts") and ("resources" or "resource") in keywords:
# return f"TypeScript is an open-source language which builds on JavaScript, one of the world’s most used tools, by adding static type definitions. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1247558205165535383}"
# # clean code
# elif ("clean" and "code") and ("resources" or "resource") in keywords:
# return f"Clean code is code that is easy to understand and easy to change. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1185484608205238332}"
# # computer science basics
# elif ("cs" and "basics") and ("resources" or "resource") in keywords:
# return f"Computer Science basics are the foundation of computer science. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1251496416203903027}"
#
# # redirecting to domain specific resources
#
# # System (Linux) Programming
# elif ("system" and "programming" and "linux") and (
# "resources" or "resource"
# ) in keywords:
# return f"System programming is the activity of programming computer system software. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1108712976971730956}"
# # Web Development
# elif (("web" and "development") or ("web" and "dev") or "html" or "css") and (
# "resources" or "resource"
# ) in keywords:
# return f"Web development is the work involved in developing a website for the Internet. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1035874106605842553}"
# # App Development
# elif (
# ("app" and "development") or ("app" and "dev") or "android" or "ios" or "app"
# ) and ("resources" or "resource") in keywords:
# return f"App development is the process of creating a mobile application. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1035874202886086657}"
# # flutter
# elif "flutter" and ("resources" or "resource") in keywords:
# return f"Flutter is an open-source UI software development kit created by Google. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1176525373148774501}"
# # DSA
# elif (
# "dsa"
# or ("data" and "structures")
# or "algorithms"
# or "ps"
# or ("problem" and "solving")
# ) and ("resources" or "resource") in keywords:
# return f"Data structures and algorithms are the building blocks of computer science. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1038729955623845888}"
# # AI/ML
# elif ("ai" or "artificial intelligence" or "ml" or "machine learning") and (
# "resources" or "resource"
# ) in keywords:
# return f"Artificial intelligence is the simulation of human intelligence processes by machines. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1230506240854200362}"
# # Blockchain
# elif ("blockchain" or "web3") and ("resources" or "resource") in keywords:
# return f"Blockchain is a system in which a record of transactions made in bitcoin or another cryptocurrency are maintained across several computers that are linked in a peer-to-peer network. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1247586354075009116}"
# # Open Source
# elif "open source" and ("resources" or "resource") in keywords:
# return f"Open-source software is a type of computer software in which source code is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1035874500639719495}"
# # General Resources
# elif "general" and ("resources" or "resource") in keywords:
# return f"General resources are resources that are not specific to any domain. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1213918549425397810}"
# # UI/UX
# elif ("ui" or "ux" or "ui/ux") and ("resources" or "resource") in keywords:
# return f"UI/UX design is the process design teams use to create products that provide meaningful and relevant experiences to users. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1230553508814524446}"
# # DevOps
# elif ("devops" or "ci/cd" or ("dev" and "ops")) and (
# "resources" or "resource"
# ) in keywords:
# return f"DevOps is a set of practices that combines software development and IT operations. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1045021472860688454}"
# # System (Windows) Programming
# elif ("system" and "programming" and "windows") and (
# "resources" or "resource"
# ) in keywords:
# return f"System programming is the activity of programming computer system software. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1110099353256865842}"
# # Embedded Systems
# elif ("embedded" and "systems") and ("resources" or "resource") in keywords:
# return f"An embedded system is a computer system—a combination of a computer processor, computer memory, and input/output peripheral devices—that has a dedicated function within a larger mechanical or electrical system. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1108716008279117974}"
# # Cybersecurity
# elif ("cybersecurity" or "security" or ("cyber" and "security")) and (
# "resources" or "resource"
# ) in keywords:
# return f"Cybersecurity is the practice of protecting systems, networks, and programs from digital attacks. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1035874742248419358}"
# # Game Development
# elif ("game" and ("development" or "dev")) and (
# "resources" or "resource"
# ) in keywords:
# return f"Game development is the process of creating video games. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1035874649046790216}"
# # CP
# elif ("cp" or ("competitive" and "programming")) and (
# "resources" or "resource"
# ) in keywords:
# return f"Competitive programming is a mind sport usually held over the Internet or a local network, involving participants trying to program according to provided specifications. For specific resources, refer here - {https://discord.com/channels/781467057807032323/1035874325921804388}"
# else:
# # return choice(['Hey sorry, what did you say?!',
# # 'I did not understand that bbg!',
# # 'I am not sure what you mean bbg!',
# # "Can you say that again?"])
# pass
from random import choice, randint
# Dictionary to store resource links and corresponding keywords
resources = {
(
"cpp",
"c++",
): "https://discord.com/channels/781467057807032323/1035869217074978886",
("python",): "https://discord.com/channels/781467057807032323/1035869711004618834",
("java",): "https://discord.com/channels/781467057807032323/1045022001762418779",
(
"javascript",
"js",
): "https://discord.com/channels/781467057807032323/1045027084717797436",
(
"golang",
"go",
): "https://discord.com/channels/781467057807032323/1192175876213833799",
("rust",): "https://discord.com/channels/781467057807032323/1038338641421938738",
(
"typescript",
"ts",
): "https://discord.com/channels/781467057807032323/1247558205165535383",
(
"clean code",
): "https://discord.com/channels/781467057807032323/1185484608205238332",
(
"cs basics",
): "https://discord.com/channels/781467057807032323/1251496416203903027",
(
"system programming",
"linux",
): "https://discord.com/channels/781467057807032323/1108712976971730956",
(
"web development",
"web dev",
"html",
"css",
): "https://discord.com/channels/781467057807032323/1035874106605842553",
(
"app development",
"app dev",
"android",
"ios",
"app",
): "https://discord.com/channels/781467057807032323/1035874202886086657",
("flutter",): "https://discord.com/channels/781467057807032323/1176525373148774501",
(
"dsa",
"data structures",
"algorithms",
"problem solving",
"ps",
): "https://discord.com/channels/781467057807032323/1038729955623845888",
(
"ai",
"artificial intelligence",
"ml",
"machine learning",
): "https://discord.com/channels/781467057807032323/1230506240854200362",
(
"blockchain",
"web3",
): "https://discord.com/channels/781467057807032323/1247586354075009116",
(
"open source",
): "https://discord.com/channels/781467057807032323/1035874500639719495",
(
"general resources",
): "https://discord.com/channels/781467057807032323/1213918549425397810",
(
"ui/ux",
"ui",
"ux",
): "https://discord.com/channels/781467057807032323/1230553508814524446",
(
"devops",
"ci/cd",
"dev ops",
): "https://discord.com/channels/781467057807032323/1045021472860688454",
(
"system programming",
"windows",
): "https://discord.com/channels/781467057807032323/1110099353256865842",
(
"embedded systems",
): "https://discord.com/channels/781467057807032323/1108716008279117974",
(
"cybersecurity",
"cyber security",
"security",
): "https://discord.com/channels/781467057807032323/1035874742248419358",
(
"game development",
"game dev",
): "https://discord.com/channels/781467057807032323/1035874649046790216",
(
"cp",
"competitive programming",
): "https://discord.com/channels/781467057807032323/1035874325921804388",
}
def get_resource_link(keywords: list[str], resources: dict) -> str:
for resource_keywords, link in resources.items():
if any(keyword in keywords for keyword in resource_keywords):
return link
return None
def get_response(user_input: str) -> str:
lowered: str = user_input.lower()
keywords: list[str] = lowered.strip().split()
# Basic responses
if lowered == "":
return "Well, I can't respond to nothing, can I?"
elif lowered == "hi":
return "Hello bbg!"
elif lowered == "bye":
return "Goodbye bbg!"
elif lowered == "roll dice":
return f"You rolled a {randint(1, 6)}!"
elif lowered == "flip a coin":
return choice(["Heads!", "Tails!"])
elif lowered == "how are you":
return "I'm doing fine bbg, tell me about yourself!"
# printing the link to the specific resources
resource_link = get_resource_link(keywords, resources)
if resource_link:
return f"For specific resources, refer here - {resource_link}"
# Default responses
return choice(
[
"Hey sorry, what did you say?!",
"I did not understand that bbg!",
"I am not sure what you mean bbg!",
"Can you say that again?",
]
)