Comments (6)
To clarify - this was part of a temporary workaround to deal with some issues related to the MessageQueue. GetMessage() in 1.0 will return null if a message doesn't exist, as it used to pre-0.9.
from discord.net.
This is the expected behavior, the client will handle all errors that it experiences internally for you.
You are correct, the Message object is not null. The easiest way to verify whether a message exists or not is to check whether Message.User
is null.
from discord.net.
How do i get the Message object when i need to call Channel.GetMessage
to retrieve a Message Object from a stored ID? There lays my problem.
from discord.net.
Channel.GetMessage()
always returns a Message. If you have a stored ID, simply feed that ID into GetMessage, and check whether the User field of the returned Message is null.
Sample:
var message = _channel.GetMessage(storedId);
if (message.User == null) return; // The message doesn't exist
from discord.net.
Ahh so it does, i thought that it was just killing the execution, would still prefer getting a null object directly, since it would give a NullReference exception which would leave a clearer picture.
I guess i'll close this issue and if @RogueException decides to implement such logic than lucky me (And the NullReference i'll get when i update), if not i guess i'll live.
Thanks @420foxbot
from discord.net.
This logic is currently being implemented into 1.0, see the /ref/ project on dev.
from discord.net.
Related Issues (20)
- Add Unknown event
- Request: Easy bypass for Defer 3 Second clock sync issue HOT 5
- [Bug]: CreatePostWithFileAsync Throws Error for Forums that Require Tags
- Spanish translation HOT 3
- [Bug]: ModifyMessageAsync timed out HOT 2
- [Bug]: Doesn't connect using newest WS4NetProvider
- [Bug]: Error converting value {null} to type 'System.DateTimeOffset'. Path 'member.joined_at'. HOT 6
- ConnectAsync time out
- Missing `available` attribute on GuildEmote
- [Bug]: NullReferenceException on interaction creation HOT 2
- There is no API to get user's banner
- There is no API to mute or deaf members HOT 1
- [Bug]: Null reference error in context UserInstall
- Slow auto reconnect causes commands to time out
- [Bug]: Can't use the SuppressNotification flag with webhooks
- How to consume Rest API scoped?
- [Bug]: Wrong report of AudioClient.ConnectionState HOT 3
- [Bug]: ModuleInfo.Attributes doesn't contain all attributes the module has HOT 1
- v4: Attached vs Detached gateway entities
- Q: About Ready event state HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discord.net.