Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.Client.MessageReactionAdded += async e =>
- {
- try
- {
- if (!e.User.Id.ToString().Equals("123") && (e.Channel.Name == "lfg-bot" || e.Channel.Name == "looking-for-games" || e.Channel.Name == "bots" || e.Channel.Name == "scheduled-games" || e.Channel.Name == "bot-testing" || e.Channel.Name == "looking-for-non-tts-games"))
- {
- string wholeStringEmbed = "";
- int posFrom = 0;
- int posTo = 0;
- string cutUrl = "";
- string[] urlSplit = null;
- ulong theMessageOtherId = 0;
- bool thisIsLFGsoSyncOtherChannel = false;
- DiscordMessage theOtherMessageDesired = null;
- var originalMensage = e.Message;
- string theOriginalTextMessage = "";
- if (originalMensage != null)
- {
- theOriginalTextMessage = originalMensage.Content;
- }
- var isXStillPresentForAValidMessage = true;
- DiscordMessage theMessagedd = originalMensage;
- if (theMessagedd == null || theMessagedd.Content == null)
- {
- theMessagedd = await e.Channel.GetMessageAsync(e.Message.Id);
- if (theMessagedd.Content != null)
- {
- theOriginalTextMessage = theMessagedd.Content;
- }
- }
- if (theOriginalTextMessage == null)
- {
- int indexer = 0;
- do
- {
- theMessagedd = await e.Channel.GetMessageAsync(e.Message.Id);
- theOriginalTextMessage = theMessagedd.Content ?? null;
- indexer++;
- } while (indexer < 15 && theOriginalTextMessage == null);
- }
- var messageReactions = theMessagedd.Reactions;
- foreach (var reaction in messageReactions)
- {
- if (reaction.Emoji.Name == "🚷" && reaction.IsMe)
- {
- isXStillPresentForAValidMessage = false;
- }
- }
- if (theMessagedd.Channel.Name == "looking-for-games" || theMessagedd.Channel.Name == "lfg-bot")
- {
- thisIsLFGsoSyncOtherChannel = true;
- }
- if (theMessagedd.Embeds.Count > 0 && theMessagedd.Author != null && theMessagedd.Author.Id.Equals(123) && isXStillPresentForAValidMessage)
- {
- //detect which emoji reacted and act accordingly
- var theFooter = new DiscordEmbedBuilder.EmbedFooter();
- DiscordEmbed oldBed = theMessagedd.Embeds.First();
- theFooter.Text = oldBed.Footer.Text;//.Text(oldBed.Footer.Text, oldBed.Footer.IconUrl)
- theFooter.IconUrl = oldBed.Footer.IconUrl.ToString();//.Text(oldBed.Footer.Text, oldBed.Footer.IconUrl)
- string newDescription = oldBed.Description;
- if (!newDescription.Contains(e.User.Mention))
- {
- newDescription += ", " + e.User.Mention;
- }
- if (thisIsLFGsoSyncOtherChannel)
- {
- wholeStringEmbed = oldBed.Description;
- posFrom = wholeStringEmbed.IndexOf('(');
- posTo = wholeStringEmbed.IndexOf(')');
- cutUrl = wholeStringEmbed.Substring(posFrom, posTo - posFrom);
- urlSplit = cutUrl.Split('/');
- theMessageOtherId = ulong.Parse(urlSplit.Last());
- theOtherMessageDesired = await e.Channel.GetMessageAsync(theMessageOtherId);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement