mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-30 14:59:34 +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.
|
caller to have the 'admin' capability. This plugin is loaded by default.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from fix import *
|
||||||
|
|
||||||
|
import pprint
|
||||||
import string
|
import string
|
||||||
|
import smtplib
|
||||||
|
|
||||||
import conf
|
import conf
|
||||||
import ircdb
|
import ircdb
|
||||||
@ -185,6 +189,35 @@ class AdminCommands(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
conf.prefixChars = s
|
conf.prefixChars = s
|
||||||
irc.reply(msg, conf.replySuccess)
|
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
|
Class = AdminCommands
|
||||||
|
|
||||||
|
@ -39,8 +39,6 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import getopt
|
import getopt
|
||||||
import pprint
|
|
||||||
import smtplib
|
|
||||||
import textwrap
|
import textwrap
|
||||||
from itertools import ifilter
|
from itertools import ifilter
|
||||||
|
|
||||||
@ -195,35 +193,6 @@ class MiscCommands(callbacks.Privmsg):
|
|||||||
else:
|
else:
|
||||||
irc.error(msg, 'There is no such command %s.' % command)
|
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):
|
def hostmask(self, irc, msg, args):
|
||||||
"""<nick>
|
"""<nick>
|
||||||
|
|
||||||
|
@ -83,9 +83,6 @@ class MiscCommandsTestCase(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
self.assertNotRegexp('list', name)
|
self.assertNotRegexp('list', name)
|
||||||
self.assertRegexp('list --private', name)
|
self.assertRegexp('list --private', name)
|
||||||
|
|
||||||
def testBug(self):
|
|
||||||
self.assertNotError('bug')
|
|
||||||
|
|
||||||
def testVersion(self):
|
def testVersion(self):
|
||||||
self.assertNotError('version')
|
self.assertNotError('version')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user