Suppression Challonge in Db.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -19,7 +20,6 @@ namespace LaDOSE.DiscordBot.Command
|
|||||||
{
|
{
|
||||||
dep = d;
|
dep = d;
|
||||||
rnd = new Random(DateTime.Now.Millisecond);
|
rnd = new Random(DateTime.Now.Millisecond);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Command("twitch")]
|
[Command("twitch")]
|
||||||
@@ -28,8 +28,29 @@ namespace LaDOSE.DiscordBot.Command
|
|||||||
await ctx.RespondAsync("https://www.twitch.tv/LaDOSETV");
|
await ctx.RespondAsync("https://www.twitch.tv/LaDOSETV");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[Command("roll")]
|
||||||
|
public async Task RollAsync(CommandContext ctx, string command = "")
|
||||||
|
{
|
||||||
|
int next = 6;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(command))
|
||||||
|
{
|
||||||
|
if(!int.TryParse(command, System.Globalization.NumberStyles.Integer, CultureInfo.InvariantCulture, out next))
|
||||||
|
{
|
||||||
|
await ctx.RespondAsync("Stupid");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await ctx.RespondAsync(rnd.Next(1,next+1).ToString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region Cards Against Humanity
|
||||||
[Command("cards")]
|
[Command("cards")]
|
||||||
public async Task CardssAsync(CommandContext ctx)
|
public async Task CardsAsync(CommandContext ctx)
|
||||||
{
|
{
|
||||||
if (Questions == null)
|
if (Questions == null)
|
||||||
LoadCards();
|
LoadCards();
|
||||||
@@ -38,18 +59,12 @@ namespace LaDOSE.DiscordBot.Command
|
|||||||
var q = Questions[rnd.Next(Questions.Count - 1)];
|
var q = Questions[rnd.Next(Questions.Count - 1)];
|
||||||
|
|
||||||
var s = q.Split('_', StringSplitOptions.RemoveEmptyEntries);
|
var s = q.Split('_', StringSplitOptions.RemoveEmptyEntries);
|
||||||
for(int i = 0; i< s.Length; i++)
|
for (int i = 0; i < s.Length - 1; i++)
|
||||||
{
|
{
|
||||||
if (i < s.Length-1)
|
response += s[i] + Answers[rnd.Next(Answers.Count - 1)];
|
||||||
{
|
|
||||||
response += s[i] + Answers[rnd.Next(Answers.Count - 1)];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
response += s[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
response += s[s.Length-1];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
await ctx.RespondAsync(response);
|
await ctx.RespondAsync(response);
|
||||||
@@ -69,24 +84,27 @@ namespace LaDOSE.DiscordBot.Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
#region Quotes
|
||||||
[Command("Quote")]
|
[Command("Quote")]
|
||||||
public async Task QuotesAsync(CommandContext ctx)
|
public async Task QuotesAsync(CommandContext ctx)
|
||||||
{
|
{
|
||||||
if (Quotes == null)
|
if (Quotes == null)
|
||||||
LoadQuote();
|
LoadQuote();
|
||||||
|
|
||||||
await ctx.RespondAsync("```"+ Quotes[rnd.Next(Quotes.Count-1)] + "```");
|
await ctx.RespondAsync("```" + Quotes[rnd.Next(Quotes.Count - 1)] + "```");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void LoadQuote()
|
private void LoadQuote()
|
||||||
{
|
{
|
||||||
Quotes = new List<string>();
|
Quotes = new List<string>();
|
||||||
string[] fileQuotes = File.ReadAllLines("quotes.txt");
|
string[] fileQuotes = File.ReadAllLines("quotes.txt");
|
||||||
string currentQuote = string.Empty;
|
string currentQuote = string.Empty;
|
||||||
for(int i = 0; i < fileQuotes.Length; i++)
|
for (int i = 0; i < fileQuotes.Length; i++)
|
||||||
{
|
{
|
||||||
if(String.IsNullOrEmpty(fileQuotes[i]))
|
if (String.IsNullOrEmpty(fileQuotes[i]))
|
||||||
{
|
{
|
||||||
Quotes.Add(currentQuote);
|
Quotes.Add(currentQuote);
|
||||||
currentQuote = string.Empty;
|
currentQuote = string.Empty;
|
||||||
@@ -96,5 +114,6 @@ namespace LaDOSE.DiscordBot.Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
namespace LaDOSE.Entity.Challonge
|
namespace LaDOSE.Entity.Challonge
|
||||||
{
|
{
|
||||||
public class ChallongeParticipent : Context.Entity
|
public class ChallongeParticipent
|
||||||
|
|
||||||
{
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
public ChallongeTournament ChallongeTournament { get; set; }
|
public ChallongeTournament ChallongeTournament { get; set; }
|
||||||
public int ChallongeTournamentId { get; set; }
|
public int ChallongeTournamentId { get; set; }
|
||||||
public int ChallongeId { get; set; }
|
public int ChallongeId { get; set; }
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ using System.Collections.Generic;
|
|||||||
|
|
||||||
namespace LaDOSE.Entity.Challonge
|
namespace LaDOSE.Entity.Challonge
|
||||||
{
|
{
|
||||||
public class ChallongeTournament : Context.Entity
|
public class ChallongeTournament
|
||||||
{
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
public int ChallongeId { get; set; }
|
public int ChallongeId { get; set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public Game Game { get; set; }
|
public Game Game { get; set; }
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ namespace LaDOSE.Entity.Context
|
|||||||
public DbSet<Set> Set { get; set; }
|
public DbSet<Set> Set { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public DbSet<ChallongeParticipent> ChallongeParticipent { get; set; }
|
//public DbSet<ChallongeParticipent> ChallongeParticipent { get; set; }
|
||||||
public DbSet<ChallongeTournament> ChallongeTournament { get; set; }
|
//public DbSet<ChallongeTournament> ChallongeTournament { get; set; }
|
||||||
|
|
||||||
#region BotEvents
|
#region BotEvents
|
||||||
public DbSet<BotEvent.BotEvent> BotEvent { get; set; }
|
public DbSet<BotEvent.BotEvent> BotEvent { get; set; }
|
||||||
@@ -47,7 +47,6 @@ namespace LaDOSE.Entity.Context
|
|||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
modelBuilder.Entity<Event>()
|
modelBuilder.Entity<Event>()
|
||||||
.HasMany(s => s.Tournaments);
|
.HasMany(s => s.Tournaments);
|
||||||
|
|
||||||
@@ -139,12 +138,12 @@ namespace LaDOSE.Entity.Context
|
|||||||
.HasForeignKey(pt => pt.WPUserId);
|
.HasForeignKey(pt => pt.WPUserId);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Challonge
|
//#region Challonge
|
||||||
modelBuilder.Entity<ChallongeParticipent>()
|
//modelBuilder.Entity<ChallongeParticipent>()
|
||||||
.HasOne(pt => pt.ChallongeTournament)
|
// .HasOne(pt => pt.ChallongeTournament)
|
||||||
.WithMany(p => p.Participents)
|
// .WithMany(p => p.Participents)
|
||||||
.HasForeignKey(pt => pt.ChallongeTournamentId);
|
// .HasForeignKey(pt => pt.ChallongeTournamentId);
|
||||||
#endregion
|
//#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user