예제 #1
0
파일: tts.py 프로젝트: nesttle/DeepThonk
async def tts(ctx):
    'Lets chat use TTS w/o cheers or other events.'
    if tts_on is False:
        await ctx.send(f"@{ctx.author.name} => TTS is temporarily disabled.")
        return

    if tts_sub_only and (ctx.author.subscriber is False
                         or ctx.author.is_mod is False):
        await ctx.send(
            f'@{ctx.author.name} => TTS is sub-only during IRL streams.')
        return
    print(ctx.content)
    token = ctx.content.split(' ', 1)
    await emit_tts(token[1])
    log.debug(f'tts request detected in chat: {token[1]}')
예제 #2
0
        async def sfx_func(ctx):

            if sfx_state is False:
                await ctx.send(
                    f"@{ctx.author.name} => SFX are temporarily disabled.")
                return

            if sfx_sub_only and (ctx.author.subscriber is False
                                 or ctx.author.is_mod is False):
                await ctx.send(
                    f'@{ctx.author.name} => SFX are sub-only at the moment.')
                return

            await emit_sfx(cmd_name_with_extenion
                           )  # send the command to the server

            log.debug(f'SFX request detected in chat: {cmd_no_extension}')
예제 #3
0
""" Simple call/reponse commands w/o dependancies

Commands w/o any integrations or external dependancies live here. Usually
they are pretty simple commands. This is the place you'll wanna put 1-offs
and your channel-unique stuff.
"""

from config.importer import bot, twitch_team, twitch_channel
from server_interface import sio
from utils.logger import loggymclogger as log
from content import faq_info
from utils.tools import list_commands
from integrations.twitch.api_wrapper import interface

log.debug(f"{__name__} loaded")

############################### CUSTOM COMMANDS ###############################
""" Put your custom commands below!"""


@bot.command(name='test', aliases=['t'])
async def test_command(ctx):
    'example command'
    log.info("test")  # tests logging
    await ctx.send(f'Test passed, @{ctx.author.name}!')  # tests chat


####################### CALL/RESPONSE COMMAND GENERATOR #######################


class CommandGenerator:
예제 #4
0
"""Checks filesystem for audio files that the bot app turns into SFX commands."""

import os
from utils.logger import loggymclogger as log

list_of_sfx_files = []
sfx_with_extentions = []

path = 'static/sfx/hooks/'
for file in os.listdir(path):
    # create instance with attributes
    if file.endswith('.ogg') or file.endswith('.mp3') or file.endswith('.wav'):

        # add the file name to a list (including the extension)
        sfx_with_extentions.append(file)
        file = file[:-4]  # removes the sextension
        list_of_sfx_files.append(file)

log.debug(f"SFX Loaded: {list_of_sfx_files}")
예제 #5
0
async def on_repsponse(data):
    log.debug(f"[MSG RCVD] {data}")
예제 #6
0
async def on_connect():
    log.debug(f"{__name__}.... CONNECTERD!")
    await sio.emit('connect', {'data': 'CONNECTERD!'})
예제 #7
0
def raid_event(methods=['GET', 'POST']):
    log.debug(f"RAID OCCURRRRRED")
    socketio.emit('raid triggered')
예제 #8
0
def get_sfx_event(methods=['GET', 'POST']):
    'Sends list of SFX files so the bot can generate chat commands/objects.'
    log.debug(f"Bot application requested SFX files to generate commands.")
    # socketio.emit('send_sfx', list_of_sfx_files) # <- list serialized as json
    socketio.emit('send_sfx',
                  sfx_with_extentions)  # <- list serialized as json
예제 #9
0
def sfx_event(command, methods=['GET', 'POST']):
    'Recievs SFX requests from bot app & triggers SFX on the Browser Source'
    sfx_command = str(command)
    socketio.emit('sfx trigger', sfx_command)
    log.debug(f"SFX Triggered => {sfx_command}")
예제 #10
0
def tts_event(data, methods=['GET', 'POST']):
    msg = str(data)
    socketio.emit('tts trigger', msg)
    log.debug(f"TTS Triggered => {msg}")
예제 #11
0
def handle_my_custom_event(json, methods=['GET', 'POST']):
    log.debug(f"RCVD: 'my event' // DATA: {str(json)}")
    socketio.emit('my response', json, callback=messageReceived)
예제 #12
0
async def emit_stream_event(event):
    # await sio.emit(event='stream event', data=event)
    log.debug(f"emitting {event} event")
    await sio.emit(event=event)
예제 #13
0
async def on_connect():
    import tts  # only import this if the websocket connection is made
    log.debug(f"{__name__}.... CONNECTERD!")
    await sio.emit('connect', {'data': 'CONNECTERD!'})
    await sio.emit('get_sfx')