Update message.py

Now, when doing
```py
for word in message:
    print(word)
```
it will print all the words of the message, which are separated by a space!
This commit is contained in:
Hunter2807 2021-08-29 16:39:00 +05:30 committed by GitHub
parent 9356e385d8
commit e04f3a1326
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -452,6 +452,10 @@ class Message(Hashable):
Returns the message's hash. Returns the message's hash.
.. describe:: iter(x)
Returns an iterator of words of the message, separated by a space
Attributes Attributes
----------- -----------
tts: :class:`bool` tts: :class:`bool`
@ -607,6 +611,9 @@ class Message(Hashable):
def __int__(self): def __int__(self):
return self.id return self.id
def __iter__(self):
yield from self.content.split()
def __repr__(self): def __repr__(self):
return '<Message id={0.id} channel={0.channel!r} type={0.type!r} author={0.author!r} flags={0.flags!r}>'.format(self) return '<Message id={0.id} channel={0.channel!r} type={0.type!r} author={0.author!r} flags={0.flags!r}>'.format(self)