static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; var Instance = new Slack(); string token=""; bool success ; Instance.OnEvent += Instance_OnEvent; do { if (File.Exists("token.txt")) token = File.ReadAllText("token.txt"); if (String.IsNullOrWhiteSpace(token)) { Console.WriteLine("Please obtain a Token, and paste it below:"); token = Console.ReadLine(); File.WriteAllText("token.txt", token); } success = Instance.Init(token); if (!success) File.WriteAllText("token.txt", ""); } while (!success); Instance.Connect(); while (Instance.Connecting || Instance.Connected) Thread.Sleep(0); Console.WriteLine("===Disconnected==="); Console.ReadKey(); }
private static string SubstituteMarkup(string p, Slack instance) { return Regex.Replace(p, @"<([@#])(.*?)>", (match) => { switch (match.Groups[1].Value) { case "#": var chan = instance.GetChannel(match.Groups[2].Value); if (chan == null) break; return "#" + chan.Name; case "@": var user = instance.GetUser(match.Groups[2].Value); if (user == null) break; return "@" + user.Name; } return match.Groups[0].Value; }); }
public SlackJsonConverter(Slack slack) { // TODO: Complete member initialization this.slack = slack; }
public SlackJsonConverter(Slack slack) { this.slack = slack; }