From e04f3a1326ed53103c2b310efbe184a5d1f70dba Mon Sep 17 00:00:00 2001 From: Hunter2807 <46440327+Hunter2807@users.noreply.github.com> Date: Sun, 29 Aug 2021 16:39:00 +0530 Subject: [PATCH] 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! --- discord/message.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/discord/message.py b/discord/message.py index f9a6337b..9afc4e9f 100644 --- a/discord/message.py +++ b/discord/message.py @@ -451,6 +451,10 @@ class Message(Hashable): .. describe:: hash(x) Returns the message's hash. + + .. describe:: iter(x) + + Returns an iterator of words of the message, separated by a space Attributes ----------- @@ -606,6 +610,9 @@ class Message(Hashable): def __int__(self): return self.id + + def __iter__(self): + yield from self.content.split() def __repr__(self): return ''.format(self) -- 2.47.2