disable !np youtube urls by default

This commit is contained in:
jesopo 2020-05-07 22:23:04 +01:00
parent 73371b5571
commit 8d932ccc34

View file

@ -7,8 +7,13 @@ from src import ModuleManager, utils
URL_SCROBBLER = "http://ws.audioscrobbler.com/2.0/" URL_SCROBBLER = "http://ws.audioscrobbler.com/2.0/"
SETTING_YT = utils.BoolSetting("lastfm-youtube",
"Whether or not to search last.fm now-playing results on youtube")
@utils.export("set", utils.Setting("lastfm", "Set last.fm username", @utils.export("set", utils.Setting("lastfm", "Set last.fm username",
example="jesopo")) example="jesopo"))
@utils.export("botset", SETTING_YT)
@utils.export("serverset", SETTING_YT)
class Module(ModuleManager.BaseModule): class Module(ModuleManager.BaseModule):
_name = "last.fm" _name = "last.fm"
@ -59,9 +64,11 @@ class Module(ModuleManager.BaseModule):
time_language = "is listening to" if np else "last listened to" time_language = "is listening to" if np else "last listened to"
yt_url_str = ""
if event["server"].get_setting("lastfm-youtube",
self.bot.get_setting("lastfm-youtube", False)):
yt_url = self.exports.get("search-youtube")( yt_url = self.exports.get("search-youtube")(
"%s - %s" % (artist, track_name)) "%s - %s" % (artist, track_name))
yt_url_str = ""
if yt_url: if yt_url:
yt_url_str = " - %s" % yt_url yt_url_str = " - %s" % yt_url