Beispiel #1
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from plugins import PluginManager

# User command
alias = "echo"
command = { alias: "Usage: !echo message\nMake the bot mimic your message." }

# Plugin Action
class EchoPlugin(PluginManager.Load):
	def action(self, cmds, scrib, c):
		if cmds[0] == command and len(cmds) >= 1:
			phrase=""
			for x in xrange (1, len (cmds)):
				phrase = phrase + str(cmds[x]) + " "
			return phrase

PluginManager.addPlugin( command, alias, EchoPlugin() )
Beispiel #2
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from plugins import PluginManager

# User command
alias = "control"
command = { alias: "Usage: !control password\nAllow user to have access to bot commands." }

# Plugin Action
class ControlPlugin(PluginManager.Load):
	def action(self, cmds, scrib, c):
		if cmds[0] == command and len(cmds) > 1 and scrib.source not in scrib.owners:
			msg = ""
			if cmds[1] == scrib.settings.password:
				scrib.owners.append(scrib.source)
				msg = "You've been added to controllers list."
			else:
				msg = "Try again."
			return msg

PluginManager.addPlugin( command, alias, ControlPlugin() )
Beispiel #3
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from plugins import PluginManager
import os

# User command
alias = "fortune"
command = { alias: "See your fortune." }

# Plugin Action
class FortunePlugin(PluginManager.Load):
	def action(self, cmds, scrib, c):
		if scrib.scrib.settings.debug == 1:
			PluginManager.barf(PluginManager.DBG, "Fortune Plugin activated.")
		if cmds[0] == command and len(cmds) >= 1:
			msg = "".join([i for i in os.popen('fortune').readlines()]).replace('\n\n','\n').replace('\n', ' ')
			msg = self.filter(msg)

PluginManager.addPlugin( command, alias, FortunePlugin() )
# User Alias and Command
sleep_alias = "sleep"
sleep_command = { sleep_alias: "Usage: !sleep \nMake the bot stop talking." }

# Plugin Action
class SleepPlugin(PluginManager.Load):
	def action(self, cmds, scrib, c):
		scrib.barf('ACT', 'Sleep called.')
		if cmds[0] == sleep_cmd and len(cmds)==1:
			msg = "Going to sleep. Goodnight!"
			scrib.settings.muted = 1
		else:
			msg = "Zzz..."
		return msg

wake_alias = "wake"
wake_command = { wake_alias: "Owner command. Usage: !wake\nAllow the bot to talk." }

class WakePlugin(PluginManager.Load):
	def action(self, cmds, scrib, c):
		scrib.barf('ACT', 'Wake called.')
		if cmds[0] == wake_cmd and scrib.settings.muted == 1:
			scrib.settings.muted = 0
			msg = "Whoohoo!"
		else:
			msg = "But I'm already awake..."
		return msg

PluginManager.addPlugin( sleep_command, sleep_alias, SleepPlugin() )
PluginManager.addPlugin( wake_command, wake_alias, WakePlugin() )