mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-12 10:18:27 -04:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
1de6cdb8dc | ||
|
f473014fe9 | ||
|
2c3e5fe507 | ||
|
ecc192c6a9 |
@@ -5,6 +5,5 @@ else {
|
|||||||
$migrationName = $args[0]
|
$migrationName = $args[0]
|
||||||
dotnet ef migrations add $migrationName -c SqliteContext -p src/NadekoBot/NadekoBot.csproj
|
dotnet ef migrations add $migrationName -c SqliteContext -p src/NadekoBot/NadekoBot.csproj
|
||||||
dotnet ef migrations add $migrationName -c PostgreSqlContext -p src/NadekoBot/NadekoBot.csproj
|
dotnet ef migrations add $migrationName -c PostgreSqlContext -p src/NadekoBot/NadekoBot.csproj
|
||||||
dotnet ef migrations add $migrationName -c MysqlContext -p src/NadekoBot/NadekoBot.csproj
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
dotnet ef migrations remove -c SqliteContext -f -p src/NadekoBot/NadekoBot.csproj
|
dotnet ef migrations remove -c SqliteContext -f -p src/NadekoBot/NadekoBot.csproj
|
||||||
dotnet ef migrations remove -c PostgreSqlContext -f -p src/NadekoBot/NadekoBot.csproj
|
dotnet ef migrations remove -c PostgreSqlContext -f -p src/NadekoBot/NadekoBot.csproj
|
||||||
dotnet ef migrations remove -c MysqlContext -f -p src/NadekoBot/NadekoBot.csproj
|
|
||||||
|
|
||||||
|
@@ -200,27 +200,45 @@ public partial class Administration
|
|||||||
|
|
||||||
if (!isEnabled)
|
if (!isEnabled)
|
||||||
{
|
{
|
||||||
var cmdName = type switch
|
var cmdName = GetCmdName(type);
|
||||||
{
|
|
||||||
GreetType.Greet => "greet",
|
|
||||||
GreetType.Bye => "bye",
|
|
||||||
GreetType.Boost => "boost",
|
|
||||||
GreetType.GreetDm => "greetdm",
|
|
||||||
_ => "unknown_command"
|
|
||||||
};
|
|
||||||
|
|
||||||
await Response().Pending(strs.boostmsg_enable($"`{prefix}{cmdName}`")).SendAsync();
|
await Response().Pending(strs.boostmsg_enable($"`{prefix}{cmdName}`")).SendAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string GetCmdName(GreetType type)
|
||||||
|
{
|
||||||
|
var cmdName = type switch
|
||||||
|
{
|
||||||
|
GreetType.Greet => "greet",
|
||||||
|
GreetType.Bye => "bye",
|
||||||
|
GreetType.Boost => "boost",
|
||||||
|
GreetType.GreetDm => "greetdm",
|
||||||
|
_ => "unknown_command"
|
||||||
|
};
|
||||||
|
return cmdName;
|
||||||
|
}
|
||||||
|
|
||||||
public async Task Test(GreetType type, IGuildUser? user = null)
|
public async Task Test(GreetType type, IGuildUser? user = null)
|
||||||
{
|
{
|
||||||
user ??= (IGuildUser)ctx.User;
|
user ??= (IGuildUser)ctx.User;
|
||||||
|
|
||||||
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 : INService, 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 : INService, 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -37,7 +37,6 @@
|
|||||||
<!-- <PackageReference Include="Grpc.AspNetCore" Version="2.62.0" />-->
|
<!-- <PackageReference Include="Grpc.AspNetCore" Version="2.62.0" />-->
|
||||||
<PackageReference Include="Google.Protobuf" Version="3.26.1"/>
|
<PackageReference Include="Google.Protobuf" Version="3.26.1"/>
|
||||||
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.62.0"/>
|
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.62.0"/>
|
||||||
<PackageReference Include="Grpc.AspNetCore" Version="2.62.0"/>
|
|
||||||
<PackageReference Include="Grpc.Tools" Version="2.63.0">
|
<PackageReference Include="Grpc.Tools" Version="2.63.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
@@ -330,9 +330,9 @@ public sealed class MedusaLoaderService : IMedusaLoaderService, IReadyExecutor,
|
|||||||
throw new FileNotFoundException($"Medusa dll not found: {path}");
|
throw new FileNotFoundException($"Medusa dll not found: {path}");
|
||||||
|
|
||||||
strings = MedusaStrings.CreateDefault(dir);
|
strings = MedusaStrings.CreateDefault(dir);
|
||||||
var ctx = new MedusaAssemblyLoadContext(Path.GetDirectoryName(path)!);
|
var ctx = new MedusaAssemblyLoadContext(path);
|
||||||
var a = ctx.LoadFromAssemblyPath(Path.GetFullPath(path));
|
var a = ctx.LoadFromAssemblyPath(Path.GetFullPath(path));
|
||||||
ctx.LoadDependencies(a);
|
// ctx.LoadDependencies(a);
|
||||||
|
|
||||||
// load services
|
// load services
|
||||||
iocModule = new MedusaNinjectIocModule(_cont, a, safeName);
|
iocModule = new MedusaNinjectIocModule(_cont, a, safeName);
|
||||||
|
Reference in New Issue
Block a user