mirror of
https://github.com/NohamR/TransmissionBot.git
synced 2025-05-24 00:48:59 +00:00
adding details to previous commit
* NEW: added log rotation * NEW: improved error handling * NEW: makes backup copies of original when overwriting json files * NEW: `notification_channel_id` config item is now an integer (was previously a string) * NEW: bot prefix is optional in DMs * IMPROVED: don't print reactions to notifications that only contain removed transfers * IMPROVED: in-channel help now initiates a help DM to the user * FIXED: fixed potential access of `CONFIG` before being initialized * FIXED: validate notification channel before trying to post notifications * FIXED: `notification_DM_opt_out_user_ids` config is now properly respected
This commit is contained in:
parent
097ff37405
commit
179a26e07e
4
bot.py
4
bot.py
@ -908,7 +908,7 @@ async def check_notification_reactions(message, is_text_channel, torrents, start
|
|||||||
return await check_notification_reactions(message, is_text_channel, torrents, starttime=starttime)
|
return await check_notification_reactions(message, is_text_channel, torrents, starttime=starttime)
|
||||||
|
|
||||||
async def run_notifications():
|
async def run_notifications():
|
||||||
if CONFIG['notification_enabled'] and CONFIG['notification_channel_id'] > 0:
|
if CONFIG['notification_enabled']:
|
||||||
# get all changes
|
# get all changes
|
||||||
logger.debug("Running notification check")
|
logger.debug("Running notification check")
|
||||||
changedTransfers = check_for_transfer_changes()
|
changedTransfers = check_for_transfer_changes()
|
||||||
@ -916,7 +916,7 @@ async def run_notifications():
|
|||||||
if nTotal > 0:
|
if nTotal > 0:
|
||||||
addReactions = (sum([len(d['data']) for k,d in changedTransfers.items() if k != "removed"]) > 0)
|
addReactions = (sum([len(d['data']) for k,d in changedTransfers.items() if k != "removed"]) > 0)
|
||||||
# first in_channel notifications
|
# first in_channel notifications
|
||||||
if CONFIG['notification_enabled_in_channel']:
|
if CONFIG['notification_enabled_in_channel'] and CONFIG['notification_channel_id'] > 0 and len(str(CONFIG['notification_channel_id'])) == 18:
|
||||||
embeds, n, torrents = prepare_notifications(changedTransfers, CONFIG['notification_states']['in_channel'])
|
embeds, n, torrents = prepare_notifications(changedTransfers, CONFIG['notification_states']['in_channel'])
|
||||||
logger.debug("in_channel notifications: {}".format(n))
|
logger.debug("in_channel notifications: {}".format(n))
|
||||||
# now post notifications
|
# now post notifications
|
||||||
|
Loading…
x
Reference in New Issue
Block a user