Removed kill command, added mute and unmute

This commit is contained in:
Matthieu Grieger 2014-11-19 23:37:12 -08:00
parent 5d22afa2c6
commit abb1176160
3 changed files with 29 additions and 15 deletions

View file

@ -13,7 +13,7 @@ BOT_USERNAME = "MumbleDJTest"
# Password to join Mumble server
# DEFAULT VALUE: "" (leave it as this value if no password is required)
MUMBLE_PASSWORD = ""
MUMBLE_PASSWORD = ENV['MUMBLE_PW']
# Server address
# DEFAULT VALUE: "localhost"
@ -77,9 +77,13 @@ VOLUME_ALIAS = "volume"
# DEFAULT VALUE: "move"
MOVE_ALIAS = "move"
# Alias used for kill command
# DEFAULT VALUE: "kill"
KILL_ALIAS = "kill"
# Alias used for mute command
# DEFAULT VALUE: "mute"
MUTE_ALIAS = "mute"
# Alias used for unmute command
# DEFAULT VALUE: "unmute"
UNMUTE_ALIAS = "unmute"
# -------------------
@ -112,8 +116,12 @@ ADMIN_VOLUME = true
# DEFAULT VALUE: true
ADMIN_MOVE = true
# Make kill an admin command?
# DEFAULT VALUE: true (I recommend never changing this to false)
ADMIN_KILL = true
# Make mute an admin command?
# DEFAULT VALUE: true
ADMIN_MUTE = true
# Make unmute an admin command?
# DEFAULT VALUE: true
ADMIN_UNMUTE = true

View file

@ -16,6 +16,7 @@ class MumbleDJ
# default_channel: The channel you would like the bot to connect to by
# default. If the channel does not exist, the bot will connect to
# the root channel of the server instead.
# password: Password to join a password-protected server
def initialize(username, server_address, server_port, default_channel, password)
@username = username
@password = password
@ -77,7 +78,7 @@ class MumbleDJ
puts("#{@sender} has added a song to the queue.")
end
if song_add_successful?(@argument, @sender)
@client.text_channel("#(@sender} has added a song to the queue.")
@client.text_channel(@client.me.current_channel.name, "<b>#{@sender}</b> has added a song to the queue.")
else
@client.text_user(@sender, "The URL you provided was not valid.")
end
@ -105,10 +106,15 @@ class MumbleDJ
else
@client.text_user(@sender, NO_PERMISSION_MSG)
end
# This one doesn't work for some reason. Gotta do some testing.
when KILL_ALIAS
if has_permission?(ADMIN_KILL, @sender)
disconnect
when MUTE_ALIAS
if has_permission?(ADMIN_MUTE, @sender)
@client.me.mute
else
@client.text_user(@sender, NO_PERMISSION_MSG)
end
when UNMUTE_ALIAS
if has_permission?(ADMIN_UNMUTE, @sender)
@client.me.mute(false)
else
@client.text_user(@sender, NO_PERMISSION_MSG)
end

View file

@ -4,11 +4,11 @@
require_relative "mumbledj"
require_relative "config"
require 'thread'
require "thread"
bot = MumbleDJ.new(username=BOT_USERNAME, server_address=MUMBLE_SERVER_ADDRESS, port=MUMBLE_SERVER_PORT,
default_channel=DEFAULT_CHANNEL, password=MUMBLE_PASSWORD)
bot.connect
default_channel=DEFAULT_CHANNEL, password=MUMBLE_PASSWORD)
bot.connect()
begin
t = Thread.new do