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 bool? ForwardMessages;
public string SoundCloudClientID; public string SoundCloudClientID;
public string MashapeKey; public string MashapeKey;
public string LOLAPIKey;
public bool DontJoinServers = false;
} }
public class AnimeResult public class AnimeResult
{ {

View File

@ -264,18 +264,21 @@ namespace NadekoBot.Modules {
text = usr?.Name; text = usr?.Name;
await e.Channel.SendFile("ripzor_m8.png", RipName(text, e.GetArg("year") == "" ? null : e.GetArg("year"))); await e.Channel.SendFile("ripzor_m8.png", RipName(text, e.GetArg("year") == "" ? null : e.GetArg("year")));
}); });
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("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") cgb.CreateCommand("slm")
.Description("Shows the message where you were last mentioned in this channel (checks last 10k messages)") .Description("Shows the message where you were last mentioned in this channel (checks last 10k messages)")
.Do(async e => { .Do(async e => {

View File

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