Add simple response function to the InteractionBase to reduce the InteractionResponse copying
This commit is contained in:
parent
5a520ff567
commit
e74aeb1403
3 changed files with 9 additions and 11 deletions
|
@ -26,13 +26,18 @@ namespace Geekbot.Core.Interactions
|
|||
}
|
||||
|
||||
public virtual InteractionResponse GetExceptionResponse(Interaction interaction)
|
||||
{
|
||||
return SimpleResponse(Localization.Internal.SomethingWentWrong);
|
||||
}
|
||||
|
||||
protected InteractionResponse SimpleResponse(string message)
|
||||
{
|
||||
return new InteractionResponse()
|
||||
{
|
||||
Type = InteractionResponseType.ChannelMessageWithSource,
|
||||
Data = new()
|
||||
{
|
||||
Content = Localization.Internal.SomethingWentWrong
|
||||
Content = message
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ namespace Geekbot.Web.Commands
|
|||
}
|
||||
};
|
||||
|
||||
return Task.FromResult(interactionResponse);
|
||||
return Task.FromResult(SimpleResponse(res));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -60,14 +60,7 @@ namespace Geekbot.Web.Commands
|
|||
guess
|
||||
);
|
||||
|
||||
return new InteractionResponse()
|
||||
{
|
||||
Type = InteractionResponseType.ChannelMessageWithSource,
|
||||
Data = new InteractionResponseData()
|
||||
{
|
||||
Content = res
|
||||
}
|
||||
};
|
||||
return SimpleResponse(res);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue