private static void Client_OnReactionAdded(DiscordSocketClient client, ReactionEventArgs args) { if (args.Reaction.UserId.Equals(611040420872585226) || args.Reaction.UserId.Equals(582537632991543307) || args.Reaction.UserId.Equals(294882584201003009) || args.Reaction.UserId.Equals(570338970261782559)) { if (client.GetMessageReactions(args.Reaction.ChannelId, args.Reaction.MessageId, args.Reaction.Emoji.GetMessegable()).Count == 1) { giveawaysTotal++; if (new Random().Next(1, 100) <= config.GiveAwayReactChance) { client.AddMessageReaction(args.Reaction.ChannelId, args.Reaction.MessageId, args.Reaction.Emoji.GetMessegable()); giveawaysParticipated++; Console.WriteLine( $"[Drops/GIVEAWAYS] Participated in https://discordapp.com/channels/{args.Reaction.GuildId}/{args.Reaction.ChannelId}/{args.Reaction.MessageId}"); Console.Title = $"AutoNitro - By iLinked | Account: {username} | Hits: {successes}/{attempts}/{messages} | Balance: ${balance} | Drops/Giveaways Participated: {giveawaysParticipated}/{giveawaysTotal}"; } else { Console.WriteLine( $"[Drops/GIVEAWAYS] Did not participate in https://discordapp.com/channels/{args.Reaction.GuildId}/{args.Reaction.ChannelId}/{args.Reaction.MessageId} due to reaction chance. (Roll was "); Console.Title = $"AutoNitro - By iLinked | Account: {username} | Hits: {successes}/{attempts}/{messages} | Balance: ${balance} | Drops/Giveaways Participated: {giveawaysParticipated}/{giveawaysTotal}"; } } } }
public static bool JoinGiveaway(DiscordSocketClient client, MessageEventArgs args) { string serverName = client.GetGuild(args.Message.GuildId.Value).Name; try { client.AddMessageReaction(client.GetChannel(args.Message.ChannelId).Id, args.Message.Id, "\ud83c\udf89"); StringBuilder sbGiveawayNotification = new StringBuilder("[Joined giveaway] Server: "); sbGiveawayNotification.Append(serverName); Console.WriteLine(sbGiveawayNotification.ToString()); return(true); } catch { Console.WriteLine("[ERROR] Could not join to the giveaway. Server:{0} Date:{1}", serverName, DateTime.Now); return(false); } }