Skip to content

Commit

Permalink
Merge pull request #2104 from half-duplex/raw-cmd
Browse files Browse the repository at this point in the history
admin: add .raw command to send raw IRC messages
  • Loading branch information
dgw authored Jul 2, 2021
2 parents 2c6d064 + 36749e0 commit f1bc92d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sopel/modules/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"""Error message when channel is missing from command arguments."""
ERROR_NOTHING_TO_SAY = 'I need a channel and a message to talk.'
"""Error message when channel and/or message are missing."""
ERROR_NOTHING_TO_RAW = 'I need an IRC message to send.'
"""Error message when no raw IRC message was given."""


class AdminSection(types.StaticSection):
Expand Down Expand Up @@ -223,6 +225,23 @@ def quit(bot, trigger):
bot.quit(quit_message)


@plugin.require_privmsg
@plugin.require_owner
@plugin.command('raw')
@plugin.priority('low')
@plugin.example('.raw PRIVMSG NickServ :CERT ADD')
def raw(bot, trigger):
"""
Send a raw IRC message. Can only be done in privmsg by the bot owner.
This is mostly useful for debugging.
"""
if trigger.group(2) is None:
bot.reply(ERROR_NOTHING_TO_RAW)
return

bot.write([trigger.group(2)])


@plugin.require_privmsg
@plugin.require_admin
@plugin.command('say', 'msg')
Expand Down

0 comments on commit f1bc92d

Please sign in to comment.