mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +01:00
Moved the bug command to AdminCommands to reduce abuse.
This commit is contained in:
parent
4fc4df9ff4
commit
3d0bc9f8b2
@ -34,7 +34,11 @@ These are commands useful for administrating the bot; they all require their
|
||||
caller to have the 'admin' capability. This plugin is loaded by default.
|
||||
"""
|
||||
|
||||
from fix import *
|
||||
|
||||
import pprint
|
||||
import string
|
||||
import smtplib
|
||||
|
||||
import conf
|
||||
import ircdb
|
||||
@ -185,6 +189,35 @@ class AdminCommands(privmsgs.CapabilityCheckingPrivmsg):
|
||||
conf.prefixChars = s
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
|
||||
def bug(self, irc, msg, args):
|
||||
"""<description>
|
||||
|
||||
Reports a bug to a private mailing list supybot-bugs. <description>
|
||||
will be the subject of the email. The most recent 10 or so messages
|
||||
the bot receives will be sent in the body of the email.
|
||||
"""
|
||||
description = privmsgs.getArgs(args)
|
||||
messages = pprint.pformat(irc.state.history[-10:])
|
||||
email = textwrap.dedent("""
|
||||
Subject: %s
|
||||
From: jemfinch@users.sourceforge.net
|
||||
To: supybot-bugs@lists.sourceforge.net
|
||||
Date: %s
|
||||
|
||||
Bug report for Supybot %s.
|
||||
%s
|
||||
""") % (description, time.ctime(), conf.version, messages)
|
||||
email = email.strip()
|
||||
email = email.replace('\n', '\r\n')
|
||||
#debug.printf(`email`)
|
||||
smtp = smtplib.SMTP('mail.sourceforge.net', 25)
|
||||
smtp.sendmail('jemfinch@users.sf.net',
|
||||
['supybot-bugs@lists.sourceforge.net'],
|
||||
email)
|
||||
smtp.quit()
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
bug = privmsgs.thread(bug)
|
||||
|
||||
|
||||
Class = AdminCommands
|
||||
|
||||
|
@ -39,8 +39,6 @@ import os
|
||||
import sys
|
||||
import time
|
||||
import getopt
|
||||
import pprint
|
||||
import smtplib
|
||||
import textwrap
|
||||
from itertools import ifilter
|
||||
|
||||
@ -195,35 +193,6 @@ class MiscCommands(callbacks.Privmsg):
|
||||
else:
|
||||
irc.error(msg, 'There is no such command %s.' % command)
|
||||
|
||||
def bug(self, irc, msg, args):
|
||||
"""<description>
|
||||
|
||||
Reports a bug to a private mailing list supybot-bugs. <description>
|
||||
will be the subject of the email. The most recent 10 or so messages
|
||||
the bot receives will be sent in the body of the email.
|
||||
"""
|
||||
description = privmsgs.getArgs(args)
|
||||
messages = pprint.pformat(irc.state.history[-10:])
|
||||
email = textwrap.dedent("""
|
||||
Subject: %s
|
||||
From: jemfinch@users.sourceforge.net
|
||||
To: supybot-bugs@lists.sourceforge.net
|
||||
Date: %s
|
||||
|
||||
Bug report for Supybot %s.
|
||||
%s
|
||||
""") % (description, time.ctime(), conf.version, messages)
|
||||
email = email.strip()
|
||||
email = email.replace('\n', '\r\n')
|
||||
debug.printf(`email`)
|
||||
smtp = smtplib.SMTP('mail.sourceforge.net', 25)
|
||||
smtp.sendmail('jemfinch@users.sf.net',
|
||||
['supybot-bugs@lists.sourceforge.net'],
|
||||
email)
|
||||
smtp.quit()
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
bug = privmsgs.thread(bug)
|
||||
|
||||
def hostmask(self, irc, msg, args):
|
||||
"""<nick>
|
||||
|
||||
|
@ -83,9 +83,6 @@ class MiscCommandsTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
self.assertNotRegexp('list', name)
|
||||
self.assertRegexp('list --private', name)
|
||||
|
||||
def testBug(self):
|
||||
self.assertNotError('bug')
|
||||
|
||||
def testVersion(self):
|
||||
self.assertNotError('version')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user