diff --git a/plugins/administration.lua b/plugins/administration.lua index 3f9a39a..ed744fe 100644 --- a/plugins/administration.lua +++ b/plugins/administration.lua @@ -1,6 +1,6 @@ --[[ administration.lua - Version 1.8.2 + Version 1.8.3 Part of the otouto project. © 2016 topkecleon GNU General Public License, version 2 @@ -26,6 +26,8 @@ 1.8.2 - Will now attempt to unban users kicked from supergroups. Other small changes. + 1.8.3 - Migrated to new plugin standard. Added /ahelp command to /desc. + ]]-- local JSON = require('dkjson') @@ -222,6 +224,7 @@ function administration:get_desc(chat_id) if modstring ~= '' then table.insert(t, '*Moderators:*\n' .. utilities.trim(modstring)) end + table.insert(t, 'Run /ahelp@' .. self.info.username .. ' for a list of commands.') return table.concat(t, '\n\n') end diff --git a/plugins/lastfm.lua b/plugins/lastfm.lua index be40153..9f3a2f4 100755 --- a/plugins/lastfm.lua +++ b/plugins/lastfm.lua @@ -16,8 +16,8 @@ function lastfm:init() lastfm.triggers = utilities.triggers(self.info.username):t('lastfm', true):t('np', true):t('fmset', true).table end -bindings.command = 'lastfm' -bindings.doc = [[``` +lastfm.command = 'lastfm' +lastfm.doc = [[``` /np [username] Returns what you are or were last listening to. If you specify a username, info will be returned for that username. diff --git a/plugins/nick.lua b/plugins/nick.lua index d2a680b..375b717 100755 --- a/plugins/nick.lua +++ b/plugins/nick.lua @@ -40,6 +40,7 @@ function nick:action(msg) self.database.users[target.id_str].nickname = nil output = target.name .. '\'s nickname has been deleted.' else + input = input:gsub('\n', ' ') self.database.users[target.id_str].nickname = input output = target.name .. '\'s nickname has been set to "' .. input .. '".' end diff --git a/plugins/xkcd.lua b/plugins/xkcd.lua index 26685c6..6834baf 100755 --- a/plugins/xkcd.lua +++ b/plugins/xkcd.lua @@ -1,7 +1,6 @@ local xkcd = {} local HTTP = require('socket.http') -local HTTPS = require('ssl.https') local URL = require('socket.url') local JSON = require('dkjson') local bindings = require('bindings') @@ -29,7 +28,10 @@ function xkcd:action(msg) local input = utilities.input(msg.text) if input then - if tonumber(input) then + if input == '404' then + bindings.sendMessage(self, msg.chat.id, '*404*\nNot found.', false, nil, true) + return + elseif tonumber(input) then if tonumber(input) > latest then strip_num = latest else @@ -49,7 +51,7 @@ function xkcd:action(msg) end local jdat = JSON.decode(jstr) - local output = '[' .. jdat.num .. '](' .. jdat.img .. ')\n' .. jdat.alt + local output = '*' .. jdat.safe_title .. '* ([' .. jdat.num .. '](' .. jdat.img .. '))\n' .. jdat.alt bindings.sendMessage(self, msg.chat.id, output, false, nil, true) diff --git a/utilities.lua b/utilities.lua index cead6c8..fad6a80 100755 --- a/utilities.lua +++ b/utilities.lua @@ -88,7 +88,6 @@ end -- Loads a JSON file as a table. function utilities.load_data(filename) - local f = io.open(filename) if not f then return {} @@ -96,19 +95,15 @@ function utilities.load_data(filename) local s = f:read('*all') f:close() local data = JSON.decode(s) - return data - end -- Saves a table to a JSON file. function utilities.save_data(filename, data) - local s = JSON.encode(data) local f = io.open(filename, 'w') f:write(s) f:close() - end -- Gets coordinates for a location. Used by gMaps.lua, time.lua, weather.lua. @@ -169,7 +164,6 @@ function utilities:user_from_message(msg) local input = utilities.input(msg.text_lower) local target = {} if msg.reply_to_message then - print('reply') target = msg.reply_to_message.from elseif input and tonumber(input) then target.id = tonumber(input)