Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.0.0-dev #50

Open
wants to merge 22 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 6 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@



Theresa3rd-Bot/TheresaBot.GoCqHttp/BotImg/
Theresa3rd-Bot/TheresaBot.MiraiHttpApi/BotImg/

Theresa3rd-Bot/TheresaBot.GoCqHttp/Font/
Theresa3rd-Bot/TheresaBot.MiraiHttpApi/Font/
Theresa-Bot/TheresaBot.GoCqHttp/BotImg/
Theresa-Bot/TheresaBot.MiraiHttpApi/BotImg/
Theresa-Bot/TheresaBot.OneBot11/BotImg/

Theresa-Bot/TheresaBot.GoCqHttp/Font/
Theresa-Bot/TheresaBot.MiraiHttpApi/Font/
Theresa-Bot/TheresaBot.OneBot11/Font/

.config

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using TheresaBot.Main.Common;
using TheresaBot.Main.Helper;
using TheresaBot.Main.Model.Cache;
using TheresaBot.Main.Type;
using TheresaBot.Core.Common;
using TheresaBot.Core.Helper;
using TheresaBot.Core.Model.Cache;
using TheresaBot.Core.Type;

namespace TheresaBot.Main.Cache
namespace TheresaBot.Core.Cache
{
public static class CoolingCache
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using TheresaBot.Main.Command;
using TheresaBot.Main.Exceptions;
using TheresaBot.Main.Game;
using TheresaBot.Main.Relay;
using TheresaBot.Core.Command;
using TheresaBot.Core.Exceptions;
using TheresaBot.Core.Game;
using TheresaBot.Core.Relay;

namespace TheresaBot.Main.Cache
namespace TheresaBot.Core.Cache
{
public static class GameCahce
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using TheresaBot.Main.Mode;
using TheresaBot.Main.Model.Cache;
using TheresaBot.Core.Mode;
using TheresaBot.Core.Model.Cache;

namespace TheresaBot.Main.Cache
namespace TheresaBot.Core.Cache
{
public static class PixivRankingCache
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using TheresaBot.Main.Model.Cache;
using TheresaBot.Core.Model.Cache;

namespace TheresaBot.Main.Cache
namespace TheresaBot.Core.Cache
{
public static class PixivUserProfileCache
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using TheresaBot.Main.Command;
using TheresaBot.Main.Exceptions;
using TheresaBot.Main.Model.Process;
using TheresaBot.Main.Relay;
using TheresaBot.Core.Command;
using TheresaBot.Core.Exceptions;
using TheresaBot.Core.Model.Process;
using TheresaBot.Core.Relay;

namespace TheresaBot.Main.Cache
namespace TheresaBot.Core.Cache
{
public static class ProcessCache
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using TheresaBot.Main.Common;
using TheresaBot.Main.Helper;
using TheresaBot.Main.Model.Cache;
using TheresaBot.Core.Common;
using TheresaBot.Core.Helper;
using TheresaBot.Core.Model.Cache;

namespace TheresaBot.Main.Cache
namespace TheresaBot.Core.Cache
{
public static class RepeatCache
{
Expand Down
70 changes: 70 additions & 0 deletions Theresa-Bot/TheresaBot.Core/Command/BaseCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
using TheresaBot.Core.Helper;
using TheresaBot.Core.Reporter;
using TheresaBot.Core.Session;
using TheresaBot.Core.Type;

namespace TheresaBot.Core.Command
{
public abstract class BaseCommand
{
/// <summary>
/// 协议返回的消息ID
/// </summary>
public abstract long MessageId { get; }
/// <summary>
/// 发送请求的成员ID
/// </summary>
public abstract long MemberId { get; }
/// <summary>
/// 发送请求的成员昵称
/// </summary>
public abstract string MemberName { get; }
/// <summary>
/// 包含前缀的指令和指令内容内容
/// </summary>
public string Instruction { get; init; }
/// <summary>
/// 指令
/// </summary>
public string Command { get; set; }
/// <summary>
/// 指令前缀
/// </summary>
public string Prefix { get; set; }
/// <summary>
/// 第一行消息内容的中参数内容
/// </summary>
public string[] Params { get; init; }
/// <summary>
/// 不包含指令前缀和指令的第一行的内容
/// </summary>
public string KeyWord { get; set; }
/// <summary>
/// 不包含指令前缀和指令的消息内容
/// </summary>
public string Content { get; set; }
/// <summary>
/// 指令类型
/// </summary>
public CommandType CommandType { get; init; }
/// <summary>
///
/// </summary>
public BaseSession Session { get; init; }

public BaseCommand(BaseSession baseSession, CommandType commandType, string message, string instruction, string command, string prefix)
{
this.Prefix = prefix;
this.Command = command;
this.Instruction = instruction;
this.CommandType = commandType;
this.Session = baseSession;
this.Content = message.SplitKeyWord(command);
this.KeyWord = instruction.SplitKeyWord(command);
this.Params = instruction.SplitKeyParams(command);
}

public abstract Task<bool> InvokeAsync(BaseSession session, BaseReporter reporter);

}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using TheresaBot.Main.Datas;
using TheresaBot.Main.Model.Invoker;
using TheresaBot.Main.Reporter;
using TheresaBot.Main.Session;
using TheresaBot.Main.Type;
using TheresaBot.Core.Datas;
using TheresaBot.Core.Model.Invoker;
using TheresaBot.Core.Reporter;
using TheresaBot.Core.Session;
using TheresaBot.Core.Type;

namespace TheresaBot.Main.Command
namespace TheresaBot.Core.Command
{
public abstract class GroupCommand : BaseCommand
{
Expand All @@ -14,13 +14,13 @@ public abstract class GroupCommand : BaseCommand

private CommandHandler<GroupCommand> HandlerInvoker { get; init; }

public GroupCommand(BaseSession baseSession, CommandType commandType, string instruction, string command, string prefix)
: base(baseSession, commandType, instruction, command, prefix)
public GroupCommand(BaseSession baseSession, CommandType commandType, string message, string instruction, string command, string prefix)
: base(baseSession, commandType, message, instruction, command, prefix)
{
}

public GroupCommand(BaseSession baseSession, CommandHandler<GroupCommand> invoker, string instruction, string command, string prefix)
: base(baseSession, invoker.CommandType, instruction, command, prefix)
public GroupCommand(BaseSession baseSession, CommandHandler<GroupCommand> invoker, string message, string instruction, string command, string prefix)
: base(baseSession, invoker.CommandType, message, instruction, command, prefix)
{
this.HandlerInvoker = invoker;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using TheresaBot.Main.Datas;
using TheresaBot.Main.Model.Invoker;
using TheresaBot.Main.Reporter;
using TheresaBot.Main.Session;
using TheresaBot.Core.Datas;
using TheresaBot.Core.Model.Invoker;
using TheresaBot.Core.Reporter;
using TheresaBot.Core.Session;

namespace TheresaBot.Main.Command
namespace TheresaBot.Core.Command
{
public abstract class GroupQuoteCommand : GroupCommand
{
protected CommandHandler<GroupQuoteCommand> HandlerInvoker { get; init; }

public GroupQuoteCommand(BaseSession baseSession, CommandHandler<GroupQuoteCommand> invoker, string instruction, string command, string prefix)
: base(baseSession, invoker.CommandType, instruction, command, prefix)
public GroupQuoteCommand(BaseSession baseSession, CommandHandler<GroupQuoteCommand> invoker, string message, string instruction, string command, string prefix)
: base(baseSession, invoker.CommandType, message, instruction, command, prefix)
{
this.HandlerInvoker = invoker;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using TheresaBot.Main.Datas;
using TheresaBot.Main.Model.Invoker;
using TheresaBot.Main.Reporter;
using TheresaBot.Main.Session;
using TheresaBot.Core.Datas;
using TheresaBot.Core.Model.Invoker;
using TheresaBot.Core.Reporter;
using TheresaBot.Core.Session;

namespace TheresaBot.Main.Command
namespace TheresaBot.Core.Command
{
public abstract class PrivateCommand : BaseCommand
{
private CommandHandler<PrivateCommand> HandlerInvoker { get; init; }

public PrivateCommand(BaseSession baseSession, CommandHandler<PrivateCommand> invoker, string instruction, string command, string prefix)
: base(baseSession, invoker.CommandType, instruction, command, prefix)
public PrivateCommand(BaseSession baseSession, CommandHandler<PrivateCommand> invoker, string message, string instruction, string command, string prefix)
: base(baseSession, invoker.CommandType, message, instruction, command, prefix)
{
this.HandlerInvoker = invoker;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
using TheresaBot.Main.Helper;
using TheresaBot.Main.Model.Bot;
using TheresaBot.Main.Model.Config;
using TheresaBot.Core.Helper;
using TheresaBot.Core.Model.Bot;
using TheresaBot.Core.Model.Config;

namespace TheresaBot.Main.Common
namespace TheresaBot.Core.Common
{
public static class BotConfig
{
public const string BotVersion = "0.11.4";
public const string BotVersion = "1.0.0";
public const string BotHomepage = "https://www.theresa3rd.cn";
public static BotInfos BotInfos = new BotInfos(0, "Bot");
public static List<long> AcceptGroups = new();
Expand All @@ -26,6 +26,7 @@ public static class BotConfig
public static SubscribeConfig SubscribeConfig = new SubscribeConfig();
public static TimingSetuConfig TimingSetuConfig = new TimingSetuConfig();
public static PixivRankingConfig PixivRankingConfig = new PixivRankingConfig();
public static PixivCollectionConfig PixivCollectionConfig = new PixivCollectionConfig();
public static WordCloudConfig WordCloudConfig = new WordCloudConfig();
public static GameConfig GameConfig = new GameConfig();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace TheresaBot.Main.Common
namespace TheresaBot.Core.Common
{
public static class DataPath
{
Expand Down
Loading