Beispiel #1
0
        //-------Reaction Roles-----------
        //----Reactions Added
        private async Task ReactionsAdded(Cacheable <IUserMessage, ulong> Items, ISocketMessageChannel channel, SocketReaction reaction)
        {
            SocketGuild gld         = _client.GetGuild(257984126718574592);
            SocketRole  role        = null;
            var         Guest       = gld.GetRole(301350337023836161) as SocketRole;
            var         CrewRecruit = gld.GetRole(428508411244707841) as SocketRole;
            var         RulesProof  = gld.GetRole(748100298144481290) as SocketRole;

            if (channel.Id == 311530747657715712) //Welcome channel
            {
                if (reaction.Emote.Name.ToLower() == "apply")
                {
                    SocketGuildUser user = gld.GetUser(reaction.UserId);
                    role = gld.GetRole(748100298144481290) as SocketRole; //RulesProof

                    if (user.Roles.Contains(RulesProof) != true)
                    {
                        await AddRole(role, reaction.UserId, gld, channel, true);

                        if (user.Roles.Contains(Guest))
                        {
                            await AnnounceNewUser(reaction.UserId, gld.GetRole(301350337023836161), "Enjoy your stay here");
                            await LogUserJoined(reaction.UserId, gld, gld.GetRole(301350337023836161));
                        }
                        if (user.Roles.Contains(CrewRecruit))
                        {
                            await dmUser(reaction.UserId, gld);
                            await AnnounceNewUser(reaction.UserId, gld.GetRole(428508411244707841), "Enjoy your stay here");
                        }
                    }
                }
            }

            if (channel.Id == 522737339844395011) // Access-squadron-chats
            {
                switch (reaction.Emote.Name.ToLower())
                {
                case "gtav":
                    role = gld.GetRole(426745071967141909) as SocketRole;
                    await AddRole(role, reaction.UserId, gld, channel, true);

                    break;

                case "war_thunder":
                    role = gld.GetRole(426745457662885898) as SocketRole;
                    await AddRole(role, reaction.UserId, gld, channel, true);

                    break;

                case "ac7":
                    role = gld.GetRole(540460922012172288) as SocketRole;
                    await AddRole(role, reaction.UserId, gld, channel, true);

                    break;

                case "dcs":
                    role = gld.GetRole(676060833150926858) as SocketRole;
                    await AddRole(role, reaction.UserId, gld, channel, true);

                    break;

                case "flightsim":
                    role = gld.GetRole(693797766689849385) as SocketRole;
                    await AddRole(role, reaction.UserId, gld, channel, true);

                    break;

                case "sws":
                    role = gld.GetRole(732891813068668929) as SocketRole;
                    await AddRole(role, reaction.UserId, gld, channel, true);

                    break;
                }
            }
            else if (channel.Id == 320600176328966145)// GTA Matchmaking
            {
                switch (reaction.Emote.Name.ToLower())
                {
                case "lazer":
                    role = gld.GetRole(733974820097884190) as SocketRole;
                    await AddRole(role, reaction.UserId, gld, channel, true);

                    break;

                case "buzzard":
                    role = gld.GetRole(733977242455244831) as SocketRole;
                    await AddRole(role, reaction.UserId, gld, channel, true);

                    break;
                }
            }
            else if (channel.Id == 714511019761991771)
            {
                switch (reaction.Emote.Name.ToLower())
                {
                case "refueling":     //f16
                    role = gld.GetRole(787335567666708540) as SocketRole;
                    await AddRole(role, reaction.UserId, gld, channel, true);

                    break;

                case "hornet":     //f18
                    role = gld.GetRole(787335719332216852) as SocketRole;
                    await AddRole(role, reaction.UserId, gld, channel, true);

                    break;

                case "harrier":     //harrier
                    role = gld.GetRole(808968387371728927) as SocketRole;
                    await AddRole(role, reaction.UserId, gld, channel, true);

                    break;

                case "brrt":     //A10CII
                    role = gld.GetRole(787336850913493053) as SocketRole;
                    await AddRole(role, reaction.UserId, gld, channel, true);

                    break;

                case "bf109":     //Axis
                    role = gld.GetRole(787335871720325230) as SocketRole;
                    await AddRole(role, reaction.UserId, gld, channel, true);

                    break;

                case "p51":     //Allied
                    role = gld.GetRole(787336008102182933) as SocketRole;
                    await AddRole(role, reaction.UserId, gld, channel, true);

                    break;

                case "mig21":     //Mig
                    role = gld.GetRole(787336781078200390) as SocketRole;
                    await AddRole(role, reaction.UserId, gld, channel, true);

                    break;

                case "ka50":     //Ka50
                    role = gld.GetRole(787336919133716501) as SocketRole;
                    await AddRole(role, reaction.UserId, gld, channel, true);

                    break;
                }
            }
            else if (channel.Id == 359339709824237568) //Hangar
            {
                int index = HangarModule.isInUserList(reaction.UserId);
                if (index == -1)
                {
                    HangarModule.AddNewUserToArray(reaction.UserId);
                    index = HangarModule.isInUserList(reaction.UserId);
                }
                SocketGuildUser user              = gld.GetUser(reaction.UserId) as SocketGuildUser;
                SocketRole      guest             = gld.GetRole(301350337023836161);
                SocketRole      recruits          = gld.GetRole(428508411244707841);
                SocketRole      pendingInspection = gld.GetRole(454537016818925569);
                switch (reaction.Emote.Name.ToLower())
                {
                case "pilot":
                    if (index != -1)
                    {
                        if (hangarUsers[index].Contains(guest.Id))
                        {
                            await reaction.Channel.SendMessageAsync("Role already saved!");
                        }
                        else
                        {
                            if (hangarUsers[index].Contains(recruits.Id))
                            {
                                await reaction.Channel.SendMessageAsync("You can't have recruit and guest role at the same time !");
                            }
                            else
                            {
                                hangarUsers[index].Add(guest.Id);
                                await reaction.Channel.SendMessageAsync("Role saved please select a game.");
                            }
                        }
                    }
                    else
                    {
                        await reaction.Channel.SendMessageAsync("Please specify your name before choosing to be a guest.");
                    }
                    break;

                case "pcpi":
                    if (index != -1)
                    {
                        recruits = gld.GetRole(428508411244707841);
                        guest    = gld.GetRole(301350337023836161);
                        if (hangarUsers[index].Contains(recruits.Id))
                        {
                            await reaction.Channel.SendMessageAsync("Role already saved!");
                        }
                        else
                        {
                            if (hangarUsers[index].Contains(guest.Id))
                            {
                                await reaction.Channel.SendMessageAsync("You can't have guest and recruit role at the same time !");
                            }
                            else
                            {
                                string nickname = user.Username;
                                if (user.Nickname != null)
                                {
                                    nickname = user.Nickname;
                                }
                                await(gld.GetUser(reaction.UserId) as SocketGuildUser).ModifyAsync(x => x.Nickname = $"[N/A] {nickname}");
                                hangarUsers[index].Add(recruits.Id);
                                hangarUsers[index].Add(pendingInspection.Id);
                                await reaction.Channel.SendMessageAsync("Role saved please select a game.");
                            }
                        }
                    }
                    else
                    {
                        await reaction.Channel.SendMessageAsync("Please specify your name before choosing to be a member.");
                    }
                    break;

                case "dcs":
                    if (index != -1)
                    {
                        SocketRole dcs = gld.GetRole(676060833150926858);
                        pendingInspection = gld.GetRole(799264189545054209);
                        if (hangarUsers[index].Contains(dcs.Id))
                        {
                            await reaction.Channel.SendMessageAsync("Role already saved.");
                        }
                        else
                        {
                            hangarUsers[index].Add(dcs.Id);
                            hangarUsers[index].Add(pendingInspection.Id);
                            await reaction.Channel.SendMessageAsync("Role saved.");
                        }
                    }
                    break;

                case "gtav":
                    if (index != -1)
                    {
                        SocketRole GTAV = gld.GetRole(426745071967141909);
                        pendingInspection = gld.GetRole(454537016818925569);     //pending inspection GTA
                        if (hangarUsers[index].Contains(GTAV.Id))
                        {
                            await reaction.Channel.SendMessageAsync("Role already saved.");
                        }
                        else
                        {
                            hangarUsers[index].Add(GTAV.Id);
                            hangarUsers[index].Add(pendingInspection.Id);
                            await reaction.Channel.SendMessageAsync("Role saved.");
                        }
                    }
                    break;

                case "war_thunder":
                    if (index != -1)
                    {
                        SocketRole warthunder = gld.GetRole(426745457662885898);
                        pendingInspection = gld.GetRole(799264318570889217);
                        if (hangarUsers[index].Contains(warthunder.Id))
                        {
                            await reaction.Channel.SendMessageAsync("Role already saved.");
                        }
                        else
                        {
                            hangarUsers[index].Add(warthunder.Id);
                            hangarUsers[index].Add(pendingInspection.Id);
                            await reaction.Channel.SendMessageAsync("Role saved.");
                        }
                    }
                    break;

                case "ac7":
                    if (index != -1)
                    {
                        SocketRole ac7 = gld.GetRole(540460922012172288);
                        if (hangarUsers[index].Contains(ac7.Id))
                        {
                            await reaction.Channel.SendMessageAsync("Role already saved.");
                        }
                        else
                        {
                            hangarUsers[index].Add(ac7.Id);
                            await reaction.Channel.SendMessageAsync("Role saved.");
                        }
                    }
                    break;

                case "flightsim":
                    if (index != -1)
                    {
                        SocketRole flightsim = gld.GetRole(693797766689849385);
                        if (hangarUsers[index].Contains(flightsim.Id))
                        {
                            await reaction.Channel.SendMessageAsync("Role already saved.");
                        }
                        else
                        {
                            hangarUsers[index].Add(flightsim.Id);
                            await reaction.Channel.SendMessageAsync("Role saved.");
                        }
                    }
                    break;

                case "sws":
                    if (index != -1)
                    {
                        SocketRole sws = gld.GetRole(732891813068668929);
                        if (hangarUsers[index].Contains(sws.Id))
                        {
                            await reaction.Channel.SendMessageAsync("Role already saved.");
                        }
                        else
                        {
                            hangarUsers[index].Add(sws.Id);
                            await reaction.Channel.SendMessageAsync("Role saved.");
                        }
                    }
                    break;

                case "apply":
                    if (index != -1)
                    {
                        List <ulong> userDetails = hangarUsers[index];
                        foreach (ulong a in userDetails)
                        {
                            switch (a)
                            {
                            case 301350337023836161:         //Guest
                                for (int i = 1; i < userDetails.Count; i++)
                                {
                                    await AddRole(gld.GetRole(userDetails[i]), reaction.UserId, gld, reaction.Channel, false);
                                }
                                //await AnnounceNewUser(reaction.UserId, gld.GetRole(301350337023836161), "Enjoy your stay here");
                                //await LogUserJoined(reaction.UserId, gld, gld.GetRole(301350337023836161));
                                await HangarModule.HangarDeleteMessages(reaction.Channel as SocketTextChannel);

                                hangarUsers.RemoveAt(index);
                                goto end;

                            case 428508411244707841:         //Crew recruit
                                for (int i = 1; i < userDetails.Count; i++)
                                {
                                    await AddRole(gld.GetRole(userDetails[i]), reaction.UserId, gld, reaction.Channel, false);
                                }
                                //await dmUser(reaction.UserId, gld);
                                //await AnnounceNewUser(reaction.UserId, gld.GetRole(428508411244707841), "Enjoy your stay here");
                                await HangarModule.HangarDeleteMessages(reaction.Channel as SocketTextChannel);

                                hangarUsers.RemoveAt(index);
                                goto end;
                            }
                        }
end:
                        Console.WriteLine();
                    }
                    else
                    {
                    }
                    break;
                }
            }
        }