import pokedex.db.tables as tables
import pokedex.lookup
+import urllib
+
class Pokedex(callbacks.Plugin):
"""Add the help for "@plugin help Pokedex" here
This should describe *how* to use this plugin."""
if isinstance(obj, tables.Pokemon):
reply_template = \
u"""#{id} {name}, {type}-type Pokémon. Has {abilities}. """ \
- """Is {stats}."""
+ """Is {stats}. """ \
+ """http://beta.veekun.com/dex/pokemon/{link_name}"""
self._reply(irc, reply_template.format(
id=obj.id,
name=obj.name,
type='/'.join(_.name for _ in obj.types),
abilities=' or '.join(_.name for _ in obj.abilities),
stats='/'.join(str(_.base_stat) for _ in obj.stats),
+ link_name=urllib.quote(obj.name.lower()),
)
)
reply_template = \
u"""{name}, {type}-type {damage_class} move. """ \
"""{power} power; {accuracy}% accuracy; {pp} PP. """ \
- """{effect}"""
+ """{effect} """ \
+ """http://beta.veekun.com/dex/moves/{link_name}"""
self._reply(irc, reply_template.format(
name=obj.name,
type=obj.type.name,
accuracy=obj.accuracy,
pp=obj.pp,
effect=unicode(obj.short_effect.as_html),
+ link_name=urllib.quote(obj.name.lower()),
)
)
elif isinstance(obj, tables.Type):
- self._reply(irc, u"""{name}, a type.""".format(
+ self._reply(irc, u"""{name}, a type. http://beta.veekun.com/dex/types/{link_name}""".format(
name=obj.name,
+ link_name=urllib.quote(obj.name.lower()),
)
)
elif isinstance(obj, tables.Item):
- self._reply(irc, u"""{name}, an item.""".format(
+ self._reply(irc, u"""{name}, an item. http://beta.veekun.com/dex/items/{link_name}""".format(
name=obj.name,
+ link_name=urllib.quote(obj.name.lower()),
)
)
elif isinstance(obj, tables.Ability):
- self._reply(irc, u"""{name}, an ability. {effect}""".format(
+ self._reply(irc, u"""{name}, an ability. {effect} http://beta.veekun.com/dex/abilities/{link_name}""".format(
name=obj.name,
effect=obj.effect,
+ link_name=urllib.quote(obj.name.lower()),
)
)