-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
57 lines (49 loc) · 1.84 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Botter
{
class Program
{
/// <summary>
/// Logging instance.
/// </summary>
private static readonly ILog Log = LogManager.GetLogger(typeof(Program));
static void Main(string[] args)
{
Console.WriteLine("Botter, a Xat Bot");
Console.WriteLine("-----------------");
Console.WriteLine("Getting chat information...");
// Clear "Getting chat information..." line
Console.SetCursorPosition(2, Console.CursorTop - 1);
ClearCurrentConsoleLine();
try
{
Bot bot = new Bot("Megafire", 1528127568, "39d855a60b5a221eab00", "721253236");
Console.WriteLine(String.Format("Chat Name: {0}", bot.Chat.Name));
Console.WriteLine(String.Format("Chat Id: {0}", bot.Chat.Id));
Console.WriteLine(String.Format("Chat Type: {0}", bot.Chat.Type));
Console.WriteLine(String.Format("Chat Host: {0}", bot.Chat.Server.Host));
Console.WriteLine(String.Format("Chat Port: {0}", bot.Chat.Server.Port));
Console.WriteLine("-----------------");
bot.Chat.Server.Connect();
} catch(Exception ex)
{
Log.Fatal(ex.Message, ex);
}
}
/// <summary>
/// Clear current line.
/// </summary>
public static void ClearCurrentConsoleLine()
{
int currentLineCursor = Console.CursorTop;
Console.SetCursorPosition(0, Console.CursorTop);
Console.Write(new string(' ', Console.WindowWidth));
Console.SetCursorPosition(0, currentLineCursor);
}
}
}