fix: no admin check for dropdatabase

This commit is contained in:
Terry Geng 2020-03-08 13:55:41 +08:00
parent 32b2875e52
commit 369af16aed
2 changed files with 17 additions and 9 deletions

View File

@ -894,18 +894,24 @@ def cmd_find_tagged(bot, user, text, command, parameter):
def cmd_drop_database(bot, user, text, command, parameter):
global log
var.db.drop_table()
var.db = SettingsDatabase(var.dbfile)
var.music_db.drop_table()
var.music_db = MusicDatabase(var.dbfile)
log.info("command: database dropped.")
bot.send_msg(constants.strings('database_dropped'), text)
if bot.is_admin(user):
var.db.drop_table()
var.db = SettingsDatabase(var.dbfile)
var.music_db.drop_table()
var.music_db = MusicDatabase(var.dbfile)
log.info("command: database dropped.")
bot.send_msg(constants.strings('database_dropped'), text)
else:
bot.mumble.users[text.actor].send_text_message(constants.strings('not_admin'))
def cmd_refresh_cache(bot, user, text, command, parameter):
global log
var.library.build_dir_cache(bot)
log.info("command: Local file cache refreshed.")
bot.send_msg(constants.strings('cache_refreshed'), text)
if bot.is_admin(user):
var.library.build_dir_cache(bot)
log.info("command: Local file cache refreshed.")
bot.send_msg(constants.strings('cache_refreshed'), text)
else:
bot.mumble.users[text.actor].send_text_message(constants.strings('not_admin'))
# Just for debug use
def cmd_real_time_rms(bot, user, text, command, parameter):

View File

@ -276,11 +276,13 @@ help = <h3>Commands</h3>
first search result of {keywords} into the playlist.</li>
</ul>
<b>Tag</b>
<ul>
<li> <b>!<u>addt</u>ag </b> {index} {tags} - add {tags} to {index}-th item on the playlist, tags separated by ",". </li>
<li> <b>!<u>addt</u>ag </b> * {tags} - add {tags} to all items on the playlist. </li>
<li> <b>!<u>un</u>tag </b> {index/*} {tags} - remove {tags} from {index}-th item on the playlist. </li>
<li> <b>!<u>un</u>tag </b> {index/*} * - remove all tags from {index}-th item on the playlist. </li>
<li> <b>!<u>fin</u>dtagged </b> (or <b>!ft</b>) {tags} - find item with {tags} in the music library. </li>
</ul>
<b>Other</b>
<ul>
<li> <b>!<u>j</u>oinme {token} </b> - join your own channel with {token}.</li>