Browse Source

Move IPC code, bit more cleanup

pull/9/head
Andrei 9 years ago
parent
commit
c7ff3b3d18
  1. 5
      disco/bot/bot.py
  2. 0
      disco/gateway/ipc.py
  3. 0
      disco/gateway/ipc/__init__.py
  4. 4
      disco/gateway/packets.py
  5. 2
      disco/gateway/sharder.py

5
disco/bot/bot.py

@ -113,7 +113,9 @@ class Bot(object):
def __init__(self, client, config=None): def __init__(self, client, config=None):
self.client = client self.client = client
self.config = config or BotConfig() self.config = config or BotConfig()
self.shards = {}
# Shard manager
self.shards = None
# The context carries information about events in a threadlocal storage # The context carries information about events in a threadlocal storage
self.ctx = ThreadLocal() self.ctx = ThreadLocal()
@ -123,6 +125,7 @@ class Bot(object):
if self.config.storage_enabled: if self.config.storage_enabled:
self.storage = Storage(self.ctx, self.config.from_prefix('storage')) self.storage = Storage(self.ctx, self.config.from_prefix('storage'))
# If the manhole is enabled, add this bot as a local
if self.client.config.manhole_enable: if self.client.config.manhole_enable:
self.client.manhole_locals['bot'] = self self.client.manhole_locals['bot'] = self

0
disco/gateway/ipc/gipc.py → disco/gateway/ipc.py

0
disco/gateway/ipc/__init__.py

4
disco/gateway/packets.py

@ -1,7 +1,7 @@
from holster.enum import Enum from holster.enum import Enum
SEND = object() SEND = 1
RECV = object() RECV = 2
OPCode = Enum( OPCode = Enum(
DISPATCH=0, DISPATCH=0,

2
disco/gateway/sharder.py

@ -12,7 +12,7 @@ from holster.log import set_logging_levels
from disco.client import Client from disco.client import Client
from disco.bot import Bot, BotConfig from disco.bot import Bot, BotConfig
from disco.api.client import APIClient from disco.api.client import APIClient
from disco.gateway.ipc.gipc import GIPCProxy from disco.gateway.ipc import GIPCProxy
from disco.util.snowflake import calculate_shard from disco.util.snowflake import calculate_shard

Loading…
Cancel
Save