small changes and fixes

This commit is contained in:
Master Kwoth 2016-02-27 02:18:49 +01:00
parent d8fa1327ed
commit 6e01fb29cd
5 changed files with 10 additions and 5 deletions

View File

@ -76,7 +76,7 @@ namespace NadekoBot.Classes.Trivia {
// load next question if game is still running // load next question if game is still running
await Task.Delay(2000); await Task.Delay(2000);
} }
End().Wait(); await End();
} }
private async Task End() { private async Task End() {

View File

@ -41,7 +41,7 @@ namespace NadekoBot.Commands {
.Alias("-tq") .Alias("-tq")
.Do(async e=> { .Do(async e=> {
if (runningTrivias.ContainsKey(e.Server)) { if (runningTrivias.ContainsKey(e.Server)) {
runningTrivias[e.Server].StopGame(); await runningTrivias[e.Server].StopGame();
} else } else
await e.Channel.SendMessage("No trivia is running on this server."); await e.Channel.SendMessage("No trivia is running on this server.");
}); });

View File

@ -417,7 +417,7 @@ namespace NadekoBot.Modules {
.Parameter("user",ParameterType.Unparsed) .Parameter("user",ParameterType.Unparsed)
.Do(async e => { .Do(async e => {
var usrId = NadekoBot.client.CurrentUser.Id; var usrId = NadekoBot.client.CurrentUser.Id;
if (!string.IsNullOrWhiteSpace(e.GetArg("user"))) { if (!string.IsNullOrWhiteSpace(e.GetArg("user")) && e.User.ServerPermissions.ManageMessages) {
var usr = e.Server.FindUsers(e.GetArg("user")).FirstOrDefault(); var usr = e.Server.FindUsers(e.GetArg("user")).FirstOrDefault();
if (usr != null) if (usr != null)
usrId = usr.Id; usrId = usr.Id;

View File

@ -33,7 +33,11 @@ namespace NadekoBot.Modules
return; return;
} }
var members = role.Members.Where(u => u.Status == Discord.UserStatus.Online); // only online var members = role.Members.Where(u => u.Status == Discord.UserStatus.Online); // only online
await e.Channel.SendMessage($"**Raffled user:** {members.ToArray()[new System.Random().Next(0, members.Count())].Name}"); try {
var usr = members.ToArray()[new System.Random().Next(0, members.Count())];
await e.Channel.SendMessage($"**Raffled user:** {usr.Name} (id: {usr.Id})");
}
catch { }
}); });
/* /*
cgb.CreateCommand("$$") cgb.CreateCommand("$$")

View File

@ -144,11 +144,12 @@ namespace NadekoBot {
try { try {
var request = e.Request as Discord.API.Client.Rest.SendMessageRequest; var request = e.Request as Discord.API.Client.Rest.SendMessageRequest;
if (request != null) { if (request != null) {
request.Content = request.Content?.Replace("@everyone", "@everyοne");
if (string.IsNullOrWhiteSpace(request.Content)) if (string.IsNullOrWhiteSpace(request.Content))
e.Cancel = true; e.Cancel = true;
else else
Console.WriteLine("Sending request."); Console.WriteLine("Sending request.");
request.Content = request.Content.Replace("@everyone", "@everyοne"); var content = request.Content;
} }
} }
catch { catch {