コード例 #1
0
        public async Task UpdateUserPermission(ulong userId, [Remainder] Container.ContainerPermissions permissions)
        {
            if (User.GetUser(Context.User.Id).ContainerAccessLevel == Container.ContainerPermissions.root)
            {
                _user = User.GetUser(userId);

                if (this._user != null)
                {
                    _user.ContainerAccessLevel = permissions;
                    User.Write(User.UserList);
                }
                else
                {
                    new User(Context.Guild.GetUser(userId));
                    this._user = User.GetUser(userId);
                    this._user.ContainerAccessLevel = permissions;
                    User.Write(User.UserList);
                }

                EmbedBuilder embed = new EmbedBuilder
                {
                    Title  = "A Users permissions has been updated",
                    Color  = Color.Green,
                    Footer = new EmbedFooterBuilder
                    {
                        IconUrl = Context.Message.Author.GetAvatarUrl(),
                        Text    = $"A users permission was updated by {Context.Message.Author} at {DateTime.Now}"
                    },
                    Description = $"`{Context.Guild.GetUser(this._user.UserId)}'s` permissions have been changed to `{permissions}`",
                };

                await Context.Channel.SendMessageAsync(embed : embed.Build());
            }
        }
コード例 #2
0
        public async Task UpdateUserPermission(ulong userId, [Remainder] Container.ContainerPermissions permissions)
        {
            if (User.GetUser(Context.User.Id).ContainerAccessLevel == Container.ContainerPermissions.root)
            {
                _user = User.GetUser(userId);

                _user.ContainerAccessLevel = permissions;
                User.Write(User.UserList);
            }

            await Context.Channel.SendMessageAsync($"User with id: `{_user.UserId}'s' permissions have been changed to {permissions}");
        }
コード例 #3
0
        public async Task UpdateContainerPermission(string containerName, [Remainder] Container.ContainerPermissions permissions)
        {
            if (User.GetUser(Context.User.Id).ContainerAccessLevel == Container.ContainerPermissions.root)
            {
                _container = Container.GetContainerByName(containerName);

                _container.ContainerPermissionLevel = permissions;
                Container.Write(Container.ContainerList);
            }


            await Context.Channel.SendMessageAsync($"Container: `{_container.ContainerName}'s` permissions have been changed to {permissions}");
        }
コード例 #4
0
        public async Task UpdateContainerPermission(string containerName, [Remainder] Container.ContainerPermissions permissions)
        {
            if (User.GetUser(Context.User.Id).ContainerAccessLevel == Container.ContainerPermissions.root)
            {
                _container = Container.GetContainerByName(containerName);

                _container.PermisssionLevel = permissions;
                Container.Write(Container.ContainerList);
            }

            EmbedBuilder embed = new EmbedBuilder
            {
                Title  = "A container has been updated",
                Color  = Color.Green,
                Footer = new EmbedFooterBuilder
                {
                    IconUrl = Context.Message.Author.GetAvatarUrl(),
                    Text    = $"A containers permission was updated by user: {Context.Guild.GetUser(Context.Message.Author.Id)} at {DateTime.Now}"
                },
                Description = $"`{_container.Name}'s` permissions have been updated to `{permissions}`",
            };

            await Context.Channel.SendMessageAsync(embed : embed.Build());
        }