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

Add wiki command #317

Merged
merged 7 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ cmake-build-*/
# IntelliJ
out/

# VSCode
.vscode/

# mpeltonen/sbt-idea plugin
.idea_modules/

Expand Down Expand Up @@ -237,3 +240,4 @@ gradle-app.setting
# End of https://www.toptal.com/developers/gitignore/api/git,java,gradle,eclipse,netbeans,jetbrains+all,visualstudiocode.

bot.properties
bot
4 changes: 4 additions & 0 deletions bot.properties.example
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ github-token: github_oauth_token
sentry-dsn: https://[email protected]/xxx
sentry-env: production
ocr-path: /usr/share/tesseract-ocr/4.00/tessdata
algolia-application-id: 0DTHI9QFCH
algolia-search-api-key: 3cc0567f76d2ed3ffdb4cc94f0ac9815
Kas-tle marked this conversation as resolved.
Show resolved Hide resolved
algolia-index-name: geysermc
algolia-site-search-url: https://geysermc.org/search?q=
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ dependencies {
// Image processing and OCR
implementation 'net.sourceforge.tess4j:tess4j:5.12.0'
implementation 'org.imgscalr:imgscalr-lib:4.2'

// Agolia Search (For Wiki)
implementation 'com.algolia:algoliasearch:4.3.2'
}

jar {
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/org/geysermc/discordbot/GeyserBot.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

package org.geysermc.discordbot;

import com.algolia.api.SearchClient;
import com.jagrosh.jdautilities.command.Command;
import com.jagrosh.jdautilities.command.CommandClientBuilder;
import com.jagrosh.jdautilities.command.ContextMenu;
Expand Down Expand Up @@ -87,6 +88,7 @@ public class GeyserBot {
private static JDA jda;
private static GitHub github;
private static Server httpServer;
private static SearchClient algolia;

static {
// Gathers all commands from "commands" package.
Expand Down Expand Up @@ -161,6 +163,9 @@ public static void main(String[] args) throws IOException {
// Connect to github
github = new GitHubBuilder().withOAuthToken(PropertiesManager.getGithubToken()).build();

// Connect to Algolia
algolia = new SearchClient(PropertiesManager.getAlgoliaApplicationId(), PropertiesManager.getAlgoliaSearchApiKey());

// Initialize the waiter
EventWaiter waiter = new EventWaiter();

Expand Down Expand Up @@ -298,6 +303,10 @@ public static GitHub getGithub() {
return github;
}

public static SearchClient getAlgolia() {
return algolia;
}

public static ScheduledExecutorService getGeneralThreadPool() {
return generalThreadPool;
}
Expand Down
Loading
Loading