public KlinikSchedulePickerForm() { InitializeComponent(); dataBaseUtil = new DataBaseUtil(); kliniks = new List <Klinik>(); }
/// <summary> /// Posts a new announcement message /// </summary> /// <param name="embed">Message to post</param> /// <returns>No object or value is returned by this method when it completes.</returns> private async Task PostAnnounce(Discord.Embed embed) { var announceIDKeyValue = await DataBaseUtil.GetKeyValueAsync("AnnounceID"); var announceNameKeyValue = await DataBaseUtil.GetKeyValueAsync("AnnounceName"); AnnounceMessage = await _dataService.AnnouncementChannel.SendMessageAsync("", false, embed) as IUserMessage; await GetAlbum(); //If data exists, just delete it so it can be remade with the new test info. if (announceIDKeyValue != null) { await DataBaseUtil.DeleteKeyValueAsync(announceIDKeyValue); await DataBaseUtil.DeleteKeyValueAsync(announceNameKeyValue); announceNameKeyValue = null; announceIDKeyValue = null; } //Create the text file containing the announce message if (announceIDKeyValue == null) { await DataBaseUtil.AddKeyValueAsync("AnnounceID", $"{AnnounceMessage.Id}"); await DataBaseUtil.AddKeyValueAsync("AnnounceName", CurrentEventInfo[2]); } await _dataService.ChannelLog("Posting Playtest Announcement", $"Posting Playtest for {CurrentEventInfo[2]}"); LastEventInfo = CurrentEventInfo; }
private async void btn_saveJan_Click(object sender, RoutedEventArgs e) { DataBaseUtil.getSingleton().updateJanCode(janBindButton.getDbCol(), this.tbx_restJan.Text); MessageDialog dialog = new MessageDialog("保存しました!"); dialog.ShowAsync(); }
public async Task Announce() { //Attempt to get Keys from DB var announceNameKeyValue = await DataBaseUtil.GetKeyValueAsync("AnnounceName"); var announceIDKeyValue = await DataBaseUtil.GetKeyValueAsync("AnnounceID"); //First program run and a previous announce exists. if (_firstRun && announceIDKeyValue != null) { _firstRun = false; await LaunchSuppress(); GetPreviousAnnounceAsync(announceIDKeyValue, announceNameKeyValue); } _caltick++; if (_dataService.CalUpdateTicks < _caltick) { _caltick = 0; CurrentEventInfo = EventCalendarService.GetEvents(); if (AnnounceMessage == null) //No current message. { await PostAnnounce(await FormatPlaytestInformationAsync(CurrentEventInfo, false)); } else if (CurrentEventInfo[2] == LastEventInfo[2]) //Title is same. { await UpdateAnnounce(await FormatPlaytestInformationAsync(CurrentEventInfo, false)); } else //Title is different, scrub and rebuild { await RebuildAnnounce(); } } }
public static void AddModelsFromFolderM(List <string> modelsPaths) { try{ foreach (string modelPath in modelsPaths) { SldWorks swApp = Activator.CreateInstance(Type.GetTypeFromProgID("SldWorks.Application")) as SldWorks; swApp.Visible = false; swApp.OpenDocSilent(modelPath, (int)swDocumentTypes_e.swDocPART, ref fileerror); ModelDoc2 swModel; swModel = swApp.ActiveDoc; if (swModel != null) { swModel.Visible = false; } double[] modelXYZ = SolidWorksUtil.GetModelXYZ((PartDoc)swModel); DataBaseUtil.AddModelToDataBase(swModel.GetTitle(), Convert.ToSingle(modelXYZ[0]), Convert.ToSingle(modelXYZ[1]), Convert.ToSingle(modelXYZ[2]), AddModelsFromFolder.privateModelCheckBox.Checked, Utils.ModelToBytes(swModel)); swApp.CloseDoc(swModel.GetTitle()); } } catch (Exception e) { MessageBox.Show(e.Message, "addModelsFromFolder()", MessageBoxButtons.OK); return; } MessageBox.Show("Models were added!", "Search 3D Modelsz", MessageBoxButtons.OK); }
/// <summary> /// Tells users how to pack custom content. /// </summary> /// <param name="message"></param> /// <returns></returns> private async Task HowToPack(SocketMessage message) { var authBuilder = new EmbedAuthorBuilder() { Name = $"Hey there {message.Author.Username}!", IconUrl = message.Author.GetAvatarUrl(), }; var builder = new EmbedBuilder() { Author = authBuilder, Title = $"Click here to learn how to use VIDE!", Url = "https://www.tophattwaffle.com/packing-custom-content-using-vide-in-steampipe/", ThumbnailUrl = "https://content.tophattwaffle.com/BotHATTwaffle/vide.png", Color = new Color(243, 128, 72), Description = $"I noticed you may be looking for information on how to pack custom content into your level. " + $"This is easily done using VIDE. Click the link above to download VIDE and learn how to use it." }; await message.Channel.SendMessageAsync("", false, builder); await DataBaseUtil.AddShitpostAsync("HowToPack", message); }
public KlinikPickerForm() { InitializeComponent(); klinikServices = new KlinikServices(); dataBaseUtil = new DataBaseUtil(); kliniks = new List <Klinik>(); }
/// <summary> /// Nags users to not use pakrat. /// </summary> /// <param name="message"></param> /// <returns></returns> private async Task PakRat(SocketMessage message) { var authBuilder = new EmbedAuthorBuilder() { Name = $"Hey there {message.Author.Username}!", IconUrl = message.Author.GetAvatarUrl(), }; var builder = new EmbedBuilder() { Author = authBuilder, Title = $"Click here to learn how to use VIDE!", Url = "https://www.tophattwaffle.com/packing-custom-content-using-vide-in-steampipe/", ThumbnailUrl = "https://www.tophattwaffle.com/wp-content/uploads/2013/11/vide.png", Color = new Color(243, 128, 72), Description = "I was minding my own business when I heard you mention something about PakRat. " + "Don't know if you know this, but PakRat is super old and has been know to cause issues in newer games. " + "There is a newer program that handles packing better called VIDE. You should check that out instead." }; await message.Channel.SendMessageAsync("", false, builder); await DataBaseUtil.AddShitpostAsync("PakRat", message); }
/// <summary> /// No. /// </summary> /// <param name="message"></param> /// <returns></returns> private async Task VB(SocketMessage message) { await message.DeleteAsync(); //Delete their message about shit game var authBuilder = new EmbedAuthorBuilder() { Name = $"Hey there {message.Author.Username}!", IconUrl = message.Author.GetAvatarUrl(), }; var builder = new EmbedBuilder() { Author = authBuilder, Title = $"Please no...", //ThumbnailUrl = "https://www.tophattwaffle.com/wp-content/uploads/2017/11/1024_png-300x300.png", Color = new Color(243, 128, 72), Description = $"I saw you posted about Velocity Brawl. How about we do not do that." }; await message.Channel.SendMessageAsync("", false, builder); await DataBaseUtil.AddShitpostAsync("VB", message); }
private void yesButton_Click(object sender, EventArgs e) { numOfAnswers++; if (numOfAnswers == 1) { q1 = lastAnsweredQuestion; } else { if (numOfAnswers == 2) { q2 = lastAnsweredQuestion; } } if (numOfAnswers == 2) { if (DataBaseUtil.LoadAnswerByTwoQuestions(q1, q2) == null) { addForm = new AddForm(this, numOfAnswers, q1, q2); addForm.Show(); this.Hide(); MessageBox.Show("Добавьте ответ"); } else { MessageBox.Show("У вас: " + DataBaseUtil.LoadAnswerByTwoQuestions(q1, q2).Answer); restart(); } } else { play(); } }
public async Task MuteAsync( [Summary("The user to mute.")] SocketGuildUser user, [Summary("The duration, in minutes, of the mute.")] [RequireBoundaries(1, 43200)] int duration = 5, [Summary("The reason for the mute.")][Remainder] string reason = "No reason provided.") { if (user.Roles.Contains(_data.ModRole)) { await Context.Channel.SendMessageAsync(string.Empty, embed : new EmbedBuilder().WithAuthor("Mods don't mute other Mods...") .WithDescription("Now you 2 need to learn to play nice and get along.")); return; } if (await _mute.MuteAsync(user, (SocketGuildUser)Context.User, duration == 0 ? default(int?) : duration, reason)) { await Context.Channel.SendMessageAsync($"Successfully muted {user}."); } else { await Context.Channel.SendMessageAsync($"{user} is already muted!"); } await DataBaseUtil.AddCommandAsync("Mute", Context); }
public async Task TanookiFactAsync() { var tanookiFact = "Did you know Tanooki has a big bushy tail?"; // Gets a fact from the file. if (File.Exists(_dataService.TanookiFactPath)) { string[] allLines = File.ReadAllLines(_dataService.TanookiFactPath); int lineNumber = _random.Next(0, allLines.Length); tanookiFact = allLines[lineNumber]; } var embed = new EmbedBuilder { ThumbnailUrl = _dataService.GetRandomImgFromUrl("https://content.tophattwaffle.com/BotHATTwaffle/tanookifacts/"), Color = new Color(230, 235, 240), Description = tanookiFact }; embed.WithAuthor("TANOOKI FACTS!", Context.Message.Author.GetAvatarUrl()); embed.WithFooter("This was Tanooki facts; you cannot unsubscribe."); await _dataService.ChannelLog($"{Context.Message.Author.Username.ToUpper()} JUST GOT HIT WITH A TANOOKI FACT"); await ReplyAsync(string.Empty, false, embed.Build()); await DataBaseUtil.AddCommandAsync("TanookiFact", Context); }
/// <summary> /// Suggests WWMT over Propper /// </summary> /// <param name="message"></param> /// <returns></returns> private async Task Propper(SocketMessage message) { var authBuilder = new EmbedAuthorBuilder() { Name = $"Hey there {message.Author.Username}!", IconUrl = message.Author.GetAvatarUrl(), }; var builder = new EmbedBuilder() { Author = authBuilder, Title = $"Click here to go to the WallWorm site!", Url = "https://dev.wallworm.com/", ThumbnailUrl = "https://www.tophattwaffle.com/wp-content/uploads/2017/12/worm_logo.png", Color = new Color(243, 128, 72), Description = $"I saw you were asking about propper. While Propper still works, it's advised to learn " + $"a better modeling solution. The preferred method for Source Engine is using 3dsmax with WallWorm Model Tools" + $" If you don't want to learn 3dsmax and WWMT, you can learn to configure propper at the link below.: " + $"\n\nhttps://www.tophattwaffle.com/configuring-propper-for-steampipe/" }; await message.Channel.SendMessageAsync("", false, builder); await DataBaseUtil.AddShitpostAsync("Propper", message); }
public async Task CatFactAsync() { var catFact = "Did you know cats have big bushy tails?"; var name = "Cat Fact 0"; // Gets a fact from the file. if (File.Exists(_dataService.CatFactPath)) { string[] allLines = File.ReadAllLines(_dataService.CatFactPath); int lineNumber = _random.Next(0, allLines.Length); catFact = allLines[lineNumber]; // Splits the name and the fact in the selected line. Match match = Regex.Match(catFact, @"^\w+ Fact \d*", RegexOptions.IgnoreCase); name = match.Value; catFact = catFact.Substring(match.Length).Trim(); } var embed = new EmbedBuilder { ThumbnailUrl = _dataService.GetRandomImgFromUrl("https://content.tophattwaffle.com/BotHATTwaffle/catfacts/"), Color = new Color(230, 235, 240) }; embed.WithAuthor("CAT FACTS!", Context.Message.Author.GetAvatarUrl()); embed.WithFooter("This was cat facts, you cannot unsubscribe."); embed.AddField(name, catFact); await _dataService.ChannelLog($"{Context.Message.Author.Username.ToUpper()} JUST GOT HIT WITH A CAT FACT"); await ReplyAsync(string.Empty, false, embed.Build()); await DataBaseUtil.AddCommandAsync("CatFact", Context); }
public static void Main(string[] args) { if (!DataBaseUtil.OnlyExecStartStop(args, p => Console.WriteLine(p))) { BuildWebHost(args).Run(); } }
public async Task <ActionResult> Login(DBtestUser objEntity) { Session["IS_ADMIN"] = null; Session["UId"] = 0; if (ModelState.IsValid) { objEntity.FirstName = objEntity.FirstName.Trim(); objEntity.Password = objEntity.Password.Trim(); var login = await DataBaseUtil.validateLogIn(objEntity.FirstName, objEntity.Password); if (login.Equals("valid")) { Session["IS_ADMIN"] = objEntity.FirstName; //var appt = await DataBaseUtil.GetUser(objEntity.Id); //if (appt.Designation == "Admin") //{ // Session["IS_ADMIN"] = "true"; //} //else //{ // Session["IS_ADMIN"] = "false"; //} //Session["UId"] = appt.Id; return(RedirectToAction("Index")); } } else { ViewData["message"] = "Invalid User ID/Password"; } return(View(objEntity)); }
/// <summary> /// Gets all the servers that exist in the servers JSON file /// and gives you an embed that lets you visualize their information. /// </summary> /// <returns>Embed object with server information</returns> public async Task <Discord.Embed> GetAllServers() { var authBuilder = new EmbedAuthorBuilder() { Name = $"Server List", IconUrl = "https://www.tophattwaffle.com/wp-content/uploads/2017/11/1024_png-300x300.png", }; Server[] servers = await DataBaseUtil.GetServersAsync(); List <EmbedFieldBuilder> fieldBuilder = new List <EmbedFieldBuilder>(); foreach (var s in servers) { fieldBuilder.Add(new EmbedFieldBuilder { Name = $"{s.address}", Value = $"Prefix: `{s.name}`\n{s.description}", IsInline = false }); } var builder = new EmbedBuilder() { Fields = fieldBuilder, Author = authBuilder, Color = new Color(243, 128, 72), Description = $"" }; return(builder); }
public async Task HelpAsync() { // Deletes the invoking message if it's not a direct message. if (!Context.IsPrivate) { await Context.Message.DeleteAsync(); } var embed = new EmbedBuilder { Color = new Color(47, 111, 146), Title = "\u2753 Command Help", Description = $"A command can be invoked by prefixing its name with `{Program.COMMAND_PREFIX}`. To see usage " + $"details for a command, use `{Program.COMMAND_PREFIX}help [command]`.\n\nThe following is a " + "list of available commands:" }; // Sorts modules alphabetically and adds a field for each one. foreach (ModuleInfo module in _commands.Modules.OrderBy(m => m.Name)) { _help.AddModuleField(module, ref embed); } // Replies normally if a direct message fails. try { await Context.User.SendMessageAsync(string.Empty, false, embed.Build()); } catch { await ReplyAsync(string.Empty, false, embed.Build()); } await DataBaseUtil.AddCommandAsync("Help", Context); }
public async Task AnnounceAsync( [Summary("A format string or the input for the interactive builder's current prompt.")][Remainder] string input = null) { await Context.Message.DeleteAsync(); if (input != null) { // Builds the embed from a supplied formatting string. var builder = new QuickBuilder(Context); Embed embed = builder.Build(input); if (!string.IsNullOrWhiteSpace(builder.Errors)) { await ReplyAndDeleteAsync($"```{builder.Errors}```", timeout : TimeSpan.FromSeconds(15)); } if (embed == null) { return; // Builder was cancelled. } await SendEmbedAsync(embed, await builder.ParseChannels()); } else { // No formatting string given; interactively builds the embed by prompting the user. var builder = new InteractiveBuilder(Context, Interactive); Embed embed = await builder.BuildAsync(); if (embed == null) { return; // Builder was cancelled or timed out. } await SendEmbedAsync(embed, await builder.PromptDestinationAsync(Context)); } // Helper function the send the embed to all given channels. async Task SendEmbedAsync(Embed embed, IReadOnlyCollection <SocketTextChannel> channels) { if (!channels.Any()) { await ReplyAndDeleteAsync("```No channel mentions were found.```", timeout : TimeSpan.FromSeconds(15)); return; } foreach (SocketTextChannel channel in channels) { await channel.SendMessageAsync(string.Empty, false, embed); } await _data.ChannelLog( $"Embed created by {Context.User} was sent to {string.Join(", ", channels.Select(c => c.Name))}."); await _data.LogChannel.SendMessageAsync(string.Empty, false, embed); } await DataBaseUtil.AddCommandAsync("Announce", Context); }
public IntroPage() { InitializeComponent(); dataBaseUtil = new DataBaseUtil(); App.IsUserLoggedIn = false; Preferences.Clear(); ResetDataRegis(); }
public MovieListItem[] SerchMoviesByTerm(string term) { var parameters = new[] { new SqlParameter("@Term", term) }; return(DataBaseUtil.Execute("GetFullMovieByTerm", parameters, _movieListItemMappingFunc).ToArray()); }
public async Task StatsAsync( [Summary("The user for which to retrieve statistics. If no user is specified, the invoking user is used.")] SocketUser user = null) { user = user ?? Context.User; CommandUse[] commands = await DataBaseUtil.GetCommandsAsync(user.Id); Shitpost[] shitposts = await DataBaseUtil.GetShitpostsAsync(user.Id); Mute[] mutes = await DataBaseUtil.GetMutesAsync(user.Id); EmbedBuilder embed = new EmbedBuilder().WithAuthor($"Stats for {user}", user.GetAvatarUrl()); if (commands.Any()) { string fav = commands.GroupBy(r => r.command).OrderByDescending(g => g.Count()).Select(g => g.Key).First(); int favCount = commands.Count(c => c.command == fav); embed.AddField("Command Usage", $"Total: `{commands.Length}`\nFavorite: `{fav}` ({favCount})"); } if (shitposts.Any()) { string fav = shitposts.GroupBy(r => r.shitpost).OrderByDescending(g => g.Count()).Select(g => g.Key).First(); int favCount = shitposts.Count(c => c.shitpost == fav); embed.AddField("Shitpost Usage", $"Total: `{shitposts.Length}`\nFavorite: `{fav}` ({favCount})"); } if (mutes.Any()) { Mute mute = mutes.First(); string value = $"Total: {mutes.Length}\nTimestamp: `{mute.Timestamp:yyyy-MM-ddTHH:mm:ssZ}`\nDuration: `"; if (mute.Duration.HasValue) { value += mute.Duration + (mute.Duration == 1 ? "` minute" : "` minutes"); } else { value += "indefinite`"; } if (mute.Reason != null) { value += $"\nReason: `{mute.Reason}`"; } embed.AddField("Latest Mute Information", value); } await ReplyAsync(string.Empty, embed : embed.Build()); await DataBaseUtil.AddCommandAsync("Stats", Context); }
public void restart() { questions.Clear(); questions = DataBaseUtil.LoadQuestions(); q1 = null; q2 = null; lastAnsweredQuestion = null; numOfAnswers = 0; play(); }
public async Task ActiveAsync([Summary("User to give role to")] SocketGuildUser user) { await _data.ChannelLog($"{user} has been given {_data.ActiveRole.Mention} by {Context.User}"); await ReplyAsync($"{user.Mention} has been given {_data.ActiveRole.Mention}!\n\nThanks for being an active member in our community!"); await((IGuildUser)user).AddRoleAsync(_data.ActiveRole); await DataBaseUtil.AddCommandAsync("Active", Context); }
private void btn_staff_PointerPressed(object sender, PointerRoutedEventArgs e) { if (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse) { var properties = e.GetCurrentPoint(this).Properties; if (properties.IsRightButtonPressed) { showJanCodeMessage(DataBaseUtil.getSingleton().queryJanFromDB(BarcodeDBSchema.BarcodeTable.Cols.STAFF), this.btn_staff, BarcodeDBSchema.BarcodeTable.Cols.STAFF); } } }
private void btn_testNine_PointerPressed(object sender, PointerRoutedEventArgs e) { if (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse) { var properties = e.GetCurrentPoint(this).Properties; if (properties.IsRightButtonPressed) { showPrePaidCardMessage(DataBaseUtil.getSingleton().queryJanFromDB(BarcodeDBSchema.BarcodeTable.Cols.TESTNINE), "9999"); } } }
public async Task PingAsync() { var builder = new EmbedBuilder { Color = new Color(47, 111, 146), Description = $"*Do you like waffles?*\nIt took me **{_client.Latency} ms** to reach the Discord API." }; await ReplyAsync(string.Empty, false, builder.Build()); await DataBaseUtil.AddCommandAsync("Ping", Context); }
public async Task TanookiLookAsync() { var embed = new EmbedBuilder { ImageUrl = _dataService.GetRandomImgFromUrl("https://content.tophattwaffle.com/BotHATTwaffle/kimjongillookingatthings/"), Color = new Color(138, 43, 226) }; await ReplyAsync(string.Empty, false, embed.Build()); await DataBaseUtil.AddCommandAsync("TanookiIRL", Context); }
public async Task SearchAsync( [Summary("The series in which to search.")] string series, [Summary("The term for which to search in the series.")][Remainder] string term) { IUserMessage wait = await ReplyAsync( $":eyes: Searching for **{term}** in **{series}**. This may take a moment! :eyes:"); bool isPrivate = Context.IsPrivate; List <List <string> > results = await _dataService.Search(series, term, isPrivate); // Peforms a search. await _dataService.ChannelLog($"{Context.User} ran a search", $"Series: {series}\nSearch Term: {term}"); // Notifies the user of a lack of search results. if (!results.Any()) { results.Add( new List <string> { "Try a different search term", "http://tophattwaffle.com/faq", "I could not locate anything for the search term you provided. Please try a different search term.", null }); } foreach (List <string> r in results) { var embed = new EmbedBuilder { Author = new EmbedAuthorBuilder { Name = r[0], IconUrl = _client.Guilds.FirstOrDefault()?.IconUrl }, Title = "Click Here", Url = r[1], ThumbnailUrl = r[3], Color = new Color(243, 128, 72), Description = r[2] }; await ReplyAsync(string.Empty, false, embed.Build()); } if (!isPrivate) { await wait.DeleteAsync(); } await DataBaseUtil.AddCommandAsync("Search", Context); }
/// <summary> /// Initializes the singleton application object. This is the first line of authored code /// executed, and as such is the logical equivalent of main() or WinMain(). /// </summary> public App() { this.InitializeComponent(); this.Suspending += OnSuspending; DataBaseUtil dataBase = DataBaseUtil.getSingleton(); dataBase.createTable(); if (!dataBase.isTableDataExists()) { dataBase.initTable(); } }