Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

made loki connection optional #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cogs/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ def get_docs_keys():
docs_data = load_md_as_dict(settings.resource("docs.md"))
return list(docs_data.keys())

LOKI_APPLICATION_NAME = settings.loki["application"]
if settings.loki:
LOKI_APPLICATION_NAME = settings.loki["application"]

class BotStats():
server_count: int
user_count: int
Expand Down Expand Up @@ -533,7 +535,8 @@ async def docs(self, inter: disnake.CommandInteraction, topic: str = commands.Pa
async def update_botstats(self):
logger.info("task_triggered: update_botstats()")
try:
await self.botstats_weekly.update(self.bot)
if LOKI_APPLICATION_NAME:
await self.botstats_weekly.update(self.bot)
except Exception as e:
await report_error("update_botstats()", e)

Expand Down
2 changes: 1 addition & 1 deletion utils/tools/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class Settings:
def __init__(self):
self.path = "settings.json"
self.defaults = OrderedDict([ ("token", ""), ("error_logging", False), ("debug", False) ])
self.defaults = OrderedDict([ ("token", ""), ("error_logging", False), ("debug", False), ("loki", OrderedDict([ ("base_url", ""), ("application", ""), ("username", ""), ("password","") ]))])
if not os.path.exists(self.path):
self.json_data = self.defaults
self.save_settings()
Expand Down