# Path: cardinal/decorators.py
# def command(triggers):
#     if isinstance(triggers, str):
#         triggers = [triggers]
# 
#     if not isinstance(triggers, list):
#         raise TypeError("Command must be a trigger string or list of triggers")
# 
#     def wrap(f):
#         f.commands = triggers
#         return f
# 
#     return wrap
# 
# def help(lines):
#     # For backwards compatibility
#     if isinstance(lines, str):
#         lines = [lines]
# 
#     if not isinstance(lines, list):
#         raise TypeError("Help must be a help string or list of help strings")
# 
#     def wrap(f):
#         # Create help list or prepend to it
#         if not hasattr(f, 'help'):
#             f.help = lines
#         else:
#             f.help = lines + f.help
# 
#         return f
# 
#     return wrap


import logging
import requests
from twisted.internet import defer
from twisted.internet.threads import deferToThread
from cardinal.decorators import command, help
            raise Exception(f"Unknown weather provider: {self.provider}")

    @command('setw')
    @help("Set your default weather location.")
    @help("Syntax: .setw <location>")
    @defer.inlineCallbacks
    def set_weather(self, cardinal, user, channel, msg):
        try:
            location = msg.split(' ', 1)[1]
        except IndexError:
            cardinal.sendMsg(channel, "Syntax: .setw <location>")
            return

        try:
            res = yield self.client.get_forecast(location)
        except Exception:
            cardinal.sendMsg(channel, "Sorry, I can't find that location.")
            self.logger.exception(
                "Error test fetching for location: '{}'".format(location)
            )
            return

        with self.db() as db:
            db[user.nick] = location

        cardinal.sendMsg(channel, '{}: Your default weather location is now '
                                  'set to {}. Next time you want the weather '
                                  'at this location, just use .weather or .w!'
                         .format(user.nick, res.location))


# Path: cardinal/decorators.py
# def command(triggers):
#     if isinstance(triggers, str):
#         triggers = [triggers]
# 
#     if not isinstance(triggers, list):
#         raise TypeError("Command must be a trigger string or list of triggers")
# 
#     def wrap(f):
#         f.commands = triggers
#         return f
# 
#     return wrap
# 
# def help(lines):
#     # For backwards compatibility
#     if isinstance(lines, str):
#         lines = [lines]
# 
#     if not isinstance(lines, list):
#         raise TypeError("Help must be a help string or list of help strings")
# 
#     def wrap(f):
#         # Create help list or prepend to it
#         if not hasattr(f, 'help'):
#             f.help = lines
#         else:
#             f.help = lines + f.help
# 
#         return f
# 
#     return wrap


# Path: plugins/weather/plugin.py
import logging
import requests
from twisted.internet import defer
from twisted.internet.threads import deferToThread
from cardinal.decorators import command, help

            raise Exception(f"Unknown weather provider: {self.provider}")

    @command('setw')
    @help("Set your default weather location.")
    @help("Syntax: .setw <location>")
    @defer.inlineCallbacks
    def set_weather(self, cardinal, user, channel, msg):
        try:
            location = msg.split(' ', 1)[1]
        except IndexError:
            cardinal.sendMsg(channel, "Syntax: .setw <location>")
            return

        try:
            res = yield self.client.get_forecast(location)
        except Exception:
            cardinal.sendMsg(channel, "Sorry, I can't find that location.")
            self.logger.exception(
                "Error test fetching for location: '{}'".format(location)
            )
            return

        with self.db() as db:
            db[user.nick] = location

        cardinal.sendMsg(channel, '{}: Your default weather location is now '
                                  'set to {}. Next time you want the weather '
                                  'at this location, just use .weather or .w!'
                         .format(user.nick, res.location))


    @command(['weather', 'w'])