o
    0a?h                     @   sl   d dl Z d dlmZ d dlZd dlZe   ejddddZG dd dejZ	e
d	kr4e	 Ze  dS dS )
    N)commands	localhosti     )hostportdbc                       sF   e Zd Z fddZdd Zdd Zejddd	d
ddZ  Z	S )SongBotc                    s.   t d}|stdt j|ddgd d S )NZTWITCH_TOKENz,TWITCH_TOKEN environment variable is not set!Zdjsuno)tokenprefixZinitial_channels)osgetenv
ValueErrorsuper__init__)selfr
   	__class__ 0/Users/zoeshleifer/deejay-suno/twitch_bot/bot.pyr      s   

zSongBot.__init__c                    s&   t d| j  t d| j  dS )zCalled when the bot is readyzBot is ready! Logged in as zConnected to channels: N)printZnickZconnected_channels)r   r   r   r   event_ready   s   zSongBot.event_readyc                    s8   |j rdS t|jj d|j  | |I dH  dS )z Called for every message in chatNz: )echor   authornamecontentZhandle_commands)r   messager   r   r   event_message   s
   zSongBot.event_messageZgo)r   N)	song_infoc                   sf   |s| d|jj dI dH  dS t|  tt| }td|jj d| d| d dS )z+Handle !go command to add songs to the list@z% Please provide a tag! Usage: !go tagN z has been requested z times!)sendr   r   redis_clientincrintgetr   )r   ctxr   valuer   r   r   song_request*   s   $zSongBot.song_request)
__name__
__module____qualname__r   r   r   r   commandr(   __classcell__r   r   r   r   r      s    
r   __main__)dotenvZtwitchio.extr   r   redisZload_dotenvRedisr"   ZBotr   r)   botrunr   r   r   r   <module>   s    ,