public async Task ViewMember(Context ctx, PKMember target) { var system = await ctx.Repository.GetSystem(target.System); await ctx.Reply( embed : await _embeds.CreateMemberEmbed(system, target, ctx.Guild, ctx.LookupContextFor(system.Id), ctx.Zone)); }
private async ValueTask HandleQueryReaction(MessageReactionAddEvent evt, FullMessage msg) { var guild = await _cache.GetGuild(evt.GuildId !.Value); // Try to DM the user info about the message try { var dm = await _dmCache.GetOrCreateDmChannel(evt.UserId); var embeds = new List <Embed>(); if (msg.Member != null) { embeds.Add(await _embeds.CreateMemberEmbed( msg.System, msg.Member, guild, LookupContext.ByNonOwner, DateTimeZone.Utc )); } embeds.Add(await _embeds.CreateMessageInfoEmbed(msg, true)); await _rest.CreateMessage(dm, new MessageRequest { Embeds = embeds.ToArray() }); } catch (ForbiddenException) { } // No permissions to DM, can't check for this :( await TryRemoveOriginalReaction(evt); }
public async Task MemberRandom(Context ctx) { ctx.CheckSystem(); var randGen = new global::System.Random(); //Maybe move this somewhere else in the file structure since it doesn't need to get created at every command // TODO: don't buffer these, find something else to do ig var members = await _data.GetSystemMembers(ctx.System).Where(m => m.MemberPrivacy == PrivacyLevel.Public).ToListAsync(); if (members == null || !members.Any()) { throw Errors.NoMembersError; } var randInt = randGen.Next(members.Count); await ctx.Reply(embed : await _embeds.CreateMemberEmbed(ctx.System, members[randInt], ctx.Guild, ctx.LookupContextFor(ctx.System))); }