Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline reaction #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JanVargovsky
Copy link

Added InlineReactionReply.

InlineReactionReply is normal UserMessage with a set of reactions and its own callbacks.

example story:
user triggers a command
bot responds with message e.g. "Do you want 1 or 2?" and adds reactions [1, 2]
user clicks on reaction 1 or 2
a callback is fired


public IUserMessage Message { get; private set; }

readonly InteractiveService interactive;
Copy link

@ghost ghost Jul 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property should be declared as private readonly InteractiveService _interactive;, to best fit the C# style guidelines.
As well as for the property below.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


public async Task<bool> HandleCallbackAsync(SocketReaction reaction)
{
var reactionCallbackItem = data.Callbacks.FirstOrDefault(t => t.Reaction.Equals(reaction.Emote));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably best to use ==

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

== doesn't work. Its not the same instance so we really have to use Equals method.

{
public class InlineReactionCallback : IReactionCallback
{
public RunMode RunMode => RunMode.Sync;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be RunMode.Async?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea to be honest, I used PaginatedMessageCallback as a template.

@@ -6,8 +6,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Discord.Net.Commands" Version="1.0.1" />
<PackageReference Include="Discord.Net.WebSocket" Version="1.0.1" />
<PackageReference Include="Discord.Net.Commands" Version="1.0.2" />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This update should be noted. Is this really necessary?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is. The 1.0.1 version has some bug and result is following exception
System.InvalidOperationException: Unknown guild channel type.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs changes as explained in comments

@MarkusKgit
Copy link

Any chance of getting this updated merged? I think it's quite a useful feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants