public async Task mKick(string user, [Remainder] string reason) { try { user = user.Substring(2); user = user.Remove(18); var userID = Context.Guild.GetUser(Convert.ToUInt64(user)); Discord.IDMChannel dm = await userID.GetOrCreateDMChannelAsync(); await dm.SendMessageAsync($"You have been kicked from {Context.Guild.Name} with the reason: {reason}"); await dm.CloseAsync(); await userID.KickAsync(reason); await ReplyAsync($"{Context.Message.Author.Mention} has kicked {userID}.\nReaon:\n`{reason}`"); } catch { await ReplyAsync("Couldn't kick user.\nPlease make sure that you have mentioned the user you want to kick."); } }
public static async Task LiveEvent() { System.Threading.Thread.Sleep(5000); while (true) { Shared.ConfigHandler.LoadConfig(); bool IsLive = TwitchBot.Commands.Drops.IsLive(); if (StreamLive != IsLive && UserList.Count != 0) { StreamLive = IsLive; TimeSpan TSPan = (TimeSpan)(DateTime.Now - DateTime.Parse(Shared.ConfigHandler.Config["Notifications"]["LastLive"].ToString())); if (StreamLive && (int)Math.Floor(TSPan.TotalMinutes) >= int.Parse(Shared.ConfigHandler.Config["Notifications"]["MinimumDownTime"].ToString())) { foreach (Newtonsoft.Json.Linq.JToken User in Shared.ConfigHandler.Config["Notifications"]["DiscordUsers"]) { foreach (SocketGuildUser SocUser in UserList) { if (SocUser.Id.ToString() == User.ToString()) { try { Discord.IDMChannel DM = await SocUser.GetOrCreateDMChannelAsync(); await DM.SendMessageAsync(Shared.ConfigHandler.Config["Notifications"]["DiscordMessage"].ToString()); } catch { } break; } } } } } if (IsLive) { Shared.ConfigHandler.Config["Notifications"]["LastLive"] = DateTime.Now.ToString(); Shared.ConfigHandler.SaveConfig(); } System.Threading.Thread.Sleep(60000); } }
public async Task CreateCharacterAsync() { var user = Context.User; Discord.IDMChannel dmChannel = await user.GetOrCreateDMChannelAsync(); // Check to make sure that the user is in a server before telling them "I'm going to DM you" (Since they might already be in a DM w/bot) if (Context.Message.Channel as SocketGuildChannel != null) { await Context.Channel.SendMessageAsync(user.Mention + " " + "I'm going to DM you some instructions on how to create your character!"); } await dmChannel.SendMessageAsync("Okay, the command for creating your character is a little complex, and a bit long.\n\n" + "The create_char command must have at least 5 *arguments*, and at most, 7 (Traits are optional, and you can just have 1 if you want).\n" + "The command treats every word seperated by a space as an *argument*, so be careful if you want to have a name with more than one word. " + "If you want to have a name with a space, wrap in in double quotes ex: \"Randy Smith\"\n\n" + // TODO: implement a config file so I can cleanly put in the prefix, instead of having to type out Services.CommandHandlerService.cmd_prefix "The order of *arguments* go as follows: **Name S.P.E.C.I.A.L. (Skill to Tag #1) (Skill to Tag #2) (Skill to Tag #3) [Trait #1] [Trait #2]**\n" + "Here's an example of the complete command: " + cPre + "createchar Rick XXX2233 Repair Speech Guns ww fe\n" + "The above command would create a character with 10 Strength, 10 Perception, 10 Endurance, 2 Charisma, 2 Intelligence, 3 Agility, and 3 Luck, " + "with the tagged skills Repair, Speech, and Guns, and with the traits Wild Wasteland and Four Eyes.\n\n" + "To get a list of what to write for your S.P.E.C.I.A.L., Skills to Tag, Traits, type " + cPre + "statshelp"); }