mirror of
https://gitlab.com/gpvkt/twitchtts.git
synced 2025-04-17 17:22:27 +02:00
Read out vote result
This commit is contained in:
parent
fcbf726e50
commit
a4b0cd0cb8
3 changed files with 43 additions and 8 deletions
|
@ -65,6 +65,7 @@ messages:
|
|||
votestart: "Quickvote started. Send #yourchoice to participate."
|
||||
voteend: "Quickvote ended. The results are:"
|
||||
votenobody: "Nobody casted a vote. :("
|
||||
voteresult: "Voting has ended. The result is:"
|
||||
votes: "Votes"
|
||||
|
||||
log:
|
||||
|
@ -117,6 +118,7 @@ Please note that the `oauth_token` is valid for approximately 60 days. If it bec
|
|||
* `votestart`: Message when a quickvote is started.
|
||||
* `voteend`: Message if a quickvote ends.
|
||||
* `votenobody`: Message if quickvote ends, but nobody has voted.
|
||||
* `voteresult`: Prefix for the result (will be read out)
|
||||
* `votes`: Suffix to vote count.
|
||||
|
||||
##### log
|
||||
|
|
|
@ -29,6 +29,7 @@ messages: # Things the bot can send as chat message
|
|||
votestart: "Quickvote started. Send #yourchoice to participate."
|
||||
voteend: "Quickvote ended. The results are:"
|
||||
votenobody: "Nobody casted a vote. :("
|
||||
voteresult: "Voting has ended. The result is:"
|
||||
votes: "Votes"
|
||||
|
||||
log:
|
||||
|
|
48
tts.py
48
tts.py
|
@ -20,21 +20,21 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
import json
|
||||
import logging
|
||||
import socket
|
||||
import sys
|
||||
import time
|
||||
import json
|
||||
import socket
|
||||
import logging
|
||||
import datetime
|
||||
import socketserver
|
||||
import urllib.request
|
||||
import urllib.parse
|
||||
import webbrowser
|
||||
import socketserver
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
|
||||
from threading import Thread
|
||||
from http.server import BaseHTTPRequestHandler
|
||||
from urllib.parse import parse_qs
|
||||
from collections import Counter
|
||||
from urllib.parse import parse_qs
|
||||
from http.server import BaseHTTPRequestHandler
|
||||
|
||||
import yaml
|
||||
|
||||
|
@ -207,6 +207,22 @@ class IRC:
|
|||
logging.info("Nobody voted")
|
||||
self.sendmsg(conf['IRC_CHANNEL'], "@chat", conf['MESSAGE']['VOTEEND'])
|
||||
self.sendmsg(conf['IRC_CHANNEL'], "*", conf['MESSAGE']['VOTENOBODY'])
|
||||
|
||||
msg = {
|
||||
"TTS": True,
|
||||
"msg": conf['MESSAGE']['VOTENOBODY'],
|
||||
"badges": True,
|
||||
"subscriber": True,
|
||||
"msgid": True,
|
||||
"user": conf['IRC_USERNAME'],
|
||||
"length": conf['IRC_TTS_LEN'],
|
||||
"queuetime": datetime.datetime.now(),
|
||||
"timestamp": str(time.time_ns())
|
||||
}
|
||||
msg_queue_raw.append(msg)
|
||||
logging.info('The result is: %s', conf['MESSAGE']['VOTENOBODY'])
|
||||
logging.debug('Votemsg: %s', msg)
|
||||
|
||||
self.quickvote = False
|
||||
self.poll = {}
|
||||
return False
|
||||
|
@ -218,6 +234,21 @@ class IRC:
|
|||
|
||||
logging.debug(count)
|
||||
|
||||
msg = {
|
||||
"TTS": True,
|
||||
"msg": conf['MESSAGE']['VOTERESULT'] +" "+ str(count[0]),
|
||||
"badges": True,
|
||||
"subscriber": True,
|
||||
"msgid": True,
|
||||
"user": conf['IRC_USERNAME'],
|
||||
"length": conf['IRC_TTS_LEN'],
|
||||
"queuetime": datetime.datetime.now(),
|
||||
"timestamp": str(time.time_ns())
|
||||
}
|
||||
msg_queue_raw.append(msg)
|
||||
logging.info('The result is: %s', conf['MESSAGE']['VOTERESULT'] +" "+ str(count[0]))
|
||||
logging.debug('Votemsg: %s', msg)
|
||||
|
||||
for key, value in count:
|
||||
self.sendmsg(
|
||||
conf['IRC_CHANNEL'], "*",
|
||||
|
@ -534,6 +565,7 @@ def load_config():
|
|||
conf['MESSAGE']['VOTESTART'] = cfg['messages']['votestart'] or "Quickvote started. Send #yourchoice to participate."
|
||||
conf['MESSAGE']['VOTEEND'] = cfg['messages']['voteend'] or "Quickvote ended. The results are:"
|
||||
conf['MESSAGE']['VOTENOBODY'] = cfg['messages']['votenobody'] or "Nobody casted a vote. :("
|
||||
conf['MESSAGE']['VOTERESULT'] = cfg['messages']['voteresult'] or "Voting has ended. The result is:"
|
||||
conf['MESSAGE']['VOTES'] = cfg['messages']['votes'] or "Stimmen"
|
||||
|
||||
conf['USERMAP'] = cfg['usermapping'] or []
|
||||
|
|
Loading…
Add table
Reference in a new issue