|
4 | 4 |
|
5 | 5 | namespace ConsoleChatbot
|
6 | 6 | {
|
7 |
| - public class ConsoleChatService : IChatService |
| 7 | + public class ConsoleChatService : IChatService |
| 8 | + { |
| 9 | + public string Name => "Console"; |
| 10 | + |
| 11 | + public bool IsAuthenticated => true; |
| 12 | + |
| 13 | + public string BotUserName => "ConsoleBot"; |
| 14 | + |
| 15 | + public event EventHandler<ChatMessageEventArgs> ChatMessage; |
| 16 | + public event EventHandler<ChatUserInfoEventArgs> UserJoined; |
| 17 | + public event EventHandler<ChatUserInfoEventArgs> UserLeft; |
| 18 | + |
| 19 | + public void ConsoleMessageReceived(string message) |
| 20 | + { |
| 21 | + |
| 22 | + ChatMessage.Invoke(this, new ChatMessageEventArgs |
| 23 | + { |
| 24 | + Message = message, |
| 25 | + UserName = "ConsoleUser" |
| 26 | + }); |
| 27 | + |
| 28 | + } |
| 29 | + |
| 30 | + public Task<bool> BanUserAsync(string userName) |
| 31 | + { |
| 32 | + throw new NotImplementedException(); |
| 33 | + } |
| 34 | + |
| 35 | + public Task<bool> SendMessageAsync(string message) |
| 36 | + { |
| 37 | + Console.Out.WriteLine(message); |
| 38 | + return Task.FromResult(true); |
| 39 | + } |
| 40 | + |
| 41 | + public Task<bool> SendWhisperAsync(string userName, string message) |
| 42 | + { |
| 43 | + Console.Out.WriteLine($"<<{userName}>> {message}"); |
| 44 | + return Task.FromResult(true); |
| 45 | + } |
| 46 | + |
| 47 | + public Task<bool> TimeoutUserAsync(string userName, TimeSpan time) |
| 48 | + { |
| 49 | + throw new NotImplementedException(); |
| 50 | + } |
| 51 | + |
| 52 | + public Task<bool> UnbanUserAsync(string userName) |
8 | 53 | {
|
9 |
| - public string Name => "Console"; |
10 |
| - |
11 |
| - public bool IsAuthenticated => true; |
12 |
| - |
13 |
| - public event EventHandler<ChatMessageEventArgs> ChatMessage; |
14 |
| - public event EventHandler<ChatUserInfoEventArgs> UserJoined; |
15 |
| - public event EventHandler<ChatUserInfoEventArgs> UserLeft; |
16 |
| - |
17 |
| - public void ConsoleMessageReceived(string message) { |
18 |
| - |
19 |
| - ChatMessage.Invoke(this, new ChatMessageEventArgs |
20 |
| - { |
21 |
| - Message = message, |
22 |
| - UserName = "ConsoleUser" |
23 |
| - }); |
24 |
| - |
25 |
| - } |
26 |
| - |
27 |
| - public Task<bool> BanUserAsync(string userName) |
28 |
| - { |
29 |
| - throw new NotImplementedException(); |
30 |
| - } |
31 |
| - |
32 |
| - public Task<bool> SendMessageAsync(string message) |
33 |
| - { |
34 |
| - Console.Out.WriteLine(message); |
35 |
| - return Task.FromResult(true); |
36 |
| - } |
37 |
| - |
38 |
| - public Task<bool> SendWhisperAsync(string userName, string message) |
39 |
| - { |
40 |
| - Console.Out.WriteLine($"<<{userName}>> {message}"); |
41 |
| - return Task.FromResult(true); |
42 |
| - } |
43 |
| - |
44 |
| - public Task<bool> TimeoutUserAsync(string userName, TimeSpan time) |
45 |
| - { |
46 |
| - throw new NotImplementedException(); |
47 |
| - } |
48 |
| - |
49 |
| - public Task<bool> UnbanUserAsync(string userName) |
50 |
| - { |
51 |
| - throw new NotImplementedException(); |
52 |
| - } |
| 54 | + throw new NotImplementedException(); |
53 | 55 | }
|
| 56 | + } |
54 | 57 |
|
55 | 58 | }
|
0 commit comments