Browse Source

Remove some debug stuff

pull/11/head
Andrei 9 years ago
parent
commit
fa2f915de5
  1. 18
      disco/api/client.py
  2. 2
      disco/bot/bot.py
  3. 3
      disco/bot/command.py
  4. 2
      disco/types/message.py

18
disco/api/client.py

@ -23,16 +23,26 @@ def optional(**kwargs):
class APIClient(LoggingClass): class APIClient(LoggingClass):
""" """
An abstraction over the :class:`disco.api.http.HTTPClient` that composes requests, and fits An abstraction over a :class:`disco.api.http.HTTPClient`, which composes
the models with the returned data. requests from provided data, and fits models with the returned data. The APIClient
is the only path to the API used within models/other interfaces, and it's
the recommended path for all third-party users/implementations.
Args Args
---- ----
token : str token : str
The Discord authentication token (without prefixes) to be used for all The Discord authentication token (without prefixes) to be used for all
HTTP requests. HTTP requests.
client : :class:`disco.client.Client` client : Optional[:class:`disco.client.Client`]
The base disco client which will be used when constructing models. The Disco client this APIClient is a member of. This is used when constructing
and fitting models from response data.
Attributes
----------
client : Optional[:class:`disco.client.Client`]
The Disco client this APIClient is a member of.
http : :class:`disco.http.HTTPClient`
The HTTPClient this APIClient uses for all requests.
""" """
def __init__(self, token, client=None): def __init__(self, token, client=None):
super(APIClient, self).__init__() super(APIClient, self).__init__()

2
disco/bot/bot.py

@ -203,7 +203,7 @@ class Bot(object):
grp = group grp = group
while grp: while grp:
# If the group already exists, means someone else thought they # If the group already exists, means someone else thought they
# could use it so we need to # could use it so we need yank it from them (and not use it)
if grp in list(six.itervalues(self.group_abbrev)): if grp in list(six.itervalues(self.group_abbrev)):
self.group_abbrev = {k: v for k, v in six.iteritems(self.group_abbrev) if v != grp} self.group_abbrev = {k: v for k, v in six.iteritems(self.group_abbrev) if v != grp}
else: else:

3
disco/bot/command.py

@ -50,6 +50,9 @@ class CommandEvent(object):
@property @property
def codeblock(self): def codeblock(self):
if '`' not in self.msg.content:
return ' '.join(self.args)
_, src = self.msg.content.split('`', 1) _, src = self.msg.content.split('`', 1)
src = '`' + src src = '`' + src

2
disco/types/message.py

@ -368,7 +368,7 @@ class Message(SlottedModel):
if user_replace: if user_replace:
replace_user = functools.partial(replace, self.mentions.get, user_replace) replace_user = functools.partial(replace, self.mentions.get, user_replace)
content = re.sub('(<@!?([0-9]+)>)', replace_user, self.content) content = re.sub('(<@!?([0-9]+)>)', replace_user, content)
if role_replace: if role_replace:
replace_role = functools.partial(replace, lambda v: (self.guild and self.guild.roles.get(v)), role_replace) replace_role = functools.partial(replace, lambda v: (self.guild and self.guild.roles.get(v)), role_replace)

Loading…
Cancel
Save