Skip to content

Commit 7186841

Browse files
committed
enviroment variables
1 parent 3efe70d commit 7186841

2 files changed

Lines changed: 13 additions & 15 deletions

File tree

src/Disc.NET.Commands/Contexts/InteractionContext.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
using Disc.NET.Commands.Contexts.Models;
2-
using System;
3-
using System.Collections.Generic;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Threading.Tasks;
7-
using Disc.NET.Client.SDK;
1+
using Disc.NET.Client.SDK;
82
using Disc.NET.Client.SDK.Interfaces;
93
using Disc.NET.Client.SDK.Messages;
4+
using Disc.NET.Commands.Contexts.Models;
105
using Disc.NET.Shared.Configurations;
116

127
namespace Disc.NET.Commands.Contexts
@@ -22,7 +17,7 @@ public class InteractionContext : IContext
2217

2318
public InteractionResponse Response { get; set; }
2419
}
25-
20+
2621
public class InteractionResponse(AppConfiguration appConfiguration)
2722
{
2823
private readonly IClient _client = ClientSingleton.GetInstance(appConfiguration);

tests/GenericBot/Program.cs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88

99

1010
App app = new App().WithDebugLogger();
11-
var appConfiguration = new AppConfiguration("MTQzNjE3ODQ0ODkwMDE2MTYyMA.Gevo76.nqkBj12AGeZI-3BmCSLa6oz1_ETbvpb9tiXCFA")
12-
{
13-
Intents = [GatewayIntent.MESSAGE_CONTENT, GatewayIntent.GUILD_MESSAGES],
14-
ApplicationId = 1436178448900161620,
15-
BotPrefix = '?'
16-
};
11+
var token = Environment.GetEnvironmentVariable("GENERIC_BOT_TOKEN")!;
12+
var applicationId = Environment.GetEnvironmentVariable("GENERIC_BOT_APPLICATION_ID")!;
13+
var appConfiguration =
14+
new AppConfiguration(token)
15+
{
16+
Intents = [GatewayIntent.MESSAGE_CONTENT, GatewayIntent.GUILD_MESSAGES],
17+
ApplicationId = long.Parse(applicationId),
18+
BotPrefix = '?'
19+
};
1720

1821
// Tratar os lifetimes, por padrão é InstancePerDependency (uma nova toda vez que é resolvida)
1922
app.UseDependencyInjection(appConfiguration).WithHttpClient();
20-
await app.RunAsync(appConfiguration);
23+
await app.RunAsync(appConfiguration);

0 commit comments

Comments
 (0)