Aka, Alias: replace obsolete LastFM example

This commit is contained in:
James Lu 2022-07-09 14:15:57 -07:00
parent 988fe08945
commit 95f6b1698e
4 changed files with 38 additions and 42 deletions

View File

@ -46,7 +46,7 @@ Now you can use Aka as you used Alias before.
Trout
^^^^^
Add an aka, trout, which expects a word as an argument::
Add an aka, ``trout``, which expects a word as an argument::
<jamessan> @aka add trout "reply action slaps $1 with a large trout"
<bot> jamessan: The operation succeeded.
@ -56,23 +56,19 @@ Add an aka, trout, which expects a word as an argument::
This ``trout`` aka requires the plugin ``Reply`` to be loaded since it
provides the ``action`` command.
LastFM
^^^^^^
Random percentage
^^^^^^^^^^^^^^^^^
Add an aka, ``lastfm``, which expects a last.fm username and replies with
their most recently played item::
Add an aka, ``randpercent``, which returns a random percentage value::
@aka add lastfm "rss [format concat http://ws.audioscrobbler.com/1.0/user/ [format concat [web urlquote $1] /recenttracks.rss]]"
@aka add randpercent "squish [dice 1d100]%"
This ``lastfm`` aka requires the following plugins to be loaded: ``RSS``,
``Format`` and ``Web``.
This requires the ``Filter`` and ``Games`` plugins to be loaded.
``RSS`` provides ``rss``, ``Format`` provides ``concat`` and ``Web`` provides
``urlquote``.
Note that if the nested commands being aliased hadn't been quoted, then
those commands would have been run immediately, and ``@lastfm`` would always
reply with the same information, the result of those commands.
Note that nested commands in an alias should be quoted, or they will only
run once when you create the alias, and not each time the alias is
called. (In this case, not quoting the nested command would mean that
``@randpercent`` always responds with the same value!)
.. _commands-Aka:

View File

@ -532,7 +532,7 @@ class Aka(callbacks.Plugin):
Trout
^^^^^
Add an aka, trout, which expects a word as an argument::
Add an aka, ``trout``, which expects a word as an argument::
<jamessan> @aka add trout "reply action slaps $1 with a large trout"
<bot> jamessan: The operation succeeded.
@ -542,23 +542,19 @@ class Aka(callbacks.Plugin):
This ``trout`` aka requires the plugin ``Reply`` to be loaded since it
provides the ``action`` command.
LastFM
^^^^^^
Random percentage
^^^^^^^^^^^^^^^^^
Add an aka, ``lastfm``, which expects a last.fm username and replies with
their most recently played item::
Add an aka, ``randpercent``, which returns a random percentage value::
@aka add lastfm "rss [format concat http://ws.audioscrobbler.com/1.0/user/ [format concat [web urlquote $1] /recenttracks.rss]]"
@aka add randpercent "squish [dice 1d100]%"
This ``lastfm`` aka requires the following plugins to be loaded: ``RSS``,
``Format`` and ``Web``.
This requires the ``Filter`` and ``Games`` plugins to be loaded.
``RSS`` provides ``rss``, ``Format`` provides ``concat`` and ``Web`` provides
``urlquote``.
Note that if the nested commands being aliased hadn't been quoted, then
those commands would have been run immediately, and ``@lastfm`` would always
reply with the same information, the result of those commands.
Note that nested commands in an alias should be quoted, or they will only
run once when you create the alias, and not each time the alias is
called. (In this case, not quoting the nested command would mean that
``@randpercent`` always responds with the same value!)
"""
def __init__(self, irc):

View File

@ -18,21 +18,23 @@ This plugin is only kept for backward compatibility, you should use the
built-in Aka plugin instead (you can migrate your existing aliases using
the 'importaliasdatabase' command.
To add an alias, `trout`, which expects a word as an argument::
To add an alias, ``trout``, which expects a word as an argument::
<jamessan> @alias add trout "action slaps $1 with a large trout"
<bot> jamessan: The operation succeeded.
<jamessan> @trout me
* bot slaps me with a large trout
To add an alias, `lastfm`, which expects a last.fm user and replies with
their recently played items::
Add an alias, ``randpercent``, which returns a random percentage value::
@alias add lastfm "rss [format concat http://ws.audioscrobbler.com/1.0/user/ [format concat [urlquote $1] /recenttracks.rss]]"
@alias add randpercent "squish [dice 1d100]%"
Note that if the nested commands being aliased hadn't been quoted, then
those commands would have been run immediately, and `@lastfm` would always
reply with the same information, the result of those commands.
This requires the ``Filter`` and ``Games`` plugins to be loaded.
Note that nested commands in an alias should be quoted, or they will only
run once when you create the alias, and not each time the alias is
called. (In this case, not quoting the nested command would mean that
``@randpercent`` always responds with the same value!)
.. _commands-Alias:

View File

@ -243,21 +243,23 @@ class Alias(callbacks.Plugin):
built-in Aka plugin instead (you can migrate your existing aliases using
the 'importaliasdatabase' command.
To add an alias, `trout`, which expects a word as an argument::
To add an alias, ``trout``, which expects a word as an argument::
<jamessan> @alias add trout "action slaps $1 with a large trout"
<bot> jamessan: The operation succeeded.
<jamessan> @trout me
* bot slaps me with a large trout
To add an alias, `lastfm`, which expects a last.fm user and replies with
their recently played items::
Add an alias, ``randpercent``, which returns a random percentage value::
@alias add lastfm "rss [format concat http://ws.audioscrobbler.com/1.0/user/ [format concat [urlquote $1] /recenttracks.rss]]"
@alias add randpercent "squish [dice 1d100]%"
Note that if the nested commands being aliased hadn't been quoted, then
those commands would have been run immediately, and `@lastfm` would always
reply with the same information, the result of those commands.
This requires the ``Filter`` and ``Games`` plugins to be loaded.
Note that nested commands in an alias should be quoted, or they will only
run once when you create the alias, and not each time the alias is
called. (In this case, not quoting the nested command would mean that
``@randpercent`` always responds with the same value!)
"""
def __init__(self, irc):
self.__parent = super(Alias, self)