-
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
27 changed files
with
2,083 additions
and
2,062 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,69 +1,69 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using fs24bot3.Core; | ||
using fs24bot3.Models; | ||
using Serilog; | ||
|
||
namespace fs24bot3.Backend; | ||
|
||
public class Basic : IMessagingClient | ||
{ | ||
public string Name { get; } | ||
public Bot BotContext { get; } | ||
|
||
public Dictionary<string, string> Fmt { get; } | ||
|
||
public Basic() | ||
{ | ||
BotContext = new Bot(this); | ||
Fmt = new Dictionary<string, string>(); | ||
Name = "fs24bot3"; | ||
} | ||
|
||
public void SetupNick(string nickname) { } | ||
public void JoinChannel(string name) | ||
{ | ||
Log.Information("Joining channel: {0}", name); | ||
} | ||
public void PartChannel(string name) | ||
{ | ||
Log.Information("Parting channel: {0}", name); | ||
} | ||
|
||
public async Task SendMessage(string channel, string message) | ||
{ | ||
await Task.Run(() => | ||
{ | ||
Log.Information(message); | ||
}); | ||
} | ||
|
||
public async void Process() | ||
{ | ||
var thread = new Thread(() => | ||
{ | ||
BotContext.ProccessInfinite(); | ||
}); | ||
thread.Start(); | ||
|
||
while (true) | ||
{ | ||
Console.Write("fs24bot3: "); | ||
string value = Console.ReadLine()?.TrimEnd(); | ||
if (!string.IsNullOrWhiteSpace(value)) | ||
{ | ||
var msg = new MessageGeneric(value, "testchannel", | ||
new User("test", BotContext.Connection)); | ||
BotContext.MessageTrigger(msg); | ||
await BotContext.ExecuteCommand(msg, ConfigurationProvider.Config.Prefix); | ||
} | ||
} | ||
} | ||
|
||
public Task<bool> EnsureAuthorization(User user) | ||
{ | ||
return Task.FromResult(true); | ||
} | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using fs24bot3.Core; | ||
using fs24bot3.Models; | ||
using Serilog; | ||
|
||
namespace fs24bot3.Backend; | ||
|
||
public class Basic : IMessagingClient | ||
{ | ||
public string Name { get; } | ||
public Bot BotContext { get; } | ||
|
||
public Dictionary<string, string> Fmt { get; } | ||
|
||
public Basic() | ||
{ | ||
BotContext = new Bot(this); | ||
Fmt = new Dictionary<string, string>(); | ||
Name = "fs24bot3"; | ||
} | ||
|
||
public void SetupNick(string nickname) { } | ||
public void JoinChannel(string name) | ||
{ | ||
Log.Information("Joining channel: {0}", name); | ||
} | ||
public void PartChannel(string name) | ||
{ | ||
Log.Information("Parting channel: {0}", name); | ||
} | ||
|
||
public async Task SendMessage(string channel, string message) | ||
{ | ||
await Task.Run(() => | ||
{ | ||
Log.Information(message); | ||
}); | ||
} | ||
|
||
public async void Process() | ||
{ | ||
var thread = new Thread(() => | ||
{ | ||
BotContext.ProccessInfinite(); | ||
}); | ||
thread.Start(); | ||
|
||
while (true) | ||
{ | ||
Console.Write("fs24bot3: "); | ||
string value = Console.ReadLine()?.TrimEnd(); | ||
if (!string.IsNullOrWhiteSpace(value)) | ||
{ | ||
var msg = new MessageGeneric(value, "testchannel", | ||
new User("test", BotContext.Connection)); | ||
BotContext.MessageTrigger(msg); | ||
await BotContext.ExecuteCommand(msg, ConfigurationProvider.Config.Prefix); | ||
} | ||
} | ||
} | ||
|
||
public Task<bool> EnsureAuthorization(User user) | ||
{ | ||
return Task.FromResult(true); | ||
} | ||
} |
Oops, something went wrong.