Made an extension to client.SendMessage
await client.SendMessage(e.Channel,msg); is now await e.Send(msg); also added e.reply. It mentions the user first and then prints the message. c# ftw
This commit is contained in:
parent
2d1b2a861f
commit
741e1d0227
@ -4,6 +4,8 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
using Discord.Commands;
|
||||||
|
using Discord;
|
||||||
|
|
||||||
namespace NadekoBot
|
namespace NadekoBot
|
||||||
{
|
{
|
||||||
@ -25,6 +27,37 @@ namespace NadekoBot
|
|||||||
return "`"+string.Join(" ", letters)+"`";
|
return "`"+string.Join(" ", letters)+"`";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sends a message to the channel from which this command is called.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e">EventArg</param>
|
||||||
|
/// <param name="message">Message to be sent</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task<Message> Send(this CommandEventArgs e, string message)
|
||||||
|
{
|
||||||
|
return await NadekoBot.client.SendMessage(e.Channel, message);
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// Sends a message to the channel from which MessageEventArg came.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="e">EventArg</param>
|
||||||
|
/// <param name="message">Message to be sent</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static async Task Send(this MessageEventArgs e, string message)
|
||||||
|
{
|
||||||
|
await NadekoBot.client.SendMessage(e.Channel, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task Reply(this CommandEventArgs e, string message)
|
||||||
|
{
|
||||||
|
await NadekoBot.client.SendMessage(e.Channel, e.User.Mention + " " + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task Reply(this MessageEventArgs e, string message)
|
||||||
|
{
|
||||||
|
await NadekoBot.client.SendMessage(e.Channel, e.User.Mention + " " + message);
|
||||||
|
}
|
||||||
|
|
||||||
public static void Shuffle<T>(this IList<T> list)
|
public static void Shuffle<T>(this IList<T> list)
|
||||||
{
|
{
|
||||||
RNGCryptoServiceProvider provider = new RNGCryptoServiceProvider();
|
RNGCryptoServiceProvider provider = new RNGCryptoServiceProvider();
|
||||||
|
@ -42,10 +42,10 @@ namespace NadekoBot
|
|||||||
TriviaGame tg;
|
TriviaGame tg;
|
||||||
if ((tg = StartNewGame(e))!=null)
|
if ((tg = StartNewGame(e))!=null)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "**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.\nTyping [idfk] 15 seconds after the question has started will give you a hint.");
|
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.\nTyping [idfk] 15 seconds after the question has started will give you a hint.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
await client.SendMessage(e.Channel, "Trivia game is already running on this server. The question is:\n**"+GetCurrentQuestion(e.Server.Id).Question+"**");
|
await e.Send( "Trivia game is already running on this server. The question is:\n**"+GetCurrentQuestion(e.Server.Id).Question+"**");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,10 +56,10 @@ namespace NadekoBot
|
|||||||
if (runningTrivias.ContainsKey(e.Server.Id))
|
if (runningTrivias.ContainsKey(e.Server.Id))
|
||||||
{
|
{
|
||||||
var lb = runningTrivias[e.User.Server.Id].GetLeaderboard();
|
var lb = runningTrivias[e.User.Server.Id].GetLeaderboard();
|
||||||
await client.SendMessage(e.Channel, lb);
|
await e.Send( lb);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
await client.SendMessage(e.Channel, "Trivia game is not running on this server.");
|
await e.Send( "Trivia game is not running on this server.");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,10 +70,10 @@ namespace NadekoBot
|
|||||||
if (runningTrivias.ContainsKey(e.Server.Id))
|
if (runningTrivias.ContainsKey(e.Server.Id))
|
||||||
{
|
{
|
||||||
var lb = runningTrivias[e.User.Server.Id].GetLeaderboard();
|
var lb = runningTrivias[e.User.Server.Id].GetLeaderboard();
|
||||||
await client.SendMessage(e.Channel, lb);
|
await e.Send( lb);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
await client.SendMessage(e.Channel, "Trivia game is not running on this server.");
|
await e.Send( "Trivia game is not running on this server.");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,10 +103,10 @@ namespace NadekoBot
|
|||||||
{
|
{
|
||||||
if (runningTrivias.ContainsKey(e.Server.Id) && runningTrivias[e.Server.Id].ChannelId ==e.Channel.Id)
|
if (runningTrivias.ContainsKey(e.Server.Id) && runningTrivias[e.Server.Id].ChannelId ==e.Channel.Id)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "Trivia will stop after this question. Run [**@NadekoBot clr**] to remove this bot's messages from the channel.");
|
await e.Send( "Trivia will stop after this question. Run [**@NadekoBot clr**] to remove this bot's messages from the channel.");
|
||||||
runningTrivias[e.Server.Id].StopGame();
|
runningTrivias[e.Server.Id].StopGame();
|
||||||
}
|
}
|
||||||
else await client.SendMessage(e.Channel, "No trivias are running on this channel.");
|
else await e.Send( "No trivias are running on this channel.");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,10 +181,10 @@ namespace NadekoBot
|
|||||||
{
|
{
|
||||||
users[e.User.Id]++;
|
users[e.User.Id]++;
|
||||||
}
|
}
|
||||||
await client.SendMessage(e.Channel, e.User.Mention + " Guessed it!\n The answer was: **" + currentQuestion.Answer + "**");
|
await e.Send( e.User.Mention + " Guessed it!\n The answer was: **" + currentQuestion.Answer + "**");
|
||||||
|
|
||||||
if (users[e.User.Id] >= 10) {
|
if (users[e.User.Id] >= 10) {
|
||||||
await client.SendMessage(e.Channel, " We have a winner! It's " + e.User.Mention+"\n"+GetLeaderboard()+"\n To start a new game type '@NadekoBot t'");
|
await e.Send( " We have a winner! It's " + e.User.Mention+"\n"+GetLeaderboard()+"\n To start a new game type '@NadekoBot t'");
|
||||||
FinishGame();
|
FinishGame();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -196,9 +196,9 @@ namespace NadekoBot
|
|||||||
|
|
||||||
public async void GetHint(MessageEventArgs e) {
|
public async void GetHint(MessageEventArgs e) {
|
||||||
if (timeout != null && !isQuit && stopwatch.ElapsedMilliseconds > 10000)
|
if (timeout != null && !isQuit && stopwatch.ElapsedMilliseconds > 10000)
|
||||||
await client.SendMessage(e.Channel, currentQuestion.Answer.Scramble());
|
await e.Send( currentQuestion.Answer.Scramble());
|
||||||
else {
|
else {
|
||||||
await client.SendMessage(e.Channel, $"You have to wait {10-stopwatch.ElapsedMilliseconds/1000} more seconds in order to get a hint.");
|
await e.Send( $"You have to wait {10-stopwatch.ElapsedMilliseconds/1000} more seconds in order to get a hint.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ namespace NadekoBot
|
|||||||
private async void Client_MessageReceived(object sender, Discord.MessageEventArgs e)
|
private async void Client_MessageReceived(object sender, Discord.MessageEventArgs e)
|
||||||
{
|
{
|
||||||
if (CopiedUsers.Contains(e.User.Id)) {
|
if (CopiedUsers.Contains(e.User.Id)) {
|
||||||
await client.SendMessage(e.Channel, e.Message.Text);
|
await e.Send( e.Message.Text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ namespace NadekoBot
|
|||||||
if (CopiedUsers.Contains(e.User.Id)) return;
|
if (CopiedUsers.Contains(e.User.Id)) return;
|
||||||
|
|
||||||
CopiedUsers.Add(e.User.Id);
|
CopiedUsers.Add(e.User.Id);
|
||||||
await client.SendMessage(e.Channel, " I'll start copying you now.");
|
await e.Send( " I'll start copying you now.");
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ namespace NadekoBot
|
|||||||
if (!CopiedUsers.Contains(e.User.Id)) return;
|
if (!CopiedUsers.Contains(e.User.Id)) return;
|
||||||
|
|
||||||
CopiedUsers.Remove(e.User.Id);
|
CopiedUsers.Remove(e.User.Id);
|
||||||
await client.SendMessage(e.Channel, " I wont copy anymore.");
|
await e.Send( " I wont copy anymore.");
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ namespace NadekoBot
|
|||||||
if (num < 1) num = 1;
|
if (num < 1) num = 1;
|
||||||
if (num > 30)
|
if (num > 30)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "You can roll up to 30 dies at a time.");
|
await e.Send( "You can roll up to 30 dies at a time.");
|
||||||
num = 30;
|
num = 30;
|
||||||
}
|
}
|
||||||
List<Image> dices = new List<Image>(num);
|
List<Image> dices = new List<Image>(num);
|
||||||
@ -73,12 +73,12 @@ namespace NadekoBot
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bitmap bitmap = ImageHandler.MergeImages(dices.ToArray());
|
Bitmap bitmap = ImageHandler.MergeImages(dices.ToArray());
|
||||||
await client.SendMessage(e.Channel, values.Count + " Dies rolled. Total: **"+values.Sum()+"** Average: **"+(values.Sum()/(1.0f*values.Count)).ToString("N2")+"**");
|
await e.Send( values.Count + " Dies rolled. Total: **"+values.Sum()+"** Average: **"+(values.Sum()/(1.0f*values.Count)).ToString("N2")+"**");
|
||||||
await client.SendFile(e.Channel, "dices.png", ImageHandler.ImageToStream(bitmap, ImageFormat.Png));
|
await client.SendFile(e.Channel, "dices.png", ImageHandler.ImageToStream(bitmap, ImageFormat.Png));
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "Please enter a number of dices to roll.");
|
await e.Send( "Please enter a number of dices to roll.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace NadekoBot
|
|||||||
if (cards == null)
|
if (cards == null)
|
||||||
{
|
{
|
||||||
cards = new Cards();
|
cards = new Cards();
|
||||||
await client.SendMessage(e.Channel, "Shuffling cards...");
|
await e.Send( "Shuffling cards...");
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -38,7 +38,7 @@ namespace NadekoBot
|
|||||||
{
|
{
|
||||||
if (cards.CardPool.Count == 0)
|
if (cards.CardPool.Count == 0)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "No more cards in a deck...\nGetting a new deck...\nShuffling cards...");
|
await e.Send( "No more cards in a deck...\nGetting a new deck...\nShuffling cards...");
|
||||||
}
|
}
|
||||||
images[i] = Image.FromFile(cards.DrawACard().Path);
|
images[i] = Image.FromFile(cards.DrawACard().Path);
|
||||||
}
|
}
|
||||||
|
@ -28,26 +28,26 @@ namespace NadekoBot.Modules
|
|||||||
if (!e.User.ServerPermissions.ManageRoles) return;
|
if (!e.User.ServerPermissions.ManageRoles) return;
|
||||||
var usr = client.FindUsers(e.Server, e.GetArg("user_name")).FirstOrDefault();
|
var usr = client.FindUsers(e.Server, e.GetArg("user_name")).FirstOrDefault();
|
||||||
if (usr == null) {
|
if (usr == null) {
|
||||||
await client.SendMessage(e.Channel, "You failed to supply a valid username");
|
await e.Send( "You failed to supply a valid username");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var role = client.FindRoles(e.Server, e.GetArg("role_name")).FirstOrDefault();
|
var role = client.FindRoles(e.Server, e.GetArg("role_name")).FirstOrDefault();
|
||||||
if (role == null) {
|
if (role == null) {
|
||||||
await client.SendMessage(e.Channel, "You failed to supply a valid role");
|
await e.Send( "You failed to supply a valid role");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await client.EditUser(usr, null, null, new Discord.Role[] { role }, Discord.EditMode.Add);
|
await client.EditUser(usr, null, null, new Discord.Role[] { role }, Discord.EditMode.Add);
|
||||||
await client.SendMessage(e.Channel, $"Successfully added role **{role.Name}** to user **{usr.Mention}**");
|
await e.Send( $"Successfully added role **{role.Name}** to user **{usr.Mention}**");
|
||||||
}
|
}
|
||||||
catch (InvalidOperationException) { //fkin voltana and his shenanigans, fix role.Mention pl0x
|
catch (InvalidOperationException) { //fkin voltana and his shenanigans, fix role.Mention pl0x
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "Failed to add roles. Most likely reason: Insufficient permissions.\n");
|
await e.Send( "Failed to add roles. Most likely reason: Insufficient permissions.\n");
|
||||||
Console.WriteLine(ex.ToString());
|
Console.WriteLine(ex.ToString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -62,27 +62,27 @@ namespace NadekoBot.Modules
|
|||||||
var usr = client.FindUsers(e.Server, e.GetArg("user_name")).FirstOrDefault();
|
var usr = client.FindUsers(e.Server, e.GetArg("user_name")).FirstOrDefault();
|
||||||
if (usr == null)
|
if (usr == null)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "You failed to supply a valid username");
|
await e.Send( "You failed to supply a valid username");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var role = client.FindRoles(e.Server, e.GetArg("role_name")).FirstOrDefault();
|
var role = client.FindRoles(e.Server, e.GetArg("role_name")).FirstOrDefault();
|
||||||
if (role == null)
|
if (role == null)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "You failed to supply a valid role");
|
await e.Send( "You failed to supply a valid role");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await client.EditUser(usr, null, null, new Discord.Role[]{ role }, Discord.EditMode.Remove);
|
await client.EditUser(usr, null, null, new Discord.Role[]{ role }, Discord.EditMode.Remove);
|
||||||
await client.SendMessage(e.Channel, $"Successfully removed role **{role.Name}** from user **{usr.Mention}**");
|
await e.Send( $"Successfully removed role **{role.Name}** from user **{usr.Mention}**");
|
||||||
}
|
}
|
||||||
catch (InvalidOperationException) {
|
catch (InvalidOperationException) {
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "Failed to remove roles. Most likely reason: Insufficient permissions.");
|
await e.Send( "Failed to remove roles. Most likely reason: Insufficient permissions.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ namespace NadekoBot.Modules
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine(ex.ToString());
|
Console.WriteLine(ex.ToString());
|
||||||
await client.SendMessage(e.Channel, "Please supply a proper color.\n Example: DarkBlue, Orange, Teal");
|
await e.Send( "Please supply a proper color.\n Example: DarkBlue, Orange, Teal");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,11 +113,11 @@ namespace NadekoBot.Modules
|
|||||||
{
|
{
|
||||||
var r = await client.CreateRole(e.Server, e.GetArg("role_name"));
|
var r = await client.CreateRole(e.Server, e.GetArg("role_name"));
|
||||||
await client.EditRole(r, null,null, color);
|
await client.EditRole(r, null,null, color);
|
||||||
await client.SendMessage(e.Channel, $"Successfully created role **{r.Mention}**.");
|
await e.Send( $"Successfully created role **{r.Mention}**.");
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "No sufficient permissions.");
|
await e.Send( "No sufficient permissions.");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
});
|
});
|
||||||
@ -132,12 +132,12 @@ namespace NadekoBot.Modules
|
|||||||
{
|
{
|
||||||
var usr = e.Message.MentionedUsers.First();
|
var usr = e.Message.MentionedUsers.First();
|
||||||
await client.BanUser(e.Message.MentionedUsers.First());
|
await client.BanUser(e.Message.MentionedUsers.First());
|
||||||
await client.SendMessage(e.Channel, "Banned user " + usr.Name + " Id: " + usr.Id);
|
await e.Send( "Banned user " + usr.Name + " Id: " + usr.Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "No sufficient permissions.");
|
await e.Send( "No sufficient permissions.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -152,12 +152,12 @@ namespace NadekoBot.Modules
|
|||||||
{
|
{
|
||||||
var usr = e.Message.MentionedUsers.First();
|
var usr = e.Message.MentionedUsers.First();
|
||||||
await client.KickUser(e.Message.MentionedUsers.First());
|
await client.KickUser(e.Message.MentionedUsers.First());
|
||||||
await client.SendMessage(e.Channel,"Kicked user " + usr.Name+" Id: "+usr.Id);
|
await e.Send("Kicked user " + usr.Name+" Id: "+usr.Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "No sufficient permissions.");
|
await e.Send( "No sufficient permissions.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -171,12 +171,12 @@ namespace NadekoBot.Modules
|
|||||||
if (e.User.ServerPermissions.ManageChannels)
|
if (e.User.ServerPermissions.ManageChannels)
|
||||||
{
|
{
|
||||||
await client.DeleteChannel(client.FindChannels(e.Server,e.GetArg("channel_name"),Discord.ChannelType.Voice).FirstOrDefault());
|
await client.DeleteChannel(client.FindChannels(e.Server,e.GetArg("channel_name"),Discord.ChannelType.Voice).FirstOrDefault());
|
||||||
await client.SendMessage(e.Channel, $"Removed channel **{e.GetArg("channel_name")}**.");
|
await e.Send( $"Removed channel **{e.GetArg("channel_name")}**.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "No sufficient permissions.");
|
await e.Send( "No sufficient permissions.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -190,12 +190,12 @@ namespace NadekoBot.Modules
|
|||||||
if (e.User.ServerPermissions.ManageChannels)
|
if (e.User.ServerPermissions.ManageChannels)
|
||||||
{
|
{
|
||||||
await client.CreateChannel(e.Server, e.GetArg("channel_name"), Discord.ChannelType.Voice);
|
await client.CreateChannel(e.Server, e.GetArg("channel_name"), Discord.ChannelType.Voice);
|
||||||
await client.SendMessage(e.Channel, $"Created voice channel **{e.GetArg("channel_name")}**.");
|
await e.Send( $"Created voice channel **{e.GetArg("channel_name")}**.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "No sufficient permissions.");
|
await e.Send( "No sufficient permissions.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -209,12 +209,12 @@ namespace NadekoBot.Modules
|
|||||||
if (e.User.ServerPermissions.ManageChannels)
|
if (e.User.ServerPermissions.ManageChannels)
|
||||||
{
|
{
|
||||||
await client.DeleteChannel(client.FindChannels(e.Server, e.GetArg("channel_name"), Discord.ChannelType.Text).FirstOrDefault());
|
await client.DeleteChannel(client.FindChannels(e.Server, e.GetArg("channel_name"), Discord.ChannelType.Text).FirstOrDefault());
|
||||||
await client.SendMessage(e.Channel, $"Removed text channel **{e.GetArg("channel_name")}**.");
|
await e.Send( $"Removed text channel **{e.GetArg("channel_name")}**.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "No sufficient permissions.");
|
await e.Send( "No sufficient permissions.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -228,11 +228,11 @@ namespace NadekoBot.Modules
|
|||||||
if (e.User.ServerPermissions.ManageChannels)
|
if (e.User.ServerPermissions.ManageChannels)
|
||||||
{
|
{
|
||||||
await client.CreateChannel(e.Server, e.GetArg("channel_name"), Discord.ChannelType.Text);
|
await client.CreateChannel(e.Server, e.GetArg("channel_name"), Discord.ChannelType.Text);
|
||||||
await client.SendMessage(e.Channel, $"Added text channel **{e.GetArg("channel_name")}**.");
|
await e.Send( $"Added text channel **{e.GetArg("channel_name")}**.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception) {
|
catch (Exception) {
|
||||||
await client.SendMessage(e.Channel, "No sufficient permissions.");
|
await e.Send( "No sufficient permissions.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -242,23 +242,23 @@ namespace NadekoBot.Modules
|
|||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
if (e.Message.MentionedUsers.Any())
|
if (e.Message.MentionedUsers.Any())
|
||||||
await client.SendMessage(e.Channel, "Id of the user " + e.Message.MentionedUsers.First().Mention + " is " + e.Message.MentionedUsers.First().Id);
|
await e.Send( "Id of the user " + e.Message.MentionedUsers.First().Mention + " is " + e.Message.MentionedUsers.First().Id);
|
||||||
else
|
else
|
||||||
await client.SendMessage(e.Channel, "You must mention a user.");
|
await e.Send( "You must mention a user.");
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand(".cid").Alias(".channelid")
|
cgb.CreateCommand(".cid").Alias(".channelid")
|
||||||
.Description("Shows current channel id")
|
.Description("Shows current channel id")
|
||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "This channel's id is " + e.Channel.Id);
|
await e.Send( "This channel's id is " + e.Channel.Id);
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand(".sid").Alias(".serverid")
|
cgb.CreateCommand(".sid").Alias(".serverid")
|
||||||
.Description("Shows current server id")
|
.Description("Shows current server id")
|
||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "This server's id is " + e.Server.Id);
|
await e.Send( "This server's id is " + e.Server.Id);
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand(".stats")
|
cgb.CreateCommand(".stats")
|
||||||
@ -270,7 +270,7 @@ namespace NadekoBot.Modules
|
|||||||
var time = (DateTime.Now - Process.GetCurrentProcess().StartTime);
|
var time = (DateTime.Now - Process.GetCurrentProcess().StartTime);
|
||||||
string uptime = " " + time.Days + " days, " + time.Hours + " hours, and " + time.Minutes + " minutes.";
|
string uptime = " " + time.Days + " days, " + time.Hours + " hours, and " + time.Minutes + " minutes.";
|
||||||
|
|
||||||
await client.SendMessage(e.Channel, String.Format("```Servers: {0}\nUnique Users: {1}\nUptime: {2}\nMy id is: {3}```", serverCount, uniqueUserCount, uptime, client.CurrentUser.Id));
|
await e.Send( String.Format("```Servers: {0}\nUnique Users: {1}\nUptime: {2}\nMy id is: {3}```", serverCount, uniqueUserCount, uptime, client.CurrentUser.Id));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -45,14 +45,14 @@ namespace NadekoBot.Modules
|
|||||||
.Description("Nadeko replies with /o/")
|
.Description("Nadeko replies with /o/")
|
||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, e.User.Mention + "/o/");
|
await e.Send( e.User.Mention + "/o/");
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand("/o/")
|
cgb.CreateCommand("/o/")
|
||||||
.Description("Nadeko replies with \\o\\")
|
.Description("Nadeko replies with \\o\\")
|
||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, e.User.Mention + "\\o\\");
|
await e.Send( e.User.Mention + "\\o\\");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -67,9 +67,9 @@ namespace NadekoBot.Modules
|
|||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
if (e.User.Id == NadekoBot.OwnerID)
|
if (e.User.Id == NadekoBot.OwnerID)
|
||||||
await client.SendMessage(e.Channel, e.User.Mention + ", Of course I do, my Master.");
|
await e.Send( e.User.Mention + ", Of course I do, my Master.");
|
||||||
else
|
else
|
||||||
await client.SendMessage(e.Channel, e.User.Mention + ", Don't be silly.");
|
await e.Send( e.User.Mention + ", Don't be silly.");
|
||||||
});
|
});
|
||||||
|
|
||||||
CreateCommand(cgb, "die")
|
CreateCommand(cgb, "die")
|
||||||
@ -82,10 +82,10 @@ namespace NadekoBot.Modules
|
|||||||
t.Interval = 2000;
|
t.Interval = 2000;
|
||||||
t.Elapsed += (s, ev) => { Environment.Exit(0); };
|
t.Elapsed += (s, ev) => { Environment.Exit(0); };
|
||||||
t.Start();
|
t.Start();
|
||||||
await client.SendMessage(e.Channel, e.User.Mention + ", Yes, my love.");
|
await e.Send( e.User.Mention + ", Yes, my love.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
await client.SendMessage(e.Channel, e.User.Mention + ", No.");
|
await e.Send( e.User.Mention + ", No.");
|
||||||
});
|
});
|
||||||
|
|
||||||
CreateCommand(cgb, "how are you")
|
CreateCommand(cgb, "how are you")
|
||||||
@ -94,18 +94,18 @@ namespace NadekoBot.Modules
|
|||||||
{
|
{
|
||||||
if (e.User.Id == NadekoBot.OwnerID)
|
if (e.User.Id == NadekoBot.OwnerID)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, e.User.Mention + " I am great as long as you are here.");
|
await e.Send( e.User.Mention + " I am great as long as you are here.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var kw = client.GetUser(e.Server, NadekoBot.OwnerID);
|
var kw = client.GetUser(e.Server, NadekoBot.OwnerID);
|
||||||
if (kw != null && kw.Status == UserStatus.Online)
|
if (kw != null && kw.Status == UserStatus.Online)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, e.User.Mention + " I am great as long as " + Mention.User(kw) + " is with me.");
|
await e.Send( e.User.Mention + " I am great as long as " + kw.Mention + " is with me.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, e.User.Mention + " I am sad. My Master is not with me.");
|
await e.Send( e.User.Mention + " I am sad. My Master is not with me.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -117,18 +117,24 @@ namespace NadekoBot.Modules
|
|||||||
{
|
{
|
||||||
List<string> insults = new List<string> { " you are a poop.", " you jerk.", " i will eat you when i get my powers back." };
|
List<string> insults = new List<string> { " you are a poop.", " you jerk.", " i will eat you when i get my powers back." };
|
||||||
Random r = new Random();
|
Random r = new Random();
|
||||||
var u = e.Message.MentionedUsers.Last();
|
var u = client.FindUsers(e.Channel,e.GetArg("mention")).FirstOrDefault();
|
||||||
|
|
||||||
|
if (u == null) {
|
||||||
|
await e.Send("Invalid user specified.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (u.Id == NadekoBot.OwnerID)
|
if (u.Id == NadekoBot.OwnerID)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "I would never insult my master <3");
|
await e.Send( "I would never insult my master <3");
|
||||||
}
|
}
|
||||||
else if (e.User.Id == NadekoBot.OwnerID)
|
else if (e.User.Id == NadekoBot.OwnerID)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, Mention.User(u) + insults[r.Next(0, insults.Count)]);
|
await e.Send( e.User.Mention + insults[r.Next(0, insults.Count)]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, e.User.Mention + " Eww, why would i do that for you ?!");
|
await e.Send( e.User.Mention + " Eww, why would i do that for you ?!");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -139,25 +145,32 @@ namespace NadekoBot.Modules
|
|||||||
{
|
{
|
||||||
List<string> praises = new List<string> { " You are cool.", " You are nice... But don't get any wrong ideas.", " You did a good job." };
|
List<string> praises = new List<string> { " You are cool.", " You are nice... But don't get any wrong ideas.", " You did a good job." };
|
||||||
Random r = new Random();
|
Random r = new Random();
|
||||||
var u = e.Message.MentionedUsers.First();
|
var u = client.FindUsers(e.Channel, e.GetArg("mention")).FirstOrDefault();
|
||||||
|
|
||||||
|
if (u == null)
|
||||||
|
{
|
||||||
|
await e.Send("Invalid user specified.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.User.Id == NadekoBot.OwnerID)
|
if (e.User.Id == NadekoBot.OwnerID)
|
||||||
{
|
{
|
||||||
if (u.Id != NadekoBot.OwnerID)
|
if (u.Id != NadekoBot.OwnerID)
|
||||||
await client.SendMessage(e.Channel, Mention.User(u) + praises[r.Next(0, praises.Count)]);
|
await e.Send( u.Mention + praises[r.Next(0, praises.Count)]);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, Mention.User(u) + " No need, you know I love you <3");
|
await e.Send( u.Mention + " No need, you know I love you <3");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (u.Id == NadekoBot.OwnerID)
|
if (u.Id == NadekoBot.OwnerID)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, e.User.Mention + " I don't need your permission to praise my beloved Master <3");
|
await e.Send( e.User.Mention + " I don't need your permission to praise my beloved Master <3");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, e.User.Mention + " Yeah... No.");
|
await e.Send( e.User.Mention + " Yeah... No.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -166,7 +179,7 @@ namespace NadekoBot.Modules
|
|||||||
.Description("Useless.")
|
.Description("Useless.")
|
||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, e.User.Mention + " I will be soon.");
|
await e.Send( e.User.Mention + " I will be soon.");
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand("are you there")
|
cgb.CreateCommand("are you there")
|
||||||
@ -178,7 +191,7 @@ namespace NadekoBot.Modules
|
|||||||
.Description("Nadeko instructs you to type $draw. Gambling functions start with $")
|
.Description("Nadeko instructs you to type $draw. Gambling functions start with $")
|
||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "Sorry i dont gamble, type $draw for that function.");
|
await e.Send( "Sorry i dont gamble, type $draw for that function.");
|
||||||
});
|
});
|
||||||
|
|
||||||
CreateCommand(cgb, "uptime")
|
CreateCommand(cgb, "uptime")
|
||||||
@ -187,7 +200,7 @@ namespace NadekoBot.Modules
|
|||||||
{
|
{
|
||||||
var time = (DateTime.Now - Process.GetCurrentProcess().StartTime);
|
var time = (DateTime.Now - Process.GetCurrentProcess().StartTime);
|
||||||
string str = "I am online for " + time.Days + " days, " + time.Hours + " hours, and " + time.Minutes + " minutes.";
|
string str = "I am online for " + time.Days + " days, " + time.Hours + " hours, and " + time.Minutes + " minutes.";
|
||||||
await client.SendMessage(e.Channel, str);
|
await e.Send( str);
|
||||||
});
|
});
|
||||||
CreateCommand(cgb, "fire")
|
CreateCommand(cgb, "fire")
|
||||||
.Description("Shows a unicode fire message. Optional parameter [x] tells her how many times to repeat the fire.\n**Usage**: @NadekoBot fire [x]")
|
.Description("Shows a unicode fire message. Optional parameter [x] tells her how many times to repeat the fire.\n**Usage**: @NadekoBot fire [x]")
|
||||||
@ -207,7 +220,7 @@ namespace NadekoBot.Modules
|
|||||||
{
|
{
|
||||||
str += firestr;
|
str += firestr;
|
||||||
}
|
}
|
||||||
await client.SendMessage(e.Channel, str);
|
await e.Send( str);
|
||||||
});
|
});
|
||||||
|
|
||||||
CreateCommand(cgb, "rip")
|
CreateCommand(cgb, "rip")
|
||||||
@ -239,11 +252,11 @@ namespace NadekoBot.Modules
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
await client.AcceptInvite(client.GetInvite(e.Args[0]).Result);
|
await client.AcceptInvite(client.GetInvite(e.Args[0]).Result);
|
||||||
await client.SendMessage(e.Channel, "I got in!");
|
await e.Send( "I got in!");
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "Invalid code.");
|
await e.Send( "Invalid code.");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -261,11 +274,11 @@ namespace NadekoBot.Modules
|
|||||||
dynamic obj = JObject.Parse(r.Content.ReadAsStringAsync().Result);
|
dynamic obj = JObject.Parse(r.Content.ReadAsStringAsync().Result);
|
||||||
if (obj.responseData.results.Count == 0)
|
if (obj.responseData.results.Count == 0)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "No results found for that keyword :\\");
|
await e.Send( "No results found for that keyword :\\");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string s = Searches.ShortenUrl(obj.responseData.results[0].url.ToString());
|
string s = Searches.ShortenUrl(obj.responseData.results[0].url.ToString());
|
||||||
await client.SendMessage(e.Channel, s);
|
await e.Send( s);
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand("ir")
|
cgb.CreateCommand("ir")
|
||||||
@ -281,12 +294,12 @@ namespace NadekoBot.Modules
|
|||||||
dynamic obj = JObject.Parse(r.Content.ReadAsStringAsync().Result);
|
dynamic obj = JObject.Parse(r.Content.ReadAsStringAsync().Result);
|
||||||
if (obj.responseData.results.Count == 0)
|
if (obj.responseData.results.Count == 0)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "No results found for that keyword :\\");
|
await e.Send( "No results found for that keyword :\\");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int rnd = rng.Next(0, obj.responseData.results.Count);
|
int rnd = rng.Next(0, obj.responseData.results.Count);
|
||||||
string s = Searches.ShortenUrl(obj.responseData.results[rnd].url.ToString());
|
string s = Searches.ShortenUrl(obj.responseData.results[rnd].url.ToString());
|
||||||
await client.SendMessage(e.Channel, s);
|
await e.Send( s);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -309,14 +322,14 @@ namespace NadekoBot.Modules
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "Error saving. Sorry :(");
|
await e.Send( "Error saving. Sorry :(");
|
||||||
}
|
}
|
||||||
if (m.Length > 0)
|
if (m.Length > 0)
|
||||||
await client.SendMessage(e.Channel, "I saved this for you: " + Environment.NewLine + "```" + m + "```");
|
await e.Send( "I saved this for you: " + Environment.NewLine + "```" + m + "```");
|
||||||
else
|
else
|
||||||
await client.SendMessage(e.Channel, "No point in saving empty message...");
|
await e.Send( "No point in saving empty message...");
|
||||||
}
|
}
|
||||||
else await client.SendMessage(e.Channel, "Not for you, only my Master <3");
|
else await e.Send( "Not for you, only my Master <3");
|
||||||
});
|
});
|
||||||
|
|
||||||
CreateCommand(cgb, "ls")
|
CreateCommand(cgb, "ls")
|
||||||
@ -326,7 +339,7 @@ namespace NadekoBot.Modules
|
|||||||
FileStream f = File.OpenRead("saves.txt");
|
FileStream f = File.OpenRead("saves.txt");
|
||||||
if (f.Length == 0)
|
if (f.Length == 0)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "Saves are empty.");
|
await e.Send( "Saves are empty.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
byte[] b = new byte[f.Length / sizeof(byte)];
|
byte[] b = new byte[f.Length / sizeof(byte)];
|
||||||
@ -341,7 +354,7 @@ namespace NadekoBot.Modules
|
|||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
File.Delete("saves.txt");
|
File.Delete("saves.txt");
|
||||||
await client.SendMessage(e.Channel, "Cleared all saves.");
|
await e.Send( "Cleared all saves.");
|
||||||
});
|
});
|
||||||
|
|
||||||
CreateCommand(cgb, "bb")
|
CreateCommand(cgb, "bb")
|
||||||
@ -354,7 +367,7 @@ namespace NadekoBot.Modules
|
|||||||
{
|
{
|
||||||
str += " " + Mention.User(u);
|
str += " " + Mention.User(u);
|
||||||
}
|
}
|
||||||
await client.SendMessage(e.Channel, str);
|
await e.Send( str);
|
||||||
});
|
});
|
||||||
|
|
||||||
AliasCommand(CreateCommand(cgb, "req"), "request")
|
AliasCommand(CreateCommand(cgb, "req"), "request")
|
||||||
@ -370,10 +383,10 @@ namespace NadekoBot.Modules
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "Something went wrong.");
|
await e.Send( "Something went wrong.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await client.SendMessage(e.Channel, "Thank you for your request.");
|
await e.Send( "Thank you for your request.");
|
||||||
});
|
});
|
||||||
|
|
||||||
CreateCommand(cgb, "lr")
|
CreateCommand(cgb, "lr")
|
||||||
@ -398,19 +411,19 @@ namespace NadekoBot.Modules
|
|||||||
{
|
{
|
||||||
if (StatsCollector.DeleteRequest(int.Parse(e.Args[0])))
|
if (StatsCollector.DeleteRequest(int.Parse(e.Args[0])))
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, e.User.Mention + " Request deleted.");
|
await e.Send( e.User.Mention + " Request deleted.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "No request on that number.");
|
await e.Send( "No request on that number.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "Error deleting request, probably NaN error.");
|
await e.Send( "Error deleting request, probably NaN error.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else await client.SendMessage(e.Channel, "You don't have permission to do that.");
|
else await e.Send( "You don't have permission to do that.");
|
||||||
});
|
});
|
||||||
|
|
||||||
CreateCommand(cgb, "rr")
|
CreateCommand(cgb, "rr")
|
||||||
@ -425,20 +438,20 @@ namespace NadekoBot.Modules
|
|||||||
var sc = StatsCollector.ResolveRequest(int.Parse(e.Args[0]));
|
var sc = StatsCollector.ResolveRequest(int.Parse(e.Args[0]));
|
||||||
if (sc != null)
|
if (sc != null)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, e.User.Mention + " Request resolved, notice sent.");
|
await e.Send( e.User.Mention + " Request resolved, notice sent.");
|
||||||
await client.SendPrivateMessage(client.GetUser(client.GetServer(sc.ServerId), sc.Id), "**This request of yours has been resolved:**\n" + sc.Text);
|
await client.SendPrivateMessage(client.GetUser(client.GetServer(sc.ServerId), sc.Id), "**This request of yours has been resolved:**\n" + sc.Text);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "No request on that number.");
|
await e.Send( "No request on that number.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "Error resolving request, probably NaN error.");
|
await e.Send( "Error resolving request, probably NaN error.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else await client.SendMessage(e.Channel, "You don't have permission to do that.");
|
else await e.Send( "You don't have permission to do that.");
|
||||||
});
|
});
|
||||||
|
|
||||||
CreateCommand(cgb, "clr")
|
CreateCommand(cgb, "clr")
|
||||||
@ -457,7 +470,7 @@ namespace NadekoBot.Modules
|
|||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "I cant do it :(");
|
await e.Send( "I cant do it :(");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -466,7 +479,7 @@ namespace NadekoBot.Modules
|
|||||||
.Parameter("who", ParameterType.Required)
|
.Parameter("who", ParameterType.Required)
|
||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "Calling " + e.Args[0] + "...");
|
await e.Send( "Calling " + e.Args[0] + "...");
|
||||||
});
|
});
|
||||||
CreateCommand(cgb, "hide")
|
CreateCommand(cgb, "hide")
|
||||||
.Description("Hides nadeko in plain sight!11!!")
|
.Description("Hides nadeko in plain sight!11!!")
|
||||||
@ -481,7 +494,7 @@ namespace NadekoBot.Modules
|
|||||||
|
|
||||||
await client.EditProfile("", null, null, null, ms, ImageType.Png);
|
await client.EditProfile("", null, null, null, ms, ImageType.Png);
|
||||||
}
|
}
|
||||||
await client.SendMessage(e.Channel, "*hides*");
|
await e.Send( "*hides*");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -502,7 +515,7 @@ namespace NadekoBot.Modules
|
|||||||
|
|
||||||
await client.EditProfile("", null, null, null,ms, ImageType.Jpeg);
|
await client.EditProfile("", null, null, null,ms, ImageType.Jpeg);
|
||||||
}
|
}
|
||||||
await client.SendMessage(e.Channel, "*unhides*");
|
await e.Send( "*unhides*");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -520,7 +533,7 @@ namespace NadekoBot.Modules
|
|||||||
if (e.Message.User.Id == NadekoBot.OwnerId)
|
if (e.Message.User.Id == NadekoBot.OwnerId)
|
||||||
{
|
{
|
||||||
var result = await CSharpScript.EvaluateAsync(e.Args[0]);
|
var result = await CSharpScript.EvaluateAsync(e.Args[0]);
|
||||||
await client.SendMessage(e.Channel, result?.ToString() ?? "null");
|
await e.Send( result?.ToString() ?? "null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});*/
|
});*/
|
||||||
|
@ -86,11 +86,11 @@ namespace NadekoBot.Modules
|
|||||||
Pause = !Pause;
|
Pause = !Pause;
|
||||||
if (Pause)
|
if (Pause)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "Pausing. Run the command again to resume.");
|
await e.Send( "Pausing. Run the command again to resume.");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "Resuming...");
|
await e.Send( "Resuming...");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -109,7 +109,7 @@ namespace NadekoBot.Modules
|
|||||||
if (video?.Uri != "" && video.Uri != null)
|
if (video?.Uri != "" && video.Uri != null)
|
||||||
{
|
{
|
||||||
SongQueue.Add(video);
|
SongQueue.Add(video);
|
||||||
await client.SendMessage(e.Channel, "**Queued** " + video.FullName);
|
await e.Send( "**Queued** " + video.FullName);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -118,8 +118,8 @@ namespace NadekoBot.Modules
|
|||||||
.Description("Lists up to 10 currently queued songs.")
|
.Description("Lists up to 10 currently queued songs.")
|
||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, SongQueue.Count + " videos currently queued.");
|
await e.Send( SongQueue.Count + " videos currently queued.");
|
||||||
await client.SendMessage(e.Channel, string.Join("\n", SongQueue.Select(v => v.FullName).Take(10)));
|
await e.Send( string.Join("\n", SongQueue.Select(v => v.FullName).Take(10)));
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand("sh")
|
cgb.CreateCommand("sh")
|
||||||
@ -128,12 +128,12 @@ namespace NadekoBot.Modules
|
|||||||
{
|
{
|
||||||
if (SongQueue.Count < 2)
|
if (SongQueue.Count < 2)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "Not enough songs in order to perform the shuffle.");
|
await e.Send( "Not enough songs in order to perform the shuffle.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SongQueue.Shuffle();
|
SongQueue.Shuffle();
|
||||||
await client.SendMessage(e.Channel, "Songs shuffled!");
|
await e.Send( "Songs shuffled!");
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand("radio")
|
cgb.CreateCommand("radio")
|
||||||
@ -162,14 +162,14 @@ namespace NadekoBot.Modules
|
|||||||
{
|
{
|
||||||
Voice = null;
|
Voice = null;
|
||||||
Exit = false;
|
Exit = false;
|
||||||
await client.SendMessage(e.Channel, "Exiting...");
|
await e.Send( "Exiting...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int blockSize = 1920;
|
int blockSize = 1920;
|
||||||
byte[] buffer = new byte[1920];
|
byte[] buffer = new byte[1920];
|
||||||
//float multiplier = 1.0f / 48000 / 2;
|
//float multiplier = 1.0f / 48000 / 2;
|
||||||
|
|
||||||
var msg = await client.SendMessage(e.Channel, "Playing " + Music.CurrentSong.FullName + " [00:00]");
|
var msg = await e.Send( "Playing " + Music.CurrentSong.FullName + " [00:00]");
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
int byteCount;
|
int byteCount;
|
||||||
using (var stream = GetAudioFileStream(Music.CurrentSong.Uri))
|
using (var stream = GetAudioFileStream(Music.CurrentSong.Uri))
|
||||||
|
@ -34,11 +34,11 @@ namespace NadekoBot.Modules
|
|||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
if (e.Message.MentionedUsers.Count() == 0) {
|
if (e.Message.MentionedUsers.Count() == 0) {
|
||||||
await client.SendMessage(e.Channel, "You need to mention a person");
|
await e.Send( "You need to mention a person");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string av = e.Message.MentionedUsers.First().AvatarUrl;
|
string av = e.Message.MentionedUsers.First().AvatarUrl;
|
||||||
await client.SendMessage(e.Channel, ShortenUrl("http://www.discordapp.com/api/" + av));
|
await e.Send( ShortenUrl("http://www.discordapp.com/api/" + av));
|
||||||
|
|
||||||
});
|
});
|
||||||
cgb.CreateCommand("~yt")
|
cgb.CreateCommand("~yt")
|
||||||
@ -51,10 +51,10 @@ namespace NadekoBot.Modules
|
|||||||
var str = ShortenUrl(FindYoutubeUrlByKeywords(e.GetArg("query")));
|
var str = ShortenUrl(FindYoutubeUrlByKeywords(e.GetArg("query")));
|
||||||
if (str == null || str.Trim().Length < 5)
|
if (str == null || str.Trim().Length < 5)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "Query failed");
|
await e.Send( "Query failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await client.SendMessage(e.Channel, str);
|
await e.Send( str);
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand("~ani")
|
cgb.CreateCommand("~ani")
|
||||||
@ -67,11 +67,11 @@ namespace NadekoBot.Modules
|
|||||||
|
|
||||||
var result = GetAnimeQueryResultLink(e.GetArg("query"));
|
var result = GetAnimeQueryResultLink(e.GetArg("query"));
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
await client.SendMessage(e.Channel, "Failed to find that anime.");
|
await e.Send( "Failed to find that anime.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await client.SendMessage(e.Channel,result.ToString());
|
await e.Send(result.ToString());
|
||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand("~mang")
|
cgb.CreateCommand("~mang")
|
||||||
@ -85,10 +85,10 @@ namespace NadekoBot.Modules
|
|||||||
var result = GetMangaQueryResultLink(e.GetArg("query"));
|
var result = GetMangaQueryResultLink(e.GetArg("query"));
|
||||||
if (result == null)
|
if (result == null)
|
||||||
{
|
{
|
||||||
await client.SendMessage(e.Channel, "Failed to find that anime.");
|
await e.Send( "Failed to find that anime.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await client.SendMessage(e.Channel, result.ToString());
|
await e.Send( result.ToString());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user