improves config and value checking for bottype discordTTS
This commit is contained in:
parent
14acea98c1
commit
04b3f23c47
1 changed files with 22 additions and 7 deletions
|
|
@ -23,20 +23,33 @@ namespace BSB.bottypes
|
||||||
await user.ModifyAsync(x => {
|
await user.ModifyAsync(x => {
|
||||||
x.Nickname = myconfig.DiscordTTS_Nickname;
|
x.Nickname = myconfig.DiscordTTS_Nickname;
|
||||||
});
|
});
|
||||||
if (myconfig.DiscordTTS_Enable == true)
|
FindTTsChannel();
|
||||||
{
|
|
||||||
TTSchannel = await FindTextChannel(TTSDiscordServer, myconfig.DiscordTTS_channel_name, null, UUID.Zero, "notUSED", false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected async void FindTTsChannel()
|
||||||
|
{
|
||||||
|
if (myconfig.DiscordTTS_Enable == true)
|
||||||
|
{
|
||||||
|
TTSchannel = await FindTextChannel(TTSDiscordServer, myconfig.DiscordTTS_channel_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override async Task DiscordIMMessage(UUID sender_uuid, string sender_name, string message)
|
protected override async Task DiscordIMMessage(UUID sender_uuid, string sender_name, string message)
|
||||||
{
|
{
|
||||||
await base.DiscordIMMessage(sender_uuid, sender_name, message);
|
await base.DiscordIMMessage(sender_uuid, sender_name, message);
|
||||||
|
if (myconfig.DiscordTTS_Enable == true)
|
||||||
|
{
|
||||||
if ((helpers.notempty(sender_name) == true) && (helpers.notempty(message) == true))
|
if ((helpers.notempty(sender_name) == true) && (helpers.notempty(message) == true))
|
||||||
{
|
{
|
||||||
if (sender_uuid.ToString() == myconfig.DiscordTTS_avatar_uuid)
|
if (sender_uuid.ToString() == myconfig.DiscordTTS_avatar_uuid)
|
||||||
|
{
|
||||||
|
if (TTSchannel == null)
|
||||||
|
{
|
||||||
|
FindTTsChannel();
|
||||||
|
}
|
||||||
|
if (TTSchannel != null)
|
||||||
{
|
{
|
||||||
await TTSchannel.SendMessageAsync(message, true);
|
await TTSchannel.SendMessageAsync(message, true);
|
||||||
}
|
}
|
||||||
|
|
@ -44,3 +57,5 @@ namespace BSB.bottypes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue