Giter VIP home page Giter VIP logo

Comments (6)

Auralytical avatar Auralytical commented on August 28, 2024 1

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.

foxbot avatar foxbot commented on August 28, 2024

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.

Nikey646 avatar Nikey646 commented on August 28, 2024

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.

foxbot avatar foxbot commented on August 28, 2024

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.

Nikey646 avatar Nikey646 commented on August 28, 2024

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.

foxbot avatar foxbot commented on August 28, 2024

This logic is currently being implemented into 1.0, see the /ref/ project on dev.

from discord.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.