Coder Social home page Coder Social logo

queuebot's Introduction

QueueBot

Queue management bot for Twitch.tv chat on Python 3.4

Set NICK, IDENT, and REALNAME to the Twitch.tv username of the bot.

PASS is the oauth token for the bot (generated from http://www.twitchapps.com/tmi/).

INIT_CHANNEL is #bot_name.

ADMIN is the Twitch.tv username of the designated bot admin.

Additional information at https://github.com/justintv/Twitch-API/blob/master/IRC.md

###Commands

######Debug Commands

!hello - Returns a message

!echo msg - Echos msg

!users - Returns the bot's list of users

!data - Returns all data for the current channel

!quit - Kills bot

######Broadcaster Commands

!join - Tells the bot to join your chatroom

!remove - Removes the bot from your chatroom

!trust user - Adds user to your trusted list

!untrust user - Removes user from your trusted list

!queue on/off - Enables or Disables queue functions in your chatroom

######Queue Commands (Broadcaster/Trusted User)

!queue show - Shows the entire queue

!queue setsize n - Sets the player group size to n

!queue new - Generates a new group from the queue

!queue remove user - Removes user from the queue. If user is in the current group, removes user from the group and adds another from the queue

!queue clear - Clears the queue and current group

######Queue Commands (Viewers)

!queue add - Add yourself to the end of the queue

!queue remove - Remove yourself from the queue or current group

!queue players - Lists the players in the current group

!queue size - Show current size of queue

!queue position - Check your position in the queue

queuebot's People

Contributors

arghblargh avatar

Stargazers

Kevin Yuliawan avatar Kirsten Korevaar avatar  avatar Kyros Koh avatar

Watchers

James Cloos avatar  avatar

Forkers

pandaman212

queuebot's Issues

Could not run Bot: Invalid Syntax

I have re-git clone after you have last committed: 65b0966 and a31356d

sh-4.1$ python --version
Python 3.3.5

sh-4.1$ python QueueBot.py
File "QueueBot.py", line 393
elif result = 'N':
^
SyntaxError: invalid syntax

ASCII codec failed.

Traceback (most recent call last):
File "QueueBot.py", line 433, in
main()
File "QueueBot.py", line 209, in main
readbuffer += s.recv(1024).decode()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xeb in position 60: ordinal not in range(128)

[Program Died] Trusted User typed !queue off

:ng224![email protected] PRIVMSG #loserfruit :!queue off
Traceback (most recent call last):
File "QueueBot.py", line 436, in
main()
File "QueueBot.py", line 335, in main
elif (queue_command=='off' and (admin_auth(user) or broadcaster_auth(channel, user) or trusted_auth(channel, user))):
File "QueueBot.py", line 188, in trusted_auth
return channel_info[channel].trusted(user)
TypeError: 'set' object is not callable


It could apply to "!queue on" too

NameError: global name 'FileNotFoundError' is not defined

HOST="irc.twitch.tv"
PORT=6667
NICK="Fruit_Bot"
PASS="oauth:xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
IDENT="fruit"
REALNAME="LoserFruit's Queue Bot"
INIT_CHANNEL="#loserfruit"
ADMIN="KyrosKoh"
SAVE_FILE='data.xml'
MIN_DELAY=datetime.timedelta(0,2,500000) # 2.5 second delay between sent messages


When I have executed the script, the error occured:

-sh-4.1$ python QueueBot.py
Traceback (most recent call last):
File "QueueBot.py", line 438, in
main()
File "QueueBot.py", line 207, in main
load_data()
File "QueueBot.py", line 156, in load_data
except FileNotFoundError:
NameError: global name 'FileNotFoundError' is not defined


Since In Python 3.3, IOError became an alias for OSError, and FileNotFoundError is a subclass of OSError.


Line 156:

except FileNotFoundError:
    print("   > load_data: file not found")

Line 156:

I have changed to:

except (OSError, IOError) as e:
print(" > load_data: file not found")


Result:

-sh-4.1$ python QueueBot.py

load_data: file not found
:tmi.twitch.tv 001 fruit_bot :Welcome, GLHF!
:tmi.twitch.tv 002 fruit_bot :Your host is tmi.twitch.tv
:tmi.twitch.tv 003 fruit_bot :This server is rather new
:tmi.twitch.tv 004 fruit_bot :-
:tmi.twitch.tv 375 fruit_bot :-
:tmi.twitch.tv 372 fruit_bot :You are in a maze of twisty passages, all alike.
:tmi.twitch.tv 376 fruit_bot :>


Do you have your data.xml sample data? empty skeleton format?

Bot not reacting to commands in twitch chat

i am unable to make the bot respond it chat or even get it to join. this is what the console outputs when i got it up and running

:tmi.twitch.tv 002 itsmeoskii :Your host is tmi.twitch.tv
:tmi.twitch.tv 003 itsmeoskii :This server is rather new
:tmi.twitch.tv 004 itsmeoskii :-
:tmi.twitch.tv 375 itsmeoskii :-
:tmi.twitch.tv 372 itsmeoskii :You are in a maze of twisty passages, all alike.
:tmi.twitch.tv 376 itsmeoskii :>
PING :tmi.twitch.tv
PONG
PING :tmi.twitch.tv
PONG```

[Error] Queue Clear

I received an error when I am performing !queue clear.

[Scenario 1]

:kyroskoh![email protected] PRIVMSG #loserfruit :!queue new

send: New group:
:kyroskoh![email protected] PRIVMSG #loserfruit :!queue clear
Traceback (most recent call last):
File "QueueBot.py", line 433, in
main()
File "QueueBot.py", line 422, in main
channel_info[channel].queue_clear()
File "QueueBot.py", line 100, in queue_clear
self.queue.clear()
AttributeError: 'list' object has no attribute 'clear'


[Scenario 2]

:kyroskoh![email protected] PRIVMSG #loserfruit :!queue add

send: kyroskoh added to queue
:kyroskoh![email protected] PRIVMSG #loserfruit :!queue new
send: New group: kyroskoh
himekyros !himekyros @himekyros.tmi.twitch.tv PRIVMSG #loserfruit :!queue add
send: himekyros added to queue
:kyroskoh![email protected] PRIVMSG #loserfruit :!queue remove
send: Replaced kyroskoh with himekyros
:kyroskoh![email protected] PRIVMSG #loserfruit :!queue players
send: Current Player(s): himekyros
:kyroskoh![email protected] PRIVMSG #loserfruit :!queue clear
Traceback (most recent call last):
File "QueueBot.py", line 433, in
main()
File "QueueBot.py", line 422, in main
channel_info[channel].queue_clear()
File "QueueBot.py", line 100, in queue_clear
self.queue.clear()
AttributeError: 'list' object has no attribute 'clear'


May I know what is the steps to be taken to create a new group, add an user to the queue, choose someone from the queue to the group.

[Program Died] Untrusted User typed !queue show

[Scenario: The user is a mod but not added to trusted, if the user type the following]

:evilserpentman![email protected] PRIVMSG #loserfruit :!queue show

Traceback (most recent call last):
File "QueueBot.py", line 433, in
main()
File "QueueBot.py", line 350, in main
elif (queue_command=='show' and (admin_auth(user) or broadcaster_auth(channel, user) or trusted_auth(channel, user))):
File "QueueBot.py", line 188, in trusted_auth
return channel_info[channel].trusted(user)
TypeError: 'set' object is not callable

[Program Died] Case Sensitive Username Input / Invalid Username's not found

I have tested out the username's case sensitive problem. In Twitch IRC, it sets all usernames to the lowercase but however your program will die when someone input the username in case sensitive and/or invalid username which is not found.

Using username: "himekyros" as this scenario:


[Case Sensitive Username]
:kyroskoh![email protected] PRIVMSG #loserfruit :!queue add

send: kyroskoh added to queue
:kyroskoh![email protected] PRIVMSG #loserfruit :!queue new
send: New group: kyroskoh
:himekyros![email protected] PRIVMSG #loserfruit :!queue add
send: himekyros added to queue
:himekyros![email protected] PRIVMSG #loserfruit :!queue position
send: himekyros: #1 of 1
:kyroskoh![email protected] PRIVMSG #loserfruit :!queue remove HimeKyros
Traceback (most recent call last):
File "QueueBot.py", line 433, in
main()
File "QueueBot.py", line 389, in main
elif result[0] == 'R':
TypeError: 'NoneType' object is unsubscriptable


[Invalid Username/Username's not found]
:kyroskoh![email protected] PRIVMSG #loserfruit :!queue add

send: kyroskoh added to queue
:kyroskoh![email protected] PRIVMSG #loserfruit :!queue new
send: New group: kyroskoh
:himekyros![email protected] PRIVMSG #loserfruit :!queue add
send: himekyros added to queue
:himekyros![email protected] PRIVMSG #loserfruit :!queue position
send: himekyros: #1 of 1
:kyroskoh![email protected] PRIVMSG #loserfruit :!queue remove hime
Traceback (most recent call last):
File "QueueBot.py", line 433, in
main()
File "QueueBot.py", line 389, in main
elif result[0] == 'R':
TypeError: 'NoneType' object is unsubscriptable


[Correct Input]
:kyroskoh![email protected] PRIVMSG #loserfruit :!queue add

send: kyroskoh added to queue
:kyroskoh![email protected] PRIVMSG #loserfruit :!queue new
send: New group: kyroskoh
:himekyros![email protected] PRIVMSG #loserfruit :!queue add
send: himekyros added to queue
:himekyros![email protected] PRIVMSG #loserfruit :!queue position
send: himekyros: #1 of 1
:kyroskoh![email protected] PRIVMSG #loserfruit :!queue remove himekyros
send: himekyros removed from queue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.