OpenMod Docs OpenMod Docs
OpenMod Docs OpenMod Docs
OpenMod .NET Plugin Framework.

Interface IUserProvider

Provides users.

Namespace: OpenMod.API.Users
Assembly: OpenMod.API.dll
Syntax
public interface IUserProvider

Methods

| Improve this Doc View Source

BanAsync(IUser, IUser, Nullable<String>, Nullable<DateTime>)

Ban a user.

Declaration
Task<bool> BanAsync(IUser user, IUser instigator = null, string? reason = null, DateTime? endTime = null)
Parameters
Type Name Description
IUser user

The user to ban.

IUser instigator

The user that ban.

System.Nullable<System.String> reason

The reason of the user ban.

System.Nullable<DateTime> endTime

The time when the ban will expire.

Returns
Type Description
Task<System.Boolean>
| Improve this Doc View Source

BanAsync(IUser, Nullable<String>, Nullable<DateTime>)

Ban a user.

Declaration
Task<bool> BanAsync(IUser user, string? reason = null, DateTime? endTime = null)
Parameters
Type Name Description
IUser user

The user to ban.

System.Nullable<System.String> reason

The reason of the user ban.

System.Nullable<DateTime> endTime

The time when the ban will expire.

Returns
Type Description
Task<System.Boolean>
| Improve this Doc View Source

BroadcastAsync(String, Nullable<Color>)

Broadcasts a message to all users.

Declaration
Task BroadcastAsync(string message, Color? color = null)
Parameters
Type Name Description
System.String message

The message to broadcast.

System.Nullable<Color> color

The message color. May not be supported on all platforms.

Returns
Type Description
Task
| Improve this Doc View Source

BroadcastAsync(String, String, Nullable<Color>)

Broadcasts a message to all users of the given type.

Declaration
Task BroadcastAsync(string userType, string message, Color? color = null)
Parameters
Type Name Description
System.String userType

The user type to broadcast to.

System.String message

The message to broadcast.

System.Nullable<Color> color

The message color. May not be supported on all platforms.

Returns
Type Description
Task
| Improve this Doc View Source

FindUserAsync(String, String, UserSearchMode)

Searches for an user.

Declaration
Task<IUser> FindUserAsync(string userType, string searchString, UserSearchMode searchMode)
Parameters
Type Name Description
System.String userType

The user type.

System.String searchString

The user ID or name depending on the search mode.

UserSearchMode searchMode

The search mode.

Returns
Type Description
Task<IUser>

The user if found; otherwise, null.

| Improve this Doc View Source

GetUsersAsync(String)

Gets all users of the given type.

Declaration
Task<IReadOnlyCollection<IUser>> GetUsersAsync(string userType)
Parameters
Type Name Description
System.String userType

The type of the users to look for.

Returns
Type Description
Task<IReadOnlyCollection<IUser>>

All users of the given type.

| Improve this Doc View Source

KickAsync(IUser, Nullable<String>)

KIck a user.

Declaration
Task<bool> KickAsync(IUser user, string? reason = null)
Parameters
Type Name Description
IUser user

The user to kick.

System.Nullable<System.String> reason

The reason of the user kick.

Returns
Type Description
Task<System.Boolean>
| Improve this Doc View Source

SupportsUserType(String)

Checks if the user provider supports the given user type.

Declaration
bool SupportsUserType(string userType)
Parameters
Type Name Description
System.String userType

The user type to check for.

Returns
Type Description
System.Boolean

True if the user type is supported; otherwise, false.

Extension Methods

DisposeHelper.DisposeSyncOrAsync(Object)