okay, so apparently, committing your token with admin in nin0Corp is not a good idea.

This commit is contained in:
nin0dev 2024-11-29 21:44:45 -05:00
parent 86453daede
commit cd08ed9ae4
Signed by: nin0
SSH key fingerprint: SHA256:Is2DvJdw1OkSopR4wKJfdWV0fZhMLxpnCs1P1nPhIgA
6 changed files with 49 additions and 4 deletions

1
.gitignore vendored
View file

@ -6,3 +6,4 @@ DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
.env

22
.vscode/launch.json vendored Normal file
View file

@ -0,0 +1,22 @@
{
"configurations": [
{
"type": "lldb",
"request": "launch",
"args": [],
"cwd": "${workspaceFolder:fj-admin-switfie}",
"name": "Debug fj-admin",
"program": "${workspaceFolder:fj-admin-switfie}/.build/debug/fj-admin",
"preLaunchTask": "swift: Build Debug fj-admin"
},
{
"type": "lldb",
"request": "launch",
"args": [],
"cwd": "${workspaceFolder:fj-admin-switfie}",
"name": "Release fj-admin",
"program": "${workspaceFolder:fj-admin-switfie}/.build/release/fj-admin",
"preLaunchTask": "swift: Build Release fj-admin"
}
]
}

1
.vscode/settings.json vendored Normal file
View file

@ -0,0 +1 @@
{}

View file

@ -1,5 +1,5 @@
{
"originHash" : "3d28c07a9322f4b5113beb449558e3d98bbcd18d5e1f793fce74c088e5e32263",
"originHash" : "376b28dbeb8d6abd83240216351c27a3bfd2a448dc29c9c10156125bce6469e7",
"pins" : [
{
"identity" : "async-http-client",
@ -28,6 +28,15 @@
"version" : "1.12.1"
}
},
{
"identity" : "dotenv",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftpackages/DotEnv.git",
"state" : {
"revision" : "1f15bb9de727d694af1d003a1a5d7a553752850f",
"version" : "3.0.0"
}
},
{
"identity" : "multipart-kit",
"kind" : "remoteSourceControl",

View file

@ -6,7 +6,8 @@ import PackageDescription
let package = Package(
name: "fj-admin",
dependencies: [
.package(url: "https://github.com/DDBKit/DDBKit", exact: "0.2.4"), // change this to latest ver
.package(url: "https://github.com/DDBKit/DDBKit", exact: "0.2.4"), // change this to latest ver,
.package(url: "https://github.com/swiftpackages/DotEnv.git", from: "3.0.0")
],
targets: [
// Targets are the basic building blocks of a package, defining a module or a test suite.
@ -17,6 +18,7 @@ let package = Package(
.product(name: "DDBKit", package: "DDBKit"),
.product(name: "DDBKitUtilities", package: "DDBKit"),
.product(name: "DDBKitFoundation", package: "DDBKit"),
.product(name: "DotEnv", package: "DotEnv"),
]
),
]

View file

@ -1,14 +1,24 @@
import DDBKit
import DotEnv
import Foundation
@main
struct FjAdminBot: DiscordBotApp {
init() async {
do {
let env = try DotEnv.read(path: "./.env")
env.load()
print("Loaded .env file")
} catch {
print("Failed to load .env file, things won't work!")
}
let httpClient = HTTPClient()
bot = await BotGatewayManager(
eventLoopGroup: httpClient.eventLoopGroup,
httpClient: httpClient,
token: "MTMxMTY2NTg1OTQ3NTAxMzY1Mg.GgVETf.KbMqaqPhOR3JMNT-GiWT3qwiK862cbbjZm9RTc",
token: ProcessInfo.processInfo.environment["BOT_TOKEN"]!,
largeThreshold: 250,
presence: .init(activities: [], status: .online, afk: false),
intents: [.messageContent, .guildMessages]
@ -23,7 +33,7 @@ struct FjAdminBot: DiscordBotApp {
var body: [any BotScene] {
ReadyEvent { ready in
print("hi mom")
print(String(format: "Logged on as %@#%@!", ready.user.username, ready.user.discriminator))
}
}