Compare commits
5
Commits
25-cakeday
...
v0.0.6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4c02b2f77 | ||
|
|
8d8af9ab35 | ||
|
|
f70a7989ae | ||
|
|
fb909c009a | ||
|
|
bdefa035ff |
@@ -1,6 +1,10 @@
|
|||||||
name: build_develop
|
name: build_develop
|
||||||
|
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '*'
|
||||||
|
- '!main'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -18,7 +22,9 @@ jobs:
|
|||||||
registry: gitea.cheezers.org
|
registry: gitea.cheezers.org
|
||||||
username: imcompiling
|
username: imcompiling
|
||||||
password: ${{ secrets.PASSWORD }}
|
password: ${{ secrets.PASSWORD }}
|
||||||
|
- name: set env
|
||||||
|
run: echo "GIT_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
|
||||||
- name: Build Docker Image
|
- name: Build Docker Image
|
||||||
run: docker build -t gitea.cheezers.org/imcompiling/dakiny-bot:develop .
|
run: docker build -t gitea.cheezers.org/imcompiling/dakiny-bot:${{env.GIT_BRANCH}} .
|
||||||
- name: Push Docker Image
|
- name: Push Docker Image
|
||||||
run: docker push gitea.cheezers.org/imcompiling/dakiny-bot:develop
|
run: docker push gitea.cheezers.org/imcompiling/dakiny-bot:${{env.GIT_BRANCH}}
|
||||||
|
|||||||
@@ -20,16 +20,15 @@ class ElectionCycle:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, cycle: int, config: DakinyConfig, guild: nextcord.Guild) -> None:
|
def __init__(self, cycle: int, config: DakinyConfig, guild: nextcord.Guild) -> None:
|
||||||
# TODO update
|
|
||||||
"""
|
"""
|
||||||
Generates all dates relevant to the election cycle from input election start, term start and end dates.
|
Generates all dates relevant to the election cycle determined by the config and cycle.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
election_start (datetime): Date the election cycle starts.
|
cycle (int): Which election cycle this cycle is.
|
||||||
term_start (datetime): Date the term being elected starts.
|
config (DakinyConfig): The entire config object.
|
||||||
term_end (datetime): Date the term being elected ends.
|
guild (nextcord.Guild): The guild that this election is running in.
|
||||||
bot: the discord bot instance
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self.config: DakinyConfig = config
|
self.config: DakinyConfig = config
|
||||||
self.cycle = cycle
|
self.cycle = cycle
|
||||||
self.elecion_cycle = self.config.election_cycles[self.cycle]
|
self.elecion_cycle = self.config.election_cycles[self.cycle]
|
||||||
@@ -56,7 +55,9 @@ class ElectionCycle:
|
|||||||
with open("bot_messages/election_announcement.txt", mode="r", encoding="utf8") as file:
|
with open("bot_messages/election_announcement.txt", mode="r", encoding="utf8") as file:
|
||||||
message = file.read()
|
message = file.read()
|
||||||
|
|
||||||
next_election = get_datetime(self.config.election_cycles[(self.cycle + 1) % 4].election_start)
|
next_election = get_datetime(
|
||||||
|
self.config.election_cycles[(self.cycle + 1) % len(self.config.election_cycles)].election_start
|
||||||
|
)
|
||||||
|
|
||||||
message = message.format(
|
message = message.format(
|
||||||
clan_council_id=self.config.params.clan_council_role_id,
|
clan_council_id=self.config.params.clan_council_role_id,
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ class DailyLoop(commands.Cog, name="Daily Loop"):
|
|||||||
|
|
||||||
today = datetime.today()
|
today = datetime.today()
|
||||||
guild: nextcord.Guild = self.bot.get_guild(self.bot.config.params.guild_id)
|
guild: nextcord.Guild = self.bot.get_guild(self.bot.config.params.guild_id)
|
||||||
announce_channel: nextcord.TextChannel = guild.get_channel(self.bot.config.params.announcement_category_id)
|
announce_channel: nextcord.TextChannel = guild.get_channel(self.bot.config.params.general_channel_id)
|
||||||
|
|
||||||
cakedays: list[nextcord.Member] = [
|
cakedays: list[nextcord.Member] = [
|
||||||
human for human in guild.humans if human.joined_at.month == today.month and human.joined_at.day == today.day
|
human for human in guild.humans if human.joined_at.month == today.month and human.joined_at.day == today.day
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class Params:
|
|||||||
clan_info_channel_id: int
|
clan_info_channel_id: int
|
||||||
clan_member_role_id: int
|
clan_member_role_id: int
|
||||||
discord_token: str
|
discord_token: str
|
||||||
|
general_channel_id: int
|
||||||
guild_id: int
|
guild_id: int
|
||||||
high_council_role_id: int
|
high_council_role_id: int
|
||||||
voting_emote_id: str
|
voting_emote_id: str
|
||||||
|
|||||||
Reference in New Issue
Block a user