diff --git a/NadekoBot/Classes/Extensions.cs b/NadekoBot/Classes/Extensions.cs
index b90a23f3..4fb1403c 100644
--- a/NadekoBot/Classes/Extensions.cs
+++ b/NadekoBot/Classes/Extensions.cs
@@ -111,7 +111,7 @@ namespace NadekoBot.Extensions {
///
public static async Task Reply(this CommandEventArgs e, string message)
{
- await e.Send(e.User.Mention + " " + message);
+ await e.Channel.SendMessage(e.User.Mention + " " + message);
}
///
@@ -122,7 +122,7 @@ namespace NadekoBot.Extensions {
///
public static async Task Reply(this MessageEventArgs e, string message)
{
- await e.Send(e.User.Mention + " " + message);
+ await e.Channel.SendMessage(e.User.Mention + " " + message);
}
///
diff --git a/NadekoBot/Classes/Music/StreamRequest.cs b/NadekoBot/Classes/Music/StreamRequest.cs
index 5d04a745..3000eb3e 100644
--- a/NadekoBot/Classes/Music/StreamRequest.cs
+++ b/NadekoBot/Classes/Music/StreamRequest.cs
@@ -354,19 +354,15 @@ namespace NadekoBot.Classes.Music {
}
public override int Read(byte[] buffer, int offset, int count) {
- lock (this) {
- Position = readPos;
- int read = base.Read(buffer, offset, count);
- readPos = Position;
- return read;
- }
+ Position = readPos;
+ int read = base.Read(buffer, offset, count);
+ readPos = Position;
+ return read;
}
public override void Write(byte[] buffer, int offset, int count) {
- lock (this) {
- Position = writePos;
- base.Write(buffer, offset, count);
- writePos = Position;
- }
+ Position = writePos;
+ base.Write(buffer, offset, count);
+ writePos = Position;
}
}
}
diff --git a/NadekoBot/Commands/ClashOfClans.cs b/NadekoBot/Commands/ClashOfClans.cs
index 2d34fa50..1b5b85ec 100644
--- a/NadekoBot/Commands/ClashOfClans.cs
+++ b/NadekoBot/Commands/ClashOfClans.cs
@@ -198,7 +198,7 @@ namespace NadekoBot.Commands {
await e.Channel.SendMessage($"💢🔰 {ex.Message}");
}
});
-
+ /*
cgb.CreateCommand(prefix + "forceunclaim")
.Alias(prefix + "forceuncall")
.Alias(prefix + "fuc")
@@ -214,7 +214,7 @@ namespace NadekoBot.Commands {
string usr =
string.IsNullOrWhiteSpace(e.GetArg("other_name")) ?
e.User.Name :
- e.GetArg("other_name");
+ e.GetArg("other_name").Trim();
try {
var war = warsInfo.Item1[warsInfo.Item2];
int baseNumber = war.Uncall(usr);
@@ -224,6 +224,7 @@ namespace NadekoBot.Commands {
await e.Channel.SendMessage($"💢🔰 {ex.Message}");
}
});
+ */
cgb.CreateCommand(prefix + "endwar")
.Alias(prefix + "ew")
@@ -323,7 +324,7 @@ namespace NadekoBot.Commands {
throw new ArgumentException($"@{u} You already claimed a base #{i + 1}. You can't claim a new one.");
}
- bases[baseNumber] = new Caller { CallUser = u, TimeAdded = DateTime.Now, BaseDestroyed = false };
+ bases[baseNumber] = new Caller { CallUser = u.Trim(), TimeAdded = DateTime.Now, BaseDestroyed = false };
}
internal async void Start() {
@@ -344,6 +345,7 @@ namespace NadekoBot.Commands {
}
}
internal int Uncall(string user) {
+ user = user.Trim();
for (int i = 0; i < bases.Length; i++) {
if (bases[i]?.CallUser == user) {
bases[i] = null;
@@ -397,6 +399,7 @@ namespace NadekoBot.Commands {
}
internal int FinishClaim(string user) {
+ user = user.Trim();
for (int i = 0; i < bases.Length; i++) {
if (bases[i]?.BaseDestroyed == false && bases[i]?.CallUser == user) {
bases[i].BaseDestroyed = true;
diff --git a/NadekoBot/Commands/CopyCommand.cs b/NadekoBot/Commands/CopyCommand.cs
index 4849681f..dd2294b6 100644
--- a/NadekoBot/Commands/CopyCommand.cs
+++ b/NadekoBot/Commands/CopyCommand.cs
@@ -21,7 +21,7 @@ namespace NadekoBot
if (string.IsNullOrWhiteSpace(e.Message.Text))
return;
if (CopiedUsers.Contains(e.User.Id)) {
- await e.Send( e.Message.Text.Replace("@everyone","@everryone"));
+ await e.Channel.SendMessage( e.Message.Text.Replace("@everyone","@everryone"));
}
}
@@ -30,7 +30,7 @@ namespace NadekoBot
if (CopiedUsers.Contains(e.User.Id)) return;
CopiedUsers.Add(e.User.Id);
- await e.Send(" I'll start copying you now.");
+ await e.Channel.SendMessage(" I'll start copying you now.");
return;
};
@@ -52,7 +52,7 @@ namespace NadekoBot
if (!CopiedUsers.Contains(e.User.Id)) return;
CopiedUsers.Remove(e.User.Id);
- await e.Send(" I wont copy anymore.");
+ await e.Channel.SendMessage(" I wont copy anymore.");
return;
};
}
diff --git a/NadekoBot/Commands/DiceRollCommand.cs b/NadekoBot/Commands/DiceRollCommand.cs
index 74588fae..253840a6 100644
--- a/NadekoBot/Commands/DiceRollCommand.cs
+++ b/NadekoBot/Commands/DiceRollCommand.cs
@@ -34,7 +34,7 @@ namespace NadekoBot {
int num = int.Parse(e.Args[0]);
if (num < 1) num = 1;
if (num > 30) {
- await e.Send("You can roll up to 30 dies at a time.");
+ await e.Channel.SendMessage("You can roll up to 30 dies at a time.");
num = 30;
}
List dices = new List(num);
@@ -56,10 +56,10 @@ namespace NadekoBot {
}
Bitmap bitmap = dices.Merge();
- await e.Send(values.Count + " Dies rolled. Total: **" + values.Sum() + "** Average: **" + (values.Sum() / (1.0f * values.Count)).ToString("N2") + "**");
+ await e.Channel.SendMessage(values.Count + " Dies rolled. Total: **" + values.Sum() + "** Average: **" + (values.Sum() / (1.0f * values.Count)).ToString("N2") + "**");
await e.Channel.SendFile("dices.png", bitmap.ToStream(ImageFormat.Png));
} catch {
- await e.Send("Please enter a number of dices to roll.");
+ await e.Channel.SendMessage("Please enter a number of dices to roll.");
return;
}
}
@@ -95,9 +95,9 @@ namespace NadekoBot {
rolled = new Random().Next(0, int.Parse(e.GetArg("range"))+1);
}
- await e.Send($"{e.User.Mention} rolled **{rolled}**.");
+ await e.Channel.SendMessage($"{e.User.Mention} rolled **{rolled}**.");
} catch (Exception ex) {
- await e.Send($":anger: {ex.Message}");
+ await e.Channel.SendMessage($":anger: {ex.Message}");
}
};
diff --git a/NadekoBot/Commands/DrawCommand.cs b/NadekoBot/Commands/DrawCommand.cs
index cf42f107..23d40760 100644
--- a/NadekoBot/Commands/DrawCommand.cs
+++ b/NadekoBot/Commands/DrawCommand.cs
@@ -16,7 +16,7 @@ namespace NadekoBot {
public override Func DoFunc() => async (e) => {
if (!AllDecks.ContainsKey(e.Server)) {
- await e.Send("Shuffling cards...");
+ await e.Channel.SendMessage("Shuffling cards...");
AllDecks.TryAdd(e.Server, new Cards());
}
@@ -36,7 +36,7 @@ namespace NadekoBot {
List cardObjects = new List();
for (int i = 0; i < num; i++) {
if (cards.CardPool.Count == 0 && i != 0) {
- await e.Send("No more cards in a deck.");
+ await e.Channel.SendMessage("No more cards in a deck.");
break;
}
var currentCard = cards.DrawACard();
@@ -46,7 +46,7 @@ namespace NadekoBot {
Bitmap bitmap = images.Merge();
await e.Channel.SendFile(images.Count + " cards.jpg", bitmap.ToStream());
if (cardObjects.Count == 5) {
- await e.Send(Cards.GetHandValue(cardObjects));
+ await e.Channel.SendMessage(Cards.GetHandValue(cardObjects));
}
} catch (Exception ex) {
Console.WriteLine("Error drawing (a) card(s) " + ex.ToString());
@@ -66,7 +66,7 @@ namespace NadekoBot {
if (!AllDecks.ContainsKey(e.Server))
AllDecks.TryAdd(e.Server, new Cards());
AllDecks[e.Server].Restart();
- await e.Send("Deck reshuffled.");
+ await e.Channel.SendMessage("Deck reshuffled.");
});
}
diff --git a/NadekoBot/Commands/FlipCoinCommand.cs b/NadekoBot/Commands/FlipCoinCommand.cs
index c844d637..5e27da59 100644
--- a/NadekoBot/Commands/FlipCoinCommand.cs
+++ b/NadekoBot/Commands/FlipCoinCommand.cs
@@ -35,7 +35,7 @@ namespace NadekoBot {
return;
}
- await e.Send("Invalid number");
+ await e.Channel.SendMessage("Invalid number");
}
};
diff --git a/NadekoBot/Commands/HelpCommand.cs b/NadekoBot/Commands/HelpCommand.cs
index f7eb406a..a5f2ece3 100644
--- a/NadekoBot/Commands/HelpCommand.cs
+++ b/NadekoBot/Commands/HelpCommand.cs
@@ -73,7 +73,7 @@ namespace NadekoBot
.Alias("-guide")
.Description("Sends a readme and a guide links to the channel.")
.Do(async e =>
- await e.Send(
+ await e.Channel.SendMessage(
@"**FULL README**:
**GUIDE ONLY**:
@@ -84,7 +84,7 @@ namespace NadekoBot
.Alias("~donate")
.Description("Instructions for helping the project!")
.Do(async e => {
- await e.Send(
+ await e.Channel.SendMessage(
@"I've created a **paypal** email for nadeko, so if you wish to support the project, you can send your donations to `nadekodiscordbot@gmail.com`
Don't forget to leave your discord name or id in the message, so that I can reward people who help out.
You can join nadekobot server by simply private messaging NadekoBot, and you will get an invite.
diff --git a/NadekoBot/Commands/RequestsCommand.cs b/NadekoBot/Commands/RequestsCommand.cs
index 7bd16904..2fba72f6 100644
--- a/NadekoBot/Commands/RequestsCommand.cs
+++ b/NadekoBot/Commands/RequestsCommand.cs
@@ -53,10 +53,10 @@ namespace NadekoBot.Commands {
try {
SaveRequest(e, str);
} catch {
- await e.Send("Something went wrong.");
+ await e.Channel.SendMessage("Something went wrong.");
return;
}
- await e.Send("Thank you for your request.");
+ await e.Channel.SendMessage("Thank you for your request.");
});
cgb.CreateCommand("lr")
@@ -76,14 +76,14 @@ namespace NadekoBot.Commands {
if (e.User.Id == NadekoBot.OwnerID) {
try {
if (DeleteRequest(int.Parse(e.Args[0]))) {
- await e.Send(e.User.Mention + " Request deleted.");
+ await e.Channel.SendMessage(e.User.Mention + " Request deleted.");
} else {
- await e.Send("No request on that number.");
+ await e.Channel.SendMessage("No request on that number.");
}
} catch {
- await e.Send("Error deleting request, probably NaN error.");
+ await e.Channel.SendMessage("Error deleting request, probably NaN error.");
}
- } else await e.Send("You don't have permission to do that.");
+ } else await e.Channel.SendMessage("You don't have permission to do that.");
});
cgb.CreateCommand("rr")
@@ -94,15 +94,15 @@ namespace NadekoBot.Commands {
try {
var sc = ResolveRequest(int.Parse(e.Args[0]));
if (sc != null) {
- await e.Send(e.User.Mention + " Request resolved, notice sent.");
+ await e.Channel.SendMessage(e.User.Mention + " Request resolved, notice sent.");
await client.GetServer((ulong)sc.ServerId).GetUser((ulong)sc.UserId).Send("**This request of yours has been resolved:**\n" + sc.RequestText);
} else {
- await e.Send("No request on that number.");
+ await e.Channel.SendMessage("No request on that number.");
}
} catch {
- await e.Send("Error resolving request, probably NaN error.");
+ await e.Channel.SendMessage("Error resolving request, probably NaN error.");
}
- } else await e.Send("You don't have permission to do that.");
+ } else await e.Channel.SendMessage("You don't have permission to do that.");
});
}
}
diff --git a/NadekoBot/Commands/ServerGreetCommand.cs b/NadekoBot/Commands/ServerGreetCommand.cs
index d6bf6c3c..b42e4996 100644
--- a/NadekoBot/Commands/ServerGreetCommand.cs
+++ b/NadekoBot/Commands/ServerGreetCommand.cs
@@ -180,9 +180,9 @@ namespace NadekoBot.Commands {
var controls = AnnouncementsDictionary[e.Server.Id];
if (controls.ToggleGreet(e.Channel.Id))
- await e.Send("Greet announcements enabled on this channel.");
+ await e.Channel.SendMessage("Greet announcements enabled on this channel.");
else
- await e.Send("Greet announcements disabled.");
+ await e.Channel.SendMessage("Greet announcements disabled.");
});
cgb.CreateCommand(".greetmsg")
@@ -195,9 +195,9 @@ namespace NadekoBot.Commands {
AnnouncementsDictionary.TryAdd(e.Server.Id, new AnnounceControls(e.Server.Id));
AnnouncementsDictionary[e.Server.Id].GreetText = e.GetArg("msg");
- await e.Send("New greet message set.");
+ await e.Channel.SendMessage("New greet message set.");
if (!AnnouncementsDictionary[e.Server.Id].Greet)
- await e.Send("Enable greet messsages by typing `.greet`");
+ await e.Channel.SendMessage("Enable greet messsages by typing `.greet`");
});
cgb.CreateCommand(".bye")
@@ -210,9 +210,9 @@ namespace NadekoBot.Commands {
var controls = AnnouncementsDictionary[e.Server.Id];
if (controls.ToggleBye(e.Channel.Id))
- await e.Send("Bye announcements enabled on this channel.");
+ await e.Channel.SendMessage("Bye announcements enabled on this channel.");
else
- await e.Send("Bye announcements disabled.");
+ await e.Channel.SendMessage("Bye announcements disabled.");
});
cgb.CreateCommand(".byemsg")
@@ -225,9 +225,9 @@ namespace NadekoBot.Commands {
AnnouncementsDictionary.TryAdd(e.Server.Id, new AnnounceControls(e.Server.Id));
AnnouncementsDictionary[e.Server.Id].ByeText = e.GetArg("msg");
- await e.Send("New bye message set.");
+ await e.Channel.SendMessage("New bye message set.");
if (!AnnouncementsDictionary[e.Server.Id].Bye)
- await e.Send("Enable bye messsages by typing `.bye`.");
+ await e.Channel.SendMessage("Enable bye messsages by typing `.bye`.");
});
cgb.CreateCommand(".byepm")
@@ -239,11 +239,11 @@ namespace NadekoBot.Commands {
AnnouncementsDictionary[e.Server.Id].ToggleByePM();
if (AnnouncementsDictionary[e.Server.Id].ByePM)
- await e.Send("Bye messages will be sent in a PM from now on.\n ⚠ Keep in mind this might fail if the user and the bot have no common servers after the user leaves.");
+ await e.Channel.SendMessage("Bye messages will be sent in a PM from now on.\n ⚠ Keep in mind this might fail if the user and the bot have no common servers after the user leaves.");
else
- await e.Send("Bye messages will be sent in a bound channel from now on.");
+ await e.Channel.SendMessage("Bye messages will be sent in a bound channel from now on.");
if (!AnnouncementsDictionary[e.Server.Id].Bye)
- await e.Send("Enable bye messsages by typing `.bye`, and set the bye message using `.byemsg`");
+ await e.Channel.SendMessage("Enable bye messsages by typing `.bye`, and set the bye message using `.byemsg`");
});
cgb.CreateCommand(".greetpm")
@@ -255,11 +255,11 @@ namespace NadekoBot.Commands {
AnnouncementsDictionary[e.Server.Id].ToggleGreetPM();
if (AnnouncementsDictionary[e.Server.Id].GreetPM)
- await e.Send("Greet messages will be sent in a PM from now on.");
+ await e.Channel.SendMessage("Greet messages will be sent in a PM from now on.");
else
- await e.Send("Greet messages will be sent in a bound channel from now on.");
+ await e.Channel.SendMessage("Greet messages will be sent in a bound channel from now on.");
if (!AnnouncementsDictionary[e.Server.Id].Greet)
- await e.Send("Enable greet messsages by typing `.greet`, and set the greet message using `.greetmsg`");
+ await e.Channel.SendMessage("Enable greet messsages by typing `.greet`, and set the greet message using `.greetmsg`");
});
}
}
diff --git a/NadekoBot/Commands/SpeedTyping.cs b/NadekoBot/Commands/SpeedTyping.cs
index b3d9ff40..d71ff218 100644
--- a/NadekoBot/Commands/SpeedTyping.cs
+++ b/NadekoBot/Commands/SpeedTyping.cs
@@ -92,7 +92,7 @@ namespace NadekoBot.Commands {
finishedUserIds.Add(e.User.Id);
await channel.Send($"{e.User.Mention} finished in **{sw.Elapsed.Seconds}** seconds with { distance } errors, **{ currentSentence.Length / TypingGame.WORD_VALUE / sw.Elapsed.Seconds * 60 }** WPM!");
if (finishedUserIds.Count % 2 == 0) {
- await e.Send($":exclamation: `A lot of people finished, here is the text for those still typing:`\n\n:book:**{currentSentence}**:book:");
+ await e.Channel.SendMessage($":exclamation: `A lot of people finished, here is the text for those still typing:`\n\n:book:**{currentSentence}**:book:");
}
}
@@ -113,7 +113,7 @@ namespace NadekoBot.Commands {
public override Func DoFunc() =>
async e => {
if (runningContests.ContainsKey(e.User.Server.Id) && runningContests[e.User.Server.Id].IsActive) {
- await e.Send($"Contest already running in { runningContests[e.User.Server.Id].Channell.Mention } channel.");
+ await e.Channel.SendMessage($"Contest already running in { runningContests[e.User.Server.Id].Channell.Mention } channel.");
return;
}
if (runningContests.ContainsKey(e.User.Server.Id) && !runningContests[e.User.Server.Id].IsActive) {
@@ -132,7 +132,7 @@ namespace NadekoBot.Commands {
runningContests.Remove(e.User.Server.Id);
return;
}
- await e.Send("No contest to stop on this channel.");
+ await e.Channel.SendMessage("No contest to stop on this channel.");
};
public override void Init(CommandGroupBuilder cgb) {
@@ -155,7 +155,7 @@ namespace NadekoBot.Commands {
DateAdded = DateTime.Now
});
- await e.Send("Added new article for typing game.");
+ await e.Channel.SendMessage("Added new article for typing game.");
});
//todo add user submissions
diff --git a/NadekoBot/Commands/TriviaCommand.cs b/NadekoBot/Commands/TriviaCommand.cs
index cd8b4918..42234145 100644
--- a/NadekoBot/Commands/TriviaCommand.cs
+++ b/NadekoBot/Commands/TriviaCommand.cs
@@ -13,9 +13,9 @@ namespace NadekoBot.Commands {
public override Func DoFunc() => async e => {
if (!runningTrivias.ContainsKey(e.Server)) {
runningTrivias.TryAdd(e.Server, new TriviaGame(e));
- await e.Send("**Trivia game started!**\nFirst player to get to 10 points wins! You have 30 seconds per question.\nUse command `tq` if game was started by accident.**");
+ await e.Channel.SendMessage("**Trivia game started!**\nFirst player to get to 10 points wins! You have 30 seconds per question.\nUse command `tq` if game was started by accident.**");
} else
- await e.Send("Trivia game is already running on this server.\n" + runningTrivias[e.Server].CurrentQuestion);
+ await e.Channel.SendMessage("Trivia game is already running on this server.\n" + runningTrivias[e.Server].CurrentQuestion);
};
public override void Init(CommandGroupBuilder cgb) {
@@ -31,9 +31,9 @@ namespace NadekoBot.Commands {
.Alias("-tlb")
.Do(async e=> {
if (runningTrivias.ContainsKey(e.Server))
- await e.Send(runningTrivias[e.Server].GetLeaderboard());
+ await e.Channel.SendMessage(runningTrivias[e.Server].GetLeaderboard());
else
- await e.Send("No trivia is running on this server.");
+ await e.Channel.SendMessage("No trivia is running on this server.");
});
cgb.CreateCommand("tq")
@@ -43,7 +43,7 @@ namespace NadekoBot.Commands {
if (runningTrivias.ContainsKey(e.Server)) {
runningTrivias[e.Server].StopGame();
} else
- await e.Send("No trivia is running on this server.");
+ await e.Channel.SendMessage("No trivia is running on this server.");
});
}
}
diff --git a/NadekoBot/Modules/Administration.cs b/NadekoBot/Modules/Administration.cs
index 16e8eb24..765597e3 100644
--- a/NadekoBot/Modules/Administration.cs
+++ b/NadekoBot/Modules/Administration.cs
@@ -41,21 +41,21 @@ namespace NadekoBot.Modules {
string.IsNullOrWhiteSpace(e.GetArg("role_name"))) return;
var usr = e.Server.FindUsers(e.GetArg("user_name")).FirstOrDefault();
if (usr == null) {
- await e.Send("You failed to supply a valid username");
+ await e.Channel.SendMessage("You failed to supply a valid username");
return;
}
var role = e.Server.FindRoles(e.GetArg("role_name")).FirstOrDefault();
if (role == null) {
- await e.Send("You failed to supply a valid role");
+ await e.Channel.SendMessage("You failed to supply a valid role");
return;
}
try {
await usr.AddRoles(new Role[] { role });
- await e.Send($"Successfully added role **{role.Name}** to user **{usr.Name}**");
+ await e.Channel.SendMessage($"Successfully added role **{role.Name}** to user **{usr.Name}**");
} catch (Exception ex) {
- await e.Send("Failed to add roles. Most likely reason: Insufficient permissions.\n");
+ await e.Channel.SendMessage("Failed to add roles. Most likely reason: Insufficient permissions.\n");
Console.WriteLine(ex.ToString());
}
});
@@ -70,21 +70,21 @@ namespace NadekoBot.Modules {
var usr = e.Server.FindUsers(e.GetArg("user_name")).FirstOrDefault();
if (usr == null) {
- await e.Send("You failed to supply a valid username");
+ await e.Channel.SendMessage("You failed to supply a valid username");
return;
}
var role = e.Server.FindRoles(e.GetArg("role_name")).FirstOrDefault();
if (role == null) {
- await e.Send("You failed to supply a valid role");
+ await e.Channel.SendMessage("You failed to supply a valid role");
return;
}
try {
await usr.RemoveRoles(new Role[] { role });
- await e.Send($"Successfully removed role **{role.Name}** from user **{usr.Name}**");
+ await e.Channel.SendMessage($"Successfully removed role **{role.Name}** from user **{usr.Name}**");
} catch (InvalidOperationException) {
} catch {
- await e.Send("Failed to remove roles. Most likely reason: Insufficient permissions.");
+ await e.Channel.SendMessage("Failed to remove roles. Most likely reason: Insufficient permissions.");
}
});
@@ -97,9 +97,9 @@ namespace NadekoBot.Modules {
return;
try {
var r = await e.Server.CreateRole(e.GetArg("role_name"));
- await e.Send($"Successfully created role **{r.Name}**.");
+ await e.Channel.SendMessage($"Successfully created role **{r.Name}**.");
} catch (Exception ex) {
- await e.Send(":warning: Unspecified error.");
+ await e.Channel.SendMessage(":warning: Unspecified error.");
}
});
@@ -118,14 +118,14 @@ namespace NadekoBot.Modules {
var args = e.Args.Where(s => s != String.Empty);
if (args.Count() != 2 && args.Count() != 4) {
- await e.Send("The parameters are invalid.");
+ await e.Channel.SendMessage("The parameters are invalid.");
return;
}
Role role = e.Server.FindRoles(e.Args[0]).FirstOrDefault();
if (role == null) {
- await e.Send("That role does not exist.");
+ await e.Channel.SendMessage("That role does not exist.");
return;
}
try {
@@ -138,7 +138,7 @@ namespace NadekoBot.Modules {
await role.Edit(color: new Color(red, green, blue));
await e.Channel.SendMessage($"Role {role.Name}'s color has been changed.");
} catch (Exception ex) {
- await e.Send(":warning: Unspecified error, please report this.");
+ await e.Channel.SendMessage(":warning: Unspecified error, please report this.");
Console.WriteLine($".rolecolor error: {ex}");
}
@@ -152,17 +152,17 @@ namespace NadekoBot.Modules {
if (!string.IsNullOrWhiteSpace(e.GetArg("user"))) {
var usr = e.Server.FindUsers(e.GetArg("user")).FirstOrDefault();
if (usr != null) {
- await e.Send($"`List of roles for **{usr.Name}**:` \n• " + string.Join("\n• ", usr.Roles).Replace("@everyone", "මeveryone"));
+ await e.Channel.SendMessage($"`List of roles for **{usr.Name}**:` \n• " + string.Join("\n• ", usr.Roles).Replace("@everyone", "මeveryone"));
return;
}
}
- await e.Send("`List of roles:` \n• " + string.Join("\n• ", e.Server.Roles).Replace("@everyone", "මeveryone"));
+ await e.Channel.SendMessage("`List of roles:` \n• " + string.Join("\n• ", e.Server.Roles).Replace("@everyone", "මeveryone"));
});
cgb.CreateCommand(".modules")
.Description("List all bot modules")
.Do(async e => {
- await e.Send("`List of modules:` \n• " + string.Join("\n• ", NadekoBot.client.GetService().Modules.Select(m => m.Name)));
+ await e.Channel.SendMessage("`List of modules:` \n• " + string.Join("\n• ", NadekoBot.client.GetService().Modules.Select(m => m.Name)));
});
cgb.CreateCommand(".commands")
@@ -172,10 +172,10 @@ namespace NadekoBot.Modules {
var commands = NadekoBot.client.GetService().AllCommands
.Where(c => c.Category.ToLower() == e.GetArg("module").Trim().ToLower());
if (commands == null || commands.Count() == 0) {
- await e.Send("That module does not exist.");
+ await e.Channel.SendMessage("That module does not exist.");
return;
}
- await e.Send("`List of commands:` \n• " + string.Join("\n• ", commands.Select(c => c.Text)));
+ await e.Channel.SendMessage("`List of commands:` \n• " + string.Join("\n• ", commands.Select(c => c.Text)));
});
cgb.CreateCommand(".b").Alias(".ban")
@@ -186,7 +186,7 @@ namespace NadekoBot.Modules {
if (e.User.ServerPermissions.BanMembers && e.Message.MentionedUsers.Any()) {
var usr = e.Message.MentionedUsers.First();
await usr.Server.Ban(usr);
- await e.Send("Banned user " + usr.Name + " Id: " + usr.Id);
+ await e.Channel.SendMessage("Banned user " + usr.Name + " Id: " + usr.Id);
}
} catch (Exception ex) { }
});
@@ -199,7 +199,7 @@ namespace NadekoBot.Modules {
if (e.User.ServerPermissions.BanMembers && e.Message.MentionedUsers.Any()) {
var usr = e.Message.MentionedUsers.First();
await usr.Server.Unban(usr);
- await e.Send("Unbanned user " + usr.Name + " Id: " + usr.Id);
+ await e.Channel.SendMessage("Unbanned user " + usr.Name + " Id: " + usr.Id);
}
} catch { }
});
@@ -212,10 +212,10 @@ namespace NadekoBot.Modules {
if (e.User.ServerPermissions.KickMembers && e.Message.MentionedUsers.Any()) {
var usr = e.Message.MentionedUsers.First();
await e.Message.MentionedUsers.First().Kick();
- await e.Send("Kicked user " + usr.Name + " Id: " + usr.Id);
+ await e.Channel.SendMessage("Kicked user " + usr.Name + " Id: " + usr.Id);
}
} catch {
- await e.Send("No sufficient permissions.");
+ await e.Channel.SendMessage("No sufficient permissions.");
}
});
cgb.CreateCommand(".mute")
@@ -223,7 +223,7 @@ namespace NadekoBot.Modules {
.Parameter("throwaway", ParameterType.Unparsed)
.Do(async e => {
if (!e.User.ServerPermissions.MuteMembers) {
- await e.Send("You do not have permission to do that.");
+ await e.Channel.SendMessage("You do not have permission to do that.");
return;
}
if (e.Message.MentionedUsers.Count() == 0)
@@ -232,9 +232,9 @@ namespace NadekoBot.Modules {
foreach (var u in e.Message.MentionedUsers) {
await u.Edit(isMuted: true);
}
- await e.Send("Mute successful");
+ await e.Channel.SendMessage("Mute successful");
} catch {
- await e.Send("I do not have permission to do that most likely.");
+ await e.Channel.SendMessage("I do not have permission to do that most likely.");
}
});
@@ -243,7 +243,7 @@ namespace NadekoBot.Modules {
.Parameter("throwaway", ParameterType.Unparsed)
.Do(async e => {
if (!e.User.ServerPermissions.MuteMembers) {
- await e.Send("You do not have permission to do that.");
+ await e.Channel.SendMessage("You do not have permission to do that.");
return;
}
if (e.Message.MentionedUsers.Count() == 0)
@@ -252,9 +252,9 @@ namespace NadekoBot.Modules {
foreach (var u in e.Message.MentionedUsers) {
await u.Edit(isMuted: false);
}
- await e.Send("Unmute successful");
+ await e.Channel.SendMessage("Unmute successful");
} catch {
- await e.Send("I do not have permission to do that most likely.");
+ await e.Channel.SendMessage("I do not have permission to do that most likely.");
}
});
@@ -264,7 +264,7 @@ namespace NadekoBot.Modules {
.Parameter("throwaway", ParameterType.Unparsed)
.Do(async e => {
if (!e.User.ServerPermissions.DeafenMembers) {
- await e.Send("You do not have permission to do that.");
+ await e.Channel.SendMessage("You do not have permission to do that.");
return;
}
if (e.Message.MentionedUsers.Count() == 0)
@@ -273,9 +273,9 @@ namespace NadekoBot.Modules {
foreach (var u in e.Message.MentionedUsers) {
await u.Edit(isDeafened: true);
}
- await e.Send("Deafen successful");
+ await e.Channel.SendMessage("Deafen successful");
} catch {
- await e.Send("I do not have permission to do that most likely.");
+ await e.Channel.SendMessage("I do not have permission to do that most likely.");
}
});
@@ -285,7 +285,7 @@ namespace NadekoBot.Modules {
.Parameter("throwaway", ParameterType.Unparsed)
.Do(async e => {
if (!e.User.ServerPermissions.DeafenMembers) {
- await e.Send("You do not have permission to do that.");
+ await e.Channel.SendMessage("You do not have permission to do that.");
return;
}
if (e.Message.MentionedUsers.Count() == 0)
@@ -294,9 +294,9 @@ namespace NadekoBot.Modules {
foreach (var u in e.Message.MentionedUsers) {
await u.Edit(isDeafened: false);
}
- await e.Send("Undeafen successful");
+ await e.Channel.SendMessage("Undeafen successful");
} catch {
- await e.Send("I do not have permission to do that most likely.");
+ await e.Channel.SendMessage("I do not have permission to do that most likely.");
}
});
@@ -307,10 +307,10 @@ namespace NadekoBot.Modules {
try {
if (e.User.ServerPermissions.ManageChannels) {
await e.Server.FindChannels(e.GetArg("channel_name"), ChannelType.Voice).FirstOrDefault()?.Delete();
- await e.Send($"Removed channel **{e.GetArg("channel_name")}**.");
+ await e.Channel.SendMessage($"Removed channel **{e.GetArg("channel_name")}**.");
}
} catch {
- await e.Send("No sufficient permissions.");
+ await e.Channel.SendMessage("No sufficient permissions.");
}
});
@@ -321,10 +321,10 @@ namespace NadekoBot.Modules {
try {
if (e.User.ServerPermissions.ManageChannels) {
await e.Server.CreateChannel(e.GetArg("channel_name"), ChannelType.Voice);
- await e.Send($"Created voice channel **{e.GetArg("channel_name")}**.");
+ await e.Channel.SendMessage($"Created voice channel **{e.GetArg("channel_name")}**.");
}
} catch {
- await e.Send("No sufficient permissions.");
+ await e.Channel.SendMessage("No sufficient permissions.");
}
});
@@ -335,10 +335,10 @@ namespace NadekoBot.Modules {
try {
if (e.User.ServerPermissions.ManageChannels) {
await e.Server.FindChannels(e.GetArg("channel_name"), ChannelType.Text).FirstOrDefault()?.Delete();
- await e.Send($"Removed text channel **{e.GetArg("channel_name")}**.");
+ await e.Channel.SendMessage($"Removed text channel **{e.GetArg("channel_name")}**.");
}
} catch {
- await e.Send("No sufficient permissions.");
+ await e.Channel.SendMessage("No sufficient permissions.");
}
});
@@ -349,10 +349,10 @@ namespace NadekoBot.Modules {
try {
if (e.User.ServerPermissions.ManageChannels) {
await e.Server.CreateChannel(e.GetArg("channel_name"), ChannelType.Text);
- await e.Send($"Added text channel **{e.GetArg("channel_name")}**.");
+ await e.Channel.SendMessage($"Added text channel **{e.GetArg("channel_name")}**.");
}
} catch {
- await e.Send("No sufficient permissions.");
+ await e.Channel.SendMessage("No sufficient permissions.");
}
});
@@ -372,16 +372,16 @@ namespace NadekoBot.Modules {
.Do(async e => {
var usr = e.User;
if (e.GetArg("user") != null) usr = e.Channel.FindUsers(e.GetArg("user")).FirstOrDefault();
- await e.Send($"Id of the user { usr.Name } is { usr.Id }");
+ await e.Channel.SendMessage($"Id of the user { usr.Name } is { usr.Id }");
});
cgb.CreateCommand(".cid").Alias(".channelid")
.Description("Shows current channel id")
- .Do(async e => await e.Send("This channel's id is " + e.Channel.Id));
+ .Do(async e => await e.Channel.SendMessage("This channel's id is " + e.Channel.Id));
cgb.CreateCommand(".sid").Alias(".serverid")
.Description("Shows current server id")
- .Do(async e => await e.Send("This server's id is " + e.Server.Id));
+ .Do(async e => await e.Channel.SendMessage("This server's id is " + e.Server.Id));
cgb.CreateCommand(".stats")
.Description("Shows some basic stats for nadeko")
@@ -390,7 +390,7 @@ namespace NadekoBot.Modules {
return NadekoStats.Instance.GetStats() + "`" + Music.GetMusicStats() + "`";
});
- await e.Send(await t);
+ await e.Channel.SendMessage(await t);
});
@@ -425,7 +425,7 @@ namespace NadekoBot.Modules {
t.Interval = 2000;
t.Elapsed += (s, ev) => { Environment.Exit(0); };
t.Start();
- await e.Send("`Shutting down.`");
+ await e.Channel.SendMessage("`Shutting down.`");
}
});
@@ -484,7 +484,7 @@ namespace NadekoBot.Modules {
image.Save("data/avatar.png", System.Drawing.Imaging.ImageFormat.Png);
await client.CurrentUser.Edit(NadekoBot.password, avatar: image.ToStream());
// Send confirm.
- await e.Send("New avatar set.");
+ await e.Channel.SendMessage("New avatar set.");
});
cgb.CreateCommand(".setgame")
@@ -519,9 +519,9 @@ namespace NadekoBot.Modules {
commsUser = commsServer?.FindUsers(e.GetArg("name")).FirstOrDefault();
if (commsUser != null) {
commsChannel = null;
- await e.Send("User for comms set.");
+ await e.Channel.SendMessage("User for comms set.");
} else
- await e.Send("No server specified or user.");
+ await e.Channel.SendMessage("No server specified or user.");
});
cgb.CreateCommand(".commsserver")
@@ -531,9 +531,9 @@ namespace NadekoBot.Modules {
if (e.User.Id != NadekoBot.OwnerID) return;
commsServer = client.FindServers(e.GetArg("server")).FirstOrDefault();
if (commsServer != null)
- await e.Send("Server for comms set.");
+ await e.Channel.SendMessage("Server for comms set.");
else
- await e.Send("No such server.");
+ await e.Channel.SendMessage("No such server.");
});
cgb.CreateCommand(".commschannel")
@@ -544,9 +544,9 @@ namespace NadekoBot.Modules {
commsChannel = commsServer?.FindChannels(e.GetArg("ch"), ChannelType.Text).FirstOrDefault();
if (commsChannel != null) {
commsUser = null;
- await e.Send("Server for comms set.");
+ await e.Channel.SendMessage("Server for comms set.");
} else
- await e.Send("No server specified or channel is invalid.");
+ await e.Channel.SendMessage("No server specified or channel is invalid.");
});
cgb.CreateCommand(".send")
@@ -559,7 +559,7 @@ namespace NadekoBot.Modules {
else if (commsChannel != null)
await commsChannel.SendMessage(e.GetArg("msg"));
else
- await e.Send("Failed. Make sure you've specified server and [channel or user]");
+ await e.Channel.SendMessage("Failed. Make sure you've specified server and [channel or user]");
});
cgb.CreateCommand(".menrole")
diff --git a/NadekoBot/Modules/Conversations.cs b/NadekoBot/Modules/Conversations.cs
index 0662494e..1039b9e4 100644
--- a/NadekoBot/Modules/Conversations.cs
+++ b/NadekoBot/Modules/Conversations.cs
@@ -34,13 +34,13 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("\\o\\")
.Description("Nadeko replies with /o/")
.Do(async e => {
- await e.Send(e.User.Mention + "/o/");
+ await e.Channel.SendMessage(e.User.Mention + "/o/");
});
cgb.CreateCommand("/o/")
.Description("Nadeko replies with \\o\\")
.Do(async e => {
- await e.Send(e.User.Mention + "\\o\\");
+ await e.Channel.SendMessage(e.User.Mention + "\\o\\");
});
});
@@ -56,7 +56,7 @@ namespace NadekoBot.Modules {
.Do(async e => {
var time = (DateTime.Now - Process.GetCurrentProcess().StartTime);
string str = "I am online for " + time.Days + " days, " + time.Hours + " hours, and " + time.Minutes + " minutes.";
- await e.Send(str);
+ await e.Channel.SendMessage(str);
});
cgb.CreateCommand("die")
@@ -67,9 +67,9 @@ namespace NadekoBot.Modules {
t.Interval = 2000;
t.Elapsed += (s, ev) => { Environment.Exit(0); };
t.Start();
- await e.Send(e.User.Mention + ", Yes, my love.");
+ await e.Channel.SendMessage(e.User.Mention + ", Yes, my love.");
} else
- await e.Send(e.User.Mention + ", No.");
+ await e.Channel.SendMessage(e.User.Mention + ", No.");
});
Stopwatch randServerSW = new Stopwatch();
@@ -79,12 +79,12 @@ namespace NadekoBot.Modules {
.Description("Generates an invite to a random server and prints some stats.")
.Do(async e => {
if (client.Servers.Count() < 10) {
- await e.Send("I need to be connected to at least 10 servers for this command to work.");
+ await e.Channel.SendMessage("I need to be connected to at least 10 servers for this command to work.");
return;
}
if (randServerSW.Elapsed.Seconds < 1800) {
- await e.Send("You have to wait " + (1800 - randServerSW.Elapsed.Seconds) + " more seconds to use this function.");
+ await e.Channel.SendMessage("You have to wait " + (1800 - randServerSW.Elapsed.Seconds) + " more seconds to use this function.");
return;
}
randServerSW.Restart();
@@ -94,7 +94,7 @@ namespace NadekoBot.Modules {
continue;
try {
var inv = await server.CreateInvite(100, 5);
- await e.Send("**Server:** " + server.Name +
+ await e.Channel.SendMessage("**Server:** " + server.Name +
"\n**Owner:** " + server.Owner.Name +
"\n**Channels:** " + server.AllChannels.Count() +
"\n**Total Members:** " + server.Users.Count() +
@@ -125,22 +125,22 @@ namespace NadekoBot.Modules {
.Description("Replies with positive answer only to the bot owner.")
.Do(async e => {
if (e.User.Id == NadekoBot.OwnerID)
- await e.Send(e.User.Mention + ", Of course I do, my Master.");
+ await e.Channel.SendMessage(e.User.Mention + ", Of course I do, my Master.");
else
- await e.Send(e.User.Mention + ", Don't be silly.");
+ await e.Channel.SendMessage(e.User.Mention + ", Don't be silly.");
});
cgb.CreateCommand("how are you")
.Description("Replies positive only if bot owner is online.")
.Do(async e => {
if (e.User.Id == NadekoBot.OwnerID) {
- await e.Send(e.User.Mention + " I am great as long as you are here.");
+ await e.Channel.SendMessage(e.User.Mention + " I am great as long as you are here.");
} else {
var kw = e.Server.GetUser(NadekoBot.OwnerID);
if (kw != null && kw.Status == UserStatus.Online) {
- await e.Send(e.User.Mention + " I am great as long as " + kw.Mention + " is with me.");
+ await e.Channel.SendMessage(e.User.Mention + " I am great as long as " + kw.Mention + " is with me.");
} else {
- await e.Send(e.User.Mention + " I am sad. My Master is not with me.");
+ await e.Channel.SendMessage(e.User.Mention + " I am sad. My Master is not with me.");
}
}
});
@@ -153,15 +153,15 @@ namespace NadekoBot.Modules {
Random r = new Random();
var u = e.Channel.FindUsers(e.GetArg("mention")).FirstOrDefault();
if (u == null) {
- await e.Send("Invalid user specified.");
+ await e.Channel.SendMessage("Invalid user specified.");
return;
}
if (u.Id == NadekoBot.OwnerID) {
- await e.Send("I would never insult my master <3");
+ await e.Channel.SendMessage("I would never insult my master <3");
return;
}
- await e.Send(u.Mention + insults[r.Next(0, insults.Count)]);
+ await e.Channel.SendMessage(u.Mention + insults[r.Next(0, insults.Count)]);
});
cgb.CreateCommand("praise")
@@ -179,15 +179,15 @@ namespace NadekoBot.Modules {
var u = e.Channel.FindUsers(e.GetArg("mention")).FirstOrDefault();
if (u == null) {
- await e.Send("Invalid user specified.");
+ await e.Channel.SendMessage("Invalid user specified.");
return;
}
if (u.Id == NadekoBot.OwnerID) {
- await e.Send(e.User.Mention + " I don't need your permission to praise my beloved Master <3");
+ await e.Channel.SendMessage(e.User.Mention + " I don't need your permission to praise my beloved Master <3");
return;
}
- await e.Send(u.Mention + praises[r.Next(0, praises.Count)]);
+ await e.Channel.SendMessage(u.Mention + praises[r.Next(0, praises.Count)]);
});
cgb.CreateCommand("pat")
@@ -206,7 +206,7 @@ namespace NadekoBot.Modules {
"http://gallery1.anivide.com/_full/65030_1382582341.gif",
"https://49.media.tumblr.com/8e8a099c4eba22abd3ec0f70fd087cce/tumblr_nxovj9oY861ur1mffo1_500.gif ",
};
- await e.Send($"{e.Message.MentionedUsers.First().Mention} {pats[new Random().Next(0, pats.Length)]}");
+ await e.Channel.SendMessage($"{e.Message.MentionedUsers.First().Mention} {pats[new Random().Next(0, pats.Length)]}");
});
cgb.CreateCommand("cry")
@@ -216,13 +216,13 @@ namespace NadekoBot.Modules {
"http://i.imgur.com/3K8DRrU.gif",
"http://i.imgur.com/k58BcAv.gif",
"http://i.imgur.com/I2fLXwo.gif" };
- await e.Send($"(•̥́ _•ૅ。)\n{pats[new Random().Next(0, pats.Length)]}");
+ await e.Channel.SendMessage($"(•̥́ _•ૅ。)\n{pats[new Random().Next(0, pats.Length)]}");
});
cgb.CreateCommand("are you real")
.Description("Useless.")
.Do(async e => {
- await e.Send(e.User.Mention + " I will be soon.");
+ await e.Channel.SendMessage(e.User.Mention + " I will be soon.");
});
cgb.CreateCommand("are you there")
@@ -233,7 +233,7 @@ namespace NadekoBot.Modules {
cgb.CreateCommand("draw")
.Description("Nadeko instructs you to type $draw. Gambling functions start with $")
.Do(async e => {
- await e.Send("Sorry, I don't gamble, type $draw for that function.");
+ await e.Channel.SendMessage("Sorry, I don't gamble, type $draw for that function.");
});
cgb.CreateCommand("fire")
.Description("Shows a unicode fire message. Optional parameter [x] tells her how many times to repeat the fire.\n**Usage**: @NadekoBot fire [x]")
@@ -251,7 +251,7 @@ namespace NadekoBot.Modules {
for (int i = 0; i < count; i++) {
str += firestr;
}
- await e.Send(str);
+ await e.Channel.SendMessage(str);
});
cgb.CreateCommand("rip")
@@ -271,10 +271,10 @@ namespace NadekoBot.Modules {
.Do(async e => {
try {
await (await client.GetInvite(e.Args[0])).Accept();
- await e.Send("I got in!");
+ await e.Channel.SendMessage("I got in!");
}
catch {
- await e.Send("Invalid code.");
+ await e.Channel.SendMessage("Invalid code.");
}
});
}
@@ -302,9 +302,9 @@ namespace NadekoBot.Modules {
}
}
if (msg != null)
- await e.Send($"Last message mentioning you was at {msg.Timestamp}\n**Message from {msg.User.Name}:** {msg.RawText.Replace("@everyone", "@everryone")}");
+ await e.Channel.SendMessage($"Last message mentioning you was at {msg.Timestamp}\n**Message from {msg.User.Name}:** {msg.RawText.Replace("@everyone", "@everryone")}");
else
- await e.Send("I can't find a message mentioning you.");
+ await e.Channel.SendMessage("I can't find a message mentioning you.");
});
cgb.CreateCommand("bb")
@@ -316,14 +316,14 @@ namespace NadekoBot.Modules {
if (u.Id != NadekoBot.client.CurrentUser.Id)
str += " " + u.Mention;
}
- await e.Send(str);
+ await e.Channel.SendMessage(str);
});
cgb.CreateCommand("call")
.Description("Useless. Writes calling @X to chat.\n**Usage**: @NadekoBot call @X ")
.Parameter("who", ParameterType.Required)
.Do(async e => {
- await e.Send("Calling " + e.Args[0].Replace("@everyone", "[everyone]") + "...");
+ await e.Channel.SendMessage("Calling " + e.Args[0].Replace("@everyone", "[everyone]") + "...");
});
cgb.CreateCommand("hide")
.Description("Hides nadeko in plain sight!11!!")
@@ -331,7 +331,7 @@ namespace NadekoBot.Modules {
using (Stream ms = Resources.hidden.ToStream(ImageFormat.Png)) {
await client.CurrentUser.Edit(NadekoBot.password, avatar: ms);
}
- await e.Send("*hides*");
+ await e.Channel.SendMessage("*hides*");
});
cgb.CreateCommand("unhide")
@@ -340,7 +340,7 @@ namespace NadekoBot.Modules {
using (FileStream fs = new FileStream("data/avatar.png", FileMode.Open)) {
await client.CurrentUser.Edit(NadekoBot.password, avatar: fs);
}
- await e.Send("*unhides*");
+ await e.Channel.SendMessage("*unhides*");
});
cgb.CreateCommand("dump")
@@ -361,7 +361,7 @@ namespace NadekoBot.Modules {
}
}
File.WriteAllText("dump.txt", invites);
- await e.Send($"Got invites for {i} servers and failed to get invites for {j} servers");
+ await e.Channel.SendMessage($"Got invites for {i} servers and failed to get invites for {j} servers");
});
cgb.CreateCommand("ab")
@@ -373,7 +373,7 @@ namespace NadekoBot.Modules {
while (cnt-- > 0) {
construct += strings[rng.Next(0, strings.Length)];
}
- await e.Send(construct);
+ await e.Channel.SendMessage(construct);
});
cgb.CreateCommand("av").Alias("avatar")
@@ -382,10 +382,10 @@ namespace NadekoBot.Modules {
.Do(async e => {
var usr = e.Channel.FindUsers(e.GetArg("mention")).FirstOrDefault();
if (usr == null) {
- await e.Send("Invalid user specified.");
+ await e.Channel.SendMessage("Invalid user specified.");
return;
}
- await e.Send(await usr.AvatarUrl.ShortenUrl());
+ await e.Channel.SendMessage(await usr.AvatarUrl.ShortenUrl());
});
/*
string saved = "";
@@ -405,7 +405,7 @@ namespace NadekoBot.Modules {
.Parameter("arg", ParameterType.Required)
.Do(async e => {
var arg = e.GetArg("arg");
- await e.Send("```"+saved+"```");
+ await e.Channel.SendMessage("```"+saved+"```");
});
*/
//TODO add eval
@@ -417,7 +417,7 @@ namespace NadekoBot.Modules {
if (e.Message.User.Id == NadekoBot.OwnerId)
{
var result = await CSharpScript.EvaluateAsync(e.Args[0]);
- await e.Send( result?.ToString() ?? "null");
+ await e.Channel.SendMessage( result?.ToString() ?? "null");
return;
}
});*/
@@ -446,6 +446,6 @@ namespace NadekoBot.Modules {
}
private Func SayYes()
- => async e => await e.Send("Yes. :)");
+ => async e => await e.Channel.SendMessage("Yes. :)");
}
}
diff --git a/NadekoBot/Modules/Games.cs b/NadekoBot/Modules/Games.cs
index e355e60d..b6864c6d 100644
--- a/NadekoBot/Modules/Games.cs
+++ b/NadekoBot/Modules/Games.cs
@@ -41,7 +41,7 @@ namespace NadekoBot.Modules
var list = arg.Split(';');
if (list.Count() < 2)
return;
- await e.Send(list[new Random().Next(0, list.Length)]);
+ await e.Channel.SendMessage(list[new Random().Next(0, list.Length)]);
});
cgb.CreateCommand(">8ball")
@@ -73,7 +73,7 @@ namespace NadekoBot.Modules
else if (dmg <= 35) {
response += "Ineffective!";
}
- await e.Send($"{ e.User.Mention }{GetImage(GetType(e.User.Id))} {response}");
+ await e.Channel.SendMessage($"{ e.User.Mention }{GetImage(GetType(e.User.Id))} {response}");
});
cgb.CreateCommand("poketype")
@@ -83,10 +83,10 @@ namespace NadekoBot.Modules
{
var usr = e.Server.FindUsers(e.GetArg("target")).FirstOrDefault();
if (usr == null) {
- await e.Send("No such person.");
+ await e.Channel.SendMessage("No such person.");
}
var t = GetType(usr.Id);
- await e.Send($"{usr.Name}'s type is {GetImage(t)} {t}");
+ await e.Channel.SendMessage($"{usr.Name}'s type is {GetImage(t)} {t}");
});
});
}
diff --git a/NadekoBot/Modules/Music.cs b/NadekoBot/Modules/Music.cs
index b3da08cb..5062d328 100644
--- a/NadekoBot/Modules/Music.cs
+++ b/NadekoBot/Modules/Music.cs
@@ -58,9 +58,9 @@ namespace NadekoBot.Modules {
.Do(async e => {
if (musicPlayers.ContainsKey(e.Server) == false) return;
if (musicPlayers[e.Server].TogglePause())
- await e.Send("🎵`Music player paused.`");
+ await e.Channel.SendMessage("🎵`Music player paused.`");
else
- await e.Send("🎵`Music player unpaused.`");
+ await e.Channel.SendMessage("🎵`Music player unpaused.`");
});
cgb.CreateCommand("q")
@@ -74,16 +74,16 @@ namespace NadekoBot.Modules {
.Description("Lists up to 10 currently queued songs.")
.Do(async e => {
if (musicPlayers.ContainsKey(e.Server) == false) {
- await e.Send("🎵 No active music player.");
+ await e.Channel.SendMessage("🎵 No active music player.");
return;
}
var player = musicPlayers[e.Server];
string toSend = "🎵 **" + player.SongQueue.Count + "** `videos currently queued.` ";
if (player.SongQueue.Count >= 25)
toSend += "**Song queue is full!**\n";
- await e.Send(toSend);
+ await e.Channel.SendMessage(toSend);
int number = 1;
- await e.Send(string.Join("\n", player.SongQueue.Take(10).Select(v => $"`{number++}.` {v.FullPrettyName}")));
+ await e.Channel.SendMessage(string.Join("\n", player.SongQueue.Take(10).Select(v => $"`{number++}.` {v.FullPrettyName}")));
});
cgb.CreateCommand("np")
@@ -92,7 +92,7 @@ namespace NadekoBot.Modules {
.Do(async e => {
if (musicPlayers.ContainsKey(e.Server) == false) return;
var player = musicPlayers[e.Server];
- await e.Send($"🎵`Now Playing` {player.CurrentSong.FullPrettyName}");
+ await e.Channel.SendMessage($"🎵`Now Playing` {player.CurrentSong.FullPrettyName}");
});
cgb.CreateCommand("vol")
@@ -104,11 +104,11 @@ namespace NadekoBot.Modules {
var arg = e.GetArg("val");
int volume;
if (!int.TryParse(arg, out volume)) {
- await e.Send("Volume number invalid.");
+ await e.Channel.SendMessage("Volume number invalid.");
return;
}
volume = player.SetVolume(volume);
- await e.Send($"🎵 `Volume set to {volume}%`");
+ await e.Channel.SendMessage($"🎵 `Volume set to {volume}%`");
});
cgb.CreateCommand("dv")
@@ -119,11 +119,11 @@ namespace NadekoBot.Modules {
var arg = e.GetArg("val");
float volume;
if (!float.TryParse(arg, out volume) || volume < 0 || volume > 100) {
- await e.Send("Volume number invalid.");
+ await e.Channel.SendMessage("Volume number invalid.");
return;
}
musicVolumes.AddOrUpdate(e.Server.Id, volume / 100, (key, newval) => volume / 100);
- await e.Send($"🎵 `Default volume set to {volume}%`");
+ await e.Channel.SendMessage($"🎵 `Default volume set to {volume}%`");
});
cgb.CreateCommand("min").Alias("mute")
@@ -156,12 +156,12 @@ namespace NadekoBot.Modules {
if (musicPlayers.ContainsKey(e.Server) == false) return;
var player = musicPlayers[e.Server];
if (player.SongQueue.Count < 2) {
- await e.Send("Not enough songs in order to perform the shuffle.");
+ await e.Channel.SendMessage("Not enough songs in order to perform the shuffle.");
return;
}
player.SongQueue.Shuffle();
- await e.Send("🎵 `Songs shuffled.`");
+ await e.Channel.SendMessage("🎵 `Songs shuffled.`");
});
bool setgameEnabled = false;
@@ -182,7 +182,7 @@ namespace NadekoBot.Modules {
else
setgameTimer.Stop();
- await e.Send("`Music status " + (setgameEnabled ? "enabled`" : "disabled`"));
+ await e.Channel.SendMessage("`Music status " + (setgameEnabled ? "enabled`" : "disabled`"));
});
cgb.CreateCommand("pl")
@@ -190,12 +190,12 @@ namespace NadekoBot.Modules {
.Parameter("playlist", ParameterType.Unparsed)
.Do(async e => {
if (e.User.VoiceChannel?.Server != e.Server) {
- await e.Send("💢 You need to be in the voice channel on this server.");
+ await e.Channel.SendMessage("💢 You need to be in the voice channel on this server.");
return;
}
var ids = await SearchHelper.GetVideoIDs(await SearchHelper.GetPlaylistIdByKeyword(e.GetArg("playlist")));
//todo TEMPORARY SOLUTION, USE RESOLVE QUEUE IN THE FUTURE
- var msg = await e.Send($"🎵 `Attempting to queue **{ids.Count}** songs".SnPl(ids.Count)+"...`");
+ var msg = await e.Channel.SendMessage($"🎵 `Attempting to queue **{ids.Count}** songs".SnPl(ids.Count)+"...`");
foreach (var id in ids) {
Task.Run(async () => await QueueSong(e, id, true)).ConfigureAwait(false);
await Task.Delay(150);
@@ -208,7 +208,7 @@ namespace NadekoBot.Modules {
.Parameter("radio_link", ParameterType.Required)
.Do(async e => {
if (e.User.VoiceChannel?.Server != e.Server) {
- await e.Send("💢 You need to be in the voice channel on this server.");
+ await e.Channel.SendMessage("💢 You need to be in the voice channel on this server.");
return;
}
await QueueSong(e, e.GetArg("radio_link"), radio: true);
@@ -235,7 +235,7 @@ namespace NadekoBot.Modules {
}
if (arg?.ToLower() == "all") {
mc.SongQueue?.Clear();
- await e.Send($"🎵Queue cleared!");
+ await e.Channel.SendMessage($"🎵Queue cleared!");
return;
}
int num;
@@ -246,7 +246,7 @@ namespace NadekoBot.Modules {
return;
mc.SongQueue.RemoveAt(num - 1);
- await e.Send($"🎵Song at position `{num}` has been removed.");
+ await e.Channel.SendMessage($"🎵Song at position `{num}` has been removed.");
});
cgb.CreateCommand("debug")
@@ -263,7 +263,7 @@ namespace NadekoBot.Modules {
private async Task QueueSong(CommandEventArgs e, string query, bool silent = false, bool radio = false) {
if (e.User.VoiceChannel?.Server != e.Server) {
- await e.Send("💢 You need to be in the voice channel on this server.");
+ await e.Channel.SendMessage("💢 You need to be in the voice channel on this server.");
return;
}
@@ -284,7 +284,7 @@ namespace NadekoBot.Modules {
vol = throwAway;
if (!musicPlayers.TryAdd(e.Server, new MusicControls(e.User.VoiceChannel, e, vol))) {
- await e.Send("Failed to create a music player for this server.");
+ await e.Channel.SendMessage("Failed to create a music player for this server.");
return;
}
}
@@ -316,23 +316,23 @@ namespace NadekoBot.Modules {
if (mc.SongQueue.Count == 0)
mc.Stop();
}
- await e.Send($"🎵`Finished`{sr.FullPrettyName}");
+ await e.Channel.SendMessage($"🎵`Finished`{sr.FullPrettyName}");
};
sr.OnStarted += async () => {
var msgTxt = $"🎵`Playing`{sr.FullPrettyName} `Vol: {(int)(player.Volume * 100)}%`";
if (msg == null)
- await e.Send(msgTxt);
+ await e.Channel.SendMessage(msgTxt);
else
await msg.Edit(msgTxt);
qmsg?.Delete();
};
sr.OnBuffering += async () => {
- msg = await e.Send($"🎵`Buffering...`{sr.FullPrettyName}");
+ msg = await e.Channel.SendMessage($"🎵`Buffering...`{sr.FullPrettyName}");
};
await sr.Resolve();
} catch (Exception ex) {
Console.WriteLine();
- await e.Send($"💢 {ex.Message}");
+ await e.Channel.SendMessage($"💢 {ex.Message}");
return;
}
}
diff --git a/NadekoBot/Modules/NSFW.cs b/NadekoBot/Modules/NSFW.cs
index 7ce45158..581f55de 100644
--- a/NadekoBot/Modules/NSFW.cs
+++ b/NadekoBot/Modules/NSFW.cs
@@ -26,8 +26,8 @@ namespace NadekoBot.Modules {
string tag = e.GetArg("tag");
if (tag == null)
tag = "";
- await e.Send(":heart: Gelbooru: " + await SearchHelper.GetGelbooruImageLink(tag));
- await e.Send(":heart: Danbooru: " + await SearchHelper.GetDanbooruImageLink(tag));
+ await e.Channel.SendMessage(":heart: Gelbooru: " + await SearchHelper.GetGelbooruImageLink(tag));
+ await e.Channel.SendMessage(":heart: Danbooru: " + await SearchHelper.GetDanbooruImageLink(tag));
});
cgb.CreateCommand("~danbooru")
.Description("Shows a random hentai image from danbooru with a given tag. Tag is optional but preffered. (multiple tags are appended with +)\n**Usage**: ~danbooru yuri+kissing")
@@ -36,7 +36,7 @@ namespace NadekoBot.Modules {
string tag = e.GetArg("tag");
if (tag == null)
tag = "";
- await e.Send(await SearchHelper.GetDanbooruImageLink(tag));
+ await e.Channel.SendMessage(await SearchHelper.GetDanbooruImageLink(tag));
});
cgb.CreateCommand("~gelbooru")
.Description("Shows a random hentai image from gelbooru with a given tag. Tag is optional but preffered. (multiple tags are appended with +)\n**Usage**: ~gelbooru yuri+kissing")
@@ -45,7 +45,7 @@ namespace NadekoBot.Modules {
string tag = e.GetArg("tag");
if (tag == null)
tag = "";
- await e.Send(await SearchHelper.GetGelbooruImageLink(tag));
+ await e.Channel.SendMessage(await SearchHelper.GetGelbooruImageLink(tag));
});
cgb.CreateCommand("~e621")
.Description("Shows a random hentai image from e621.net with a given tag. Tag is optional but preffered. Use spaces for multiple tags.\n**Usage**: ~e621 yuri kissing")
@@ -54,22 +54,22 @@ namespace NadekoBot.Modules {
string tag = e.GetArg("tag");
if (tag == null)
tag = "";
- await e.Send(await SearchHelper.GetE621ImageLink(tag));
+ await e.Channel.SendMessage(await SearchHelper.GetE621ImageLink(tag));
});
cgb.CreateCommand("~cp")
.Description("We all know where this will lead you to.")
.Parameter("anything", ParameterType.Unparsed)
.Do(async e => {
- await e.Send("http://i.imgur.com/MZkY1md.jpg");
+ await e.Channel.SendMessage("http://i.imgur.com/MZkY1md.jpg");
});
cgb.CreateCommand("~boobs")
.Description("Real adult content.")
.Do(async e => {
try {
var obj = JArray.Parse(await SearchHelper.GetResponseAsync($"http://api.oboobs.ru/boobs/{_r.Next(0, 9304)}"))[0];
- await e.Send($"http://media.oboobs.ru/{ obj["preview"].ToString() }");
+ await e.Channel.SendMessage($"http://media.oboobs.ru/{ obj["preview"].ToString() }");
} catch (Exception ex) {
- await e.Send($"💢 {ex.Message}");
+ await e.Channel.SendMessage($"💢 {ex.Message}");
}
});
});
diff --git a/NadekoBot/Modules/Permissions.cs b/NadekoBot/Modules/Permissions.cs
index bdff87aa..07f437d6 100644
--- a/NadekoBot/Modules/Permissions.cs
+++ b/NadekoBot/Modules/Permissions.cs
@@ -1,7 +1,7 @@
-using System;
-using Discord.Modules;
-using Discord.Commands;
-using NadekoBot.Extensions;
+using System;
+using Discord.Modules;
+using Discord.Commands;
+using NadekoBot.Extensions;
using NadekoBot.Classes;
using PermsHandler = NadekoBot.Classes.Permissions.PermissionsHandler;
using System.Linq;
@@ -28,7 +28,7 @@ namespace NadekoBot.Modules {
.Parameter("role", ParameterType.Unparsed)
.Do(async e => {
if (string.IsNullOrWhiteSpace(e.GetArg("role"))) {
- await e.Send($"Current permissions role is `{PermsHandler.GetServerPermissionsRoleName(e.Server)}`");
+ await e.Channel.SendMessage($"Current permissions role is `{PermsHandler.GetServerPermissionsRoleName(e.Server)}`");
return;
}
@@ -39,11 +39,11 @@ namespace NadekoBot.Modules {
}
catch (Exception ex) {
Console.WriteLine(ex.Message);
- await e.Send($"Role `{arg}` probably doesn't exist. Create the role with that name first.");
+ await e.Channel.SendMessage($"Role `{arg}` probably doesn't exist. Create the role with that name first.");
return;
}
PermsHandler.SetPermissionsRole(e.Server, role.Name);
- await e.Send($"Role `{role.Name}` is now required in order to change permissions.");
+ await e.Channel.SendMessage($"Role `{role.Name}` is now required in order to change permissions.");
});
cgb.CreateCommand(prefix + "verbose")
@@ -54,7 +54,7 @@ namespace NadekoBot.Modules {
var arg = e.GetArg("arg");
bool val = PermissionHelper.ValidateBool(arg);
PermsHandler.SetVerbosity(e.Server, val);
- await e.Send($"Verbosity set to {val}.");
+ await e.Channel.SendMessage($"Verbosity set to {val}.");
});
cgb.CreateCommand(prefix + "serverperms")
@@ -63,8 +63,8 @@ namespace NadekoBot.Modules {
.Do(async e => {
var perms = PermsHandler.GetServerPermissions(e.Server);
if (string.IsNullOrWhiteSpace(perms?.ToString()))
- await e.Send("No permissions set for this server.");
- await e.Send(perms.ToString());
+ await e.Channel.SendMessage("No permissions set for this server.");
+ await e.Channel.SendMessage(perms.ToString());
});
cgb.CreateCommand(prefix + "roleperms")
@@ -79,15 +79,15 @@ namespace NadekoBot.Modules {
role = PermissionHelper.ValidateRole(e.Server, e.GetArg("role"));
}
catch (Exception ex) {
- await e.Send("💢 Error: " + ex.Message);
+ await e.Channel.SendMessage("💢 Error: " + ex.Message);
return;
}
var perms = PermsHandler.GetRolePermissionsById(e.Server, role.Id);
if (string.IsNullOrWhiteSpace(perms?.ToString()))
- await e.Send($"No permissions set for **{role.Name}** role.");
- await e.Send(perms.ToString());
+ await e.Channel.SendMessage($"No permissions set for **{role.Name}** role.");
+ await e.Channel.SendMessage(perms.ToString());
});
cgb.CreateCommand(prefix + "channelperms")
@@ -102,14 +102,14 @@ namespace NadekoBot.Modules {
channel = PermissionHelper.ValidateChannel(e.Server, e.GetArg("channel"));
}
catch (Exception ex) {
- await e.Send("💢 Error: " + ex.Message);
+ await e.Channel.SendMessage("💢 Error: " + ex.Message);
return;
}
var perms = PermsHandler.GetChannelPermissionsById(e.Server, channel.Id);
if (string.IsNullOrWhiteSpace(perms?.ToString()))
- await e.Send($"No permissions set for **{channel.Name}** channel.");
- await e.Send(perms.ToString());
+ await e.Channel.SendMessage($"No permissions set for **{channel.Name}** channel.");
+ await e.Channel.SendMessage(perms.ToString());
});
cgb.CreateCommand(prefix + "userperms")
@@ -124,14 +124,14 @@ namespace NadekoBot.Modules {
user = PermissionHelper.ValidateUser(e.Server, e.GetArg("user"));
}
catch (Exception ex) {
- await e.Send("💢 Error: " + ex.Message);
+ await e.Channel.SendMessage("💢 Error: " + ex.Message);
return;
}
var perms = PermsHandler.GetUserPermissionsById(e.Server, user.Id);
if (string.IsNullOrWhiteSpace(perms?.ToString()))
- await e.Send($"No permissions set for user **{user.Name}**.");
- await e.Send(perms.ToString());
+ await e.Channel.SendMessage($"No permissions set for user **{user.Name}**.");
+ await e.Channel.SendMessage(perms.ToString());
});
cgb.CreateCommand(prefix + "sm").Alias(prefix + "servermodule")
@@ -144,13 +144,13 @@ namespace NadekoBot.Modules {
bool state = PermissionHelper.ValidateBool(e.GetArg("bool"));
PermsHandler.SetServerModulePermission(e.Server, module, state);
- await e.Send($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** on this server.");
+ await e.Channel.SendMessage($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** on this server.");
}
catch (ArgumentException exArg) {
- await e.Send(exArg.Message);
+ await e.Channel.SendMessage(exArg.Message);
}
catch (Exception ex) {
- await e.Send("Something went terribly wrong - " + ex.Message);
+ await e.Channel.SendMessage("Something went terribly wrong - " + ex.Message);
}
});
@@ -164,13 +164,13 @@ namespace NadekoBot.Modules {
bool state = PermissionHelper.ValidateBool(e.GetArg("bool"));
PermsHandler.SetServerCommandPermission(e.Server, command, state);
- await e.Send($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** on this server.");
+ await e.Channel.SendMessage($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** on this server.");
}
catch (ArgumentException exArg) {
- await e.Send(exArg.Message);
+ await e.Channel.SendMessage(exArg.Message);
}
catch (Exception ex) {
- await e.Send("Something went terribly wrong - " + ex.Message);
+ await e.Channel.SendMessage("Something went terribly wrong - " + ex.Message);
}
});
@@ -188,20 +188,20 @@ namespace NadekoBot.Modules {
foreach (var role in e.Server.Roles) {
PermsHandler.SetRoleModulePermission(role, module, state);
}
- await e.Send($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **ALL** roles.");
+ await e.Channel.SendMessage($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **ALL** roles.");
}
else {
Discord.Role role = PermissionHelper.ValidateRole(e.Server, e.GetArg("role"));
PermsHandler.SetRoleModulePermission(role, module, state);
- await e.Send($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.");
+ await e.Channel.SendMessage($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.");
}
}
catch (ArgumentException exArg) {
- await e.Send(exArg.Message);
+ await e.Channel.SendMessage(exArg.Message);
}
catch (Exception ex) {
- await e.Send("Something went terribly wrong - " + ex.Message);
+ await e.Channel.SendMessage("Something went terribly wrong - " + ex.Message);
}
});
@@ -219,20 +219,20 @@ namespace NadekoBot.Modules {
foreach (var role in e.Server.Roles) {
PermsHandler.SetRoleCommandPermission(role, command, state);
}
- await e.Send($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for **ALL** roles.");
+ await e.Channel.SendMessage($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for **ALL** roles.");
}
else {
Discord.Role role = PermissionHelper.ValidateRole(e.Server, e.GetArg("role"));
PermsHandler.SetRoleCommandPermission(role, command, state);
- await e.Send($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.");
+ await e.Channel.SendMessage($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.");
}
}
catch (ArgumentException exArg) {
- await e.Send(exArg.Message);
+ await e.Channel.SendMessage(exArg.Message);
}
catch (Exception ex) {
- await e.Send("Something went terribly wrong - " + ex.Message);
+ await e.Channel.SendMessage("Something went terribly wrong - " + ex.Message);
}
});
@@ -250,20 +250,20 @@ namespace NadekoBot.Modules {
foreach (var channel in e.Server.TextChannels) {
PermsHandler.SetChannelModulePermission(channel, module, state);
}
- await e.Send($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** on **ALL** channels.");
+ await e.Channel.SendMessage($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** on **ALL** channels.");
}
else {
Discord.Channel channel = PermissionHelper.ValidateChannel(e.Server, e.GetArg("channel"));
PermsHandler.SetChannelModulePermission(channel, module, state);
- await e.Send($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.");
+ await e.Channel.SendMessage($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.");
}
}
catch (ArgumentException exArg) {
- await e.Send(exArg.Message);
+ await e.Channel.SendMessage(exArg.Message);
}
catch (Exception ex) {
- await e.Send("Something went terribly wrong - " + ex.Message);
+ await e.Channel.SendMessage("Something went terribly wrong - " + ex.Message);
}
});
@@ -281,20 +281,20 @@ namespace NadekoBot.Modules {
foreach (var channel in e.Server.TextChannels) {
PermsHandler.SetChannelCommandPermission(channel, command, state);
}
- await e.Send($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** on **ALL** channels.");
+ await e.Channel.SendMessage($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** on **ALL** channels.");
}
else {
Discord.Channel channel = PermissionHelper.ValidateChannel(e.Server, e.GetArg("channel"));
PermsHandler.SetChannelCommandPermission(channel, command, state);
- await e.Send($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.");
+ await e.Channel.SendMessage($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.");
}
}
catch (ArgumentException exArg) {
- await e.Send(exArg.Message);
+ await e.Channel.SendMessage(exArg.Message);
}
catch (Exception ex) {
- await e.Send("Something went terribly wrong - " + ex.Message);
+ await e.Channel.SendMessage("Something went terribly wrong - " + ex.Message);
}
});
@@ -310,13 +310,13 @@ namespace NadekoBot.Modules {
Discord.User user = PermissionHelper.ValidateUser(e.Server, e.GetArg("user"));
PermsHandler.SetUserModulePermission(user, module, state);
- await e.Send($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for user **{user.Name}**.");
+ await e.Channel.SendMessage($"Module **{module}** has been **{(state ? "enabled" : "disabled")}** for user **{user.Name}**.");
}
catch (ArgumentException exArg) {
- await e.Send(exArg.Message);
+ await e.Channel.SendMessage(exArg.Message);
}
catch (Exception ex) {
- await e.Send("Something went terribly wrong - " + ex.Message);
+ await e.Channel.SendMessage("Something went terribly wrong - " + ex.Message);
}
});
@@ -332,13 +332,13 @@ namespace NadekoBot.Modules {
Discord.User user = PermissionHelper.ValidateUser(e.Server, e.GetArg("user"));
PermsHandler.SetUserCommandPermission(user, command, state);
- await e.Send($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for user **{user.Name}**.");
+ await e.Channel.SendMessage($"Command **{command}** has been **{(state ? "enabled" : "disabled")}** for user **{user.Name}**.");
}
catch (ArgumentException exArg) {
- await e.Send(exArg.Message);
+ await e.Channel.SendMessage(exArg.Message);
}
catch (Exception ex) {
- await e.Send("Something went terribly wrong - " + ex.Message);
+ await e.Channel.SendMessage("Something went terribly wrong - " + ex.Message);
}
});
@@ -352,13 +352,13 @@ namespace NadekoBot.Modules {
foreach (var module in NadekoBot.client.GetService().Modules) {
PermsHandler.SetServerModulePermission(e.Server, module.Name, state);
}
- await e.Send($"All modules have been **{(state ? "enabled" : "disabled")}** on this server.");
+ await e.Channel.SendMessage($"All modules have been **{(state ? "enabled" : "disabled")}** on this server.");
}
catch (ArgumentException exArg) {
- await e.Send(exArg.Message);
+ await e.Channel.SendMessage(exArg.Message);
}
catch (Exception ex) {
- await e.Send("Something went terribly wrong - " + ex.Message);
+ await e.Channel.SendMessage("Something went terribly wrong - " + ex.Message);
}
});
@@ -374,13 +374,13 @@ namespace NadekoBot.Modules {
foreach (var command in NadekoBot.client.GetService().AllCommands.Where(c => c.Category == module)) {
PermsHandler.SetServerCommandPermission(e.Server, command.Text, state);
}
- await e.Send($"All commands from the **{module}** module have been **{(state ? "enabled" : "disabled")}** on this server.");
+ await e.Channel.SendMessage($"All commands from the **{module}** module have been **{(state ? "enabled" : "disabled")}** on this server.");
}
catch (ArgumentException exArg) {
- await e.Send(exArg.Message);
+ await e.Channel.SendMessage(exArg.Message);
}
catch (Exception ex) {
- await e.Send("Something went terribly wrong - " + ex.Message);
+ await e.Channel.SendMessage("Something went terribly wrong - " + ex.Message);
}
});
@@ -396,13 +396,13 @@ namespace NadekoBot.Modules {
PermsHandler.SetChannelModulePermission(channel, module.Name, state);
}
- await e.Send($"All modules have been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.");
+ await e.Channel.SendMessage($"All modules have been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.");
}
catch (ArgumentException exArg) {
- await e.Send(exArg.Message);
+ await e.Channel.SendMessage(exArg.Message);
}
catch (Exception ex) {
- await e.Send("Something went terribly wrong - " + ex.Message);
+ await e.Channel.SendMessage("Something went terribly wrong - " + ex.Message);
}
});
@@ -419,13 +419,13 @@ namespace NadekoBot.Modules {
foreach (var command in NadekoBot.client.GetService().AllCommands.Where(c => c.Category == module)) {
PermsHandler.SetChannelCommandPermission(channel, command.Text, state);
}
- await e.Send($"All commands from the **{module}** module have been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.");
+ await e.Channel.SendMessage($"All commands from the **{module}** module have been **{(state ? "enabled" : "disabled")}** for **{channel.Name}** channel.");
}
catch (ArgumentException exArg) {
- await e.Send(exArg.Message);
+ await e.Channel.SendMessage(exArg.Message);
}
catch (Exception ex) {
- await e.Send("Something went terribly wrong - " + ex.Message);
+ await e.Channel.SendMessage("Something went terribly wrong - " + ex.Message);
}
});
@@ -441,13 +441,13 @@ namespace NadekoBot.Modules {
PermsHandler.SetRoleModulePermission(role, module.Name, state);
}
- await e.Send($"All modules have been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.");
+ await e.Channel.SendMessage($"All modules have been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.");
}
catch (ArgumentException exArg) {
- await e.Send(exArg.Message);
+ await e.Channel.SendMessage(exArg.Message);
}
catch (Exception ex) {
- await e.Send("Something went terribly wrong - " + ex.Message);
+ await e.Channel.SendMessage("Something went terribly wrong - " + ex.Message);
}
});
@@ -464,13 +464,13 @@ namespace NadekoBot.Modules {
foreach (var command in NadekoBot.client.GetService().AllCommands.Where(c => c.Category == module)) {
PermsHandler.SetRoleCommandPermission(role, command.Text, state);
}
- await e.Send($"All commands from the **{module}** module have been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.");
+ await e.Channel.SendMessage($"All commands from the **{module}** module have been **{(state ? "enabled" : "disabled")}** for **{role.Name}** role.");
}
catch (ArgumentException exArg) {
- await e.Send(exArg.Message);
+ await e.Channel.SendMessage(exArg.Message);
}
catch (Exception ex) {
- await e.Send("Something went terribly wrong - " + ex.Message);
+ await e.Channel.SendMessage("Something went terribly wrong - " + ex.Message);
}
});
});
diff --git a/NadekoBot/Modules/Searches.cs b/NadekoBot/Modules/Searches.cs
index 27bebe5d..c2581edc 100644
--- a/NadekoBot/Modules/Searches.cs
+++ b/NadekoBot/Modules/Searches.cs
@@ -34,10 +34,10 @@ namespace NadekoBot.Modules {
var str = await SearchHelper.ShortenUrl(await SearchHelper.FindYoutubeUrlByKeywords(e.GetArg("query")));
if (string.IsNullOrEmpty(str.Trim())) {
- await e.Send("Query failed");
+ await e.Channel.SendMessage("Query failed");
return;
}
- await e.Send(str);
+ await e.Channel.SendMessage(str);
});
cgb.CreateCommand("~ani")
@@ -49,11 +49,11 @@ namespace NadekoBot.Modules {
var result = await SearchHelper.GetAnimeQueryResultLink(e.GetArg("query"));
if (result == null) {
- await e.Send("Failed to find that anime.");
+ await e.Channel.SendMessage("Failed to find that anime.");
return;
}
- await e.Send(result.ToString());
+ await e.Channel.SendMessage(result.ToString());
});
cgb.CreateCommand("~mang")
@@ -65,17 +65,17 @@ namespace NadekoBot.Modules {
var result = await SearchHelper.GetMangaQueryResultLink(e.GetArg("query"));
if (result == null) {
- await e.Send("Failed to find that anime.");
+ await e.Channel.SendMessage("Failed to find that anime.");
return;
}
- await e.Send(result.ToString());
+ await e.Channel.SendMessage(result.ToString());
});
cgb.CreateCommand("~randomcat")
.Description("Shows a random cat image.")
.Do(async e => {
try {
- await e.Send(JObject.Parse(new StreamReader(
+ await e.Channel.SendMessage(JObject.Parse(new StreamReader(
WebRequest.Create("http://www.random.cat/meow")
.GetResponse()
.GetResponseStream())
@@ -93,10 +93,10 @@ namespace NadekoBot.Modules {
try {
var reqString = $"https://www.googleapis.com/customsearch/v1?q={Uri.EscapeDataString(e.GetArg("query"))}&cx=018084019232060951019%3Ahs5piey28-e&num=1&searchType=image&fields=items%2Flink&key={NadekoBot.creds.GoogleAPIKey}";
var obj = JObject.Parse(await SearchHelper.GetResponseAsync(reqString));
- await e.Send(obj["items"][0]["link"].ToString());
+ await e.Channel.SendMessage(obj["items"][0]["link"].ToString());
}
catch (Exception ex) {
- await e.Send($"💢 {ex.Message}");
+ await e.Channel.SendMessage($"💢 {ex.Message}");
}
});
@@ -109,10 +109,10 @@ namespace NadekoBot.Modules {
try {
var reqString = $"https://www.googleapis.com/customsearch/v1?q={Uri.EscapeDataString(e.GetArg("query"))}&cx=018084019232060951019%3Ahs5piey28-e&num=1&searchType=image&start={ _r.Next(1, 150) }&fields=items%2Flink&key={NadekoBot.creds.GoogleAPIKey}";
var obj = JObject.Parse(await SearchHelper.GetResponseAsync(reqString));
- await e.Send(obj["items"][0]["link"].ToString());
+ await e.Channel.SendMessage(obj["items"][0]["link"].ToString());
}
catch (Exception ex) {
- await e.Send($"💢 {ex.Message}");
+ await e.Channel.SendMessage($"💢 {ex.Message}");
}
});
cgb.CreateCommand("lmgtfy")
@@ -121,7 +121,7 @@ namespace NadekoBot.Modules {
.Parameter("ffs", ParameterType.Unparsed)
.Do(async e => {
if (e.GetArg("ffs") == null || e.GetArg("ffs").Length < 1) return;
- await e.Send(await $"http://lmgtfy.com/?q={ Uri.EscapeUriString(e.GetArg("ffs").ToString()) }".ShortenUrl());
+ await e.Channel.SendMessage(await $"http://lmgtfy.com/?q={ Uri.EscapeUriString(e.GetArg("ffs").ToString()) }".ShortenUrl());
});
cgb.CreateCommand("~hs")
@@ -130,7 +130,7 @@ namespace NadekoBot.Modules {
.Do(async e => {
var arg = e.GetArg("name");
if (string.IsNullOrWhiteSpace(arg)) {
- await e.Send("💢 Please enter a card name to search for.");
+ await e.Channel.SendMessage("💢 Please enter a card name to search for.");
return;
}
await e.Channel.SendIsTyping();
@@ -153,14 +153,14 @@ namespace NadekoBot.Modules {
images.Add(System.Drawing.Bitmap.FromStream(await SearchHelper.GetResponseStream(item["img"].ToString())));
}
if (items.Count > 4) {
- await e.Send("⚠ Found over 4 images. Showing random 4.");
+ await e.Channel.SendMessage("⚠ Found over 4 images. Showing random 4.");
}
Console.WriteLine("Start");
await e.Channel.SendFile(arg + ".png", (await images.MergeAsync()).ToStream(System.Drawing.Imaging.ImageFormat.Png));
Console.WriteLine("Finish");
}
catch (Exception ex) {
- await e.Send($"💢 Error {ex.Message}");
+ await e.Channel.SendMessage($"💢 Error {ex.Message}");
}
});
@@ -179,7 +179,7 @@ namespace NadekoBot.Modules {
cl.DownloadDataCompleted += async (s, cle) => {
try {
await e.Channel.SendFile($"{e.GetArg("usr")}.png", new MemoryStream(cle.Result));
- await e.Send($"`Profile Link:`https://osu.ppy.sh/u/{Uri.EscapeDataString(e.GetArg("usr"))}\n`Image provided by https://lemmmy.pw/osusig`");
+ await e.Channel.SendMessage($"`Profile Link:`https://osu.ppy.sh/u/{Uri.EscapeDataString(e.GetArg("usr"))}\n`Image provided by https://lemmmy.pw/osusig`");
}
catch { }
};
@@ -196,7 +196,7 @@ namespace NadekoBot.Modules {
.Do(async e => {
var arg = e.GetArg("query");
if (string.IsNullOrWhiteSpace(arg)) {
- await e.Send("💢 Please enter a search term.");
+ await e.Channel.SendMessage("💢 Please enter a search term.");
return;
}
await e.Channel.SendIsTyping();
@@ -209,7 +209,7 @@ namespace NadekoBot.Modules {
sb.AppendLine($"`Term:` {items["list"][0]["word"].ToString()}");
sb.AppendLine($"`Definition:` {items["list"][0]["definition"].ToString()}");
sb.Append($"`Link:` <{await items["list"][0]["permalink"].ToString().ShortenUrl()}>");
- await e.Send(sb.ToString());
+ await e.Channel.SendMessage(sb.ToString());
}
catch {
await e.Channel.SendMessage("💢 Failed finding a definition for that term.");
@@ -222,7 +222,7 @@ namespace NadekoBot.Modules {
.Do(async e => {
var arg = e.GetArg("query");
if (string.IsNullOrWhiteSpace(arg)) {
- await e.Send("💢 Please enter a search term.");
+ await e.Channel.SendMessage("💢 Please enter a search term.");
return;
}
await e.Channel.SendIsTyping();
@@ -235,7 +235,7 @@ namespace NadekoBot.Modules {
sb.AppendLine($"`Hashtag:` {items["defs"]["def"]["hashtag"].ToString()}");
sb.AppendLine($"`Definition:` {items["defs"]["def"]["text"].ToString()}");
sb.Append($"`Link:` <{await items["defs"]["def"]["uri"].ToString().ShortenUrl()}>");
- await e.Send(sb.ToString());
+ await e.Channel.SendMessage(sb.ToString());
}
catch {
await e.Channel.SendMessage("💢 Failed finidng a definition for that tag");
@@ -251,7 +251,7 @@ namespace NadekoBot.Modules {
var osuName = e.GetArg("osu_name");
var usr = e.Server.FindUsers(userName).FirstOrDefault();
if (usr == null) {
- await e.Send("Cannot find that discord user.");
+ await e.Channel.SendMessage("Cannot find that discord user.");
return;
}
});
diff --git a/NadekoBot/Modules/Trello.cs b/NadekoBot/Modules/Trello.cs
index d7088422..972f5a91 100644
--- a/NadekoBot/Modules/Trello.cs
+++ b/NadekoBot/Modules/Trello.cs
@@ -83,7 +83,7 @@ namespace NadekoBot.Modules {
bound = e.Channel;
board = new Board(e.GetArg("board_id").Trim());
board.Refresh();
- await e.Send("Successfully bound to this channel and board " + board.Name);
+ await e.Channel.SendMessage("Successfully bound to this channel and board " + board.Name);
t.Start();
} catch (Exception ex) {
Console.WriteLine("Failed to join the board. " + ex.ToString());
@@ -98,7 +98,7 @@ namespace NadekoBot.Modules {
t.Stop();
bound = null;
board = null;
- await e.Send("Successfully unbound trello from this channel.");
+ await e.Channel.SendMessage("Successfully unbound trello from this channel.");
});
@@ -108,7 +108,7 @@ namespace NadekoBot.Modules {
.Do(async e => {
if (e.User.Id != NadekoBot.OwnerID) return;
if (bound == null || board == null || bound != e.Channel) return;
- await e.Send("Lists for a board '" + board.Name + "'\n" + string.Join("\n", board.Lists.Select(l => "**• " + l.ToString() + "**")));
+ await e.Channel.SendMessage("Lists for a board '" + board.Name + "'\n" + string.Join("\n", board.Lists.Select(l => "**• " + l.ToString() + "**")));
});
cgb.CreateCommand("cards")
@@ -128,9 +128,9 @@ namespace NadekoBot.Modules {
if (list != null)
- await e.Send("There are " + list.Cards.Count() + " cards in a **" + list.Name + "** list\n" + string.Join("\n", list.Cards.Select(c => "**• " + c.ToString() + "**")));
+ await e.Channel.SendMessage("There are " + list.Cards.Count() + " cards in a **" + list.Name + "** list\n" + string.Join("\n", list.Cards.Select(c => "**• " + c.ToString() + "**")));
else
- await e.Send("No such list.");
+ await e.Channel.SendMessage("No such list.");
});
});
}
diff --git a/NadekoBot/NadekoBot.cs b/NadekoBot/NadekoBot.cs
index 98cce609..b89510aa 100644
--- a/NadekoBot/NadekoBot.cs
+++ b/NadekoBot/NadekoBot.cs
@@ -159,12 +159,12 @@ namespace NadekoBot {
if (!NadekoBot.creds.DontJoinServers) {
try {
await (await client.GetInvite(e.Message.Text)).Accept();
- await e.Send("I got in!");
+ await e.Channel.SendMessage("I got in!");
return;
}
catch {
if (e.User.Id == 109338686889476096) { //carbonitex invite
- await e.Send("Failed to join the server.");
+ await e.Channel.SendMessage("Failed to join the server.");
return;
}
}
@@ -175,7 +175,7 @@ namespace NadekoBot {
if (!repliedRecently) {
repliedRecently = true;
- await e.Send("**FULL LIST OF COMMANDS**:\n❤ ❤\n\n⚠**COMMANDS DO NOT WORK IN PERSONAL MESSAGES**\n\n\n**Bot Creator's server:** ");
+ await e.Channel.SendMessage("**FULL LIST OF COMMANDS**:\n❤ ❤\n\n⚠**COMMANDS DO NOT WORK IN PERSONAL MESSAGES**\n\n\n**Bot Creator's server:** ");
Timer t = new Timer();
t.Interval = 2000;
t.Start();