diff --git a/config.py b/config.py index c56ed18..b0c0528 100644 --- a/config.py +++ b/config.py @@ -28,5 +28,6 @@ conf.registerChannelValue(Tweety,'defaultResults',registry.Integer(1, """Default conf.registerChannelValue(Tweety,'maxResults',registry.Integer(10, """Maximum number of results to return on timelines.""")) conf.registerChannelValue(Tweety,'outputColorTweets',registry.Boolean(False, """When outputting Tweets, display them with some color.""")) conf.registerChannelValue(Tweety,'hideHashtagsTrends',registry.Boolean(False, """When displaying trends, should we display #hashtags? Default is no.""")) +conf.registerChannelValue(Tweety,'requireVoiceOrAbove',registry.Boolean(False, """Only allows a user with voice or above on a channel to use commands.""")) # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=250: diff --git a/plugin.py b/plugin.py index 6b7271e..3cd535f 100644 --- a/plugin.py +++ b/plugin.py @@ -334,6 +334,10 @@ class Tweety(callbacks.Plugin): Use --exclude to not include #hashtags in trends data. """ + # enforce +voice or above to use command? + if self.registryValue('requireVoiceOrAbove', msg.args[0]) and not irc.state.channels[msg.args[0]].isVoicePlus(msg.nick): + irc.error("ERROR: You have to be at least voiced to use this command.") + # before we do anything, make sure we have a twitterApi object. if not self.twitterApi: irc.reply("ERROR: Twitter is not authorized. Please check logs before running this command.") @@ -378,6 +382,10 @@ class Tweety(callbacks.Plugin): searchtype being recent, popular or mixed. Popular is the default. """ + # enforce +voice or above to use command? + if self.registryValue('requireVoiceOrAbove', msg.args[0]) and not irc.state.channels[msg.args[0]].isVoicePlus(msg.nick): + irc.error("ERROR: You have to be at least voiced to use this command.") + # before we do anything, make sure we have a twitterApi object. if not self.twitterApi: irc.reply("ERROR: Twitter is not authorized. Please check logs before running this command.") @@ -431,6 +439,10 @@ class Tweety(callbacks.Plugin): Or returns information on user with --info 'name'. """ + # enforce +voice or above to use command? + if self.registryValue('requireVoiceOrAbove', msg.args[0]) and not irc.state.channels[msg.args[0]].isVoicePlus(msg.nick): + irc.error("ERROR: You have to be at least voiced to use this command.") + # before we do anything, make sure we have a twitterApi object. if not self.twitterApi: irc.reply("ERROR: Twitter is not authorized. Please check logs before running this command.")