コード例 #1
0
        public async Task <UserRole> CreateNewRole(NewUserRole role, DiscordServerContext discordServer)
        {
            var permissionsValue = role.Permissions.GetRawValue();

            var guild = await this._restClient.GetGuildAsync(discordServer.Id);

            var restRole = await guild.CreateRoleAsync(role.Name, new GuildPermissions(permissionsValue), isMentionable : false);

            var userRole = new UserRoleFactory().Create(restRole);

            return(userRole);
        }
コード例 #2
0
ファイル: Server.cs プロジェクト: Zilib/Watchman
        public static async Task <UserRole> CreateNewRole(NewUserRole role, DiscordServerContext discordServer)
        {
            var permissionsValue = role.Permissions.GetRawValue();

            var guild = await _restClient.GetGuildAsync(discordServer.Id);

            var createRoleTask = guild.CreateRoleAsync(role.Name, new GuildPermissions(permissionsValue));

            var restRole = createRoleTask.Result;
            var userRole = new UserRoleFactory().Create(restRole);

            return(userRole);
        }
コード例 #3
0
ファイル: UsersRolesService.cs プロジェクト: Zilib/Watchman
 public UserRole CreateNewRole(DiscordServerContext server, NewUserRole userRole)
 {
     return(Server.CreateNewRole(userRole, server).Result);
 }
コード例 #4
0
 private async Task <UserRole> SetRoleToServer(DiscordServerContext server, NewUserRole mutedRole)
 {
     return(await this._usersRolesService.CreateNewRole(server, mutedRole));
 }
コード例 #5
0
 internal static Task <UserRole> CreateNewRole(NewUserRole role, DiscordServerContext discordServer)
 {
     return(_discordClient.RolesService.CreateNewRole(role, discordServer));
 }
コード例 #6
0
 public async Task <UserRole> CreateNewRole(DiscordServerContext server, NewUserRole userRole)
 {
     return(await Server.CreateNewRole(userRole, server));
 }
コード例 #7
0
 private UserRole SetRoleToServer(DiscordServerContext server, NewUserRole mutedRole)
 {
     return(_usersRolesService.CreateNewRole(server, mutedRole));
 }