Esempio n. 1
0
            public async Task AutoTranslate(AutoDeleteAutoTranslate autoDelete = AutoDeleteAutoTranslate.Nodel)
            {
                var channel = (ITextChannel)Context.Channel;

                if (autoDelete == AutoDeleteAutoTranslate.Del)
                {
                    translatedChannels.AddOrUpdate(channel.Id, true, (key, val) => true);
                    await ReplyConfirmLocalized("atl_ad_started").ConfigureAwait(false);

                    return;
                }

                bool throwaway;

                if (translatedChannels.TryRemove(channel.Id, out throwaway))
                {
                    await ReplyConfirmLocalized("atl_stopped").ConfigureAwait(false);

                    return;
                }
                if (translatedChannels.TryAdd(channel.Id, autoDelete == AutoDeleteAutoTranslate.Del))
                {
                    await ReplyConfirmLocalized("atl_started").ConfigureAwait(false);
                }
            }
Esempio n. 2
0
            public async Task AutoTranslate(IUserMessage msg, AutoDeleteAutoTranslate autoDelete = AutoDeleteAutoTranslate.Nodel)
            {
                var channel = (ITextChannel)msg.Channel;

                if (autoDelete == AutoDeleteAutoTranslate.Del)
                {
                    TranslatedChannels.AddOrUpdate(channel.Id, true, (key, val) => true);
                    try { await channel.SendMessageAsync("`Started automatic translation of messages on this channel. User messages will be auto-deleted.`").ConfigureAwait(false); } catch { }
                    return;
                }

                bool throwaway;

                if (TranslatedChannels.TryRemove(channel.Id, out throwaway))
                {
                    try { await channel.SendMessageAsync("`Stopped automatic translation of messages on this channel.`").ConfigureAwait(false); } catch { }
                    return;
                }
                else if (TranslatedChannels.TryAdd(channel.Id, autoDelete == AutoDeleteAutoTranslate.Del))
                {
                    try { await channel.SendMessageAsync("`Started automatic translation of messages on this channel.`").ConfigureAwait(false); } catch { }
                }
            }
Esempio n. 3
0
            public async Task AutoTranslate(IUserMessage msg, AutoDeleteAutoTranslate autoDelete = AutoDeleteAutoTranslate.Nodel)
            {
                var channel = (ITextChannel)msg.Channel;

                if (autoDelete == AutoDeleteAutoTranslate.Del)
                {
                    TranslatedChannels.AddOrUpdate(channel.Id, true, (key, val) => true);
                    try { await channel.SendMessageAsync("`Started automatic translation of messages on this channel. User messages will be auto-deleted.`").ConfigureAwait(false); } catch { }
                    return;
                }

                bool throwaway;
                if (TranslatedChannels.TryRemove(channel.Id, out throwaway))
                {
                    try { await channel.SendMessageAsync("`Stopped automatic translation of messages on this channel.`").ConfigureAwait(false); } catch { }
                    return;
                }
                else if (TranslatedChannels.TryAdd(channel.Id, autoDelete == AutoDeleteAutoTranslate.Del))
                {
                    try { await channel.SendMessageAsync("`Started automatic translation of messages on this channel.`").ConfigureAwait(false); } catch { }
                }
            }