Exemple #1
0
        public static async Task CreateDiscordRoles(Game game)
        {
            #region Roles

            Global.Roles = new Dictionary <CustomRoles, DiscordRole>();


            var adminRole = await game.Guild.CreateRoleAsync(game.Texts.BotName, Permissions.Administrator, Color.AdminColor, true, true, "GameRole Bot");

            Global.Roles.Add(CustomRoles.Admin, adminRole);


            var playerPerms = GameBuilder.CreatePerms(Permissions.SendMessages, Permissions.ReadMessageHistory,
                                                      Permissions.AddReactions);

            var playerRole = await game.Guild.CreateRoleAsync(game.Texts.Player, playerPerms, Color.PlayerColor, true, true, "GameRole Joueur");

            Global.Roles.Add(CustomRoles.Player, playerRole);


            var spectPerms = GameBuilder.CreatePerms(Permissions.AccessChannels, Permissions.ReadMessageHistory);
            GameBuilder.RevokePerm(spectPerms, Permissions.ManageEmojis);
            var spectRole = await game.Guild.CreateRoleAsync(game.Texts.Spectator, spectPerms, Color.SpectColor, true, false, "GameRole spectateur");

            Global.Roles.Add(CustomRoles.Spectator, spectRole);


            await game.Guild.EveryoneRole.ModifyAsync(x => x.Permissions = Permissions.None);

            #endregion
        }