| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…alink statistics are received.
This reverts commit 416c316.
|
Thanks lad but just a few things:
|
Sorry, something went wrong.
Is that true here? Can message references not reference guilds the current user isn’t a part of? |
Sorry, something went wrong.
You raise a great point, I did not take that into consideration. |
Sorry, something went wrong.
I don't feel it should inherit from DiscordApplication because there would be many properties that wouldn't get used if it is sent as a message property.
How so?
I thought about this, but I chose to keep these just as IDs because the client would need to be in the same server as the original message (for a news channel) in order for it not to be null. Maybe when more guilds have access to news channels it would make sense but I just don't see the point of adding it when news channels are still experimental. |
Sorry, something went wrong.
I meant to inherit them the other way around.
All SnowflakeObject types must initialize the client property, via the constructor. At least for now, the deserializer cannot do this.
Not null - skeleton objects should be used instead. That's how it works elsewhere in the lib. |
Sorry, something went wrong.
Ah I see, I'll edit those then. |
Sorry, something went wrong.
|
So for creating the skeleton objects, should I just always return a skeleton object for the message references? Or should I try to search through the message, guild, and channel caches and return the full object if it's there, and if not then return a skeleton object? |
Sorry, something went wrong.
|
DiscordMessageApplication is the correct way of handling this, though I only glanced at the solution. Guilds are, like everything in Discord, not 100% guaranteed, particularly in sharded scenarios. As far as message reference goes, I think you should just make it an object with supplied data and optionally a method to fetch the message. No real point in doing much beyond that. |
Sorry, something went wrong.
|
I just wrote this in the constructor to fetch those objects from the cache or just create new objects. Don't really know how to test this without a news channel though: internal DiscordMessageReference()
{
if (this.guildId.HasValue && this.client._guilds.TryGetValue(this.guildId.Value, out var g))
this.Guild = g;
else this.Guild = new DiscordGuild
{
Id = this.guildId.Value
};
var channel = this.client.InternalGetCachedChannel(this.channelId);
if (channel == null)
this.Channel = new DiscordChannel
{
Id = this.channelId,
GuildId = this.guildId.Value
};
else this.Channel = channel;
if (messageId.HasValue && this.client.MessageCache.TryGet(m => m.Id == messageId.Value && m.ChannelId == channelId, out var msg))
this.Message = msg;
else this.Message = new DiscordMessage
{
Id = this.messageId.Value,
ChannelId = this.channelId
};
}Since it's not tested I think just creating skeleton objects would be the safest option. What do you all think? |
Sorry, something went wrong.
This looks fine, but be sure to set the .Discord property of these skeleton objects, and add them to their appropriate parent objects. Dwarfed entities aren't a fun time |
Sorry, something went wrong.
|
Yeah good point |
Sorry, something went wrong.
…ageApplication, also rewrote DiscordMessageReference to be able to search the cache, and if no results found return a skeleton object with the provided data.
| Back | FazBrowse Home | New Git URL |
Summary
Implemented support for several new DiscordMessage properties in addition to creating/moving a few files. This addresses issue #436.
Details
I added reference to the new activity, application, and message_reference properties sent. These objects were also each given their own class and properties.
I also added 5 new message types, that involve messages sent with nitro boosting and news channel updates to the MessageType enum, and moved the enum from the DiscordMessage class to it's own separate file inside of the Enums folder.
Changes proposed
Note
In terms of the Author property not being handled properly, I didn't find it necessary to change because there is a property to check whether the message is a webhook or not.