Class Player
Represents a Discord user as a Player.
Namespace: Discord.Addons.MpGame
Assembly: Discord.Addons.MpGame.dll
Syntax
public class Player
Constructors
| Improve this Doc View SourcePlayer(IUser, IMessageChannel)
Declaration
public Player(IUser user, IMessageChannel channel)
Parameters
Type | Name | Description |
---|---|---|
IUser | user | The user represented. |
IMessageChannel | channel | The channel where this game is played. |
Properties
| Improve this Doc View SourceUser
The underlying IUser instance.
Declaration
public IUser User { get; }
Property Value
Type | Description |
---|---|
IUser |
Methods
| Improve this Doc View SourceSendMessageAsync(String, Embed)
Sends a message to this Player's DM Channel and will cache the message if the user has DMs disabled.
Declaration
public async Task<IUserMessage> SendMessageAsync(string text, Embed embed = null)
Parameters
Type | Name | Description |
---|---|---|
String | text | The text to send. |
Embed | embed | If provided, an embed to send. |
Returns
Type | Description |
---|---|
Task<IUserMessage> | The message that is sent, or null if it couldn't be sent. |
ShouldKick(Int32)
Can be overriden to determine if a player should be kicked for not having DMs enabled for too long.
Declaration
protected virtual bool ShouldKick(int backstuffedDms)
Parameters
Type | Name | Description |
---|---|---|
Int32 | backstuffedDms | The amount of DMs that are currently not sent to this player. |
Returns
Type | Description |
---|---|
Boolean | true if the player should be kicked, otherwise false. |
Remarks
note
The default implementation always returns false.