From 74e8793cc61fdfa954571b3d86e95c1f751d76e3 Mon Sep 17 00:00:00 2001 From: Fortunate-MAN Date: Thu, 21 Sep 2017 16:40:36 +0530 Subject: [PATCH] fast forward to release 0.1.5 --- Source/Bot.py | 16 ++++++---------- Source/ChatRoom.py | 4 ++-- Source/Command.py | 3 ++- Source/CommandManager.py | 7 ++++++- Source/CommandPrivilegeUser.py | 4 ++-- Source/init.bk | 17 +++++++++++++++++ __init__.py | 1 + setup.py | 11 +++++++++++ 8 files changed, 47 insertions(+), 16 deletions(-) create mode 100644 Source/init.bk create mode 100644 __init__.py create mode 100644 setup.py diff --git a/Source/Bot.py b/Source/Bot.py index 053d2fe..57ea0a3 100644 --- a/Source/Bot.py +++ b/Source/Bot.py @@ -7,16 +7,12 @@ # import chatexchange as ce -from Chatcommunicate import * -from CommandAlive import * -from CommandStop import * -from CommandListRunningCommands import * -from CommandManager import * -from BackgroundTaskManager import * -from BackgroundTask import * -from ChatRoom import * -from Utilities import * -import Utilities +from .Chatcommunicate import * +from .CommandManager import * +from .BackgroundTaskManager import * +from .BackgroundTask import * +from .ChatRoom import * +from . import Utilities import os class Bot: diff --git a/Source/ChatRoom.py b/Source/ChatRoom.py index 1d42ce7..966f04e 100644 --- a/Source/ChatRoom.py +++ b/Source/ChatRoom.py @@ -7,8 +7,8 @@ # import chatexchange as ce -from PrivilegeType import * -from PrivilegedChatUser import * +from .PrivilegeType import * +from .PrivilegedChatUser import * import os import pickle diff --git a/Source/Command.py b/Source/Command.py index ada36a1..8da72cc 100644 --- a/Source/Command.py +++ b/Source/Command.py @@ -8,8 +8,9 @@ import chatexchange as ce class Command: - def __init__(self, command_manager, message, arguments, usage_index=0): + def __init__(self, command_manager, chat_room, message, arguments, usage_index=0): self.command_manager = command_manager + self.chat_room = chat_room self.message = message self.arguments = arguments self.usage_index = usage_index diff --git a/Source/CommandManager.py b/Source/CommandManager.py index 7476723..3daece6 100644 --- a/Source/CommandManager.py +++ b/Source/CommandManager.py @@ -71,7 +71,12 @@ def handle_command(self, message): match = False if match: - self.run_command(command(self, message, args, usage_index)) + for each_room in self.rooms: + if each_room.room_id == command.message.room.id: + command_room = each_room + break + + self.run_command(command(self, message, command_room, args, usage_index)) return def cleanup_finished_commands(self): diff --git a/Source/CommandPrivilegeUser.py b/Source/CommandPrivilegeUser.py index b3b58d5..0878b07 100644 --- a/Source/CommandPrivilegeUser.py +++ b/Source/CommandPrivilegeUser.py @@ -6,7 +6,7 @@ # # -from Command import * +from .Command import * class CommandPrivilegeUser(Command): def usage(): @@ -16,4 +16,4 @@ def privileges(self): return 1 def run(self): - + diff --git a/Source/init.bk b/Source/init.bk new file mode 100644 index 0000000..c8db7e8 --- /dev/null +++ b/Source/init.bk @@ -0,0 +1,17 @@ +from . import BackgroundTask +from . import BackgroundTaskManager +from . import Bot +from . import ChatRoom +from . import Chatcommunicate +from . import Command +from . import CommandAlive +from . import CommandListRunningCommands +from . import CommandManager +from . import CommandStop +from . import PrivilegeType +from . import PrivilegedChatUser +from . import Utilities + +CommandListRunningCommands = CommandListRunningCommands.CommandListRunningCommands +CommandStop = CommandStop.CommandStop +CommandAlive = CommandAlive.CommandAlive diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..3f73daa --- /dev/null +++ b/__init__.py @@ -0,0 +1 @@ +from .Source/Bot import Bot diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..9ec56ff --- /dev/null +++ b/setup.py @@ -0,0 +1,11 @@ +from distutils.core import setup + +setup ( + name = "BotpySE", + packages = ["BotpySE"], + version = "0.1.5", + description = "A python framework to create chatbots on the StackExchange network.", + author = "Ashish Ahuja", + author_email = "ashish.ahuja@sobotics.org", + url = "https://github.com/SOBotics/Botpy", +)