private async Task DisposeSelf() { if (message != null) { remindMe.BotMethods.RemoveReactionListener(this, channel.GuildId, message.Id, this); foreach (var emoji in ValidReactions) { await message.DeleteOwnReactionAsync(emoji); } } }
/// <summary> /// Deletes the response for the message /// </summary> /// <param name="message"></param> /// <returns></returns> public async Task DeleteResponseAsync(DiscordMessage message, bool deleteReaction = true) { //Get the reply associated with the message var reply = await GetReplyFromMessageAsync(message); if (reply != null && reply.CommandMsg == message.Id) { //We are a reaction, so delete our reaction to the message (if we are allowed too) if (deleteReaction && reply.ResponseType == Reply.SnowflakeType.Reaction) { await message.DeleteOwnReactionAsync(DiscordEmoji.FromName(Bot.Discord, reply.ResponseEmote)); } //We are just a message, so delete the message if (reply.ResponseType == Reply.SnowflakeType.Message) { //Get the response message and load it into our memory cache // then modify the contents of the message var msg = await message.Channel.GetMessageAsync(reply.ResponseMsg); if (msg != null) { await msg.DeleteAsync("Deleted requesting method."); } } //Now delete the reply await DeleteReplyAsync(message.Channel.Guild, reply); } }
public async Task UnlinkRoleEmojiAsync(CommandContext ctx, DiscordMessage message, DiscordEmoji emoji) { await Manager.RemoveReactionRoleAsync(message, emoji); await ctx.ReplyReactionAsync(true); await message.DeleteOwnReactionAsync(emoji); }
public static async Task RemoveReactionAsync(this DiscordMessage message, DiscordEmoji emoji) { try { await message.DeleteOwnReactionAsync(emoji).ConfigureAwait(false); } catch (Exception e) { Config.Log.Warn(e); } }
/// <summary>Deletes your own reaction.</summary> public static Task DeleteOwnReactionAsync(this DiscordMessage message, string emoji) => message.DeleteOwnReactionAsync(emoji.ToEmoji());