Added .setstatus
This commit is contained in:
parent
1dad858a65
commit
c99d2a9bba
@ -485,7 +485,6 @@ namespace NadekoBot.Modules.Administration
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
var msgs = new List<IMessage>(cnt);
|
||||
|
||||
await Context.Channel.GetMessagesAsync(cnt).ForEachAsync(dled => msgs.AddRange(dled)).ConfigureAwait(false);
|
||||
|
||||
var title = $"Chatlog-{Context.Guild.Name}/#{Context.Channel.Name}-{DateTime.Now}.txt";
|
||||
|
@ -59,7 +59,16 @@ namespace NadekoBot.Modules.Administration
|
||||
|
||||
await NadekoBot.Client.CurrentUser().ModifyAsync(u => u.Username = newName).ConfigureAwait(false);
|
||||
|
||||
await Context.Channel.SendConfirmAsync($"ℹ️ Successfully changed name to **{newName}**").ConfigureAwait(false);
|
||||
await Context.Channel.SendConfirmAsync($"Bot name changed to **{newName}**").ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[OwnerOnly]
|
||||
public async Task SetStatus([Remainder] SettableUserStatus status)
|
||||
{
|
||||
await NadekoBot.Client.SetStatus(status);
|
||||
|
||||
await Context.Channel.SendConfirmAsync($"Bot status changed to **{status}**").ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
|
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
27
src/NadekoBot/Resources/CommandStrings.Designer.cs
generated
@ -6566,6 +6566,33 @@ namespace NadekoBot.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to setstatus.
|
||||
/// </summary>
|
||||
public static string setstatus_cmd {
|
||||
get {
|
||||
return ResourceManager.GetString("setstatus_cmd", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Sets the bot's status. (Online/Idle/Invisible).
|
||||
/// </summary>
|
||||
public static string setstatus_desc {
|
||||
get {
|
||||
return ResourceManager.GetString("setstatus_desc", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to `{0}setstatus Idle`.
|
||||
/// </summary>
|
||||
public static string setstatus_usage {
|
||||
get {
|
||||
return ResourceManager.GetString("setstatus_usage", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to setstream.
|
||||
/// </summary>
|
||||
|
@ -2853,4 +2853,13 @@
|
||||
<data name="autohentai_usage" xml:space="preserve">
|
||||
<value>`{0}autohentai 30 yuri|tail|long_hair` or `{0}autohentai`</value>
|
||||
</data>
|
||||
<data name="setstatus_cmd" xml:space="preserve">
|
||||
<value>setstatus</value>
|
||||
</data>
|
||||
<data name="setstatus_desc" xml:space="preserve">
|
||||
<value>Sets the bot's status. (Online/Idle/Invisible)</value>
|
||||
</data>
|
||||
<data name="setstatus_usage" xml:space="preserve">
|
||||
<value>`{0}setstatus Idle`</value>
|
||||
</data>
|
||||
</root>
|
@ -140,5 +140,32 @@ namespace NadekoBot
|
||||
|
||||
|
||||
public Task SetStream(string name, string url) => Task.WhenAll(Clients.Select(ms => ms.SetGameAsync(name, url, StreamType.NotStreaming)));
|
||||
|
||||
public Task SetStatus(SettableUserStatus status) => Task.WhenAll(Clients.Select(ms => ms.SetStatusAsync(SettableUserStatusToUserStatus(status))));
|
||||
|
||||
private static UserStatus SettableUserStatusToUserStatus(SettableUserStatus sus)
|
||||
{
|
||||
switch (sus)
|
||||
{
|
||||
case SettableUserStatus.Online:
|
||||
return UserStatus.Online;
|
||||
case SettableUserStatus.Invisible:
|
||||
return UserStatus.Invisible;
|
||||
case SettableUserStatus.Idle:
|
||||
return UserStatus.AFK;
|
||||
}
|
||||
|
||||
return UserStatus.Online;
|
||||
}
|
||||
}
|
||||
|
||||
public enum SettableUserStatus
|
||||
{
|
||||
Online = 1,
|
||||
On = 1,
|
||||
Invisible = 2,
|
||||
Invis = 2,
|
||||
Idle = 3,
|
||||
Afk = 3
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user