Skip to content

Commit

Permalink
idk
Browse files Browse the repository at this point in the history
  • Loading branch information
LaineZ committed Sep 24, 2024
1 parent 8150289 commit 53e35f8
Show file tree
Hide file tree
Showing 27 changed files with 2,083 additions and 2,062 deletions.
136 changes: 68 additions & 68 deletions fs24bot3/Backend/Basic.cs
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);
}
}
Loading

0 comments on commit 53e35f8

Please sign in to comment.