revert all permission changes

This commit is contained in:
mudkipdev
2023-05-07 21:28:09 -06:00
parent 122fc79d01
commit 50782392a5
3 changed files with 4 additions and 13 deletions

View File

@@ -9,21 +9,12 @@ class InvalidTokenException(Exception):
pass
class InvalidConfigException(Exception):
pass
def main() -> None:
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
if not DISCORD_TOKEN:
raise InvalidTokenException("A Discord token was not set.")
with open("config.toml", "rb") as config_file:
if "[permissions]" in config_file.read():
raise InvalidConfigException(
"The format for permissions has changed; please check the new example config."
)
config = Config(tomllib.load(config_file))
bot = Bot(config)

View File

@@ -34,11 +34,11 @@ class Config:
return self._get_allowed_objects("allowed_users")
def _get_allowed_objects(self, object_name, /) -> list:
allowed_objects = self.config["permissions"]["announcements"].get(
allowed_objects = self.config["permissions"].get(
object_name, []
)
if self.debug:
allowed_objects += self.config["permissions"]["announcements"]["debug"].get(
allowed_objects += self.config["permissions"]["debug"].get(
object_name, []
)