✨
This commit is contained in:
@@ -9,16 +9,15 @@ from gwendolyn.exceptions import NoToken, CannotConnectToService
|
|||||||
from gwendolyn.funcs import Other, BetterNetflix, Sonarr, Radarr, TMDb, QBittorrent
|
from gwendolyn.funcs import Other, BetterNetflix, Sonarr, Radarr, TMDb, QBittorrent
|
||||||
|
|
||||||
class Gwendolyn(Client):
|
class Gwendolyn(Client):
|
||||||
def __init__(self, testing: bool = True):
|
def __init__(self):
|
||||||
"""Initialize the bot."""
|
"""Initialize the bot."""
|
||||||
initiation_parameters = {
|
initiation_parameters = {
|
||||||
"status": Status.DND,
|
"status": Status.DND,
|
||||||
"delete_unused_application_cmds": True
|
"delete_unused_application_cmds": True,
|
||||||
|
"sync_interactions": True
|
||||||
}
|
}
|
||||||
super().__init__(**initiation_parameters)
|
super().__init__(**initiation_parameters)
|
||||||
|
|
||||||
self.testing = testing
|
|
||||||
|
|
||||||
self._add_clients_and_options()
|
self._add_clients_and_options()
|
||||||
self._add_functions()
|
self._add_functions()
|
||||||
self._add_extensions()
|
self._add_extensions()
|
||||||
@@ -26,6 +25,9 @@ class Gwendolyn(Client):
|
|||||||
def _add_clients_and_options(self):
|
def _add_clients_and_options(self):
|
||||||
"""Add all the client, option and credentials objects."""
|
"""Add all the client, option and credentials objects."""
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
self.testing = getenv("GWENDOLYN_TESTING", "False").lower() in ('true', '1', 't')
|
||||||
|
self.enable_nework_services = getenv("NETWORK_SERVICES", "False").lower() in ('true', '1', 't')
|
||||||
|
|
||||||
self.bot_token = getenv("DISCORD_TOKEN")
|
self.bot_token = getenv("DISCORD_TOKEN")
|
||||||
|
|
||||||
if self.bot_token == "TOKEN":
|
if self.bot_token == "TOKEN":
|
||||||
@@ -54,18 +56,22 @@ class Gwendolyn(Client):
|
|||||||
|
|
||||||
def _add_functions(self):
|
def _add_functions(self):
|
||||||
self.other = Other(self)
|
self.other = Other(self)
|
||||||
self.better_netflix = BetterNetflix(
|
if self.enable_nework_services:
|
||||||
self,
|
self.better_netflix = BetterNetflix(
|
||||||
radarr=Radarr(getenv("RADARR_IP"),getenv("RADARR_PORT"),getenv("RADARR_API_KEY")),
|
self,
|
||||||
sonarr=Sonarr(getenv("SONARR_IP"),getenv("SONARR_PORT"),getenv("SONARR_API_KEY")),
|
radarr=Radarr(getenv("RADARR_IP"),getenv("RADARR_PORT"),getenv("RADARR_API_KEY")),
|
||||||
tmdb=TMDb(getenv("TMDB_API_ACCESS_TOKEN")),
|
sonarr=Sonarr(getenv("SONARR_IP"),getenv("SONARR_PORT"),getenv("SONARR_API_KEY")),
|
||||||
qbittorrent=QBittorrent(getenv("QBITTORRENT_IP"),getenv("QBITTORRENT_PORT"),getenv("QBITTORRENT_USERNAME"),getenv("QBITTORRENT_PASSWORD"))
|
tmdb=TMDb(getenv("TMDB_API_ACCESS_TOKEN")),
|
||||||
)
|
qbittorrent=QBittorrent(getenv("QBITTORRENT_IP"),getenv("QBITTORRENT_PORT"),getenv("QBITTORRENT_USERNAME"),getenv("QBITTORRENT_PASSWORD"))
|
||||||
|
)
|
||||||
|
|
||||||
def _add_extensions(self):
|
def _add_extensions(self):
|
||||||
"""Load cogs."""
|
"""Load cogs."""
|
||||||
for filename in listdir("./gwendolyn/ext"):
|
for filename in listdir("./gwendolyn/ext"):
|
||||||
if filename.endswith(".py"):
|
if filename.endswith(".py"):
|
||||||
|
if filename == "better_netflix.py" and not self.enable_nework_services:
|
||||||
|
continue
|
||||||
|
|
||||||
self.load_extension(f"gwendolyn.ext.{filename[:-3]}")
|
self.load_extension(f"gwendolyn.ext.{filename[:-3]}")
|
||||||
|
|
||||||
def log(self, messages, channel: str = "", level: int = 20): # pylint:disable=no-self-use
|
def log(self, messages, channel: str = "", level: int = 20): # pylint:disable=no-self-use
|
||||||
|
|||||||
Reference in New Issue
Block a user