-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #450 from zaanposni/release/v2.3.0
Release/v2.3.0
- Loading branch information
Showing
34 changed files
with
1,036 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using DSharpPlus; | ||
using DSharpPlus.Entities; | ||
using DSharpPlus.SlashCommands; | ||
|
||
namespace masz.Commands | ||
{ | ||
|
||
public class AvatarCommand : BaseCommand<AvatarCommand> | ||
{ | ||
public AvatarCommand(IServiceProvider serviceProvider) : base(serviceProvider) { } | ||
|
||
[SlashCommand("avatar", "Get the high resolution avatar of a user.")] | ||
public async Task Avatar(InteractionContext ctx, [Option("user", "User to get the avatar from")] DiscordUser user) | ||
{ | ||
DiscordMember member = null; | ||
try | ||
{ | ||
member = await ctx.Guild.GetMemberAsync(user.Id); | ||
} catch (Exception) { } | ||
|
||
DiscordEmbedBuilder embed = new DiscordEmbedBuilder(); | ||
embed.WithTitle("Avatar"); | ||
embed.WithFooter($"UserId: {user.Id}"); | ||
if (member != null && member.GuildAvatarHash != user.AvatarHash) | ||
{ | ||
embed.WithUrl(member.GuildAvatarUrl); | ||
embed.WithImageUrl(member.GuildAvatarUrl); | ||
} else | ||
{ | ||
embed.WithUrl(user.AvatarUrl); | ||
embed.WithImageUrl(user.AvatarUrl); | ||
} | ||
|
||
await ctx.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().AddEmbed(embed.Build()).AsEphemeral(true)); | ||
} | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
.../masz/Controllers/api/v1/Enums/AutoModerationChannelNotificationBehaviorEnumController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using masz.Dtos.Enum; | ||
using masz.Enums; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace masz.Controllers | ||
{ | ||
[ApiController] | ||
[Route("api/v1/enums/")] | ||
public class AutoModerationChannelNotificationBehaviorEnumController : SimpleController | ||
{ | ||
private readonly ILogger<AutoModerationChannelNotificationBehaviorEnumController> _logger; | ||
|
||
public AutoModerationChannelNotificationBehaviorEnumController(ILogger<AutoModerationChannelNotificationBehaviorEnumController> logger, IServiceProvider serviceProvider) : base(serviceProvider) | ||
{ | ||
_logger = logger; | ||
} | ||
|
||
[HttpGet("automodchannelbehavior")] | ||
public IActionResult ChannelNotificationBehavior([FromQuery] Language? language = null) { | ||
_translator.SetContext(language); | ||
return Ok(new List<EnumDto>() | ||
{ | ||
EnumDto.Create((int) AutoModerationChannelNotificationBehavior.SendNotification, _translator.T().Enum(AutoModerationChannelNotificationBehavior.SendNotification)), | ||
EnumDto.Create((int) AutoModerationChannelNotificationBehavior.SendNotificationAndDelete, _translator.T().Enum(AutoModerationChannelNotificationBehavior.SendNotificationAndDelete)), | ||
EnumDto.Create((int) AutoModerationChannelNotificationBehavior.NoNotification, _translator.T().Enum(AutoModerationChannelNotificationBehavior.NoNotification)) | ||
}); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
backend/masz/Enums/AutoModerationChannelNotificationBehaviorEnum.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace masz.Enums | ||
{ | ||
public enum AutoModerationChannelNotificationBehavior | ||
{ | ||
SendNotification, | ||
SendNotificationAndDelete, | ||
NoNotification | ||
} | ||
} |
Oops, something went wrong.