Fix Discord webhook init and add local config defaults/ignores
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -15,6 +15,7 @@ botty_v*/
|
||||
custom.ini
|
||||
config/custom.ini
|
||||
config/custom.*.ini
|
||||
config/*.local.ini
|
||||
.vscode
|
||||
.vs/
|
||||
test/assets/
|
||||
@@ -36,3 +37,9 @@ pickit_screenshots/
|
||||
*.log
|
||||
log/
|
||||
blizzpw.txt
|
||||
|
||||
# Local user/workspace files
|
||||
.claude/
|
||||
GEMINI.md
|
||||
botty_v*.zip
|
||||
test_config_load.py
|
||||
|
||||
22
config/custom.ini.example
Normal file
22
config/custom.ini.example
Normal file
@@ -0,0 +1,22 @@
|
||||
; Personal overrides for your local machine/user.
|
||||
; This file is tracked as an example.
|
||||
; Copy to config/custom.ini and edit values there.
|
||||
;
|
||||
; Botty auto-loads config/custom.ini when present.
|
||||
|
||||
[general]
|
||||
; name=botty
|
||||
; custom_message_hook=
|
||||
; custom_loot_message_hook=
|
||||
|
||||
[char]
|
||||
; type=blizz_sorc
|
||||
; atk_len_pindle=3.0
|
||||
; show_items=alt
|
||||
|
||||
[sorceress]
|
||||
; teleport=t
|
||||
|
||||
[blizz_sorc]
|
||||
; blizzard=f1
|
||||
; ice_blast=f2
|
||||
@@ -7,7 +7,7 @@ import traceback
|
||||
import discord
|
||||
from version import __version__
|
||||
import numpy as np
|
||||
from discord import Webhook, SyncWebhook, Color
|
||||
from discord import SyncWebhook, Color
|
||||
import json
|
||||
class DiscordEmbeds(GenericApi):
|
||||
def __init__(self):
|
||||
@@ -22,7 +22,7 @@ class DiscordEmbeds(GenericApi):
|
||||
hook_url = Config().general['custom_message_hook']
|
||||
if hook_url:
|
||||
try:
|
||||
hook = Webhook.from_url(hook_url, adapter=SyncWebhook(), )
|
||||
hook = SyncWebhook.from_url(hook_url)
|
||||
except BaseException as e:
|
||||
Logger.warning(f"Your custom_message_hook URL {hook_url} is invalid, Discord updates will not be sent")
|
||||
Logger.error(f"Error initializing webhook {hook_url}: {e}")
|
||||
@@ -95,6 +95,8 @@ class DiscordEmbeds(GenericApi):
|
||||
self._send_embed(e, self._webhook)
|
||||
|
||||
def _send_embed(self, e, webhook, file = None):
|
||||
if webhook is None:
|
||||
return
|
||||
e.set_footer(text=f'Botty v.{__version__} by Aeon')
|
||||
e.timestamp=datetime.datetime.now(datetime.timezone.utc)
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user