Allow specification of several messages to choose from
This commit is contained in:
parent
b6b158580a
commit
fade3c20fc
|
@ -40,7 +40,7 @@ Usage: python3 gelbooru-bot.py [--gen-config] [--help]
|
|||
"hololive_images": {
|
||||
"gelbooru_tags": "hololive",
|
||||
"gelbooru_tags_exclude": "-sky",
|
||||
"bot_message": "Hololive Image",
|
||||
"bot_message": ["Hololive Image", "Uooooh"],
|
||||
"bot_hashtags": "#hololive",
|
||||
"misskey_token": "uuuu0hOhrrrlrlrP8888uquqaaaaAUAU",
|
||||
"max_page_number": 200,
|
||||
|
|
|
@ -158,6 +158,9 @@ class BotInstance:
|
|||
post_json = post_request.json()
|
||||
if 'id' in post_json:
|
||||
# Submit a /notes/create request to Misskey
|
||||
if isinstance(self.bot_message, list):
|
||||
msg = random.choice(self.bot_message)
|
||||
else:
|
||||
msg = self.bot_message
|
||||
if random.randint(0, 100) < 5:
|
||||
msg += " " + self.bot_hashtags
|
||||
|
@ -168,6 +171,9 @@ class BotInstance:
|
|||
return True
|
||||
|
||||
# Submit a /notes/create request to Misskey
|
||||
if isinstance(self.bot_message, list):
|
||||
msg = random.choice(self.bot_message)
|
||||
else:
|
||||
msg = self.bot_message
|
||||
if random.randint(0, 100) < 5:
|
||||
msg += " " + self.bot_hashtags
|
||||
|
@ -218,7 +224,7 @@ def generate_defaults():
|
|||
|
||||
config['gelbooru_tags'] = 'rating:safe'
|
||||
config['gelbooru_tags_exclude'] = ''
|
||||
config['bot_message'] = 'Random image from Gelbooru'
|
||||
config['bot_message'] = ['Random image from Gelbooru']
|
||||
config['bot_hashtags'] = '#gelbooru #random'
|
||||
config['misskey_url'] = 'https://misskey.example.com/'
|
||||
config['misskey_token'] = ''
|
||||
|
|
Loading…
Reference in New Issue