Skip to content

Commit d83f7e3

Browse files
board member -> cabinet; update_data -> set_points;
1 parent e197020 commit d83f7e3

File tree

5 files changed

+93
-13
lines changed

5 files changed

+93
-13
lines changed

.github/workflows/deployment.yml

-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,3 @@ jobs:
3030
docker build -t ${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}:${{ env.COMMIT_SHORT_SHA }} --quiet .
3131
docker run --detach --name ${{ github.event.repository.name }}-deploy ${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}:${{ env.COMMIT_SHORT_SHA }}
3232
docker container prune --force && docker image prune --all --force
33-

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.11.7-slim AS requirements-image
1+
FROM python:3.11-slim AS requirements-image
22

33
ENV PYTHONUNBUFFERED=1
44

@@ -12,7 +12,7 @@ COPY pyproject.toml poetry.lock ./
1212

1313
RUN ["poetry","export","--format","requirements.txt","--output","requirements.txt"]
1414

15-
FROM python:3.11.7-slim AS runtime-image
15+
FROM python:3.11-slim AS runtime-image
1616

1717
LABEL description="CYSCOM VIT's discord bot"
1818

bot.py

+22-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from distutils.command.check import check
22
from os import environ, getenv, listdir
33
from os.path import dirname
4+
from requests import get as requests_get
45

56
import discord
6-
import requests
77
from discord.ext import commands
88
from dotenv import load_dotenv
99
from firebase_admin import credentials, db, initialize_app
@@ -104,7 +104,7 @@ async def ping(ctx):
104104
async def doge(ctx):
105105
"""Return a doge pic"""
106106
try:
107-
doge_pic_url = requests.get(
107+
doge_pic_url = requests_get(
108108
"https://shibe.online/api/shibes?count=1&urls=true"
109109
).json()[0]
110110
await ctx.send(doge_pic_url)
@@ -121,7 +121,7 @@ async def sum(ctx, numOne: int, numTwo: int):
121121

122122

123123
@bot.command()
124-
@commands.has_any_role("Board Member")
124+
@commands.has_any_role("Cabinet Member")
125125
async def add_data(ctx, name: str, rating: int = 0, contributions: int = 0):
126126
f"""Add data to the leaderboard. Call it by {command_prefix} add_data "name" rating contribution"""
127127
try:
@@ -172,7 +172,7 @@ async def add_data(ctx, name: str, rating: int = 0, contributions: int = 0):
172172

173173

174174
@bot.command()
175-
@commands.has_any_role("Board Member")
175+
@commands.has_any_role("Cabinet Member")
176176
async def add_recruits(ctx):
177177
f"""Add recruits by reading a members.txt file present in the same folder"""
178178
# Place file in discord-bot folder.
@@ -199,8 +199,8 @@ async def add_recruits(ctx):
199199

200200

201201
@bot.command()
202-
@commands.has_any_role("Board Member")
203-
async def update_data(ctx, name: str, rating=0, contributions=0):
202+
@commands.has_any_role("Cabinet Member")
203+
async def set_points(ctx, name: str, rating=0, contributions=0):
204204
try:
205205
data = leaderboard_ref.get()
206206
name = name.strip()
@@ -238,7 +238,7 @@ async def update_data(ctx, name: str, rating=0, contributions=0):
238238

239239

240240
@bot.command()
241-
@commands.has_any_role("Member", "Board Member")
241+
@commands.has_any_role("Member", "Cabinet Member")
242242
async def fetch_data(ctx, name):
243243
"""Fetch data from the leaderboard"""
244244
try:
@@ -260,7 +260,7 @@ async def fetch_data(ctx, name):
260260

261261

262262
@bot.command()
263-
@commands.has_any_role("Board Member")
263+
@commands.has_any_role("Cabinet Member")
264264
async def delete_data(ctx, name):
265265
"""Delete someone from the leaderboard"""
266266
try:
@@ -278,7 +278,7 @@ async def delete_data(ctx, name):
278278

279279

280280
@bot.command()
281-
@commands.has_any_role("Leaderboard", "Board Member")
281+
@commands.has_any_role("Leaderboard", "Cabinet Member")
282282
async def contribution(ctx, name, task):
283283
"""Add contribution to a member"""
284284
try:
@@ -405,4 +405,17 @@ async def on_message(message):
405405
await bot.process_commands(message)
406406

407407

408+
def add_members_to_act(
409+
act_num: int,
410+
member_names: list[str],
411+
discord_roles: list[str],
412+
add_roles_to_discord: bool = False,
413+
):
414+
...
415+
416+
417+
def fetch_spreadsheet(speadsheet_id: str):
418+
...
419+
420+
408421
bot.run(getenv("BOT_TOKEN"))

poetry.lock

+68-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ python = "^3.11.6"
1111
firebase-admin = "^6.2.0"
1212
discord-py = "^2.3.2"
1313
python-dotenv = "^1.0.0"
14+
gspread = "^5.12.4"
1415

1516

1617
[build-system]

0 commit comments

Comments
 (0)