Fixed .greettest byetest greetdmtest and boosttest command if you didn't have them enabled. Also fixed greetdmtest sending messages twice.
This commit is contained in:
parent
6b44f9f5b7
commit
8ec4e6cbb0
2 changed files with 37 additions and 11 deletions
|
@ -199,6 +199,14 @@ public partial class Administration
|
||||||
|
|
||||||
|
|
||||||
if (!isEnabled)
|
if (!isEnabled)
|
||||||
|
{
|
||||||
|
var cmdName = GetCmdName(type);
|
||||||
|
|
||||||
|
await Response().Pending(strs.boostmsg_enable($"`{prefix}{cmdName}`")).SendAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static string GetCmdName(GreetType type)
|
||||||
{
|
{
|
||||||
var cmdName = type switch
|
var cmdName = type switch
|
||||||
{
|
{
|
||||||
|
@ -208,9 +216,7 @@ public partial class Administration
|
||||||
GreetType.GreetDm => "greetdm",
|
GreetType.GreetDm => "greetdm",
|
||||||
_ => "unknown_command"
|
_ => "unknown_command"
|
||||||
};
|
};
|
||||||
|
return cmdName;
|
||||||
await Response().Pending(strs.boostmsg_enable($"`{prefix}{cmdName}`")).SendAsync();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task Test(GreetType type, IGuildUser? user = null)
|
public async Task Test(GreetType type, IGuildUser? user = null)
|
||||||
|
@ -219,8 +225,19 @@ public partial class Administration
|
||||||
|
|
||||||
await _service.Test(ctx.Guild.Id, type, (ITextChannel)ctx.Channel, user);
|
await _service.Test(ctx.Guild.Id, type, (ITextChannel)ctx.Channel, user);
|
||||||
var conf = await _service.GetGreetSettingsAsync(ctx.Guild.Id, type);
|
var conf = await _service.GetGreetSettingsAsync(ctx.Guild.Id, type);
|
||||||
|
|
||||||
|
var cmd = $"`{prefix}{GetCmdName(type)}`";
|
||||||
|
|
||||||
|
var str = type switch
|
||||||
|
{
|
||||||
|
GreetType.Greet => strs.boostmsg_enable(cmd),
|
||||||
|
GreetType.Bye => strs.greetmsg_enable(cmd),
|
||||||
|
GreetType.Boost => strs.byemsg_enable(cmd),
|
||||||
|
GreetType.GreetDm => strs.greetdmmsg_enable(cmd),
|
||||||
|
_ => strs.error
|
||||||
|
};
|
||||||
if (conf?.IsEnabled is not true)
|
if (conf?.IsEnabled is not true)
|
||||||
await Response().Pending(strs.boostmsg_enable($"`{prefix}boost`")).SendAsync();
|
await Response().Pending(str).SendAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -457,7 +457,17 @@ public class GreetService : IEService, IReadyExecutor
|
||||||
{
|
{
|
||||||
var conf = await GetGreetSettingsAsync(guildId, type);
|
var conf = await GetGreetSettingsAsync(guildId, type);
|
||||||
if (conf is null)
|
if (conf is null)
|
||||||
return false;
|
{
|
||||||
|
conf = new GreetSettings()
|
||||||
|
{
|
||||||
|
ChannelId = channel.Id,
|
||||||
|
GreetType = type,
|
||||||
|
IsEnabled = false,
|
||||||
|
GuildId = guildId,
|
||||||
|
AutoDeleteTimer = 30,
|
||||||
|
MessageText = GetDefaultGreet(type)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
await SendMessage(conf, channel, user);
|
await SendMessage(conf, channel, user);
|
||||||
return true;
|
return true;
|
||||||
|
@ -467,7 +477,6 @@ public class GreetService : IEService, IReadyExecutor
|
||||||
{
|
{
|
||||||
if (conf.GreetType == GreetType.GreetDm)
|
if (conf.GreetType == GreetType.GreetDm)
|
||||||
{
|
{
|
||||||
await _greetQueue.Writer.WriteAsync((conf, user, channel as ITextChannel));
|
|
||||||
return await GreetDmUser(conf, user);
|
return await GreetDmUser(conf, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue