Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/Source Generation Based Hybrid Commands #318

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
160 commits
Select commit Hold shift + click to select a range
0a31886
feat: lib dev rework
Lulalaby Mar 25, 2023
e82c807
feat: use discordjson deser to find new fields
Lulalaby Mar 25, 2023
47519fe
feat!: Rename ApiObject to ObservableApiObject
Lulalaby Mar 25, 2023
eb97b55
chore: xml docs
Lulalaby Mar 25, 2023
5fc16db
chore: fix xml docs
Lulalaby Mar 25, 2023
edac9b6
whoops
Lulalaby Mar 25, 2023
ad61de9
fix missing observe
Lulalaby Mar 26, 2023
58c1688
[ci skip] grant extension access to internals
Lulalaby Mar 28, 2023
7a6d4f5
fuck it
Lulalaby May 6, 2023
4b47658
expose additional properties
Lulalaby May 13, 2023
1ad830b
net7 cleanup
Lulalaby May 14, 2023
2e3afd8
feat!: convert most objects to ObservableApiObject
Lulalaby May 14, 2023
4068e5b
fix: ac doesn't throw warnings anymore for too much exec time
Lulalaby May 14, 2023
fc24007
chore: prefer new() in dispatch
Lulalaby May 15, 2023
3f5b270
Update DiscordClient.Dispatch.cs
Lulalaby May 15, 2023
069c9fc
a
Lulalaby May 15, 2023
2cdd364
aaaa
Lulalaby May 15, 2023
21e1a58
well
Lulalaby May 15, 2023
d0280d1
b
Lulalaby May 15, 2023
7c204cb
fix: fix static sentry
Lulalaby May 15, 2023
13b982c
feat: sentry release
Lulalaby May 16, 2023
a9cd84f
feat: guild_id for integration
Lulalaby May 16, 2023
c0a21f7
fix: ignore guild_hashes and hashes on channel
Lulalaby May 16, 2023
a82763e
feat(actions): fucking sentry
Lulalaby May 17, 2023
333ce3f
Update release.yml
Lulalaby May 17, 2023
e662d19
Update DiscordInvite.cs
Lulalaby May 17, 2023
f064ec6
fix: dcs attr is unused and should return false
Lulalaby May 17, 2023
b33765d
feat: discordjson rework part 1 from idfk how many
Lulalaby May 17, 2023
7f0fc5b
aaaaaaaaa
Lulalaby May 17, 2023
8623a8b
Update DiscordApplicationCommand.cs
Lulalaby May 17, 2023
f91ab4c
more observable api objects
Lulalaby May 17, 2023
baa1337
a
Lulalaby May 17, 2023
7b8d826
Update DiscordPresence.cs
Lulalaby May 17, 2023
4f32c6a
Update release.yml
Lulalaby May 17, 2023
67ad1fa
Update release.yml
Lulalaby May 17, 2023
72f8565
Update release.yml
Lulalaby May 18, 2023
2d0aaf4
fix(actions): step name
Lulalaby May 18, 2023
496437a
feat: allow devs to give their contact data for sentry reports
Lulalaby May 18, 2023
de3b06f
fix: internal get; set
Lulalaby May 18, 2023
f4592b2
feat(actions): internal registry
Lulalaby May 18, 2023
a13293c
fix(actions): i hate this shit
Lulalaby May 18, 2023
aa06c14
fix(actions): i hate this shit again
Lulalaby May 18, 2023
f5d2ec6
[ci skip] fix(actions): formatting
Lulalaby May 18, 2023
026fb15
feat: channel type 16
Lulalaby May 18, 2023
47e254e
fix: sentry user if enabled for global scope
Lulalaby May 19, 2023
525c758
[ci skip] fix(actions): step names
Lulalaby May 19, 2023
520fae3
fix: fix sentry logger
Lulalaby May 19, 2023
d13dfb0
fix: i should not log tf outta the lib
Lulalaby May 19, 2023
f876848
fix: we don't need sentry to log connection errors
Lulalaby May 20, 2023
f2271a5
feat: sentry event fingerprint for missing field events
Lulalaby May 20, 2023
0062e2b
docs: ex addition
Lulalaby May 21, 2023
5faeb29
feat: x-discord-timezone & formatting of headers
Lulalaby May 22, 2023
f5ab125
feat: sentry native build
Lulalaby May 23, 2023
d509af8
fix(ci): fix sentry target
Lulalaby May 23, 2023
5d0b2ba
fix(ci): fix sentry target again
Lulalaby May 23, 2023
812357c
fix: limit sentry logging
Lulalaby May 24, 2023
7873595
fix: log certain stuff only in lib dev mode
Lulalaby May 24, 2023
b262102
feat: centralized config for internal visibility
Lulalaby May 24, 2023
65f6e35
fix: docs fix and accessors in config
Lulalaby May 24, 2023
d1522b2
fix: internals
Lulalaby May 24, 2023
bb3ac1a
Update InternalsVisibleTo.targets
Lulalaby May 24, 2023
14987b8
fix: ignore json fields
Lulalaby May 25, 2023
070469e
feat: allow in custom sentry dsn
Lulalaby May 28, 2023
9d77286
Default Timezone to Null
TheXorog May 28, 2023
7ea2e84
fix: webhook entity
Lulalaby May 28, 2023
91c723d
chore: add todo
Lulalaby May 30, 2023
e62407b
refactor: discord overwrite builder & permissions
TheXorog May 30, 2023
e9666a6
feat: allow overwrite builder with just ids
Lulalaby May 31, 2023
731bf48
fix: cache members on GetAllMembersAsync
Lulalaby May 31, 2023
acd5c09
fix: mira 🙄
Lulalaby May 31, 2023
916ebe9
fix: Linq in merge
FabiChan99 Jun 1, 2023
a0a3027
fix: UserLimit updating when null
TheXorog Jun 1, 2023
12007e6
Revert "fix: UserLimit updating when null"
Lulalaby Jun 1, 2023
8297d6e
to-be-tested: remove obsoletes
Lulalaby Jun 1, 2023
fd9891a
docs: re-enable CustomMemberIndexer
Lulalaby Jun 2, 2023
df241a7
Revert "docs: re-enable CustomMemberIndexer"
Lulalaby Jun 2, 2023
487fb03
Revert "to-be-tested: remove obsoletes"
Lulalaby Jun 3, 2023
c648b42
Add SubCommandName & FullCommandName to BaseContext
TheXorog Jun 4, 2023
d8a3e70
Update DiscordButtonComponent.cs
TheXorog Jun 7, 2023
a903801
Update ApplicationCommandsExtension.cs
TheXorog Jun 8, 2023
374a472
fix: file license header wording. See 68c795c
Lulalaby Jun 8, 2023
7e4477b
feat: channel flag 1L << 15
Lulalaby Jun 9, 2023
e71190e
fix: component only builder messages were incorrectly checked
Lulalaby Jun 11, 2023
a18fddf
fix: bug in webhookclient when discordclient not existing
Lulalaby Jun 14, 2023
7a5ea4a
fix: missing import
Lulalaby Jun 14, 2023
0204aaa
feat(tests): add safety test to ensure no token is set on RestClient
Lulalaby Jun 16, 2023
80012d9
feat: unusual dm activity field
Lulalaby Jun 18, 2023
3138a32
feat!: Lavalink v4
Lulalaby Jun 7, 2023
09d21f7
fix: issues (and I have daddy issues)
Lulalaby Jun 11, 2023
8a1d62f
fix: invalid voice server update state
Lulalaby Jun 11, 2023
df8fa0a
chore: remove debug
Lulalaby Jun 11, 2023
c8900d1
fix: folder of comp int
Lulalaby Jun 11, 2023
7fd2cc7
chore: make player public on guild player
Lulalaby Jun 11, 2023
4dac275
chore: expose client
Lulalaby Jun 11, 2023
aafff53
fix!: remove lavalink v1
Lulalaby Jun 22, 2023
547047d
feat!: lavalink v1 as default lavalink
Lulalaby Jun 22, 2023
3993e69
docs!: hide lavalink v1 from toc
Lulalaby Jun 22, 2023
f3e512a
feat: lib dev rework
Lulalaby Mar 25, 2023
bf2d54d
wörk
TheXorog Jun 10, 2023
ad97f62
wörk 2
TheXorog Jun 10, 2023
9172be2
Forgor
TheXorog Jun 10, 2023
9f6c86b
wörk 3 (from the creator of wörk 1 & 2)
TheXorog Jun 10, 2023
7df6a8b
chore: license year 2023
Lulalaby Jun 10, 2023
17d29b4
wörk 4: wörk in search for a home
TheXorog Jun 10, 2023
141a019
wörk 5: the dawn of exams
TheXorog Jun 10, 2023
50585ff
Revert "feat: lib dev rework"
Lulalaby Jun 22, 2023
cca4b40
feat: app flags 1<<26
Lulalaby Jun 22, 2023
3a78213
docs: llv4
Lulalaby Jun 23, 2023
bc85e3a
fix: link
NyuwBot Jun 23, 2023
860776a
docs: more lavalink stuff
NyuwBot Jun 23, 2023
0e00bb5
feat: enable react
NyuwBot Jun 24, 2023
5503a64
fix: docs
NyuwBot Jun 24, 2023
fb492a6
feat: guild incident message types
NyuwBot Jun 24, 2023
5678cab
feat: schemas
NyuwBot Jun 25, 2023
a25d646
chore: toc schema update
NyuwBot Jun 25, 2023
2a0596c
docs: llv4 again
NyuwBot Jun 25, 2023
872adab
Merge branch 'main' into feat/lib-dev-rework
Lulalaby Jun 25, 2023
ce2b1dd
meow: nya
NyuwBot Jun 25, 2023
f70bb89
Merge branch 'feat/lib-dev-rework' of https://github.com/Aiko-IT-Syst…
NyuwBot Jun 25, 2023
4ab18d1
fix: websocket url double slash
NyuwBot Jun 25, 2023
82aeb66
docs: llv4 again and again and again, send help
NyuwBot Jun 25, 2023
0002b4b
docs: eh
NyuwBot Jun 25, 2023
9d44c7a
fix: forgot to add LavalinkSearchType method
NyuwBot Jun 26, 2023
548bd44
fix: add missing methods to play by track
NyuwBot Jun 26, 2023
f6ed685
fix: add missing currenttrack on guildplayer
NyuwBot Jun 26, 2023
2674343
docs: ll docs :3
NyuwBot Jun 26, 2023
26ec812
feat: LavalinkTrackLoadingResult.GetResultAs<T>
NyuwBot Jun 26, 2023
05161b0
docs: llv4 cmds
NyuwBot Jun 26, 2023
4cc001f
docs: use xref instead of link & fix ll snippet
NyuwBot Jun 26, 2023
c059209
docs: clarify DiscordMessage.Thread
Lulalaby Jun 27, 2023
9b34ec0
Change namespaces of v1 back to .Lavalink
TheXorog Jun 29, 2023
94b5f13
Fix Ticket 58: args.Message.Thread is null MessageReactionAdded/Removed
TheXorog Jun 29, 2023
107b378
fix: thread nre for new messages
Lulalaby Jun 29, 2023
d03882b
docs: fix lavalink example code
NyuwBot Jun 30, 2023
dddc494
Merge branch 'main' into feat/lib-dev-rework
Lulalaby Jun 30, 2023
5bc1bd7
chore(nuget): add release note file
NyuwBot Jun 30, 2023
86e3853
feat(nuget): add release notes
Lulalaby Jun 30, 2023
de13a65
[ci skip] chore: remove saved old config for docfx
NyuwBot Jun 30, 2023
fea3616
docs!: change topic names
NyuwBot Jun 30, 2023
763c94a
docs: rework faq
NyuwBot Jun 30, 2023
2bbfd21
docs: uniform appCommands example code
DraconicDragon Jul 1, 2023
861ca2d
Merge pull request #325 from DraconicDragon/feat/lib-dev-rework
Lulalaby Jul 1, 2023
55860bf
Merge branch 'main' into feat/lib-dev-rework
Lulalaby Jul 1, 2023
19bf713
[ci skip] docs: rm img
Lulalaby Jul 2, 2023
8aa23a5
[ci skip] docs: rework
NyuwBot Jul 2, 2023
c1e526e
docs: rework interactivity
NyuwBot Jul 2, 2023
157f1fa
[ci skip] docs: rm img
Lulalaby Jul 2, 2023
a1eef5c
Merge branch 'feat/lib-dev-rework' of https://github.com/Aiko-IT-Syst…
Lulalaby Jul 2, 2023
c71facc
docs: rework
NyuwBot Jul 2, 2023
f4b6331
add AggregateException with more infos here
TheXorog Jul 2, 2023
8855bee
Add AggregateExceptions with more information to command registering
TheXorog Jul 2, 2023
4ab9477
docs: clean imgs
Lulalaby Jul 3, 2023
8ea377a
docs: replace images with interactive components
NyuwBot Jul 3, 2023
3118f90
fix(docs): re-enable featherlight
NyuwBot Jul 3, 2023
c378c8a
Merge branch 'feat/lib-dev-rework' into feat/sourcegenbased-hybrid-co…
TheXorog Jul 4, 2023
aaf0983
a
TheXorog Jul 4, 2023
afdb31b
wörk 5
TheXorog Jul 4, 2023
002f13c
Merge branch 'main' into feat/sourcegenbased-hybrid-commands
Lulalaby Jul 5, 2023
e7a5cc3
Merge branch 'main' into feat/sourcegenbased-hybrid-commands
Lulalaby Jul 5, 2023
73a055f
Merge branch 'main' into feat/sourcegenbased-hybrid-commands
Lulalaby Jul 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions DisCatSharp.HybridCommands/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = false

#### Core EditorConfig Options ####

# All files
[*]

# General
charset = utf-8
trim_trailing_whitespace = true

[*.cs]
file_header_template = This file is part of the DisCatSharp project.\n\nCopyright (c) 2023 AITSYS\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the "Software"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.
110 changes: 110 additions & 0 deletions DisCatSharp.HybridCommands/Attributes/HybridCommandAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2023 AITSYS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

using System;
using DisCatSharp.Enums;

namespace DisCatSharp.HybridCommands.Attributes;

/// <summary>
/// Marks this method as a hybrid command
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
public class HybridCommandAttribute : Attribute
{
/// <summary>
/// Gets the name of this command
/// </summary>
public string Name { get; set; }

/// <summary>
/// Gets the description of this command
/// </summary>
public string Description { get; set; }

/// <summary>
/// Gets the needed permission of this command
/// </summary>
public Permissions? DefaultMemberPermissions { get; set; }

/// <summary>
/// Gets the dm permission of this command
/// </summary>
public bool? DmPermission { get; set; }

/// <summary>
/// Gets whether this command is marked as NSFW
/// </summary>
public bool IsNsfw { get; set; }

/// <summary>
/// Marks this method as hybrid command.
/// </summary>
/// <param name="name">The name of this hybrid command.</param>
/// <param name="description">The description of this hybrid command.</param>
/// <param name="defaultMemberPermissions">
/// <para>The default permissions required for execution.</para>
/// <para>This can be overriden by a guild and is not enforced via prefix commands.</para>
/// </param>
/// <param name="dmPermission">Whether this command should be available in direct messages.</param>
/// <param name="isNsfw">
/// <para>Whether this command should be marked as nsfw.</para>
/// <para>Does not protect this command from being ran as prefix command from users under 18.</para>
/// </param>
public HybridCommandAttribute(string name, string description, Permissions? defaultMemberPermissions = null, bool dmPermission = true, bool isNsfw = false)
{
this.Name = name;
this.Description = description;
this.DefaultMemberPermissions = defaultMemberPermissions;
this.DmPermission = dmPermission;
this.IsNsfw = isNsfw;
}

/// <summary>
/// Marks this method as hybrid command.
/// </summary>
/// <param name="name">The name of this hybrid command.</param>
/// <param name="description">The description of this hybrid command.</param>
/// <param name="dmPermission">Whether this command should be available in direct messages.</param>
/// <param name="isNsfw">
/// <para>Whether this command should be marked as nsfw.</para>
/// <para>Does not protect this command from being ran as prefix command from users under 18.</para>
/// </param>
public HybridCommandAttribute(string name, string description, bool dmPermission, bool isNsfw = false)
{
this.Name = name;
this.Description = description;
this.DmPermission = dmPermission;
this.IsNsfw = isNsfw;
}

/// <summary>
/// Marks this method as hybrid command.
/// </summary>
/// <param name="name">The name of this hybrid command.</param>
/// <param name="description">The description of this hybrid command.</param>
public HybridCommandAttribute(string name, string description)
{
this.Name = name;
this.Description = description;
}
}
58 changes: 58 additions & 0 deletions DisCatSharp.HybridCommands/Attributes/OptionAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2023 AITSYS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

using System;

namespace DisCatSharp.HybridCommands.Attributes;

/// <summary>
/// Marks this parameter as an option for a hybrid command
/// </summary>
[AttributeUsage(AttributeTargets.Parameter)]
public class OptionAttribute : Attribute
{
/// <summary>
/// Gets the name of this option.
/// </summary>
public string Name;

/// <summary>
/// Gets the description of this option.
/// </summary>
public string Description;

/// <summary>
/// Initializes a new instance of the <see cref="OptionAttribute"/> class.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="description">The description.</param>
public OptionAttribute(string name, string description)
{
if (name.Length > 32)
throw new ArgumentException("Hybrid command option names cannot go over 32 characters.");
else if (description.Length > 100)
throw new ArgumentException("Hybrid command option descriptions cannot go over 100 characters.");

this.Name = name.ToLower();
this.Description = description;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// This file is part of the DisCatSharp project, based off DSharpPlus.
//
// Copyright (c) 2023 AITSYS
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

using System;

using DisCatSharp.HybridCommands.Enums;

namespace DisCatSharp.HybridCommands.Attributes;

/// <summary>
/// Restricts a hybrid command to be only executable by certain execution types.
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
public class RestrictedExecutionTypesAttribute : Attribute
{
/// <summary>
/// Gets which execution types are allowed for this hybrid command.
/// </summary>
public HybridExecutionType[] Types { get; set; }

/// <summary>
/// Restricts a hybrid command to be only executable by certain execution types.
/// </summary>
/// <param name="allowedTypes">The types of execution that are allowed.</param>
public RestrictedExecutionTypesAttribute(params HybridExecutionType[] allowedTypes)
{
this.Types = allowedTypes;
}
}
Loading
Loading