rewrite: New Pomodoro Timer system.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from typing import Optional, TYPE_CHECKING
|
||||
from enum import Enum
|
||||
import asyncio
|
||||
import pytz
|
||||
import discord
|
||||
|
||||
@@ -48,7 +49,7 @@ class LionGuild(Timezoned):
|
||||
No guarantee is made that the client is in the corresponding Guild,
|
||||
or that the corresponding Guild even exists.
|
||||
"""
|
||||
__slots__ = ('bot', 'data', 'guildid', 'config', '_guild', '__weakref__')
|
||||
__slots__ = ('bot', 'data', 'guildid', 'config', '_guild', 'voice_lock', '__weakref__')
|
||||
|
||||
Config = GuildConfig
|
||||
settings = Config.settings
|
||||
@@ -62,6 +63,11 @@ class LionGuild(Timezoned):
|
||||
|
||||
self.config = self.Config(self.guildid, data)
|
||||
|
||||
# Guild-specific voice lock
|
||||
# Every module which uses voice alerts should hold this lock throughout the alert.
|
||||
# Avoids voice race-states
|
||||
self.voice_lock = asyncio.Lock()
|
||||
|
||||
@property
|
||||
def guild(self):
|
||||
if self._guild is None:
|
||||
@@ -77,6 +83,10 @@ class LionGuild(Timezoned):
|
||||
def timezone(self) -> pytz.timezone:
|
||||
return self.config.timezone.value
|
||||
|
||||
@property
|
||||
def locale(self) -> str:
|
||||
return self.config.get('guild_locale').value
|
||||
|
||||
async def touch_discord_model(self, guild: discord.Guild):
|
||||
"""
|
||||
Update saved Discord model attributes for this guild.
|
||||
|
||||
Reference in New Issue
Block a user