Rename NoMoreMessages to NoMoreItems.
This commit is contained in:
parent
8c274139df
commit
06ca518459
@ -33,7 +33,7 @@ from collections import namedtuple
|
||||
|
||||
from .iterators import HistoryIterator
|
||||
from .context_managers import Typing
|
||||
from .errors import ClientException, NoMoreMessages, InvalidArgument
|
||||
from .errors import ClientException, NoMoreItems, InvalidArgument
|
||||
from .permissions import PermissionOverwrite, Permissions
|
||||
from .role import Role
|
||||
from . import utils, compat
|
||||
@ -740,7 +740,7 @@ class Messageable(metaclass=abc.ABCMeta):
|
||||
while True:
|
||||
try:
|
||||
message = yield from iterator.get()
|
||||
except discord.NoMoreMessages:
|
||||
except discord.NoMoreItems:
|
||||
break
|
||||
else:
|
||||
if message.author == client.user:
|
||||
@ -813,7 +813,7 @@ class Messageable(metaclass=abc.ABCMeta):
|
||||
while True:
|
||||
try:
|
||||
msg = yield from iterator.get()
|
||||
except NoMoreMessages:
|
||||
except NoMoreItems:
|
||||
# no more messages to poll
|
||||
if count >= 2:
|
||||
# more than 2 messages -> bulk delete
|
||||
|
@ -38,9 +38,10 @@ class ClientException(DiscordException):
|
||||
"""
|
||||
pass
|
||||
|
||||
class NoMoreMessages(DiscordException):
|
||||
"""Exception that is thrown when a ``history`` operation has no more
|
||||
messages. This is only exposed for Python 3.4 only.
|
||||
class NoMoreItems(DiscordException):
|
||||
"""Exception that is thrown when an async iteration operation has no more
|
||||
items. This is mainly exposed for Python 3.4 support where `StopAsyncIteration`
|
||||
is not provided.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
@ -29,7 +29,7 @@ import asyncio
|
||||
import aiohttp
|
||||
import datetime
|
||||
|
||||
from .errors import NoMoreMessages
|
||||
from .errors import NoMoreItems
|
||||
from .utils import time_snowflake
|
||||
from .object import Object
|
||||
|
||||
@ -132,7 +132,7 @@ class HistoryIterator:
|
||||
try:
|
||||
return self.messages.get_nowait()
|
||||
except asyncio.QueueEmpty:
|
||||
raise NoMoreMessages()
|
||||
raise NoMoreItems()
|
||||
|
||||
@asyncio.coroutine
|
||||
def flatten(self):
|
||||
@ -217,7 +217,7 @@ class HistoryIterator:
|
||||
try:
|
||||
msg = yield from self.get()
|
||||
return msg
|
||||
except NoMoreMessages:
|
||||
except NoMoreItems:
|
||||
# if we're still empty at this point...
|
||||
# we didn't get any new messages so stop looping
|
||||
raise StopAsyncIteration()
|
||||
|
@ -782,6 +782,8 @@ The following exceptions are thrown by the library.
|
||||
|
||||
.. autoexception:: LoginFailure
|
||||
|
||||
.. autoexception:: NoMoreItems
|
||||
|
||||
.. autoexception:: HTTPException
|
||||
:members:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user