cleanup, multiserver music,stats, message forwarding

and through bot communication
This commit is contained in:
Master Kwoth 2016-01-22 08:17:16 +01:00
parent 0b8caf568c
commit 6c7a0fb4fe
5 changed files with 188 additions and 194 deletions

View File

@ -39,32 +39,32 @@ Global
{8D71A857-879A-4A10-859E-5FF824ED6688}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.FullDebug|Any CPU.Build.0 = Debug|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.PRIVATE|Any CPU.ActiveCfg = PRIVATE|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.PRIVATE|Any CPU.Build.0 = PRIVATE|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.PRIVATE|Any CPU.ActiveCfg = TestResponses|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.PRIVATE|Any CPU.Build.0 = TestResponses|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8D71A857-879A-4A10-859E-5FF824ED6688}.Release|Any CPU.Build.0 = Release|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.FullDebug|Any CPU.Build.0 = Debug|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.PRIVATE|Any CPU.ActiveCfg = PRIVATE|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.PRIVATE|Any CPU.Build.0 = PRIVATE|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.PRIVATE|Any CPU.ActiveCfg = Release|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.PRIVATE|Any CPU.Build.0 = Release|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3091164F-66AE-4543-A63D-167C1116241D}.Release|Any CPU.Build.0 = Release|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.FullDebug|Any CPU.Build.0 = Debug|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.PRIVATE|Any CPU.ActiveCfg = PRIVATE|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.PRIVATE|Any CPU.Build.0 = PRIVATE|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.PRIVATE|Any CPU.ActiveCfg = Release|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.PRIVATE|Any CPU.Build.0 = Release|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B5603B4-6F8F-4289-B945-7BAAE523D740}.Release|Any CPU.Build.0 = Release|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.FullDebug|Any CPU.ActiveCfg = Debug|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.FullDebug|Any CPU.Build.0 = Debug|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.PRIVATE|Any CPU.ActiveCfg = PRIVATE|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.PRIVATE|Any CPU.Build.0 = PRIVATE|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.PRIVATE|Any CPU.ActiveCfg = Release|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.PRIVATE|Any CPU.Build.0 = Release|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7BFEF748-B934-4621-9B11-6302E3A9F6B3}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection

View File

@ -5,7 +5,6 @@ using System;
using System.Diagnostics;
using System.Linq;
using System.Timers;
using Discord.Commands.Permissions.Visibility;
using NadekoBot.Extensions;
namespace NadekoBot.Modules
@ -18,8 +17,7 @@ namespace NadekoBot.Modules
public override void Install(ModuleManager manager)
{
manager.CreateCommands("", cgb =>
{
manager.CreateCommands("", cgb => {
var client = manager.Client;
commands.ForEach(cmd => cmd.Init(cgb));
@ -28,29 +26,25 @@ namespace NadekoBot.Modules
.Description("Sets a role for a given user.\n**Usage**: .sr @User Guest")
.Parameter("user_name", ParameterType.Required)
.Parameter("role_name", ParameterType.Required)
.Do(async e =>
{
.Do(async e => {
if (!e.User.ServerPermissions.ManageRoles) 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.Send("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.Send("You failed to supply a valid role");
return;
}
try
{
try {
await usr.AddRoles(new Role[] { role });
await e.Send( $"Successfully added role **{role.Name}** to user **{usr.Mention}**");
}
catch (Exception ex)
{
await e.Send( "Failed to add roles. Most likely reason: Insufficient permissions.\n");
await e.Send($"Successfully added role **{role.Name}** to user **{usr.Mention}**");
} catch (Exception ex) {
await e.Send("Failed to add roles. Most likely reason: Insufficient permissions.\n");
Console.WriteLine(ex.ToString());
}
});
@ -59,34 +53,27 @@ namespace NadekoBot.Modules
.Description("Removes a role from a given user.\n**Usage**: .rr @User Admin")
.Parameter("user_name", ParameterType.Required)
.Parameter("role_name", ParameterType.Required)
.Do(async e =>
{
.Do(async e => {
if (!e.User.ServerPermissions.ManageRoles) return;
var usr = e.Server.FindUsers(e.GetArg("user_name")).FirstOrDefault();
if (usr == null)
{
await e.Send( "You failed to supply a valid username");
if (usr == null) {
await e.Send("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");
if (role == null) {
await e.Send("You failed to supply a valid role");
return;
}
try
{
try {
await usr.RemoveRoles(new Role[] { role });
await e.Send( $"Successfully removed role **{role.Name}** from user **{usr.Mention}**");
}
catch (InvalidOperationException) {
}
catch (Exception)
{
await e.Send( "Failed to remove roles. Most likely reason: Insufficient permissions.");
await e.Send($"Successfully removed role **{role.Name}** from user **{usr.Mention}**");
} catch (InvalidOperationException) {
} catch (Exception) {
await e.Send("Failed to remove roles. Most likely reason: Insufficient permissions.");
}
});
@ -94,45 +81,35 @@ namespace NadekoBot.Modules
.Description("Creates a role with a given name, and color.\n**Usage**: .r AwesomeRole Orange")
.Parameter("role_name", ParameterType.Required)
.Parameter("role_color", ParameterType.Optional)
.Do(async e =>
{
.Do(async e => {
if (!e.User.ServerPermissions.ManageRoles) return;
var color = Color.Blue;
if (e.GetArg("role_color") != null)
{
try
{
if (e.GetArg("role_color") != null) {
try {
if (e.GetArg("role_color") != null && e.GetArg("role_color").Trim().Length > 0)
color = (typeof(Color)).GetField(e.GetArg("role_color")).GetValue(null) as Color;
}
catch (Exception ex)
{
} catch (Exception ex) {
Console.WriteLine(ex.ToString());
await e.Send( "Please supply a proper color.\n Example: DarkBlue, Orange, Teal");
await e.Send("Please supply a proper color.\n Example: DarkBlue, Orange, Teal");
return;
}
}
try
{
var r = await e.Server.CreateRole(e.GetArg("role_name"));
await r.Edit(null,null, color);
await e.Send( $"Successfully created role **{r.ToString()}**.");
}
catch (Exception) { }
try {
var r = await e.Server.CreateRole(e.GetArg("role_name"));
await r.Edit(null, null, color);
await e.Send($"Successfully created role **{r.ToString()}**.");
} catch (Exception) { }
});
cgb.CreateCommand(".b").Alias(".ban")
.Description("Bans a mentioned user")
.Do(async e =>
{
try
{
if (e.User.ServerPermissions.BanMembers && e.Message.MentionedUsers.Any())
{
.Do(async e => {
try {
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.Send("Banned user " + usr.Name + " Id: " + usr.Id);
}
} catch (Exception) { }
});
@ -152,95 +129,71 @@ namespace NadekoBot.Modules
cgb.CreateCommand(".k").Alias(".kick")
.Parameter("user")
.Description("Kicks a mentioned user.")
.Do(async e =>
{
try
{
if (e.User.ServerPermissions.KickMembers && e.Message.MentionedUsers.Any())
{
.Do(async e => {
try {
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.Send("Kicked user " + usr.Name + " Id: " + usr.Id);
}
}
catch (Exception)
{
await e.Send( "No sufficient permissions.");
} catch (Exception) {
await e.Send("No sufficient permissions.");
}
});
cgb.CreateCommand(".rvch")
.Description("Removes a voice channel with a given name.")
.Parameter("channel_name", ParameterType.Required)
.Do(async e =>
{
try
{
if (e.User.ServerPermissions.ManageChannels)
{
.Do(async e => {
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.Send($"Removed channel **{e.GetArg("channel_name")}**.");
}
}
catch (Exception)
{
await e.Send( "No sufficient permissions.");
} catch (Exception) {
await e.Send("No sufficient permissions.");
}
});
cgb.CreateCommand(".vch").Alias(".cvch")
.Description("Creates a new voice channel with a given name.")
.Parameter("channel_name", ParameterType.Required)
.Do(async e =>
{
try
{
if (e.User.ServerPermissions.ManageChannels)
{
.Do(async e => {
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.Send($"Created voice channel **{e.GetArg("channel_name")}**.");
}
}
catch (Exception)
{
await e.Send( "No sufficient permissions.");
} catch (Exception) {
await e.Send("No sufficient permissions.");
}
});
cgb.CreateCommand(".rch").Alias(".rtch")
.Description("Removes a text channel with a given name.")
.Parameter("channel_name", ParameterType.Required)
.Do(async e =>
{
try
{
if (e.User.ServerPermissions.ManageChannels)
{
.Do(async e => {
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.Send($"Removed text channel **{e.GetArg("channel_name")}**.");
}
}
catch (Exception)
{
await e.Send( "No sufficient permissions.");
} catch (Exception) {
await e.Send("No sufficient permissions.");
}
});
cgb.CreateCommand(".ch").Alias(".tch")
.Description("Creates a new text channel with a given name.")
.Parameter("channel_name", ParameterType.Required)
.Do(async e =>
{
try
{
if (e.User.ServerPermissions.ManageChannels)
{
.Do(async e => {
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.Send($"Added text channel **{e.GetArg("channel_name")}**.");
}
}
catch (Exception) {
await e.Send( "No sufficient permissions.");
} catch (Exception) {
await e.Send("No sufficient permissions.");
}
});
@ -249,7 +202,7 @@ namespace NadekoBot.Modules
.Parameter("topic", ParameterType.Unparsed)
.Do(async e => {
try {
if(e.User.ServerPermissions.ManageChannels)
if (e.User.ServerPermissions.ManageChannels)
await e.Channel.Edit(topic: e.GetArg("topic"));
} catch (Exception) { }
});
@ -257,48 +210,32 @@ namespace NadekoBot.Modules
cgb.CreateCommand(".uid").Alias(".userid")
.Description("Shows user id")
.Parameter("user", ParameterType.Required)
.Do(async e =>
{
.Do(async e => {
var usr = e.Channel.FindUsers(e.GetArg("user")).FirstOrDefault();
if (usr == null)
{
if (usr == null) {
await e.Send("You must mention a user.");
return;
}
await e.Send( "Id of the user " + usr.Name + " is " + usr.Id);
await e.Send("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.Send("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.Send("This server's id is " + e.Server.Id));
cgb.CreateCommand(".stats")
.Description("Shows some basic stats for nadeko")
.Do(async e =>
{
int serverCount = client.Servers.Count();
int uniqueUserCount = client.Servers.Sum(s=>s.Users.Count());
var time = (DateTime.Now - Process.GetCurrentProcess().StartTime);
string uptime = " " + time.Days + " days, " + time.Hours + " hours, and " + time.Minutes + " minutes.";
await e.Send($"```Servers: {serverCount}\nUnique Users: {uniqueUserCount}\nUptime: {uptime}\nMy id is: {client.CurrentUser.Id}```");
});
.Do(async e => await e.Send("```" + NadekoBot.GetStats() + "```"));
cgb.CreateCommand(".leaveall")
.Description("Nadeko leaves all servers")
.Do(e => {
if(e.User.Id == NadekoBot.OwnerID)
if (e.User.Id == NadekoBot.OwnerID)
NadekoBot.client.Servers.ForEach(async s => { if (s.Name == "NadekoLog" || s.Name == "Discord Bots") return; await s.Leave(); });
});
@ -361,7 +298,7 @@ namespace NadekoBot.Modules
.Do(async e => {
if (e.User.Id != NadekoBot.OwnerID) return;
announcingGreet = !announcingGreet;
if (announcingGreet) {
announceChannel = e.Channel;
joinServer = e.Server;
@ -415,6 +352,59 @@ namespace NadekoBot.Modules
announceLeaveMsg = e.GetArg("msg");
await e.Send("New bye message set.");
});
cgb.CreateCommand(".checkmyperms")
.Description("Checks your userspecific permissions on this channel.")
.Do(async e => {
string output = "```\n";
foreach (var p in e.User.ServerPermissions.GetType().GetProperties().Where(p => p.GetGetMethod().GetParameters().Count() == 0)) {
output += p.Name + ": " + p.GetValue(e.User.ServerPermissions, null).ToString() + "\n";
}
output += "```";
await e.User.SendMessage(output);
//await e.Send("```\n" + e.User.ServerPermissions.+"\n```");
});
//todo maybe add .opencomms and then make send always send to that user?
Server commsServer = null;
User commsUser = null;
cgb.CreateCommand(".commsuser")
.Description("Sets a user for through-bot communication. Only works if server is set.**Owner only**.")
.Parameter("name", ParameterType.Unparsed)
.Do(async e => {
commsUser = commsServer?.FindUsers(e.GetArg("name")).FirstOrDefault();
if (commsUser != null)
await e.Send("User for comms set.");
else
await e.Send("No such user.");
});
cgb.CreateCommand(".commsserver")
.Description("Sets a server for through-bot communication.**Owner only**.")
.Parameter("server", ParameterType.Unparsed)
.Do(async e => {
commsServer = client.FindServers(e.GetArg("server")).FirstOrDefault();
if (commsServer != null)
await e.Send("Server for comms set.");
else
await e.Send("No such server.");
});
cgb.CreateCommand(".send")
.Description("Send a message to someone on a different server through the bot.**Owner only.**\n **Usage**: .send Message text multi word!")
.Parameter("msg",ParameterType.Unparsed)
.Do(async e => {
if (e.User.Id != NadekoBot.OwnerID) return;
try {
await commsUser.SendMessage(e.GetArg("msg"));
} catch (Exception) {
await e.Send("Sending failed.");
}
});
});
}

View File

@ -27,6 +27,35 @@ namespace NadekoBot.Modules {
public bool Pause = false;
public List<StreamRequest> SongQueue = new List<StreamRequest>();
public StreamRequest CurrentSong;
public MusicControls() {
Task.Run(async () => {
while (true) {
try {
if (CurrentSong == null || CurrentSong.State == StreamTaskState.Completed) {
LoadNextSong();
}
} catch (Exception e) {
Console.WriteLine("Bug in music task run. " + e);
}
await Task.Delay(200);
}
});
}
private void LoadNextSong() {
if (SongQueue.Count == 0 || !SongQueue[0].LinkResolved) {
if (CurrentSong != null)
CurrentSong.Cancel();
CurrentSong = null;
return;
}
CurrentSong = SongQueue[0];
SongQueue.RemoveAt(0);
CurrentSong.Start();
return;
}
}
public static ConcurrentDictionary<Server, MusicControls> musicPlayers = new ConcurrentDictionary<Server,MusicControls>();
@ -47,22 +76,7 @@ namespace NadekoBot.Modules {
public override void Install(ModuleManager manager) {
var client = NadekoBot.client;
Task.Run(async () => {
while (true) {
try {
foreach (var kvp in musicPlayers) {
var player = kvp.Value;
if (player.CurrentSong == null || player.CurrentSong.State == StreamTaskState.Completed) {
LoadNextSong(player);
await Task.Delay(200);
}
}
} catch (Exception e) {
Console.WriteLine(e);
}
}
});
manager.CreateCommands("!m", cgb => {
//queue all more complex commands
@ -147,19 +161,6 @@ namespace NadekoBot.Modules {
});
});
}
private void LoadNextSong(MusicControls player) {
if (player.SongQueue.Count == 0 || !player.SongQueue[0].LinkResolved) {
if (player.CurrentSong != null)
player.CurrentSong.Cancel();
player.CurrentSong = null;
return;
}
player.CurrentSong = player.SongQueue[0];
player.SongQueue.RemoveAt(0);
player.CurrentSong.Start();
return;
}
}
enum StreamTaskState {

View File

@ -24,12 +24,13 @@ namespace NadekoBot
public static string password;
public static string TrelloAppKey;
public static bool ForwardMessages = false;
public static string BotVersion = "0.5-beta1";
static void Main()
{
//load credentials from credentials.json
Credentials c;
bool trelloLoaded = false;
bool loadTrello = false;
try
{
c = JsonConvert.DeserializeObject<Credentials>(File.ReadAllText("credentials.json"));
@ -45,7 +46,7 @@ namespace NadekoBot
} else {
Console.WriteLine("Trello app key provided.");
TrelloAppKey = c.TrelloAppKey;
trelloLoaded = true;
loadTrello = true;
}
if (c.ForwardMessages != true)
Console.WriteLine("Not forwarding messages.");
@ -97,8 +98,7 @@ namespace NadekoBot
var audio = client.Services.Add<AudioService>(new AudioService(new AudioServiceConfig() {
Channels = 2,
EnableEncryption = false,
EnableMultiserver = true,
Mode = AudioMode.Outgoing
EnableMultiserver = true
}));
//install modules
@ -108,25 +108,17 @@ namespace NadekoBot
modules.Add(new Games(), "Games", ModuleFilter.None);
modules.Add(new Music(), "Music", ModuleFilter.None);
modules.Add(new Searches(), "Searches", ModuleFilter.None);
if(trelloLoaded)
if(loadTrello)
modules.Add(new Trello(), "Trello", ModuleFilter.None);
//run the bot
client.ExecuteAndWait(async () =>
{
await client.Connect(c.Username, c.Password);
Console.WriteLine("-------------------------");
Console.WriteLine("Discord.Net version: " + DiscordConfig.LibVersion);
Console.WriteLine("Runtime: " + client.GetRuntime());
Console.WriteLine("Logged in as: " + client.CurrentUser.Name);
Console.WriteLine("Bot id: " + client.CurrentUser.Id);
Console.WriteLine("Servers: " + client.Servers.Count());
Console.WriteLine("Channels: " + client.Servers.Sum(s=>s.AllChannels.Count()));
Console.WriteLine("Users: " + client.Servers.Sum(s => s.Users.Count()));
Console.WriteLine("Heap: "+ Math.Round(GC.GetTotalMemory(true) / (1024.0 * 1024.0), 2).ToString() + "MB");
Console.WriteLine("-------------------------");
Console.WriteLine("-----------------");
Console.WriteLine(GetStats());
Console.WriteLine("-----------------");
foreach (var serv in client.Servers) {
if ((OwnerUser = serv.GetUser(OwnerID)) != null)
@ -137,17 +129,28 @@ namespace NadekoBot
Console.WriteLine("Exiting...");
Console.ReadKey();
}
static bool repliedRecently = false;
public static string GetStats() =>
"Discord.Net version: " + DiscordConfig.LibVersion +
"\nRuntime: " + client.GetRuntime() +
"\nBot Version: " + BotVersion +
"\nLogged in as: " + client.CurrentUser.Name +
"\nBot id: " + client.CurrentUser.Id +
"\nServers: " + client.Servers.Count() +
"\nChannels: " + client.Servers.Sum(s => s.AllChannels.Count()) +
"\nUsers: " + client.Servers.Sum(s => s.Users.Count()) +
"\nHeap: " + Math.Round(GC.GetTotalMemory(true) / (1024.0 * 1024.0), 2).ToString() + "MB";
static bool repliedRecently = false;
private static async void Client_MessageReceived(object sender, MessageEventArgs e) {
if (e.Server != null) return;
if (e.Server != null || e.User.Id == client.CurrentUser.Id) return;
try {
(await client.GetInvite(e.Message.Text))?.Accept();
await e.User.Send("I got in, thanks. <3");
} catch (Exception) { }
if (NadekoBot.ForwardMessages && OwnerUser != null)
await OwnerUser.Send(e.Message.Text);
if (ForwardMessages && OwnerUser != null)
await OwnerUser.SendMessage(e.User +": ```\n"+e.Message.Text+"\n```");
if (repliedRecently = !repliedRecently) {
await e.Send("You can type `-h` or `-help` or `@MyName help` in any of the channels I am in and I will send you a message with my commands.\n Or you can find out what i do here: https://github.com/Kwoth/NadekoBot\nYou can also just send me an invite link to a server and I will join it.\nIf you don't want me on your server, you can simply ban me ;(");

View File

@ -25,8 +25,8 @@
<MapFileExtensions>true</MapFileExtensions>
<WebPage>publish.htm</WebPage>
<AutorunEnabled>true</AutorunEnabled>
<ApplicationRevision>2</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>0.5.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>