def message(): return messages.Message( app=None, id=snowflakes.Snowflake(1234), channel_id=snowflakes.Snowflake(5678), guild_id=snowflakes.Snowflake(910112), author=mock.Mock(spec_set=users.User), member=mock.Mock(spec_set=guilds.Member), content="blahblahblah", timestamp=datetime.datetime.now().astimezone(), edited_timestamp=None, is_tts=False, mentions=messages.Mentions( message=mock.Mock(), users={}, role_ids=[], channels={}, everyone=False, ), attachments=(), embeds=(), reactions=(), is_pinned=True, webhook_id=None, type=messages.MessageType.DEFAULT, activity=None, application=None, message_reference=None, flags=None, nonce=None, referenced_message=None, stickers=[], )
def build_entity(self, app: traits.RESTAware, /) -> messages.Message: referenced_message: typing.Optional[messages.Message] = None if self.referenced_message: referenced_message = self.referenced_message.object.build_entity(app) message = messages.Message( id=self.id, app=app, channel_id=self.channel_id, guild_id=self.guild_id, author=self.author.copy(), member=self.member.object.build_entity(app) if self.member else None, content=self.content, timestamp=self.timestamp, edited_timestamp=self.edited_timestamp, is_tts=self.is_tts, mentions=NotImplemented, attachments=tuple(map(copy.copy, self.attachments)), embeds=tuple(map(_copy_embed, self.embeds)), reactions=tuple(map(copy.copy, self.reactions)), is_pinned=self.is_pinned, webhook_id=self.webhook_id, type=self.type, activity=copy.copy(self.activity) if self.activity else None, application=copy.copy(self.application) if self.application else None, message_reference=copy.copy(self.message_reference) if self.message_reference else None, flags=self.flags, stickers=tuple(map(copy.copy, self.stickers)), nonce=self.nonce, referenced_message=referenced_message, interaction=self.interaction.build_entity(app) if self.interaction else None, application_id=self.application_id, ) message.mentions = self.mentions.build_entity(app, message=message) return message