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