├── .vscode
├── solution-explorer
│ ├── class.ts-template
│ ├── default.ts-template
│ ├── interface.ts-template
│ ├── class.cs-template
│ ├── enum.cs-template
│ ├── interface.cs-template
│ ├── class.vb-template
│ ├── template-parameters.js
│ └── template-list.json
├── tasks.json
└── launch.json
├── Resources
├── voc_list_kiso_kansei.csv
├── ngwords.txt
└── greeting.json
├── bin
└── Debug
│ ├── net5.0
│ └── publish
│ │ └── Citrine.dll
│ └── netstandard2.1
│ └── publish
│ └── Citrine.dll
├── Const.cs
├── .gitignore
├── .editorconfig
├── Citrine.csproj
├── README.md
├── README-ja.md
├── Commands
├── EchoCommand.cs
├── IsAdminCommand.cs
├── WakachiCommand.cs
├── ReverseCommand.cs
├── PipeLineCommand.cs
├── DateTimeCommand.cs
├── UnyaizeCommand.cs
├── StopCommand.cs
├── VersionCommand.cs
├── WrapWithCommand.cs
├── RandomModule.cs
├── UserAgentCommand.cs
├── NyaizeCommand.cs
├── FujiwaraTatsuyaCommand.cs
├── ModuleCommand.cs
├── InspectCommand.cs
├── WaCommand.cs
├── BalloonGenCommand.cs
├── DebugCommand.cs
├── ToCharCommand.cs
├── KatakanaCommand.cs
├── HiraganaCommand.cs
├── DumpCommand.cs
├── TranslateCommand.cs
├── OjisanCommand.cs
├── PipeCommand.cs
├── RatingModule.cs
├── NmoudameCommand.cs
├── WordCommand.cs
├── DiceCommand.cs
├── HelpCommand.cs
└── BinCommand.cs
├── Modules
├── EmptyMentionHandlerModule.cs
├── GreetingModule.command.cs
├── GoodRoundDetectorModule.cs
├── OjichatModule.cs
├── CallMeModule.cs
├── ImHereModule.cs
├── WeatherModule.cs
├── EraitModule.cs
├── Markov
│ ├── MarkovNode.cs
│ └── TinySegmenter.cs
├── FollowBackModule.cs
├── CommandModule.cs
├── IntegrationFamilyModule.cs
├── BackupModule.cs
├── StatusModule.cs
├── ValentineModule.cs
├── SushiModule.cs
├── HarassmentHandlerModule.cs
├── ReactModule.cs
├── UserMovingKit.cs
├── JankenModule.cs
├── GreetingModule.cs
├── KawaiiModule.cs
├── FortuneModule.cs
├── BirthdayModule.cs
├── EconomyModule.cs
├── TranslateModule.cs
├── SearchModule.cs
├── ApexLegendsModule.cs
└── FortuneModule.strings.cs
└── LICENSE
/.vscode/solution-explorer/class.ts-template:
--------------------------------------------------------------------------------
1 | export class {{name}} {
2 |
3 | }
4 |
--------------------------------------------------------------------------------
/.vscode/solution-explorer/default.ts-template:
--------------------------------------------------------------------------------
1 | export default {{name}} {
2 |
3 | }
4 |
--------------------------------------------------------------------------------
/.vscode/solution-explorer/interface.ts-template:
--------------------------------------------------------------------------------
1 | export interface {{name}} {
2 |
3 | }
4 |
--------------------------------------------------------------------------------
/Resources/voc_list_kiso_kansei.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EbiseLutica/Citrine/HEAD/Resources/voc_list_kiso_kansei.csv
--------------------------------------------------------------------------------
/bin/Debug/net5.0/publish/Citrine.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EbiseLutica/Citrine/HEAD/bin/Debug/net5.0/publish/Citrine.dll
--------------------------------------------------------------------------------
/bin/Debug/netstandard2.1/publish/Citrine.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EbiseLutica/Citrine/HEAD/bin/Debug/netstandard2.1/publish/Citrine.dll
--------------------------------------------------------------------------------
/.vscode/solution-explorer/class.cs-template:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace {{namespace}}
4 | {
5 | public class {{name}}
6 | {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/.vscode/solution-explorer/enum.cs-template:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace {{namespace}}
4 | {
5 | public enum {{name}}
6 | {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/Const.cs:
--------------------------------------------------------------------------------
1 | namespace Citrine.Core
2 | {
3 | public static class Const
4 | {
5 | public static readonly string Version = "1.3.1";
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/.vscode/solution-explorer/interface.cs-template:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace {{namespace}}
4 | {
5 | public interface {{name}}
6 | {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/.vscode/solution-explorer/class.vb-template:
--------------------------------------------------------------------------------
1 | Imports System
2 |
3 | Namespace {{namespace}}
4 |
5 | Public Class {{name}}
6 |
7 | End Class
8 |
9 | End Namespace
10 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | bin/*
2 | !bin/Debug
3 | bin/Debug/*
4 | !bin/Debug/net5.0
5 | bin/Debug/net5.0/*
6 | !bin/Debug/net5.0/publish
7 | bin/Debug/net5.0/publish/*
8 | !bin/Debug/net5.0/publish/Citrine.dll
9 | obj
10 |
11 | Citrine/token
12 | token
13 | admin
14 | nicknames
15 | *.log
16 | config.json
17 | storage.json
18 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = tab
5 | indent_size = 4
6 | charset = utf-8
7 | trim_trailing_whitespace = true
8 | insert_final_newline = true
9 |
10 | [.yml]
11 | indent_style = space
12 | indent_size = 2
13 |
14 |
15 | [/disboard/**]
16 | charset = unset
17 | end_of_line = unset
18 | insert_final_newline = unset
19 | trim_trailing_whitespace = unset
20 | indent_style = unset
21 | indent_size = unset
22 |
--------------------------------------------------------------------------------
/Citrine.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net5.0
4 | Latest
5 | Enable
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Citrine
2 |
3 | シトリンは、可愛くて賢い chatbot な BotBone プラグインです。
4 |
5 | ## 使用法
6 |
7 | まずはビルド。
8 |
9 | ```
10 | dotnet build
11 | ```
12 |
13 | BotBoneの /plugins フォルダに、Citrine.dllを導入
14 | BotBone を起動するだけ
15 |
16 | ## 貢献
17 |
18 | - [バグ報告 / 要望](//github.com/xeltica/citrine/issues/new)
19 | - [プルリクエスト](//github.com/xeltica/citrine/compare)
20 |
21 | ### 以前のコントリビューター
22 |
23 | [その他...](//github.com/Xeltica/Citrine/graphs/contributors)
24 |
25 | ## ライセンス
26 |
27 | [MIT License](LICENSE)
28 |
--------------------------------------------------------------------------------
/.vscode/solution-explorer/template-parameters.js:
--------------------------------------------------------------------------------
1 | var path = require("path");
2 |
3 | module.exports = function(filename, projectPath, folderPath) {
4 | var namespace = "Unknown";
5 | if (projectPath) {
6 | namespace = path.basename(projectPath, path.extname(projectPath));
7 | if (folderPath) {
8 | namespace += "." + folderPath.replace(path.dirname(projectPath), "").substring(1).replace(/[\\\/]/g, ".");
9 | }
10 | namespace = namespace.replace(/[\\\-]/g, "_");
11 | }
12 |
13 | return {
14 | namespace: namespace,
15 | name: path.basename(filename, path.extname(filename))
16 | }
17 | };
18 |
--------------------------------------------------------------------------------
/README-ja.md:
--------------------------------------------------------------------------------
1 | # Citrine
2 |
3 | [English](README.md) ・ 日本語
4 |
5 | シトリンは、可愛くて賢い chatbot な BotBone プラグインです。
6 |
7 | ## 使用法
8 |
9 | まずはビルド。
10 |
11 | ```
12 | dotnet build
13 | ```
14 |
15 | BotBoneの /plugins フォルダに、[Citrine.dll](bin/Debug/netstandard2.1/publish/Citrine.dll) を導入
16 | BotBone を起動するだけ
17 |
18 | ## 貢献
19 |
20 | - [バグ報告 / 要望](//github.com/xeltica/citrine/issues/new)
21 | - [プルリクエスト](//github.com/xeltica/citrine/compare)
22 |
23 | ### 以前のコントリビューター
24 |
25 | - @u1-liquid
26 |
27 | [その他...](//github.com/Xeltica/Citrine/graphs/contributors)
28 |
29 | ## ライセンス
30 |
31 | [MIT License](LICENSE)
32 |
--------------------------------------------------------------------------------
/Commands/EchoCommand.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 | using System.Threading.Tasks;
3 | using BotBone.Core;
4 | using BotBone.Core.Api;
5 | using BotBone.Core.Modules;
6 |
7 | namespace Citrine.Core
8 | {
9 | public class EchoCommand : CommandBase
10 | {
11 | public override string Name => "echo";
12 |
13 | public override string Usage => "/echo ";
14 |
15 | public override string Description => "引数をそのままオウム返しします。";
16 |
17 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
18 | {
19 | return body;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Modules/EmptyMentionHandlerModule.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using BotBone.Core;
3 | using BotBone.Core.Api;
4 | using BotBone.Core.Modules;
5 |
6 | namespace Citrine.Core.Modules
7 | {
8 | public class EmptyMentionHandlerModule : ModuleBase
9 | {
10 | public override async Task ActivateAsync(IPost n, IShell shell, Server core)
11 | {
12 | // n.Text.TrimMentions() がカラッポであり
13 | // n.Reply.User.Id == n.User.Id であればハンドルする
14 | if (string.IsNullOrEmpty(n.Text?.TrimMentions()) && n.Reply?.User.Id == n.User.Id)
15 | {
16 | await core.HandleMentionAsync(n.Reply);
17 | return true;
18 | }
19 | return false;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Commands/IsAdminCommand.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 | using System.Threading.Tasks;
3 | using BotBone.Core;
4 | using BotBone.Core.Api;
5 | using BotBone.Core.Modules;
6 |
7 | namespace Citrine.Core
8 | {
9 | public class IsAdminCommand : CommandBase
10 | {
11 | public override string Name => "isadmin";
12 |
13 | public override string Usage => "/isadmin";
14 |
15 | public override string Description => "管理者であるかどうか取得します";
16 |
17 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
18 | {
19 | return sender.IsAdmin ? "yes" : "no";
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Commands/WakachiCommand.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 | using System.Threading.Tasks;
3 | using BotBone.Core;
4 | using BotBone.Core.Api;
5 | using Citrine.Core.Modules.Markov;
6 |
7 | namespace Citrine.Core
8 | {
9 | public class WakachiCommand : CommandBase
10 | {
11 | public override string Name => "wakachi";
12 | public override string Usage => "/wakachi ";
13 | public override string Description => "入力文字列をわかち書きします。";
14 |
15 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
16 | {
17 | return string.Join(" ", TinySegmenter.Instance.Segment(body));
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Commands/ReverseCommand.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 | using System.Linq;
3 | using System.Threading.Tasks;
4 | using BotBone.Core;
5 | using BotBone.Core.Api;
6 | using BotBone.Core.Modules;
7 |
8 | namespace Citrine.Core
9 | {
10 | public class ReverseCommand : CommandBase
11 | {
12 | public override string Name => "reverse";
13 |
14 | public override string Usage => "/reverse ";
15 |
16 | public override string Description => "テキストを逆さに変換します。";
17 |
18 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
19 | {
20 | return string.Concat(body.Reverse());
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Commands/PipeLineCommand.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 | using System.Threading.Tasks;
3 | using BotBone.Core;
4 | using BotBone.Core.Api;
5 | using BotBone.Core.Modules;
6 |
7 | namespace Citrine.Core
8 | {
9 | public class PipeLineCommand : CommandBase
10 | {
11 | public override string Name => "pipeline";
12 |
13 | public override string Usage => "/pipeline (これ以降に改行で区切ってコマンドを書いて下さい。)";
14 |
15 | public override string Description => "各種コマンドを連結して実行します。前のコマンドの出力は、次のコマンドの末尾に追記されます。";
16 |
17 | public override Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
18 | {
19 | return PipeCommand.RunPipeAsync(sender, core, body, '|');
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Commands/DateTimeCommand.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 | using System;
3 | using System.Threading.Tasks;
4 | using BotBone.Core;
5 | using BotBone.Core.Api;
6 | using BotBone.Core.Modules;
7 |
8 | namespace Citrine.Core
9 | {
10 | public class DateTimeCommand : CommandBase
11 | {
12 | public override string Name => "datetime";
13 |
14 | public override string Usage => "/datetime";
15 |
16 | public override string Description => "現在時刻を返します。";
17 |
18 | public override string[] Aliases => new[] { "date", "time", "dt" };
19 |
20 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
21 | {
22 | return DateTime.Now.ToString();
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Commands/UnyaizeCommand.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 | using System.Threading.Tasks;
3 | using BotBone.Core;
4 | using BotBone.Core.Api;
5 | using BotBone.Core.Modules;
6 |
7 | namespace Citrine.Core
8 | {
9 | public class UnyaizeCommand : CommandBase
10 | {
11 | public override string Name => "unnyaize";
12 |
13 | public override string Usage => "/unnyaize";
14 |
15 | public override string[] Aliases => new []{ "unnya" };
16 |
17 | public override string Description => "発言のねこを除去します。";
18 |
19 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
20 | {
21 | return body.Replace("にゃ", "な").Replace("ニャ", "ナ").Replace("ニャ", "ナ");
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Commands/StopCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading.Tasks;
3 | using BotBone.Core;
4 | using BotBone.Core.Api;
5 | using BotBone.Core.Modules;
6 |
7 | namespace Citrine.Core
8 | {
9 | public class StopCommand : CommandBase
10 | {
11 | public override string Name => "stop";
12 |
13 | public override string Usage => "/stop";
14 |
15 | public override PermissionFlag Permission => PermissionFlag.AdminOnly;
16 |
17 | public override string Description => "シトリンを停止します。";
18 |
19 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
20 | {
21 | if (sender is PostCommandSender s)
22 | await shell.ReplyAsync(s.Post, "またねー。");
23 | Environment.Exit(0);
24 | return null;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Commands/VersionCommand.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 | using System.Threading.Tasks;
3 | using BotBone.Core;
4 | using BotBone.Core.Api;
5 | using BotBone.Core.Modules;
6 |
7 | namespace Citrine.Core
8 | {
9 | public class VersionCommand : CommandBase
10 | {
11 | public override string Name => "version";
12 |
13 | public override string Usage => "/version or /ver or /v";
14 |
15 | public override string[] Aliases { get; } = { "ver", "v" };
16 |
17 | public override string Description => "バージョン情報を取得します。";
18 |
19 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
20 | {
21 | return $"BotBone v{Server.Version} Citrine v{Const.Version}";
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Modules/GreetingModule.command.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq;
3 | using System.Threading.Tasks;
4 | using BotBone.Core;
5 | using BotBone.Core.Api;
6 |
7 | namespace Citrine.Core.Modules
8 | {
9 | public partial class GreetingModule
10 | {
11 | public string Name => "greetings";
12 |
13 | public string[] Aliases => Array.Empty();
14 |
15 | public bool IgnoreCase => false;
16 |
17 | public PermissionFlag Permission => PermissionFlag.AdminOnly;
18 |
19 | public string Usage => "";
20 |
21 | public string Description => "";
22 |
23 | public async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
24 | {
25 | await Task.Delay(0);
26 | return string.Join(", ", patterns.Select(p => p.Regex));
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Commands/WrapWithCommand.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 | using System.Threading.Tasks;
3 | using BotBone.Core;
4 | using BotBone.Core.Api;
5 | using BotBone.Core.Modules;
6 |
7 | namespace Citrine.Core
8 | {
9 | public class WrapWithCommand : CommandBase
10 | {
11 | public override string Name => "wrapwith";
12 |
13 | public override string Usage => "/wrapwith ";
14 |
15 | public override string Description => "指定した文字列で囲まれた文字列を返します。";
16 |
17 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
18 | {
19 | if (args.Length < 2)
20 | throw new CommandException();
21 | body = body[(args[0].Length + 1)..];
22 | return args[0] + body + args[0];
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Commands/RandomModule.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 | using System.Collections.Generic;
3 | using System.Net.Http;
4 | using System.Threading.Tasks;
5 | using BotBone.Core;
6 | using BotBone.Core.Api;
7 | using BotBone.Core.Modules;
8 | using Newtonsoft.Json;
9 |
10 | namespace Citrine.Core
11 | {
12 | public class RandomModule : CommandBase
13 | {
14 | public override string Name => "random";
15 |
16 | public override string Usage => "/random ";
17 |
18 | public override string Description => "指定した引数の中からどれか1つを返します。";
19 |
20 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
21 | {
22 | if (args.Length == 0) throw new CommandException();
23 |
24 | return args.Random();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Commands/UserAgentCommand.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 | using System.Text;
3 | using System.Threading.Tasks;
4 | using BotBone.Core;
5 | using BotBone.Core.Api;
6 | using BotBone.Core.Modules;
7 |
8 | namespace Citrine.Core
9 | {
10 | public class UserAgentCommand : CommandBase
11 | {
12 | public override string Name => "useragent";
13 |
14 | public override string Usage => "/useragent or /ua";
15 |
16 | public override string[] Aliases { get; } = { "ua" };
17 |
18 | public override string Description => "シトリンが使用する HTTP Client のユーザーエージェントを取得します。";
19 |
20 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
21 | {
22 | return Server.Http.DefaultRequestHeaders.UserAgent.ToString();
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Commands/NyaizeCommand.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 | using System;
3 | using System.Threading.Tasks;
4 | using System.Web;
5 | using BotBone.Core;
6 | using BotBone.Core.Api;
7 | using BotBone.Core.Modules;
8 | using Newtonsoft.Json.Linq;
9 |
10 | namespace Citrine.Core
11 | {
12 | public class NyaizeCommand : CommandBase
13 | {
14 | public override string Name => "nyaize";
15 |
16 | public override string Usage => "/nyaize";
17 |
18 | public override string[] Aliases => new []{ "nya" };
19 |
20 | public override string Description => "発言をねこにします。";
21 |
22 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
23 | {
24 | return body.Replace("な", "にゃ").Replace("ナ", "ニャ").Replace("ナ", "ニャ");
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Commands/FujiwaraTatsuyaCommand.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 | using System.Linq;
3 | using System.Threading.Tasks;
4 | using BotBone.Core;
5 | using BotBone.Core.Api;
6 | using BotBone.Core.Modules;
7 |
8 | namespace Citrine.Core
9 | {
10 | public class FujiwaraTatsuyaCommand : CommandBase
11 | {
12 | public override string Name => "fujiwaratatsuya";
13 |
14 | public override string Usage => "/fujiwaratatsuya";
15 |
16 | public override string[] Aliases => new []{ "fujiwara", "fjwr", "fujitatsu" };
17 |
18 | public override string Description => "テ゛キ゛ス゛ト゛を゛返゛す゛だ゛け゛の゛コ゛マ゛ン゛ド゛だ゛ぞ゛。";
19 |
20 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
21 | {
22 | return string.Concat(body.Select(c => c + "゛"));
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Commands/ModuleCommand.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 |
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using BotBone.Core;
6 | using BotBone.Core.Api;
7 | using BotBone.Core.Modules;
8 |
9 | namespace Citrine.Core
10 | {
11 | public class ModuleCommand : CommandBase
12 | {
13 | public override string Name => "modules";
14 |
15 | public override string Usage => "/modules or /mods";
16 |
17 | public override string[] Aliases { get; } = { "mods" };
18 |
19 | public override string Description => "全モジュールを列挙します。";
20 |
21 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
22 | {
23 | var mods = core.Modules.Select(mod => mod.GetType().Name);
24 | return $"モジュール数: {mods.Count()}\n{string.Join(",", mods)}";
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Modules/GoodRoundDetectorModule.cs:
--------------------------------------------------------------------------------
1 | using System.Threading.Tasks;
2 | using BotBone.Core;
3 | using BotBone.Core.Api;
4 | using BotBone.Core.Modules;
5 |
6 | namespace Citrine.Core.Modules
7 | {
8 | ///
9 | /// キリ番ノート検出モジュール
10 | ///
11 | public class GoodRoundDetectorModule : ModuleBase
12 | {
13 | public override async Task OnTimelineAsync(IPost n, IShell shell, Server core)
14 | {
15 | if (core.GetRatingOf(n.User) < Rating.Like) return false;
16 | // 投稿についているユーザー名は完璧では無い
17 | // なのでシェルを用いて完全体を持ってくる
18 | var user = await shell.GetUserAsync(n.User.Id);
19 | if (user == null) return false;
20 |
21 | if (user.PostsCount > 0 && user.PostsCount % 10000 == 0)
22 | {
23 | await shell.SendDirectMessageAsync(user, $"{core.GetNicknameOf(user)},{user.PostsCount}投稿達成おめでとう.");
24 | }
25 |
26 | return false;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Commands/InspectCommand.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 | using System.Linq;
3 | using System.Text;
4 | using System.Threading.Tasks;
5 | using BotBone.Core;
6 | using BotBone.Core.Api;
7 | using BotBone.Core.Modules;
8 |
9 | namespace Citrine.Core
10 | {
11 | public class InspectCommand : CommandBase
12 | {
13 | public override string Name => "inspect";
14 |
15 | public override string Usage => "/inspect [commands]";
16 |
17 | public override string Description => "コマンドの引数をそのまま列挙します。";
18 |
19 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
20 | {
21 | var builder = new StringBuilder();
22 | builder.AppendFormat("[{0}]: ", args.Length);
23 | builder.Append(string.Join(", ", args.Select(a => $"\"{a}\"")));
24 | return builder.ToString();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Modules/OjichatModule.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Net.Http;
4 | using System.Threading.Tasks;
5 | using BotBone.Core;
6 | using BotBone.Core.Api;
7 | using BotBone.Core.Modules;
8 | using Newtonsoft.Json;
9 |
10 | namespace Citrine.Core.Modules
11 | {
12 | public class OjichatModule : ModuleBase
13 | {
14 | public static readonly string StatOjisanedCount = "stat.ojisaned-count";
15 | public override async Task ActivateAsync(IPost n, IShell shell, Server core)
16 | {
17 | if (n.Text is string text && text.IsMatch("おじさんの(真似|まね)"))
18 | {
19 | EconomyModule.Pay(n, shell, core);
20 | await Task.Delay(4000);
21 | core.LikeWithLimited(n.User);
22 | core.Storage[n.User].Add(StatOjisanedCount);
23 | await shell.ReplyAsync(n, await core.ExecCommand("/ojisan " + core.GetNicknameOf(n.User)));
24 | return true;
25 | }
26 | return false;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Commands/WaCommand.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 | using System.Collections.Generic;
3 | using System.Threading.Tasks;
4 | using BotBone.Core;
5 | using BotBone.Core.Api;
6 |
7 | namespace Citrine.Core
8 | {
9 | public class WaCommand : CommandBase
10 | {
11 | public override string Name => "wa";
12 |
13 | public override string Usage => "/wa [amount=15]";
14 |
15 | public override string Description => "#わーーーーーーーーーーーーーーー";
16 |
17 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
18 | {
19 | var amount = args.Length < 1 ? 15 : int.Parse(args[0]);
20 |
21 | return string.Concat(Wa(amount));
22 | }
23 |
24 | private IEnumerable Wa(int amount)
25 | {
26 | yield return '#';
27 | yield return 'わ';
28 | for (var i = 0; i < amount; i++)
29 | yield return 'ー';
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Commands/BalloonGenCommand.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 |
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using BotBone.Core;
6 | using BotBone.Core.Api;
7 | using BotBone.Core.Modules;
8 |
9 | namespace Citrine.Core
10 | {
11 | public class BalloonGenCommand : CommandBase
12 | {
13 | public override string Name => "balloongen";
14 |
15 | public override string Usage => "/balloongen <好きな文字列>";
16 |
17 | public override string[] Aliases { get; } = { "balloon-gen", "balloon", "genballoon" };
18 |
19 | public override string Description => "ギザギザ吹き出しを作ります。";
20 |
21 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
22 | {
23 | body = " " + body + " ";
24 | var crown = ".\n_" + new string('人', body.Length) + "_\n";
25 | var pate = ">" + body + "<\n";
26 | var heel = " ̄" + string.Concat(Enumerable.Repeat("Y^", body.Length - 1)) + "Y ̄";
27 | return crown + pate + heel;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Commands/DebugCommand.cs:
--------------------------------------------------------------------------------
1 | #pragma warning disable CS1998 // 非同期メソッドは、'await' 演算子がないため、同期的に実行されます
2 |
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using BotBone.Core;
6 | using BotBone.Core.Api;
7 | using BotBone.Core.Modules;
8 |
9 | namespace Citrine.Core
10 | {
11 | public class DebugCommand : CommandBase
12 | {
13 | public override string Name => "debug";
14 |
15 | public override string Usage => "/debug";
16 |
17 | public override async Task OnActivatedAsync(ICommandSender sender, Server core, IShell shell, string[] args, string body)
18 | {
19 | if (sender is not PostCommandSender p) return "call from post";
20 |
21 | switch (args[0])
22 | {
23 | case "set":
24 | core.Storage[p.User].Set(args[1], args[2]);
25 | return "success";
26 | case "get":
27 | return (core.Storage[p.User].Get