Implement disabling the exp module

This commit is contained in:
Daniel_I_Am 2020-08-13 21:11:15 +02:00
parent ff854df99d
commit d71f4ac3c6
No known key found for this signature in database
GPG Key ID: 80C428FCC9743E84
2 changed files with 4 additions and 0 deletions

View File

@ -20,6 +20,7 @@ namespace ChaosBot.Discord.Modules.User
[Command("level")] [Command("level")]
[Alias("xp", "exp", "experience", "lvl")] [Alias("xp", "exp", "experience", "lvl")]
[CheckCommandPerm("User")] [CheckCommandPerm("User")]
[CheckModuleEnabled("Experience")]
public async Task XpShowInfo() public async Task XpShowInfo()
{ {
try try

View File

@ -1,6 +1,7 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using ChaosBot.Discord.PreConditions;
using ChaosBot.Models; using ChaosBot.Models;
using ChaosBot.Repositories; using ChaosBot.Repositories;
using Discord; using Discord;
@ -19,6 +20,8 @@ namespace ChaosBot.Discord.Services
{ {
try try
{ {
if (!CheckModuleEnabled.GetResult(context, "Experience")) return;
using (ChaosbotContext dbContext = new ChaosbotContext()) using (ChaosbotContext dbContext = new ChaosbotContext())
{ {
IQueryable<Experience> ctxUser = dbContext.ExperiencePoints; IQueryable<Experience> ctxUser = dbContext.ExperiencePoints;