public AliasTransaction(NetworkType networkType, int version, Deadline deadline, ulong?maxFee, EntityType transactionType, NamespaceId namespaceId, AliasActionType actionType, MosaicId mosaicId = null, Address address = null, string signature = null, PublicAccount signer = null, TransactionInfo transactionInfo = null) : base(networkType, version, transactionType, deadline, maxFee, signature, signer, transactionInfo) { NamespaceId = namespaceId; MosaicId = mosaicId; AliasActionType = actionType; Address = address; }
public static AliasTransaction CreateForAddress(Address address, NamespaceId namespaceId, AliasActionType actionType, Deadline deadline, NetworkType networkType) { if (namespaceId == null) { throw new ArgumentNullException(nameof(namespaceId)); } if (address == null) { throw new ArgumentNullException(nameof(address)); } return(new AliasTransaction(networkType, EntityVersion.ADDRESS_ALIAS.GetValue(), deadline, 0, EntityType.ADDRESS_ALIAS, namespaceId, actionType, null, address)); }
public static AliasTransaction CreateForMosaic(MosaicId mosaicId, NamespaceId namespaceId, AliasActionType actionType, Deadline deadline, NetworkType networkType) { if (namespaceId == null) { throw new ArgumentNullException(nameof(namespaceId)); } if (mosaicId == null) { throw new ArgumentNullException(nameof(mosaicId)); } return(new AliasTransaction(networkType, EntityVersion.MOSAIC_ALIAS.GetValue(), deadline, 0, EntityType.MOSAIC_ALIAS, namespaceId, actionType, mosaicId)); }
public async Task Alias(AliasActionType AliasActionType, string CommandName, [Optional] string Alias) { CustomCommand Command = CustomCommandDB.GetCommandByNameOrAlias(CommandName); switch (AliasActionType) { case AliasActionType.Add: if (string.IsNullOrEmpty(Alias)) { await BuildEmbed(EmojiEnum.Annoyed) .WithTitle("Error Adding Alias.") .WithDescription("Alias is not given! Please enter an alias with this command.") .SendEmbed(Context.Channel); return; } CustomCommand Add = CustomCommandDB.GetCommandByNameOrAlias(Alias); if (Add != null) { await BuildEmbed(EmojiEnum.Annoyed) .WithTitle("Error Adding Alias.") .WithDescription($"The command `{BotConfiguration.Prefix}{Add.CommandName}` " + $"already has the alias `{BotConfiguration.Prefix}{Alias}`!") .SendEmbed(Context.Channel); return; } await SendForAdminApproval(AddAliasCallback, new Dictionary <string, string>() { { "CommandName", CommandName.ToLower() }, { "Alias", Alias } }, Context.User.Id, $"{Context.User.GetUserInformation()} has suggested that the command `{BotConfiguration.Prefix}{CommandName}` should have the alias `{BotConfiguration.Prefix}{Alias}` added to it!"); await BuildEmbed(EmojiEnum.Love) .WithTitle($"The command `{BotConfiguration.Prefix}{CommandName}` was suggested to have added the alias of `{BotConfiguration.Prefix}{Alias}`!") .WithDescription($"Once the suggestion has passed admin approval, you may use the `{BotConfiguration.Prefix}ccalias list` command to view the aliases of this command.") .SendEmbed(Context.Channel); break; case AliasActionType.Remove: if (string.IsNullOrEmpty(Alias)) { await BuildEmbed(EmojiEnum.Annoyed) .WithTitle("Error Removing Alias.") .WithDescription("Alias is not given! Please enter an alias with this command.") .SendEmbed(Context.Channel); return; } CustomCommand Remove = CustomCommandDB.GetCommandByNameOrAlias(Alias); if (Remove == null) { await BuildEmbed(EmojiEnum.Annoyed) .WithTitle("Error Removing Alias.") .WithDescription($"No command with alias of `{BotConfiguration.Prefix}{Alias}` exists! Are you sure you spelt it correctly?") .SendEmbed(Context.Channel); return; } await SendForAdminApproval(AddAliasCallback, new Dictionary <string, string>() { { "CommandName", CommandName.ToLower() }, { "Alias", Alias } }, Context.User.Id, $"{Context.User.GetUserInformation()} has suggested that the command `{BotConfiguration.Prefix}{CommandName}` should have the alias `{BotConfiguration.Prefix}{Alias}` removed from it!"); await BuildEmbed(EmojiEnum.Love) .WithTitle($"The command `{BotConfiguration.Prefix}{CommandName}` was suggested to be remved from the alias of `{BotConfiguration.Prefix}{Alias}`!") .WithDescription($"Once the suggestion has passed admin approval, you may use the `{BotConfiguration.Prefix}ccalias list` command to view the aliases of this command.") .SendEmbed(Context.Channel); break; case AliasActionType.List: CustomCommand List = CustomCommandDB.GetCommandByNameOrAlias(CommandName); if (List == null) { await BuildEmbed(EmojiEnum.Annoyed) .WithTitle("Error Listing Alias.") .WithDescription($"The command `{BotConfiguration.Prefix}{CommandName}` doesn't exist!") .SendEmbed(Context.Channel); return; } List <string> AliasList = JsonConvert.DeserializeObject <List <string> >(List.Alias); string Aliases = string.Join('\n', AliasList.Select(Alias => $"{BotConfiguration.Prefix}{Alias}")); await BuildEmbed(EmojiEnum.Love) .WithTitle($"The command `{BotConfiguration.Prefix}{CommandName}` has these aliases:") .WithDescription(AliasList.Count > 0 ? Aliases : "No aliases set!") .SendEmbed(Context.Channel); break; default: await BuildEmbed(EmojiEnum.Annoyed) .WithTitle("Unable To Modify Alias.") .WithDescription($"The {AliasActionType} does not exist as an option!") .SendEmbed(Context.Channel); break; } }
public AliasTransactionBuilder SetAliasAction(AliasActionType aliasActionType) { AliasActionType = aliasActionType; return(Self()); }
/// <summary> /// Get value extension /// </summary> /// <param name="type">The alias action type</param> /// <returns>AliasActionType</returns> public static byte GetValueInByte(this AliasActionType type) { return((byte)type); }