.repeat reverted to fix a bug
This commit is contained in:
parent
286fe8f81a
commit
3cf8d100de
@ -53,13 +53,13 @@ namespace NadekoBot.Modules.Administration
|
|||||||
var toSend = "🔄 " + Repeater.Message;
|
var toSend = "🔄 " + Repeater.Message;
|
||||||
await Task.Delay(Repeater.Interval, token).ConfigureAwait(false);
|
await Task.Delay(Repeater.Interval, token).ConfigureAwait(false);
|
||||||
|
|
||||||
var lastMsgInChannel = (await Channel.GetMessagesAsync(1)).FirstOrDefault();
|
//var lastMsgInChannel = (await Channel.GetMessagesAsync(2)).FirstOrDefault();
|
||||||
if (lastMsgInChannel.Id == oldMsg.Id) //don't send if it's the same message in the channel
|
// if (lastMsgInChannel.Id == oldMsg?.Id) //don't send if it's the same message in the channel
|
||||||
continue;
|
// continue;
|
||||||
|
|
||||||
if (oldMsg != null)
|
if (oldMsg != null)
|
||||||
try { await oldMsg.DeleteAsync(); } catch { }
|
try { await oldMsg.DeleteAsync(); } catch { }
|
||||||
try { oldMsg = await Channel.SendMessageAsync(toSend).ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex); try { source.Cancel(); } catch { } }
|
try { oldMsg = await Channel.SendMessageAsync(toSend).ConfigureAwait(false); } catch (Exception ex) { _log.Warn(ex); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (OperationCanceledException) { }
|
catch (OperationCanceledException) { }
|
||||||
|
Loading…
Reference in New Issue
Block a user