Browse Source

Have a bit better stuff for working as a system

development
Sapein 8 months ago
parent
commit
eccd11ec67

+ 6
- 2
almaren_bot/almaren.py View File

@@ -1,8 +1,12 @@
1 1
 import asyncio
2 2
 import discord
3 3
 
4
-import configuration
5
-import managers
4
+try:
5
+    import almaren_bot.configuration as configuration
6
+    import almaren_bot.managers as managers 
7
+except ImportError:
8
+    import configuration
9
+    import managers
6 10
 
7 11
 class PotatoBot(discord.Client):
8 12
     _version = "0.3.0-alpha"

+ 6
- 2
almaren_bot/bot.py View File

@@ -1,8 +1,12 @@
1 1
 import datetime
2 2
 import logging
3 3
 
4
-import almaren
5
-import configuration
4
+try:
5
+    import almaren_bot.almaren as almaren
6
+    import almaren_bot.configuration as configuration
7
+except ImportError:
8
+    import almaren
9
+    import configuration
6 10
 
7 11
 _version = "0.1.0-a"
8 12
 def log_setup(config):

+ 4
- 1
almaren_bot/managers.py View File

@@ -7,7 +7,10 @@ import imp
7 7
 import logging
8 8
 import os
9 9
 
10
-import plugins
10
+try:
11
+    import almaren_bot.plugins as plugins
12
+except ImportError:
13
+    import plugins
11 14
 
12 15
 class Manager:
13 16
     """ The base class for all Managers. """

+ 4
- 1
almaren_bot/plugins/admin_commands.py View File

@@ -1,4 +1,7 @@
1
-import plugins
1
+try:
2
+    import almaren_bot.plugins as plugins
3
+except ImportError:
4
+    import plugins
2 5
 
3 6
 # TODO rewrite plugin to be cleaner
4 7
 @plugins.Command('reload', None)

+ 4
- 1
almaren_bot/plugins/autorole.py View File

@@ -1,7 +1,10 @@
1 1
 import asyncio
2 2
 import discord
3 3
 
4
-import plugins
4
+try:
5
+    import almaren_bot.plugins as plugins
6
+except ImportError:
7
+    import plugins
5 8
 
6 9
 class AutoRole(plugins.Plugin):
7 10
     name = "AutoRole"

+ 4
- 1
almaren_bot/plugins/base_commands.py View File

@@ -1,5 +1,8 @@
1 1
 """ A basic plugin for basic commands """
2
-import plugins
2
+try:
3
+    import almaren_bot.plugins as plugins
4
+except ImportError:
5
+    import plugins
3 6
 
4 7
 
5 8
 @plugins.Command("source", "The source for the bot")

+ 6
- 2
tests/plugin_test.py View File

@@ -3,8 +3,12 @@ import asyncio
3 3
 import os
4 4
 import pytest
5 5
 
6
-import plugins
7
-import managers
6
+try:
7
+    import almaren_bot.plugins as plugins
8
+    import almaren_bot.managers as managers
9
+except ImportError:
10
+    import plugins
11
+    import managers
8 12
 
9 13
 class TestPluginIntegration:
10 14
     @pytest.fixture

+ 4
- 1
tests/test_managers.py View File

@@ -3,7 +3,10 @@ import asyncio
3 3
 import os
4 4
 import pytest
5 5
 
6
-import managers
6
+try:
7
+    import almaren_bot.managers as managers
8
+except ImportError:
9
+    import managers
7 10
 
8 11
 class TestManagerBase:
9 12
     @pytest.fixture

+ 4
- 1
tests/test_plugins.py View File

@@ -2,7 +2,10 @@
2 2
 import asyncio
3 3
 import pytest
4 4
 
5
-import plugins
5
+try:
6
+    import almaren_bot.plugins as plugins
7
+except ImportError:
8
+    import plugins
6 9
 
7 10
 class TestPlugins:
8 11
     """ Tests the Plugin API """

Loading…
Cancel
Save