parent
3412cf0df4
commit
cc5a45c06b
@ -19,6 +19,7 @@ ignored_folders = tmp
|
|||||||
ignored_files = Thumbs.db
|
ignored_files = Thumbs.db
|
||||||
|
|
||||||
announce_current_music = True
|
announce_current_music = True
|
||||||
|
allow_other_channel_message = False
|
||||||
|
|
||||||
[webinterface]
|
[webinterface]
|
||||||
enabled = False
|
enabled = False
|
||||||
@ -63,6 +64,7 @@ multiple_matches = Track not found! Possible candidates:
|
|||||||
queue_contents = The next items in the queue are:
|
queue_contents = The next items in the queue are:
|
||||||
queue_empty = No more music in the playlist!
|
queue_empty = No more music in the playlist!
|
||||||
now_playing = Now playing %s<br />%s
|
now_playing = Now playing %s<br />%s
|
||||||
|
not_in_my_channel = You're not in my channel, command refused !
|
||||||
|
|
||||||
help = Command available:
|
help = Command available:
|
||||||
<br />!file [path]
|
<br />!file [path]
|
||||||
|
21
mumbleBot.py
21
mumbleBot.py
@ -129,7 +129,13 @@ class MumbleBot:
|
|||||||
|
|
||||||
logging.info(command + ' - ' + parameter + ' by ' + user)
|
logging.info(command + ' - ' + parameter + ' by ' + user)
|
||||||
|
|
||||||
if command == var.config.get('command', 'play_file') and parameter:
|
if command == var.config.get('command', 'joinme'):
|
||||||
|
self.mumble.users.myself.move_in(self.mumble.users[text.actor]['channel_id'])
|
||||||
|
|
||||||
|
elif not self.is_admin(user) and not var.config.getboolean('bot', 'allow_other_channel_message') and self.mumble.users[text.actor]['channel_id'] != self.mumble.users.myself['channel_id']:
|
||||||
|
self.mumble.users[text.actor].send_message(var.config.get('strings', 'not_in_my_channel'))
|
||||||
|
|
||||||
|
elif command == var.config.get('command', 'play_file') and parameter:
|
||||||
music_folder = var.config.get('bot', 'music_folder')
|
music_folder = var.config.get('bot', 'music_folder')
|
||||||
# sanitize "../" and so on
|
# sanitize "../" and so on
|
||||||
path = os.path.abspath(os.path.join(music_folder, parameter))
|
path = os.path.abspath(os.path.join(music_folder, parameter))
|
||||||
@ -166,7 +172,7 @@ class MumbleBot:
|
|||||||
self.stop()
|
self.stop()
|
||||||
|
|
||||||
elif command == var.config.get('command', 'kill'):
|
elif command == var.config.get('command', 'kill'):
|
||||||
if self.is_admin(text.actor):
|
if self.is_admin(user):
|
||||||
self.stop()
|
self.stop()
|
||||||
self.exit = True
|
self.exit = True
|
||||||
else:
|
else:
|
||||||
@ -177,9 +183,6 @@ class MumbleBot:
|
|||||||
if self.channel:
|
if self.channel:
|
||||||
self.mumble.channels.find_by_name(self.channel).move_in()
|
self.mumble.channels.find_by_name(self.channel).move_in()
|
||||||
|
|
||||||
elif command == var.config.get('command', 'joinme'):
|
|
||||||
self.mumble.users.myself.move_in(self.mumble.users[text.actor]['channel_id'])
|
|
||||||
|
|
||||||
elif command == var.config.get('command', 'volume'):
|
elif command == var.config.get('command', 'volume'):
|
||||||
if parameter is not None and parameter.isdigit() and 0 <= int(parameter) <= 100:
|
if parameter is not None and parameter.isdigit() and 0 <= int(parameter) <= 100:
|
||||||
self.volume = float(float(parameter) / 100)
|
self.volume = float(float(parameter) / 100)
|
||||||
@ -246,8 +249,8 @@ class MumbleBot:
|
|||||||
msg = var.config.get('strings', 'queue_empty')
|
msg = var.config.get('strings', 'queue_empty')
|
||||||
else:
|
else:
|
||||||
msg = var.config.get('strings', 'queue_contents') + '<br />'
|
msg = var.config.get('strings', 'queue_contents') + '<br />'
|
||||||
for (type, path) in var.playlist:
|
for (music_type, path) in var.playlist:
|
||||||
msg += '({}) {}<br />'.format(type, path)
|
msg += '({}) {}<br />'.format(music_type, path)
|
||||||
|
|
||||||
self.send_msg_channel(msg)
|
self.send_msg_channel(msg)
|
||||||
|
|
||||||
@ -268,9 +271,9 @@ class MumbleBot:
|
|||||||
self.playing = True
|
self.playing = True
|
||||||
|
|
||||||
def is_admin(self, user):
|
def is_admin(self, user):
|
||||||
username = self.mumble.users[user]['name']
|
|
||||||
list_admin = var.config.get('bot', 'admin').split(';')
|
list_admin = var.config.get('bot', 'admin').split(';')
|
||||||
if username in list_admin:
|
print(list_admin)
|
||||||
|
if user in list_admin:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user