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)
|
public virtual InteractionResponse GetExceptionResponse(Interaction interaction)
|
||||||
|
{
|
||||||
|
return SimpleResponse(Localization.Internal.SomethingWentWrong);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected InteractionResponse SimpleResponse(string message)
|
||||||
{
|
{
|
||||||
return new InteractionResponse()
|
return new InteractionResponse()
|
||||||
{
|
{
|
||||||
Type = InteractionResponseType.ChannelMessageWithSource,
|
Type = InteractionResponseType.ChannelMessageWithSource,
|
||||||
Data = new()
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -59,15 +59,8 @@ namespace Geekbot.Web.Commands
|
||||||
interaction.Member.Nick ?? interaction.Member.User.Username,
|
interaction.Member.Nick ?? interaction.Member.User.Username,
|
||||||
guess
|
guess
|
||||||
);
|
);
|
||||||
|
|
||||||
return new InteractionResponse()
|
return SimpleResponse(res);
|
||||||
{
|
|
||||||
Type = InteractionResponseType.ChannelMessageWithSource,
|
|
||||||
Data = new InteractionResponseData()
|
|
||||||
{
|
|
||||||
Content = res
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue