Ejemplo n.º 1
0
        public async Task Close(IUser agent, ITextChannel channel, string user, string content)
        {
            if (UserAccounts.GetAccountByName(user).UserName == channel.Name)
            {
                var   userID = UserAccounts.GetAccountByName(user).UserID;
                var   guild  = Utils.Guild;
                IUser target = guild.GetUser(userID);
                if (target != null)
                {
                    var eb = new EmbedBuilder()
                    {
                        Author = new EmbedAuthorBuilder()
                        {
                            IconUrl = agent.GetAvatarUrl(),
                            Name    = $"{agent.Username}#{agent.Discriminator} closed your ticket."
                        },
                        Description = content,
                        Footer      = new EmbedFooterBuilder()
                        {
                            Text = DateTime.Now.ToString(),
                        }
                    };

                    DMTicket.ReplyToDM(target, "", eb);
                    await channel.DeleteAsync();

                    await Task.CompletedTask;
                }
            }
        }
Ejemplo n.º 2
0
        public async Task Reply(IUser agent, ITextChannel channel, string user, string content)
        {
            if (UserAccounts.GetAccountByName(user).UserName == channel.Name)
            {
                var   userID = UserAccounts.GetAccountByName(user).UserID;
                var   guild  = Utils.Guild;
                IUser target = guild.GetUser(userID);
                if (target != null)
                {
                    var eb = new EmbedBuilder()
                    {
                        Author = new EmbedAuthorBuilder()
                        {
                            IconUrl = agent.GetAvatarUrl(),
                            Name    = $"{agent.Username}#{agent.Discriminator} replied to your question."
                        },
                        Description = content,
                        Footer      = new EmbedFooterBuilder()
                        {
                            Text = DateTime.Now.ToString(),
                        }
                    };
                    var ebl = new EmbedBuilder()
                    {
                        Author = new EmbedAuthorBuilder()
                        {
                            IconUrl = target.GetAvatarUrl(),
                            Name    = $"Sent reply to {target.Username}#{target.Discriminator}."
                        },
                        Description = content,
                        Footer      = new EmbedFooterBuilder()
                        {
                            Text = DateTime.Now.ToString(),
                        }
                    };
                    await channel.SendMessageAsync("", false, eb.Build());

                    DMTicket.ReplyToDM(target, "", eb);
                    await Task.CompletedTask;
                    return;
                }
            }
            else
            {
                await channel.SendMessageAsync("Invalid ticket channel, This command only works in ticket channels.");
            }
            return;
        }