Skip to content

Commit 34cfd1d

Browse files
documentation for commands;readme
1 parent 724ba0a commit 34cfd1d

File tree

3 files changed

+44
-14
lines changed

3 files changed

+44
-14
lines changed

.gitignore

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Don't ignore these files
2+
!points.json
3+
14
testing.py
25
Pipfile
36
Pipfile.lock
@@ -11,10 +14,6 @@ Pipfile.lock
1114

1215
members.txt
1316

14-
# Don't ignore these files
15-
!points.json
16-
17-
1817
__pycache__/
1918
.mypy_cache/
2019
.vscode/

README.md

+30-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,36 @@ ROOT_USER=handydandyrandy
3030

3131
There are no data types in ENV, have to convert everything from str to required type. Types are just mentioned to give approx idea of what kind of values are expected for each key.
3232

33-
### 2. Run using docker
33+
### 2. points.json
34+
35+
Number of points for each task. Uses hardcoded values if file absent.
36+
37+
```json
38+
{
39+
"pull request": 20,
40+
"info": 40,
41+
"blog": 60,
42+
"sm posting": 7,
43+
"weekly work": 5,
44+
"idea": 3,
45+
"brochure": 10,
46+
"news": 40,
47+
"demos": 20,
48+
"oc volunteer": 30,
49+
"oc assigned": 20,
50+
"oc no work": 10,
51+
"oc manager": 50,
52+
"wtf": 75,
53+
"discord": 10,
54+
"marketing": 20,
55+
"mini project": 100,
56+
"complete project": 200,
57+
"promotion medium": 25,
58+
"promotion large": 50
59+
}
60+
```
61+
62+
### 3. Run using docker
3463

3564
```sh
3665
docker build -t cyscomvit/discord-bot:latest .

bot.py

+11-9
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def check_if_required_env_variables_are_present():
2929
}
3030
if not all(env in environ for env in required_env_variables):
3131
raise RuntimeError(
32-
f"The following required environmental variables have not been set - {list(x for x in required_env_variables if x not in environ)}. Refer to code and Readme.MD for seeing what env keys are needed"
32+
f"The following required environmental variables have not been set - {set(x for x in required_env_variables if x not in environ)}. Refer to code and Readme.MD for seeing what env keys are needed"
3333
)
3434

3535

@@ -106,7 +106,7 @@ async def ping(ctx):
106106

107107
@bot.command()
108108
async def doge(ctx):
109-
"""Return a doge pic"""
109+
"""Return a doge pic."""
110110
try:
111111
doge_pic_url = requests_get(
112112
"https://shibe.online/api/shibes?count=1&urls=true"
@@ -120,14 +120,14 @@ async def doge(ctx):
120120

121121
@bot.command()
122122
async def sum(ctx, numOne: int, numTwo: int):
123-
f"""Return a sum of 2 numbers. {command_prefix} sum num1 num2"""
123+
"""Return a sum of 2 numbers. !cyscom sum num1 num2"""
124124
await ctx.send(numOne + numTwo)
125125

126126

127127
@bot.command()
128128
@commands.has_any_role("Cabinet Member")
129129
async def add_member(ctx, name: str, rating: int = 0, contributions: int = 0):
130-
f"""Add data to the leaderboard. Call it by {command_prefix} add_member "name" rating contribution"""
130+
"""Add data to the leaderboard. Call it by !cyscom add_member "name" rating contribution"""
131131
try:
132132
data = leaderboard_ref.get()
133133
name = name.strip()
@@ -179,7 +179,8 @@ async def add_member(ctx, name: str, rating: int = 0, contributions: int = 0):
179179
@bot.command()
180180
@commands.has_any_role("Cabinet Member")
181181
async def add_recruits(ctx):
182-
f"""Add recruits by reading a members.txt file present in the same folder"""
182+
"""Add recruits by reading a members.txt file present in the same folder"""
183+
183184
# Place file in discord-bot folder.
184185
try:
185186
filename = "members.txt"
@@ -207,7 +208,7 @@ async def add_recruits(ctx):
207208
@bot.command()
208209
@commands.has_any_role("Cabinet Member")
209210
async def set_points(ctx, name: str, rating=0, contributions=0):
210-
f"""Specifically set a member's points. Call it by {command_prefix} set_points "name" rating contribution"""
211+
"""Specifically set a member's points. Call it by !cyscom set_points "name" rating contribution"""
211212
try:
212213
data = leaderboard_ref.get()
213214
name = name.strip()
@@ -248,7 +249,7 @@ async def set_points(ctx, name: str, rating=0, contributions=0):
248249
@bot.command()
249250
@commands.has_any_role("Member", "Cabinet Member")
250251
async def fetch_data(ctx, name):
251-
"""Fetch data from the leaderboard"""
252+
"""Fetch data from the leaderboard. !cyscom fetch_data "name\" """
252253
try:
253254
data = leaderboard_ref.get()
254255
if data != None:
@@ -270,7 +271,7 @@ async def fetch_data(ctx, name):
270271
@bot.command()
271272
@commands.has_any_role("Cabinet Member")
272273
async def delete_data(ctx, name):
273-
"""Delete someone from the leaderboard"""
274+
"""Delete someone from the leaderboard. !cyscom delete_data "name\" """
274275
try:
275276
data = leaderboard_ref.get()
276277
if data != None:
@@ -329,7 +330,7 @@ def fetch_points_for_each_task() -> dict[str, int]:
329330
@bot.command()
330331
@commands.has_any_role("Leaderboard", "Cabinet Member")
331332
async def contribution(ctx, name, task):
332-
# """Add contribution to a member"""
333+
"""Add contribution to a member. !cyscom contribution "name" "task\""""
333334
try:
334335
data = leaderboard_ref.get()
335336
if data != None:
@@ -368,6 +369,7 @@ async def contribution(ctx, name, task):
368369
@bot.command()
369370
@commands.has_any_role("Member", "Cabinet Member")
370371
async def attendance(ctx, channel_name):
372+
"""Attendance in a voice channel. !cyscom attendance "channel name\""""
371373
f"""Mark attendance in a voice channel. Call by {command_prefix} attendance voice_channel_name"""
372374

373375
# Get the voice channel by name

0 commit comments

Comments
 (0)