Some database stuff.

This commit is contained in:
Kwoth 2016-08-30 03:11:25 +02:00
parent 2be15c921d
commit e6dca827f9
13 changed files with 10 additions and 19 deletions

View File

@ -12,12 +12,10 @@ using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
//todo DB
namespace NadekoBot.Modules.Administration namespace NadekoBot.Modules.Administration
{ {
public partial class Administration public partial class Administration
{ {
[Group] [Group]
public class RepeatCommands public class RepeatCommands
{ {

View File

@ -10,7 +10,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
//todo DB
namespace NadekoBot.Modules.Administration namespace NadekoBot.Modules.Administration
{ {
public partial class Administration public partial class Administration

View File

@ -12,7 +12,6 @@ using NadekoBot.Services.Database.Models;
using System.Linq; using System.Linq;
using NadekoBot.Services.Database; using NadekoBot.Services.Database;
//todo DB
namespace NadekoBot.Modules.ClashOfClans namespace NadekoBot.Modules.ClashOfClans
{ {
[Module(",", AppendSpace = false)] [Module(",", AppendSpace = false)]

View File

@ -12,7 +12,6 @@ using NadekoBot.Services.Database;
using NadekoBot.Services.Database.Models; using NadekoBot.Services.Database.Models;
using System.Collections.Generic; using System.Collections.Generic;
//todo DB
namespace NadekoBot.Modules.Gambling namespace NadekoBot.Modules.Gambling
{ {
[Module("$", AppendSpace = false)] [Module("$", AppendSpace = false)]
@ -92,7 +91,6 @@ namespace NadekoBot.Modules.Gambling
await channel.SendMessageAsync($"{umsg.Author.Mention} successfully sent {amount} {Gambling.CurrencyPluralName}s to {receiver.Mention}!").ConfigureAwait(false); await channel.SendMessageAsync($"{umsg.Author.Mention} successfully sent {amount} {Gambling.CurrencyPluralName}s to {receiver.Mention}!").ConfigureAwait(false);
} }
////todo DB
////todo owner only ////todo owner only
//[LocalizedCommand, LocalizedDescription, LocalizedSummary] //[LocalizedCommand, LocalizedDescription, LocalizedSummary]
//[RequireContext(ContextType.Guild)] //[RequireContext(ContextType.Guild)]
@ -114,7 +112,6 @@ namespace NadekoBot.Modules.Gambling
//} //}
////todo owner only ////todo owner only
////todo DB
//[LocalizedCommand, LocalizedDescription, LocalizedSummary] //[LocalizedCommand, LocalizedDescription, LocalizedSummary]
//[RequireContext(ContextType.Guild)] //[RequireContext(ContextType.Guild)]
//public Task Take(IUserMessage umsg, long amount, [Remainder] IGuildUser user) => //public Task Take(IUserMessage umsg, long amount, [Remainder] IGuildUser user) =>
@ -184,7 +181,6 @@ namespace NadekoBot.Modules.Gambling
await channel.SendMessageAsync(str).ConfigureAwait(false); await channel.SendMessageAsync(str).ConfigureAwait(false);
} }
//todo DB
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
public async Task Leaderboard(IUserMessage umsg) public async Task Leaderboard(IUserMessage umsg)

View File

@ -12,8 +12,7 @@
//using System.Threading; //using System.Threading;
//using System.Threading.Tasks; //using System.Threading.Tasks;
////todo DI into partials ////todo rewrite
////todo DB
//namespace NadekoBot.Modules.Games //namespace NadekoBot.Modules.Games
//{ //{
// /// <summary> // /// <summary>

View File

@ -12,7 +12,6 @@ namespace NadekoBot.Modules.Games
{ {
public partial class GamesModule public partial class GamesModule
{ {
//todo DB in the future
public static ConcurrentDictionary<IGuild, Poll> ActivePolls = new ConcurrentDictionary<IGuild, Poll>(); public static ConcurrentDictionary<IGuild, Poll> ActivePolls = new ConcurrentDictionary<IGuild, Poll>();
[LocalizedCommand, LocalizedDescription, LocalizedSummary] [LocalizedCommand, LocalizedDescription, LocalizedSummary]

View File

@ -7,8 +7,7 @@ using System.Text;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
// todo rewrite? // todo rewrite
// todo DB
namespace NadekoBot.Modules.Games.Trivia namespace NadekoBot.Modules.Games.Trivia
{ {
public class TriviaGame public class TriviaGame

View File

@ -9,7 +9,6 @@ namespace NadekoBot.Modules.Games.Trivia
public class TriviaQuestionPool public class TriviaQuestionPool
{ {
public static TriviaQuestionPool Instance { get; } = new TriviaQuestionPool(); public static TriviaQuestionPool Instance { get; } = new TriviaQuestionPool();
//todo DB
public HashSet<TriviaQuestion> pool = new HashSet<TriviaQuestion>(); public HashSet<TriviaQuestion> pool = new HashSet<TriviaQuestion>();
private Random rng { get; } = new Random(); private Random rng { get; } = new Random();
@ -30,7 +29,7 @@ namespace NadekoBot.Modules.Games.Trivia
internal void Reload() internal void Reload()
{ {
var arr = JArray.Parse(File.ReadAllText("data/questions.json")); var arr = JArray.Parse(File.ReadAllText("data/triviaquestions.json"));
foreach (var item in arr) foreach (var item in arr)
{ {

View File

@ -15,7 +15,6 @@ namespace NadekoBot.Modules.Games
[Module(">", AppendSpace = false)] [Module(">", AppendSpace = false)]
public partial class Games : DiscordModule public partial class Games : DiscordModule
{ {
//todo DB
private IEnumerable<string> _8BallResponses { private IEnumerable<string> _8BallResponses {
get { get {
using (var uow = DbHandler.UnitOfWork()) using (var uow = DbHandler.UnitOfWork())

View File

@ -13,6 +13,7 @@ using NadekoBot.Extensions;
using System.Net.Http; using System.Net.Http;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using NadekoBot.Services.Database;
namespace NadekoBot.Modules.Music namespace NadekoBot.Modules.Music
{ {
@ -643,8 +644,11 @@ namespace NadekoBot.Modules.Music
var musicPlayer = MusicPlayers.GetOrAdd(textCh.Guild.Id, server => var musicPlayer = MusicPlayers.GetOrAdd(textCh.Guild.Id, server =>
{ {
//todo DB
float vol = 1;// SpecificConfigurations.Default.Of(server.Id).DefaultMusicVolume; float vol = 1;// SpecificConfigurations.Default.Of(server.Id).DefaultMusicVolume;
using (var uow = DbHandler.UnitOfWork())
{
vol = uow.GuildConfigs.For(textCh.Guild.Id).DefaultMusicVolume;
}
var mp = new MusicPlayer(voiceCh, vol); var mp = new MusicPlayer(voiceCh, vol);

View File

@ -19,7 +19,6 @@ namespace NadekoBot.Modules.Searches
[Group] [Group]
public class JokeCommands public class JokeCommands
{ {
//todo DB
private List<WoWJoke> wowJokes = new List<WoWJoke>(); private List<WoWJoke> wowJokes = new List<WoWJoke>();
private List<MagicItem> magicItems; private List<MagicItem> magicItems;
private Logger _log; private Logger _log;

View File

@ -15,7 +15,6 @@ namespace NadekoBot.Modules.Searches
[Group] [Group]
public class PokemonSearchCommands public class PokemonSearchCommands
{ {
//todo DB
private static Dictionary<string, SearchPokemon> pokemons = new Dictionary<string, SearchPokemon>(); private static Dictionary<string, SearchPokemon> pokemons = new Dictionary<string, SearchPokemon>();
private static Dictionary<string, SearchPokemonAbility> pokemonAbilities = new Dictionary<string, SearchPokemonAbility>(); private static Dictionary<string, SearchPokemonAbility> pokemonAbilities = new Dictionary<string, SearchPokemonAbility>();

View File

@ -31,5 +31,6 @@ namespace NadekoBot.Services.Database.Models
//self assignable roles //self assignable roles
public bool ExclusiveSelfAssignedRoles { get; set; } public bool ExclusiveSelfAssignedRoles { get; set; }
public bool AutoDeleteSelfAssignedRoleMessages { get; set; } public bool AutoDeleteSelfAssignedRoleMessages { get; set; }
public float DefaultMusicVolume { get; set; }
} }
} }