Ejemplo n.º 1
0
        public async Task PublishIssue(IssueInfo issue, SocketTextChannel channel)
        {
            await UnpublishIssue(issue, channel.Guild);

            string prefix = IssueSystem.StatusPrefix[issue.status];
            string text   = IssueSystem.StatusText[issue.status];

            var message = await channel.SendMessageAsync($"{prefix} - #**{issue.issueId}** - **{text}:** {issue.text}", options : MopBot.optAlwaysRetry);

            issue.messageId = message.Id;
            issue.channelId = channel.Id;
        }
Ejemplo n.º 2
0
        public IssueInfo NewIssue(string text, IssueStatus status = IssueStatus.Open)
        {
            var newIssue = new IssueInfo {
                issueId = NextIssueId,
                status  = status,
                text    = text
            };

            nextIssueId++;

            issues.Add(newIssue);

            return(newIssue);
        }
Ejemplo n.º 3
0
        public async Task UnpublishIssue(IssueInfo issue, SocketGuild server)
        {
            if (issue.messageId == 0 || issue.channelId == 0)
            {
                return;
            }

            var oldChannel = server.GetChannel(issue.channelId);

            if (oldChannel != null && oldChannel is SocketTextChannel oldTextChannel)
            {
                var oldMessage = await oldTextChannel.GetMessageAsync(issue.messageId);

                if (oldMessage != null)
                {
                    await oldMessage.DeleteAsync();
                }
            }
        }