From 0afeeb2798fdf6c8d942926e28b3c49dbafd1393 Mon Sep 17 00:00:00 2001 From: ahmedjabbar1 Date: Sat, 22 Oct 2016 07:46:26 +0300 Subject: [PATCH] Delete channels.lua --- plugins/channels.lua | 80 -------------------------------------------- 1 file changed, 80 deletions(-) delete mode 100644 plugins/channels.lua diff --git a/plugins/channels.lua b/plugins/channels.lua deleted file mode 100644 index 8d7e710f..00000000 --- a/plugins/channels.lua +++ /dev/null @@ -1,80 +0,0 @@ --- Checks if bot was disabled on specific chat -local function is_channel_disabled( receiver ) - if not _config.disabled_channels then - return false - end - - if _config.disabled_channels[receiver] == nil then - return false - end - - return _config.disabled_channels[receiver] -end - -local function enable_channel(receiver) - if not _config.disabled_channels then - _config.disabled_channels = {} - end - - if _config.disabled_channels[receiver] == nil then - return 'Channel isn\'t disabled' - end - - _config.disabled_channels[receiver] = false - - save_config() - return "Channel re-enabled" -end - -local function disable_channel( receiver ) - if not _config.disabled_channels then - _config.disabled_channels = {} - end - - _config.disabled_channels[receiver] = true - - save_config() - return "Channel disabled" -end - -local function pre_process(msg) - local receiver = get_receiver(msg) - - -- If sender is sudo then re-enable the channel - if is_sudo(msg) then - if msg.text == "!channel enable" then - enable_channel(receiver) - end - end - - if is_channel_disabled(receiver) then - msg.text = "" - end - - return msg -end - -local function run(msg, matches) - local receiver = get_receiver(msg) - -- Enable a channel - if matches[1] == 'enable' then - return enable_channel(receiver) - end - -- Disable a channel - if matches[1] == 'disable' then - return disable_channel(receiver) - end -end - -return { - description = "Plugin to manage channels. Enable or disable channel.", - usage = { - "!channel enable: enable current channel", - "!channel disable: disable current channel" }, - patterns = { - "^!channel? (enable)", - "^!channel? (disable)" }, - run = run, - privileged = true, - pre_process = pre_process -} \ No newline at end of file