Skip to content

Commit 2f8752c

Browse files
authored
Merge pull request #2 from Amino-NET-Group/dev
Dev
2 parents 034cb9e + 39bf6a5 commit 2f8752c

File tree

17 files changed

+620
-28
lines changed

17 files changed

+620
-28
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ko_fi: fabiothefox

.github/workflows/tests.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Dev Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- dev
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: '7.x'
20+
21+
- name: Restore dependencies
22+
run: dotnet restore
23+
24+
- name: Build and test
25+
run: dotnet build --configuration Release && dotnet test --no-build --verbosity normal

Amino.NET.Interactions/Amino.NET.Interactions.csproj

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,41 @@
44
<TargetFramework>net7.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7+
<Authors>FabioTheeFox</Authors>
8+
<Company>FabiDev</Company>
9+
<Description>A simple framework for Amino chatbots built on Amino.NET</Description>
10+
<PackageId>Amino.NET.Interactions</PackageId>
11+
<Title>Amino.NET.Interactions</Title>
12+
<Version>1.0.0</Version>
13+
<Product>Amino.NET.Interactions</Product>
14+
<Copyright>FabioTheFox</Copyright>
15+
<PackageIcon>Amino.Net-Logo-V2.png</PackageIcon>
16+
<PackageReadmeFile>README.md</PackageReadmeFile>
17+
<RepositoryUrl>https://github.com/Amino-NET-Group/Amino.NET.Interactions</RepositoryUrl>
18+
<RepositoryType>GIT</RepositoryType>
19+
<PackageTags>Amino, Aminoapps, Amino.NET, rest, api, framework, Amino.NET.Interactions, Interactions</PackageTags>
20+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
21+
<PackageRequireLicenseAcceptance>True</PackageRequireLicenseAcceptance>
22+
<IncludeSymbols>False</IncludeSymbols>
23+
<GenerateDocumentationFile>True</GenerateDocumentationFile>
724
</PropertyGroup>
825

26+
<ItemGroup>
27+
<None Include="..\README.md">
28+
<Pack>True</Pack>
29+
<PackagePath>\</PackagePath>
30+
</None>
31+
</ItemGroup>
32+
933
<ItemGroup>
1034
<PackageReference Include="Amino.NET" Version="1.6.0" />
1135
</ItemGroup>
1236

37+
<ItemGroup>
38+
<None Update="Media\Amino.Net-Logo-V2.png">
39+
<Pack>True</Pack>
40+
<PackagePath>\</PackagePath>
41+
</None>
42+
</ItemGroup>
43+
1344
</Project>

Amino.NET.Interactions/Attributes/Command.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace Amino.Interactions.Attributes
88
{
9+
/// <summary>
10+
/// This Attribute defines a Module to be a command
11+
/// </summary>
912
public class Command : Attribute
1013
{
1114
public string CommandName { get; }

Amino.NET.Interactions/Attributes/EnabledInDms.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66

77
namespace Amino.Interactions.Attributes
88
{
9+
/// <summary>
10+
/// This Attribute defines if a Module can be used in DMs and or DM Groups
11+
/// </summary>
12+
/// <remarks>Note: Using this attribute will not have any effect on your program as it is not fully implemented yet. You can still have it and update your project dependencies later for this take effect.</remarks>
913
public class EnabledInDms : Attribute
1014
{
1115
public bool IsEnabledInDms { get; } = true;

Amino.NET.Interactions/Attributes/PermissionGroup.cs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@
66

77
namespace Amino.Interactions.Attributes
88
{
9-
public class PermissionGroup
9+
/// <summary>
10+
/// With this Attribute you can determine what permission level is required in order for a user to be able to use your module
11+
/// </summary>
12+
/// <remarks>Note: Using this attribute will not have any effect on your program as it is not fully implemented yet. You can still have it and update your project dependencies later for this take effect.</remarks>
13+
public class PermissionGroup : Attribute
1014
{
1115
public enum PermissionGroups
1216
{
13-
All,
14-
Chat_Staff,
15-
Staff,
16-
Curator,
17-
Leader,
18-
Agent
17+
All = 0,
18+
Chat_Staff = 1,
19+
Staff = 2,
20+
Curator = 3,
21+
Leader = 4,
22+
Agent = 5
1923
}
2024

2125
public PermissionGroups RequiredPermission { get; set; } = PermissionGroups.All;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Reflection;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace Amino.Interactions
9+
{
10+
public class ParameterInfo
11+
{
12+
public string Name { get; set; }
13+
public bool IsOptional { get; set; }
14+
}
15+
16+
public class FunctionAnalyzer
17+
{
18+
public ParameterInfo[] GetParameters(MethodInfo method)
19+
{
20+
return method.GetParameters()
21+
.Select(p => new ParameterInfo
22+
{
23+
Name = p.ParameterType.Name,
24+
IsOptional = p.HasDefaultValue
25+
})
26+
.ToArray();
27+
}
28+
}
29+
}
Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,44 @@
1-
using System;
1+
using Amino.Interactions.Objects;
2+
using System;
23
using System.Collections.Generic;
34
using System.Linq;
45
using System.Text;
56
using System.Threading.Tasks;
6-
7+
using Amino;
8+
using System.Security.Cryptography.X509Certificates;
79
namespace Amino.Interactions
810
{
911
public class InteractionBase
1012
{
11-
public Objects.Interaction Context;
1213

1314

15+
public Task<Amino.Objects.Message> Respond(Interaction context, string message, bool asReply = true)
16+
{
17+
SubClient subClient = new SubClient(context.AminoClient, context.Message.communityId.ToString());
18+
var ReturnMessage = subClient.send_message(message, context.InteractionChatId, replyTo: asReply ? context.Message.messageId : null);
19+
return Task.FromResult(ReturnMessage);
20+
}
21+
22+
public Task RespondWithFile(Interaction context, byte[] file, Amino.Types.upload_File_Types type = Types.upload_File_Types.Image)
23+
{
24+
SubClient subClient = new SubClient(context.AminoClient, context.Message.communityId.ToString());
25+
subClient.send_file_message(context.InteractionChatId, file, type);
26+
return Task.CompletedTask;
27+
}
28+
29+
public Task RespondWithSticker(Interaction context, string stickerId)
30+
{
31+
SubClient subClient = new SubClient(context.AminoClient, context.Message.communityId.ToString());
32+
subClient.send_sticker(context.InteractionChatId, stickerId);
33+
return Task.CompletedTask;
34+
}
35+
36+
public Task RespondWithEmbed(Interaction context, string content, string embedId = null, string embedLink = null, string embedTitle = null, string embedContent = null, byte[] embedImage = null)
37+
{
38+
SubClient subClient = new SubClient(context.AminoClient, context.Message.communityId.ToString());
39+
subClient.send_embed(context.InteractionChatId, content, embedId, embedLink, embedTitle, embedContent, embedImage);
40+
return Task.CompletedTask;
41+
}
42+
1443
}
1544
}

0 commit comments

Comments
 (0)