Class DiscordInit
- Namespace
- BotManager.Discord.Expressions
- Assembly
- BotManager.Discord.dll
The Discord plugin will connect to the Discord api using the given Token. You can register Commands that will run an expression once a user executes them.
Return type is null.
null:
{ "$OpenAiInit": { "TokenType": "Bot", "Token": { "$Env": "DISCORD_TOKEN" } } }
public sealed class DiscordInit : IExpression
- Inheritance
-
DiscordInit
- Implements
- Inherited Members
Constructors
DiscordInit()
public DiscordInit()
Properties
Client
Gets the Discord client interface.
[JsonIgnore]
public DiscordSocketClient Client { get; }
Property Value
- DiscordSocketClient
Commands
Gets and sets the slash commands.
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public DiscordSlashCommand[]? Commands { get; set; }
Property Value
Token
Gets and sets the Discord API key.
public IExpression? Token { get; set; }
Property Value
TokenType
Gets and sets the Token type.
[JsonConverter(typeof(EnumConverter<TokenType>))]
public TokenType TokenType { get; set; }
Property Value
- TokenType
Methods
ExecuteAsync(RuntimeContext, Type?)
Executes the expression in the given RuntimeContext. Please do not use this method to run an expression. Use ExecuteAsync(IExpression?) instead.
public Task<object?> ExecuteAsync(RuntimeContext context, Type? returnType)
Parameters
contextRuntimeContextThe current runtime context.
returnTypeTypeThe expected return type. Use
typeof(object)for a generic result. Usenullif you don't need the return value.
Returns
GetGuild(DiscordIdentifier)
Returns the guild by the given identifier
public IGuild? GetGuild(DiscordIdentifier identifier)
Parameters
identifierDiscordIdentifier
Returns
- IGuild
GetGuild(ulong)
Returns the guild by the given identifier
public IGuild? GetGuild(ulong id)
Parameters
idulong
Returns
- IGuild