fixed commschannel

This commit is contained in:
Master Kwoth 2016-02-02 18:06:06 +01:00
parent f1cfad1556
commit 64fdb0c25d

View File

@ -480,8 +480,8 @@ namespace NadekoBot.Modules {
.Parameter("ch", ParameterType.Unparsed) .Parameter("ch", ParameterType.Unparsed)
.Do(async e => { .Do(async e => {
if (e.User.Id != NadekoBot.OwnerID) return; if (e.User.Id != NadekoBot.OwnerID) return;
commsChannel = commsServer?.FindChannels(e.GetArg("ch")).FirstOrDefault(); commsChannel = commsServer?.FindChannels(e.GetArg("ch"), ChannelType.Text).FirstOrDefault();
if (commsServer != null) { if (commsChannel != null) {
commsUser = null; commsUser = null;
await e.Send("Server for comms set."); await e.Send("Server for comms set.");
} else } else
@ -493,14 +493,12 @@ namespace NadekoBot.Modules {
.Parameter("msg", ParameterType.Unparsed) .Parameter("msg", ParameterType.Unparsed)
.Do(async e => { .Do(async e => {
if (e.User.Id != NadekoBot.OwnerID) return; if (e.User.Id != NadekoBot.OwnerID) return;
try { if (commsUser != null)
if (commsUser != null) await commsUser.SendMessage(e.GetArg("msg"));
await commsUser.SendMessage(e.GetArg("msg")); else if (commsChannel != null)
else if (commsChannel != null) await commsChannel.SendMessage(e.GetArg("msg"));
await commsChannel.SendMessage(e.GetArg("msg")); else
} catch (Exception) { await e.Send("Failed. Make sure you've specified server and [channel or user]");
await e.Send("Sending failed.");
}
}); });
/*cgb.CreateCommand(".voicetext") /*cgb.CreateCommand(".voicetext")
.Description("Enabled or disabled voice to text channel connection. Only people in a certain voice channel will see ") .Description("Enabled or disabled voice to text channel connection. Only people in a certain voice channel will see ")