diff options
Diffstat (limited to 'plugins/discord/init.lua')
-rw-r--r-- | plugins/discord/init.lua | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/plugins/discord/init.lua b/plugins/discord/init.lua index cc7d09582c5..9e077f5d656 100644 --- a/plugins/discord/init.lua +++ b/plugins/discord/init.lua @@ -1,14 +1,16 @@ -- license:BSD-3-Clause -- copyright-holders:Carl -local exports = {} -exports.name = "discord" -exports.version = "0.0.1" -exports.description = "Discord presence" -exports.license = "BSD-3-Clause" -exports.author = { name = "Carl" } +local exports = { + name = "discord", + version = "0.0.1", + description = "Discord presence", + license = "BSD-3-Clause", + author = { name = "Carl" } } local discord = exports +local reset_subscription, pause_subscription, resume_subscription + function discord.startplugin() local pipe = emu.file("rw") local json = require("json") @@ -98,16 +100,16 @@ function discord.startplugin() end end - emu.register_start(function() + reset_subscription = emu.add_machine_reset_notifier(function () starttime = os.time() update("Playing") end) - emu.register_pause(function() + pause_subscription = emu.add_machine_pause_notifier(function () update("Paused") end) - emu.register_resume(function() + resume_subscription = emu.add_machine_resume_notifier(function () update("Playing") end) end |