-
Notifications
You must be signed in to change notification settings - Fork 0
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
11 changed files
with
127 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,34 @@ | ||
using DXKumaBot.Bot.Lagrange; | ||
using DXKumaBot.Bot.Telegram; | ||
using DXKumaBot.Functions; | ||
using DXKumaBot.Utils; | ||
|
||
namespace DXKumaBot.Bot; | ||
|
||
public sealed class BotInstance | ||
public sealed class BotInstance(Config config) | ||
{ | ||
private readonly QQBot _qqBot = new(); | ||
private readonly TgBot _tgBot = new(); | ||
private readonly QqBot _qqBot = new(); | ||
private readonly TgBot _tgBot = new(config.Telegram); | ||
|
||
public static event AsyncEventHandler<MessageReceivedEventArgs> MessageReceived; | ||
public static event AsyncEventHandler<MessageReceivedEventArgs>? MessageReceived; | ||
|
||
public async Task RunAsync() | ||
private static void RegisterFunctions() | ||
{ | ||
await Task.WhenAll(_qqBot.RunAsync(), _tgBot.RunAsync()); | ||
LoveYou loveYou = new(); | ||
loveYou.Register(); | ||
} | ||
|
||
public async Task SendMessageAsync(object message) | ||
private void RegisterEvents() | ||
{ | ||
_qqBot.MessageReceived += MessageReceived; | ||
_tgBot.MessageReceived += MessageReceived; | ||
} | ||
|
||
public async Task RunAsync() | ||
{ | ||
throw new NotImplementedException(); | ||
RegisterFunctions(); | ||
RegisterEvents(); | ||
_tgBot.Run(); | ||
await _qqBot.RunAsync(); | ||
} | ||
} |
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
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
File renamed without changes.
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
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,7 @@ | ||
namespace DXKumaBot; | ||
|
||
public record Config(TelegramConfig Telegram); | ||
|
||
public record TelegramConfig(string BotToken, ProxyConfig Proxy); | ||
|
||
public record ProxyConfig(bool Enabled, string Url); |
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
Oops, something went wrong.