async Task <bool> FilterScreenshots(ChannelFilter filter, SocketUserMessage message) { if (message.Attachments.Count == 0 && !message.Content.Contains(".jpg") && !message.Content.Contains(".png") && !message.Content.Contains(".gif") && !message.Content.Contains(".jpeg")) { if (filter.AlertChannel != 0) { ITextChannel discussion = await(message.Channel as IGuildChannel).Guild.GetChannelAsync(filter.AlertChannel) as ITextChannel; await discussion.SendMessageAsync(message.Author.Mention + " said in " + (message.Channel as ITextChannel).Mention + " : " + message.Content); await ReplyAndDelete(message, $"Hi {message.Author.Mention}! I've copied your message to {discussion.Mention}. If you move the discussion there, we can keep this channel filled with screenshots!", 10); } else { await ReplyAndDelete(message, $"Hi {message.Author.Mention}! Only images are allowed here!", 10); } await message.DeleteAsync(); return(false); } else if (!CheckIfAboveMinimum(message)) { // Joel, I don't know what to put here, edit it pls. await ReplyAndDelete(message, $"Hi {message.Author.Mention}! Make sure your image size is above 640x360!", 10); return(false); } return(true); }
public async Task Add(ITextChannel channel) { TownGuild guild = Database.GetGuild(Context.Guild); if (guild == null) { return; } ChannelFilter filter = guild.ChannelFilters.FirstOrDefault(x => x.Channel == channel.Id); if (filter == null) { filter = new ChannelFilter() { Channel = channel.Id }; guild.ChannelFilters.Add(filter); } await ReplyAsync("Editing filter...\n" + $"Please answer the following questions ('{SkipCharacter}' to skip / leave default)"); await AskEnum($"What type of filter? (Heading or Image)", filter.Type, value => filter.Type = value); await AskChannel($"Which channel should rejected content be copied to?", filter.AlertChannel, value => filter.AlertChannel = value); Database.Guilds.Update(guild); await ReplyAsync("Done!"); }
async Task <bool> FilterHeadings(ChannelFilter filter, SocketUserMessage message) { if (!message.Content.StartsWith("```")) { if (filter.AlertChannel != 0) { ITextChannel channel = (message.Channel as ITextChannel); ITextChannel discussion = await channel.Guild.GetChannelAsync(filter.AlertChannel) as ITextChannel; await discussion.SendMessageAsync($@"Hi {message.Author.Mention} - Messages in {channel.Mention} require a heading! To help, I've created a template for you to copy & paste. Be sure to change the placeholder text! If you were simply trying to discuss someone elses message, this is the place to do so. Alternatively react with a :thumbsup: to show your support. ` ```Your Heading``` {message.Content}`"); await ReplyAndDelete(message, $"Hi {message.Author.Mention}! Your message needs a heading! Let me help you out in {discussion.Mention}.", 10); } else { await ReplyAndDelete(message, $"Hi {message.Author.Mention}! Your message needs a heading! (Starting with \\```<Your heading>>>```)", 10); } await message.DeleteAsync(); return(false); } return(true); }
static void Main2(string[] args) { // Process all Console.WriteLine(VCRProfiles.GetSources("Nexus").Count()); Console.WriteLine(VCRProfiles.GetSources("Nexus2").Count()); // Create the filter ChannelFilter filter = new ChannelFilter { Profile = "Nexus", ServiceType = FilterServiceTypes.Radio, Encryption = FilterEncryptionTypes.Free, Name = "^[AB]", NameMatching = FilterNameMatching.RegularExpression }; // Process foreach (Channel channel in VCRProfiles.GetSources(filter).ToChannels().OrderBy(c => c.UniqueName)) { Console.WriteLine("{0} {1} {2} {3}", channel.UniqueName, channel.Station, channel.Source.DisplayName, channel.Source.SelectionKey); } // Done Console.ReadLine(); }
public void UpdateImage() { var texture = _view.SelectedTexture; if (texture != null) { var image = texture.Decode(_view.SelectedMipMap); if (_view.SelectedImageChannel != ImageChannel.All) { var channelFilter = new ChannelFilter(_view.SelectedImageChannel); channelFilter.Apply(image); } _view.PreviewImage = image; } }
async Task Handle(SocketMessage socketMessage) { if (!(socketMessage is SocketUserMessage message && message.Channel is ITextChannel channel) || message.Author.Id == discord.CurrentUser.Id) { return; } TownGuild guild = database.GetGuild(channel.Guild); if (guild == null) { return; } ChannelFilter filter = guild.ChannelFilters.FirstOrDefault(x => x.Channel == channel.Id); if (filter == null) { return; } try { switch (filter.Type) { case ChannelFilter.FilterType.Heading: await FilterHeadings(filter, message); break; case ChannelFilter.FilterType.Image: await FilterScreenshots(filter, message); break; } } catch (Exception e) { Console.WriteLine(e.StackTrace); } }
/// <summary> /// /// </summary> /// <returns></returns> public Page <Channel> Get(int pindex, int psize, ChannelFilter filter) { Page <Channel> result = new Page <Channel>(); result.PageIndex = pindex; result.PageSize = psize; string query = @" SELECT DISTINCT [Channel].* FROM [Channel] WHERE [Channel].[ChannelType] = @ChannelType OR @ChannelType IS NULL ORDER BY [Channel].[Name] ASC OFFSET @Psize * @Pindex ROWS FETCH NEXT @Psize ROWS ONLY;"; string qcount = @" SELECT COUNT([Channel].Id) FROM [Channel] WHERE [Channel].[ChannelType] = @ChannelType OR @ChannelType IS NULL;"; var count = base.Context.ExecuteScalar(qcount, new { pindex, psize, filter.ChannelType }); result.Total = Convert.ToInt32(count); result.Result = this.Context.Query <Channel>(query, new { pindex, psize, filter.ChannelType }); return(result); }
private void Window_Loaded(object sender, RoutedEventArgs e) { string path = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\RIFT\\"; string logFilename = "log.txt"; if (!File.Exists(path + logFilename)) { OpenFileDialog oFD = new OpenFileDialog(); oFD.DefaultExt = ".txt"; oFD.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*"; Nullable <bool> result = oFD.ShowDialog(); if (result == true) { fullPath = oFD.FileName; } } else { fullPath = path + logFilename; } this.reader = new Reader(fullPath, sc, lEval); Filter channelFilter = new ChannelFilter(); lEval.registerFilter(channelFilter); Filter numberOfPlayersFilter = new AnalyticsNumberOfPlayersFilter("analytics", 0); lEval.registerFilter(numberOfPlayersFilter); dispatcherTimer1.Start(); dispatcherTimer2.Start(); dispatcherTimer3.Start(); dispatcherTimer4.Start(); }
public async Task Delete(ITextChannel channel) { TownGuild guild = Database.GetGuild(Context.Guild); if (guild == null) { return; } ChannelFilter filter = guild.ChannelFilters.FirstOrDefault(x => x.Channel == channel.Id); if (filter == null) { await ReplyAsync("Filter not found for " + channel.Mention); } else { await ReplyAsync("Deleted filter for " + channel.Mention); guild.ChannelFilters.Remove(filter); Database.Guilds.Update(guild); } }
public void SetParams(FilterCutOffFrequencies cutoff, FilterGain filter_gain, PGA_GainsEnum pga_gain) { ChannelFilter.SetCutOffFrequencyAndGain(_channelName, cutoff, filter_gain); ChannelPGA.SetAmplification(pga_gain); CommonLatch.PulseLatchForChannel(_channelName); }
static void Main2( string[] args ) { // Process all Console.WriteLine( VCRProfiles.GetSources( "Nexus" ).Count() ); Console.WriteLine( VCRProfiles.GetSources( "Nexus2" ).Count() ); // Create the filter ChannelFilter filter = new ChannelFilter { Profile = "Nexus", ServiceType = FilterServiceTypes.Radio, Encryption = FilterEncryptionTypes.Free, Name = "^[AB]", NameMatching = FilterNameMatching.RegularExpression }; // Process foreach (Channel channel in VCRProfiles.GetSources( filter ).ToChannels().OrderBy( c => c.UniqueName )) Console.WriteLine( "{0} {1} {2} {3}", channel.UniqueName, channel.Station, channel.Source.DisplayName, channel.Source.SelectionKey ); // Done Console.ReadLine(); }
public Page <Channel> Get(int pindex, int psize, [FromQuery] ChannelFilter filter) { return(this.svc.Get(pindex, psize, filter)); }
/// <summary> /// /// </summary> /// <param name="IdMediaType"></param> /// <returns></returns> public Page <Channel> Get(int pindex, int psize, ChannelFilter filter) { return(this.repo.Get(pindex, psize, filter)); }