mirror of
https://github.com/hencaric/SCNewsBot.git
synced 2026-08-17 06:56:03 +01:00
revert all permission changes
This commit is contained in:
@@ -8,14 +8,14 @@ extensions = [
|
|||||||
"extensions.templates"
|
"extensions.templates"
|
||||||
]
|
]
|
||||||
|
|
||||||
[permissions.announcements]
|
[permissions]
|
||||||
# This works in a whitelist mode. The invoker of the command must be in an allowed guild and
|
# This works in a whitelist mode. The invoker of the command must be in an allowed guild and
|
||||||
# must have an allowed role. If neither of those are true, allowed_users is checked last.
|
# must have an allowed role. If neither of those are true, allowed_users is checked last.
|
||||||
allowed_guilds = []
|
allowed_guilds = []
|
||||||
allowed_roles = []
|
allowed_roles = []
|
||||||
allowed_users = []
|
allowed_users = []
|
||||||
|
|
||||||
[permissions.announcements.debug]
|
[permissions.debug]
|
||||||
# This works in addition to the regular permissions, but only if debug mode is enabled.
|
# This works in addition to the regular permissions, but only if debug mode is enabled.
|
||||||
allowed_guilds = []
|
allowed_guilds = []
|
||||||
allowed_roles = []
|
allowed_roles = []
|
||||||
|
|||||||
@@ -9,21 +9,12 @@ class InvalidTokenException(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class InvalidConfigException(Exception):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
|
DISCORD_TOKEN = os.getenv("DISCORD_TOKEN")
|
||||||
if not DISCORD_TOKEN:
|
if not DISCORD_TOKEN:
|
||||||
raise InvalidTokenException("A Discord token was not set.")
|
raise InvalidTokenException("A Discord token was not set.")
|
||||||
|
|
||||||
with open("config.toml", "rb") as config_file:
|
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))
|
config = Config(tomllib.load(config_file))
|
||||||
|
|
||||||
bot = Bot(config)
|
bot = Bot(config)
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ class Config:
|
|||||||
return self._get_allowed_objects("allowed_users")
|
return self._get_allowed_objects("allowed_users")
|
||||||
|
|
||||||
def _get_allowed_objects(self, object_name, /) -> list:
|
def _get_allowed_objects(self, object_name, /) -> list:
|
||||||
allowed_objects = self.config["permissions"]["announcements"].get(
|
allowed_objects = self.config["permissions"].get(
|
||||||
object_name, []
|
object_name, []
|
||||||
)
|
)
|
||||||
if self.debug:
|
if self.debug:
|
||||||
allowed_objects += self.config["permissions"]["announcements"]["debug"].get(
|
allowed_objects += self.config["permissions"]["debug"].get(
|
||||||
object_name, []
|
object_name, []
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user