added don't join servers in order to prevent the bot from spreading if needed

This commit is contained in:
Master Kwoth 2016-02-19 06:23:02 +01:00
parent 891cc408ff
commit 21c1e95515
3 changed files with 28 additions and 21 deletions

View File

@ -11,6 +11,8 @@
public bool? ForwardMessages;
public string SoundCloudClientID;
public string MashapeKey;
public string LOLAPIKey;
public bool DontJoinServers = false;
}
public class AnimeResult
{

View File

@ -74,7 +74,7 @@ namespace NadekoBot.Modules {
Stopwatch randServerSW = new Stopwatch();
randServerSW.Start();
cgb.CreateCommand("randserver")
.Description("Generates an invite to a random server and prints some stats.")
.Do(async e => {
@ -264,18 +264,21 @@ namespace NadekoBot.Modules {
text = usr?.Name;
await e.Channel.SendFile("ripzor_m8.png", RipName(text, e.GetArg("year") == "" ? null : e.GetArg("year")));
});
cgb.CreateCommand("j")
.Description("Joins a server using a code.")
.Parameter("id", ParameterType.Required)
.Do(async e => {
try {
await (await client.GetInvite(e.Args[0])).Accept();
await e.Send("I got in!");
} catch {
await e.Send("Invalid code.");
}
});
if (!NadekoBot.creds.DontJoinServers) {
cgb.CreateCommand("j")
.Description("Joins a server using a code.")
.Parameter("id", ParameterType.Required)
.Do(async e => {
try {
await (await client.GetInvite(e.Args[0])).Accept();
await e.Send("I got in!");
}
catch {
await e.Send("Invalid code.");
}
});
}
cgb.CreateCommand("slm")
.Description("Shows the message where you were last mentioned in this channel (checks last 10k messages)")
.Do(async e => {

View File

@ -156,16 +156,18 @@ namespace NadekoBot {
e.User.Id == 143515953525817344)
return; // FU
try {
await (await client.GetInvite(e.Message.Text)).Accept();
await e.Send("I got in!");
return;
}
catch {
if (e.User.Id == 109338686889476096) { //carbonitex invite
await e.Send("Failed to join the server.");
if (!NadekoBot.creds.DontJoinServers) {
try {
await (await client.GetInvite(e.Message.Text)).Accept();
await e.Send("I got in!");
return;
}
catch {
if (e.User.Id == 109338686889476096) { //carbonitex invite
await e.Send("Failed to join the server.");
return;
}
}
}
if (ForwardMessages && OwnerPrivateChannel != null)