Skip to content

Commit 35467ad

Browse files
pokeimonmedariox
andauthored
Add the ability to modify the Discord Bot Username. (#8148)
* Add the ability to modify the Discord Bot Username. * yarn dev Co-authored-by: Dario <medariox@users.noreply.github.com>
1 parent af4e413 commit 35467ad

File tree

6 files changed

+10
-4
lines changed

6 files changed

+10
-4
lines changed

medusa/__main__.py

+2
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,7 @@ def initialize(self, console_logging=True):
762762
check_setting_int(app.CFG, 'Discord', 'discord_notify_onsubtitledownload', 0))
763763
app.DISCORD_WEBHOOK = check_setting_str(app.CFG, 'Discord', 'discord_webhook', '', censor_log='normal')
764764
app.DISCORD_TTS = check_setting_bool(app.CFG, 'Discord', 'discord_tts', 0)
765+
app.DISCORD_NAME = check_setting_str(app.CFG, 'Discord', 'discord_name', '', censor_log='normal')
765766

766767
app.USE_PROWL = bool(check_setting_int(app.CFG, 'Prowl', 'use_prowl', 0))
767768
app.PROWL_NOTIFY_ONSNATCH = bool(check_setting_int(app.CFG, 'Prowl', 'prowl_notify_onsnatch', 0))
@@ -1765,6 +1766,7 @@ def save_config():
17651766
new_config['Discord']['discord_notify_onsubtitledownload'] = int(app.DISCORD_NOTIFY_ONSUBTITLEDOWNLOAD)
17661767
new_config['Discord']['discord_webhook'] = app.DISCORD_WEBHOOK
17671768
new_config['Discord']['discord_tts'] = int(app.DISCORD_TTS)
1769+
new_config['Discord']['discord_name'] = app.DISCORD_NAME
17681770

17691771
new_config['Prowl'] = {}
17701772
new_config['Prowl']['use_prowl'] = int(app.USE_PROWL)

medusa/server/api/v2/config.py

+2
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ class ConfigHandler(BaseRequestHandler):
400400
'notifiers.discord.notifyOnSnatch': BooleanField(app, 'DISCORD_NOTIFY_ONSNATCH'),
401401
'notifiers.discord.notifyOnDownload': BooleanField(app, 'DISCORD_NOTIFY_ONDOWNLOAD'),
402402
'notifiers.discord.notifyOnSubtitleDownload': BooleanField(app, 'DISCORD_NOTIFY_ONSUBTITLEDOWNLOAD'),
403+
'notifiers.discord.name': StringField(app, 'DISCORD_NAME'),
403404

404405
'notifiers.twitter.enabled': BooleanField(app, 'USE_TWITTER'),
405406
'notifiers.twitter.dmto': StringField(app, 'TWITTER_DMTO'),
@@ -963,6 +964,7 @@ def data_notifiers():
963964
section_data['discord']['notifyOnSubtitleDownload'] = bool(app.DISCORD_NOTIFY_ONSUBTITLEDOWNLOAD)
964965
section_data['discord']['webhook'] = app.DISCORD_WEBHOOK
965966
section_data['discord']['tts'] = bool(app.DISCORD_TTS)
967+
section_data['discord']['name'] = app.DISCORD_NAME
966968

967969
section_data['twitter'] = {}
968970
section_data['twitter']['enabled'] = bool(app.USE_TWITTER)

tests/apiv2/test_config.py

+1
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,7 @@ def config_notifiers():
636636
section_data['discord']['notifyOnSubtitleDownload'] = bool(app.DISCORD_NOTIFY_ONSUBTITLEDOWNLOAD)
637637
section_data['discord']['webhook'] = app.DISCORD_WEBHOOK
638638
section_data['discord']['tts'] = bool(app.DISCORD_TTS)
639+
section_data['discord']['name'] = app.DISCORD_NAME
639640

640641
section_data['twitter'] = {}
641642
section_data['twitter']['enabled'] = bool(app.USE_TWITTER)

themes-default/slim/src/components/config-notifications.vue

+1
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,7 @@
652652
<config-toggle-slider v-model="notifiers.discord.notifyOnSubtitleDownload" label="Notify on subtitle download" id="discord_notify_onsubtitledownload" :explanations="['send a message when subtitles are downloaded?']" @change="save()" />
653653
<config-textbox v-model="notifiers.discord.webhook" label="Channel webhook" id="discord_webhook" :explanations="['Add a webhook to a channel, use the returned url here']" @change="save()" />
654654
<config-toggle-slider v-model="notifiers.discord.tts" label="Text to speech" id="discord_tts" :explanations="['Use discord text to speech feature']" @change="save()" />
655+
<config-textbox v-model="notifiers.discord.name" label="Bot username" id="discord_name" :explanations="['Create a username for the Discord Bot to use']" @change="save()" />
655656

656657
<div class="testNotification" id="testDiscord-result">Click below to test your settings.</div>
657658
<input class="btn-medusa" type="button" value="Test Discord" id="testDiscord" @click="testDiscord">

themes/dark/assets/js/medusa-runtime.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

themes/light/assets/js/medusa-runtime.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)