Skip to content

Commit 91ce4ba

Browse files
committed
Update bot class to work fine with web code entirely removed
1 parent d76a54d commit 91ce4ba

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

cloudbot/bot.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222

2323
try:
2424
from cloudbot.web.main import WebInterface
25+
web_installed = True
2526
except ImportError:
26-
WebInterface = None
27+
web_installed = False
2728

2829
logger = logging.getLogger("cloudbot")
2930

@@ -98,7 +99,7 @@ def __init__(self, loop=asyncio.get_event_loop()):
9899
self.db_base = declarative_base(metadata=self.db_metadata, bind=self.db_engine)
99100

100101
# create web interface
101-
if self.config.get("web", {}).get("enabled", False):
102+
if self.config.get("web", {}).get("enabled", False) and web_installed:
102103
self.web = WebInterface(self)
103104

104105
# set botvars so plugins can access when loading
@@ -205,7 +206,7 @@ def _init_routine(self):
205206
yield from asyncio.gather(*[conn.connect() for conn in self.connections.values()], loop=self.loop)
206207

207208
# Activate web interface.
208-
if self.config.get("web", {}).get("enabled", False):
209+
if self.config.get("web", {}).get("enabled", False) and web_installed:
209210
self.web.start()
210211

211212
# Run a manual garbage collection cycle, to clean up any unused objects created during initialization

cloudbot/web/templates/layout.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ <h4 class="modal-title">About {{ bot_name }}</h4>
126126
<script src="/s/js/bootstrap-sortable.js"></script>
127127
<script>
128128
$(function () {
129-
$('#theme-select').bootstrapThemeSwitcher({'defaultCssFile': '/s/css/bootstrap.min.css', 'excludeBootswatch': 'Paper,Superhero,Simplex,Sandstone,Spacelab'});
129+
$('#theme-select').bootstrapThemeSwitcher({'defaultCssFile': '/s/css/bootstrap.min.css', 'excludeBootswatch': 'Paper,superhero,simplex,Sandstone,Spacelab'});
130130
$().bootstrapThemeSwitcher('loadThemeFromCookie');
131131
$('[data-toggle="tooltip"]').tooltip();
132132
$('[data-toggle="popover"]').popover();

0 commit comments

Comments
 (0)