Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5adfdb16f | ||
|
|
ee19f32be9 | ||
|
|
8ff53d9a13 | ||
|
|
9609837b1d | ||
|
|
8cf66351dd | ||
|
|
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}}
|
||||||
|
|||||||
@@ -8,6 +8,6 @@ From {highcouncil_election_announce} to {highcouncil_election_start}, you will b
|
|||||||
Discord Server Manager
|
Discord Server Manager
|
||||||
|
|
||||||
Each member of the CCE can cast one for each category by using the emotes: <:Rank_Owner:479008325137072155> for Clan Leader and <:Rank_Deputy:479008295319896064> for Discord Server Manager.
|
Each member of the CCE can cast one for each category by using the emotes: <:Rank_Owner:479008325137072155> for Clan Leader and <:Rank_Deputy:479008295319896064> for Discord Server Manager.
|
||||||
If needed, the icon 🤷 can be used to abstain to vote in any or both categories and it should be apply to all candidates of that category.
|
If needed, the icon 🤷 can be used to abstain to vote in any or both categories and it should be applied to all candidates of that category.
|
||||||
|
|
||||||
Votes can be cast until the {highcouncil_election_end}, so we can announce and have everyone set up to start the term by {term_start}.
|
Votes can be cast until {highcouncil_election_end}, so we can announce and have everyone set up to start the term by {term_start}.
|
||||||
@@ -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,
|
||||||
@@ -154,6 +155,8 @@ class ElectionCycle:
|
|||||||
|
|
||||||
# create new entry into database.
|
# create new entry into database.
|
||||||
election_channel: nextcord.TextChannel = await category.create_text_channel(quarter_name)
|
election_channel: nextcord.TextChannel = await category.create_text_channel(quarter_name)
|
||||||
|
clan_member_role: nextcord.Role = self.guild.get_role(self.config.params.clan_member_role_id)
|
||||||
|
await election_channel.set_permissions(clan_member_role, send_messages=True, add_reactions=True)
|
||||||
with Session(engine) as session:
|
with Session(engine) as session:
|
||||||
new_cycle = ElectionInformation(ElectionCycle=quarter_name, ElectionChannel=election_channel.id)
|
new_cycle = ElectionInformation(ElectionCycle=quarter_name, ElectionChannel=election_channel.id)
|
||||||
session.add(new_cycle)
|
session.add(new_cycle)
|
||||||
@@ -185,8 +188,10 @@ class ElectionCycle:
|
|||||||
message = self.build_highcouncil_election_announce()
|
message = self.build_highcouncil_election_announce()
|
||||||
council_elect_role: nextcord.Role = self.guild.get_role(self.config.params.clan_council_elect_role_id)
|
council_elect_role: nextcord.Role = self.guild.get_role(self.config.params.clan_council_elect_role_id)
|
||||||
election_channel: nextcord.TextChannel = self.guild.get_channel(self.get_election_info().ElectionChannel)
|
election_channel: nextcord.TextChannel = self.guild.get_channel(self.get_election_info().ElectionChannel)
|
||||||
|
clan_member_role: nextcord.Role = self.guild.get_role(self.config.params.clan_member_role_id)
|
||||||
await election_channel.send(message)
|
await election_channel.send(message)
|
||||||
await election_channel.set_permissions(council_elect_role, send_messages=True)
|
await election_channel.set_permissions(council_elect_role, send_messages=True, add_reactions=True)
|
||||||
|
await election_channel.set_permissions(clan_member_role, add_reactions=False)
|
||||||
|
|
||||||
async def highcouncil_election_start_action(self) -> None:
|
async def highcouncil_election_start_action(self) -> None:
|
||||||
"""
|
"""
|
||||||
@@ -216,7 +221,7 @@ class ElectionCycle:
|
|||||||
str: the name of the election cycle
|
str: the name of the election cycle
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return f"{self.election_start.year} {self.elecion_cycle.name} election"
|
return f"vote-{self.election_start.year}-{self.elecion_cycle.name}"
|
||||||
|
|
||||||
def get_election_info(self) -> ElectionInformation:
|
def get_election_info(self) -> ElectionInformation:
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -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