Typereaders will be autoloaded when module loads
This commit is contained in:
23
NadekoBot.Modules.Utility/NadekoBot.Modules.Searches.csproj
Normal file
23
NadekoBot.Modules.Utility/NadekoBot.Modules.Searches.csproj
Normal file
@ -0,0 +1,23 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputPath>..\src\NadekoBot\bin\$(Configuration)\netcoreapp2.0\modules\$(AssemblyName)\</OutputPath>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AngleSharp" Version="0.9.9" />
|
||||
<PackageReference Include="Discord.Net" Version="2.0.0-alpha-build-00832" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\NadekoBot.Core\NadekoBot.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -20,4 +20,12 @@
|
||||
<ProjectReference Include="..\NadekoBot.Core\NadekoBot.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="2.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="NadekoBot.Modules.Searches.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -147,59 +147,57 @@ namespace NadekoBot.Modules.Utility
|
||||
Format.Bold(rep.Repeater.Interval.Minutes.ToString()))).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
//todo guild date time
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
[RequireUserPermission(GuildPermission.ManageMessages)]
|
||||
[Priority(1)]
|
||||
public async Task Repeat(GuildDateTime gt, [Remainder] string message)
|
||||
{
|
||||
if (!_service.RepeaterReady)
|
||||
return;
|
||||
|
||||
//[NadekoCommand, Usage, Description, Aliases]
|
||||
//[RequireContext(ContextType.Guild)]
|
||||
//[RequireUserPermission(GuildPermission.ManageMessages)]
|
||||
//[Priority(1)]
|
||||
//public async Task Repeat(GuildDateTime gt, [Remainder] string message)
|
||||
//{
|
||||
// if (!_service.RepeaterReady)
|
||||
// return;
|
||||
if (string.IsNullOrWhiteSpace(message))
|
||||
return;
|
||||
|
||||
// if (string.IsNullOrWhiteSpace(message))
|
||||
// return;
|
||||
var toAdd = new GuildRepeater()
|
||||
{
|
||||
ChannelId = Context.Channel.Id,
|
||||
GuildId = Context.Guild.Id,
|
||||
Interval = TimeSpan.FromHours(24),
|
||||
StartTimeOfDay = gt.InputTimeUtc.TimeOfDay,
|
||||
Message = message
|
||||
};
|
||||
|
||||
// var toAdd = new GuildRepeater()
|
||||
// {
|
||||
// ChannelId = Context.Channel.Id,
|
||||
// GuildId = Context.Guild.Id,
|
||||
// Interval = TimeSpan.FromHours(24),
|
||||
// StartTimeOfDay = gt.InputTimeUtc.TimeOfDay,
|
||||
// Message = message
|
||||
// };
|
||||
using (var uow = _db.UnitOfWork)
|
||||
{
|
||||
var gc = uow.GuildConfigs.For(Context.Guild.Id, set => set.Include(x => x.GuildRepeaters));
|
||||
|
||||
// using (var uow = _db.UnitOfWork)
|
||||
// {
|
||||
// var gc = uow.GuildConfigs.For(Context.Guild.Id, set => set.Include(x => x.GuildRepeaters));
|
||||
if (gc.GuildRepeaters.Count >= 5)
|
||||
return;
|
||||
gc.GuildRepeaters.Add(toAdd);
|
||||
|
||||
// if (gc.GuildRepeaters.Count >= 5)
|
||||
// return;
|
||||
// gc.GuildRepeaters.Add(toAdd);
|
||||
await uow.CompleteAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
// await uow.CompleteAsync().ConfigureAwait(false);
|
||||
// }
|
||||
var rep = new RepeatRunner(_client, (SocketGuild)Context.Guild, toAdd);
|
||||
|
||||
// var rep = new RepeatRunner(_client, (SocketGuild)Context.Guild, toAdd);
|
||||
_service.Repeaters.AddOrUpdate(Context.Guild.Id, new ConcurrentQueue<RepeatRunner>(new[] { rep }), (key, old) =>
|
||||
{
|
||||
old.Enqueue(rep);
|
||||
return old;
|
||||
});
|
||||
|
||||
// _service.Repeaters.AddOrUpdate(Context.Guild.Id, new ConcurrentQueue<RepeatRunner>(new[] { rep }), (key, old) =>
|
||||
// {
|
||||
// old.Enqueue(rep);
|
||||
// return old;
|
||||
// });
|
||||
var secondPart = GetText("repeater_initial",
|
||||
Format.Bold(rep.InitialInterval.Hours.ToString()),
|
||||
Format.Bold(rep.InitialInterval.Minutes.ToString()));
|
||||
|
||||
// var secondPart = GetText("repeater_initial",
|
||||
// Format.Bold(rep.InitialInterval.Hours.ToString()),
|
||||
// Format.Bold(rep.InitialInterval.Minutes.ToString()));
|
||||
|
||||
// await Context.Channel.SendConfirmAsync(
|
||||
// "🔁 " + GetText("repeater",
|
||||
// Format.Bold(((IGuildUser)Context.User).GuildPermissions.MentionEveryone ? rep.Repeater.Message : rep.Repeater.Message.SanitizeMentions()),
|
||||
// Format.Bold(rep.Repeater.Interval.Days.ToString()),
|
||||
// Format.Bold(rep.Repeater.Interval.Hours.ToString()),
|
||||
// Format.Bold(rep.Repeater.Interval.Minutes.ToString())) + " " + secondPart).ConfigureAwait(false);
|
||||
//}
|
||||
await Context.Channel.SendConfirmAsync(
|
||||
"🔁 " + GetText("repeater",
|
||||
Format.Bold(((IGuildUser)Context.User).GuildPermissions.MentionEveryone ? rep.Repeater.Message : rep.Repeater.Message.SanitizeMentions()),
|
||||
Format.Bold(rep.Repeater.Interval.Days.ToString()),
|
||||
Format.Bold(rep.Repeater.Interval.Hours.ToString()),
|
||||
Format.Bold(rep.Repeater.Interval.Minutes.ToString())) + " " + secondPart).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
[NadekoCommand, Usage, Description, Aliases]
|
||||
[RequireContext(ContextType.Guild)]
|
||||
|
Reference in New Issue
Block a user