#19 ignore PM
This commit is contained in:
parent
cc5a45c06b
commit
d4d9eb24f5
@ -20,6 +20,7 @@ ignored_files = Thumbs.db
|
|||||||
|
|
||||||
announce_current_music = True
|
announce_current_music = True
|
||||||
allow_other_channel_message = False
|
allow_other_channel_message = False
|
||||||
|
allow_private_message = True
|
||||||
|
|
||||||
[webinterface]
|
[webinterface]
|
||||||
enabled = False
|
enabled = False
|
||||||
@ -65,6 +66,7 @@ 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 !
|
not_in_my_channel = You're not in my channel, command refused !
|
||||||
|
pm_not_allowed = Private message aren't allowed.
|
||||||
|
|
||||||
help = Command available:
|
help = Command available:
|
||||||
<br />!file [path]
|
<br />!file [path]
|
||||||
|
11
mumbleBot.py
11
mumbleBot.py
@ -131,11 +131,17 @@ class MumbleBot:
|
|||||||
|
|
||||||
if command == var.config.get('command', 'joinme'):
|
if command == var.config.get('command', 'joinme'):
|
||||||
self.mumble.users.myself.move_in(self.mumble.users[text.actor]['channel_id'])
|
self.mumble.users.myself.move_in(self.mumble.users[text.actor]['channel_id'])
|
||||||
|
return
|
||||||
|
|
||||||
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']:
|
if 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'))
|
self.mumble.users[text.actor].send_message(var.config.get('strings', 'not_in_my_channel'))
|
||||||
|
return
|
||||||
|
|
||||||
elif command == var.config.get('command', 'play_file') and parameter:
|
if not self.is_admin(user) and not var.config.getboolean('bot', 'allow_private_message') and text.session:
|
||||||
|
self.mumble.users[text.actor].send_message(var.config.get('strings', 'pm_not_allowed'))
|
||||||
|
return
|
||||||
|
|
||||||
|
if 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))
|
||||||
@ -272,7 +278,6 @@ class MumbleBot:
|
|||||||
|
|
||||||
def is_admin(self, user):
|
def is_admin(self, user):
|
||||||
list_admin = var.config.get('bot', 'admin').split(';')
|
list_admin = var.config.get('bot', 'admin').split(';')
|
||||||
print(list_admin)
|
|
||||||
if user in list_admin:
|
if user in list_admin:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user