Skip to content

Commit

Permalink
add /restart
Browse files Browse the repository at this point in the history
  • Loading branch information
NecronomiconCoding committed Aug 9, 2016
1 parent 20b653b commit 0757c9a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion PoGo.NecroBot.Logic/Service/TelegramService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using PoGo.NecroBot.Logic.Common;
using PoGo.NecroBot.Logic.Event;
using PoGo.NecroBot.Logic.PoGoUtils;
using POGOProtos.Data;
using POGOProtos.Inventory.Item;
Expand All @@ -33,7 +35,7 @@ public TelegramService(string apiKey, ISession session)
bot.OnMessage += OnTelegramMessageReceived;
bot.StartReceiving();

Logger.Write("Using TelegramAPI with " + me.Username);
this.session.EventDispatcher.Send(new NoticeEvent {Message = "Using TelegramAPI with " + me.Username});
}

private async void OnTelegramMessageReceived(object sender, MessageEventArgs messageEventArgs)
Expand Down Expand Up @@ -186,6 +188,11 @@ await session.Inventory.GetItemAmountByType(ItemId.ItemTroyDisk)
case "/status":
SendMessage(message.Chat.Id, Console.Title);
break;
case "/restart":
Process.Start(Assembly.GetEntryAssembly().Location);
SendMessage(message.Chat.Id, "Restarted Bot. Closing old Instance... BYE!");
Environment.Exit(-1);
break;
default:
answerTextmessage += session.Translation.GetTranslation(TranslationString.HelpTemplate);
SendMessage(message.Chat.Id, answerTextmessage);
Expand Down

0 comments on commit 0757c9a

Please sign in to comment.