This repository has been archived by the owner on Mar 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/Flandre.Adapters.Konata.Extensions/AdapterCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using Flandre.Framework; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Flandre.Adapters.Konata.Extensions; | ||
|
||
/// <summary> | ||
/// Konata 适配器扩展 | ||
/// </summary> | ||
public static class AdapterCollectionExtensions | ||
{ | ||
/// <summary> | ||
/// 添加 Konata 适配器,自动从配置根中的 <c>Adapters:Konata</c> 项读取配置。 | ||
/// </summary> | ||
public static void AddKonata(this IAdapterCollection adapters) | ||
{ | ||
var config = adapters.Services | ||
.BuildServiceProvider() | ||
.GetRequiredService<IConfigurationRoot>() | ||
.GetSection("Adapters:Konata") | ||
.Get<KonataAdapterConfig>(); | ||
adapters.Add(new KonataAdapter(config ?? new KonataAdapterConfig())); | ||
} | ||
|
||
/// <summary> | ||
/// 添加 Konata 适配器。 | ||
/// </summary> | ||
public static void AddKonata(this IAdapterCollection adapters, IConfiguration configuration) | ||
{ | ||
var config = configuration.Get<KonataAdapterConfig>(); | ||
adapters.Add(new KonataAdapter(config ?? new KonataAdapterConfig())); | ||
} | ||
|
||
/// <summary> | ||
/// 添加 Konata 适配器。 | ||
/// </summary> | ||
public static void AddKonata(this IAdapterCollection adapters, Action<KonataAdapterConfig> action) | ||
{ | ||
var config = new KonataAdapterConfig(); | ||
action(config); | ||
adapters.Add(new KonataAdapter(config)); | ||
} | ||
|
||
/// <summary> | ||
/// 添加 Konata 适配器。 | ||
/// </summary> | ||
public static void AddKonata(this IAdapterCollection adapters, KonataAdapterConfig config) | ||
{ | ||
adapters.Add(new KonataAdapter(config)); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/Flandre.Adapters.Konata.Extensions/Flandre.Adapters.Konata.Extensions.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<Title>Flandre.Adapters.Konata.Extensions</Title> | ||
<PackageVersion>1.0.0</PackageVersion> | ||
<Authors>FlandreDevs,bsdayo</Authors> | ||
<Description>Flandre.Framework extensions for Flandre.Adapters.Konata.</Description> | ||
<PackageTags>bot;chatbot;flandre;adapter;konata;extensions</PackageTags> | ||
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression> | ||
<PackageIcon>avatar.jpg</PackageIcon> | ||
|
||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<OutputType>Library</OutputType> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
|
||
<PackageProjectUrl>https://github.com/FlandreDevs/Flandre</PackageProjectUrl> | ||
<RepositoryUrl>https://github.com/FlandreDevs/Flandre.git</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<Copyright>FlandreDevs (C) 2022-2023</Copyright> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Flandre.Adapters.Konata\Flandre.Adapters.Konata.csproj"/> | ||
<ProjectReference Include="..\Flandre.Framework\Flandre.Framework.csproj"/> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="../../assets/avatar.jpg" Pack="true" PackagePath="/"/> | ||
</ItemGroup> | ||
|
||
</Project> |
52 changes: 52 additions & 0 deletions
52
src/Flandre.Adapters.OneBot.Extensions/AdapterCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
using Flandre.Framework; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Flandre.Adapters.OneBot.Extensions; | ||
|
||
/// <summary> | ||
/// OneBot 适配器扩展 | ||
/// </summary> | ||
public static class AdapterCollectionExtensions | ||
{ | ||
/// <summary> | ||
/// 添加 OneBot 适配器,自动从配置根中的 <c>Adapters:OneBot</c> 项读取配置。 | ||
/// </summary> | ||
public static void AddOneBot(this IAdapterCollection adapters) | ||
{ | ||
var config = adapters.Services | ||
.BuildServiceProvider() | ||
.GetRequiredService<IConfigurationRoot>() | ||
.GetSection("Adapters:OneBot") | ||
.Get<OneBotAdapterConfig>(); | ||
adapters.Add(new OneBotAdapter(config ?? new OneBotAdapterConfig())); | ||
} | ||
|
||
/// <summary> | ||
/// 添加 OneBot 适配器。 | ||
/// </summary> | ||
public static void AddOneBot(this IAdapterCollection adapters, IConfiguration configuration) | ||
{ | ||
var config = configuration.Get<OneBotAdapterConfig>(); | ||
adapters.Add(new OneBotAdapter(config ?? new OneBotAdapterConfig())); | ||
} | ||
|
||
/// <summary> | ||
/// 添加 OneBot 适配器。 | ||
/// </summary> | ||
public static void AddOneBot(this IAdapterCollection adapters, Action<OneBotAdapterConfig> action) | ||
{ | ||
var config = new OneBotAdapterConfig(); | ||
action(config); | ||
adapters.Add(new OneBotAdapter(config)); | ||
} | ||
|
||
/// <summary> | ||
/// 添加 OneBot 适配器。 | ||
/// </summary> | ||
public static void AddOneBot(this IAdapterCollection adapters, OneBotAdapterConfig config) | ||
{ | ||
adapters.Add(new OneBotAdapter(config)); | ||
} | ||
} | ||
|
33 changes: 33 additions & 0 deletions
33
src/Flandre.Adapters.OneBot.Extensions/Flandre.Adapters.OneBot.Extensions.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<Title>Flandre.Adapters.OneBot.Extensions</Title> | ||
<PackageVersion>1.0.0</PackageVersion> | ||
<Authors>FlandreDevs,bsdayo</Authors> | ||
<Description>Flandre.Framework extensions for Flandre.Adapters.OneBot.</Description> | ||
<PackageTags>bot;chatbot;flandre;adapter;onebot;extensions</PackageTags> | ||
<PackageLicenseExpression>MIT</PackageLicenseExpression> | ||
<PackageIcon>avatar.jpg</PackageIcon> | ||
|
||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<OutputType>Library</OutputType> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
|
||
<PackageProjectUrl>https://github.com/FlandreDevs/Flandre</PackageProjectUrl> | ||
<RepositoryUrl>https://github.com/FlandreDevs/Flandre.git</RepositoryUrl> | ||
<RepositoryType>git</RepositoryType> | ||
<Copyright>FlandreDevs (C) 2022-2023</Copyright> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Flandre.Adapters.OneBot\Flandre.Adapters.OneBot.csproj" /> | ||
<ProjectReference Include="..\Flandre.Framework\Flandre.Framework.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<None Include="../../assets/avatar.jpg" Pack="true" PackagePath="/"/> | ||
</ItemGroup> | ||
|
||
</Project> |