More refactor, more extension methods.
Preparing to ditch this project... I just want to reimplement image searches and then i will probably stop working on this project.
This commit is contained in:
		| @@ -34,6 +34,7 @@ namespace NadekoBot | ||||
|         /// <returns></returns> | ||||
|         public static async Task<Message> Send(this CommandEventArgs e, string message)  | ||||
|             => await NadekoBot.client.SendMessage(e.Channel, message); | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Sends a message to the channel from which MessageEventArg came. | ||||
|         /// </summary> | ||||
| @@ -45,16 +46,55 @@ namespace NadekoBot | ||||
|             await NadekoBot.client.SendMessage(e.Channel, message); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Sends a message to this channel. | ||||
|         /// </summary> | ||||
|         /// <param name="c"></param> | ||||
|         /// <param name="message"></param> | ||||
|         /// <returns></returns> | ||||
|         public static async Task Send(this Channel c, string message) | ||||
|         { | ||||
|             await NadekoBot.client.SendMessage(c, message); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Sends a private message to this user. | ||||
|         /// </summary> | ||||
|         /// <param name="c"></param> | ||||
|         /// <param name="message"></param> | ||||
|         /// <returns></returns> | ||||
|         public static async Task Send(this User u, string message) | ||||
|         { | ||||
|             await NadekoBot.client.SendMessage(u, message); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Replies to a user who invoked this command, message start with that user's mention. | ||||
|         /// </summary> | ||||
|         /// <param name="e"></param> | ||||
|         /// <param name="message"></param> | ||||
|         /// <returns></returns> | ||||
|         public static async Task Reply(this CommandEventArgs e, string message) | ||||
|         { | ||||
|             await NadekoBot.client.SendMessage(e.Channel, e.User.Mention + " " + message); | ||||
|             await e.Send(e.User.Mention + " " + message); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Replies to a user who invoked this command, message start with that user's mention. | ||||
|         /// </summary> | ||||
|         /// <param name="e"></param> | ||||
|         /// <param name="message"></param> | ||||
|         /// <returns></returns> | ||||
|         public static async Task Reply(this MessageEventArgs e, string message) | ||||
|         { | ||||
|             await NadekoBot.client.SendMessage(e.Channel, e.User.Mention + " " + message); | ||||
|             await e.Send(e.User.Mention + " " + message); | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Randomizes element order in a list | ||||
|         /// </summary> | ||||
|         /// <typeparam name="T"></typeparam> | ||||
|         /// <param name="list"></param> | ||||
|         public static void Shuffle<T>(this IList<T> list) | ||||
|         { | ||||
|             RNGCryptoServiceProvider provider = new RNGCryptoServiceProvider(); | ||||
|   | ||||
| @@ -196,7 +196,7 @@ namespace NadekoBot | ||||
|  | ||||
|             if (currentQuestion == null || isQuit) | ||||
|             { | ||||
|                 client.SendMessage(ch, "Trivia bot stopping. :\\\n" + GetLeaderboard()); | ||||
|                 await ch.Send("Trivia bot stopping. :\\\n" + GetLeaderboard()); | ||||
|                 FinishGame(); | ||||
|                 return; | ||||
|             } | ||||
| @@ -205,7 +205,7 @@ namespace NadekoBot | ||||
|             t.Enabled = true; | ||||
|             t.Elapsed += async (s, ev) => { | ||||
|                 active = true; | ||||
|                 await client.SendMessage(ch, currentQuestion.ToString()); | ||||
|                 await ch.Send(currentQuestion.ToString()); | ||||
|                 t.Enabled = false; | ||||
|                 timeout.Enabled = true;//starting countdown of the next question | ||||
|                 stopwatch.Reset(); | ||||
| @@ -215,7 +215,7 @@ namespace NadekoBot | ||||
|         } | ||||
|  | ||||
|         private async void TimeUp() { | ||||
|             await client.SendMessage(client.GetChannel(_channellId), "**Time's up.**\nCorrect answer was: **" + currentQuestion.Answer+"**\n\n*[tq quits trivia][tl shows leaderboard]["+NadekoBot.botMention+" clr clears my messages]*"); | ||||
|             await client.GetChannel(_channellId)?.Send("**Time's up.**\nCorrect answer was: **" + currentQuestion.Answer+"**\n\n*[tq quits trivia][tl shows leaderboard]["+NadekoBot.botMention+" clr clears my messages]*"); | ||||
|             LoadNextRound(); | ||||
|         } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user