├── .editorconfig ├── .gitattributes ├── .github ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── FAQ.txt ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── STRUCTURE_GUIDE.md ├── musl-lavaplayer-natives │ └── linux-x86-64 │ │ └── libconnector.so ├── sentry.sh └── workflows │ ├── 1-build-projects.yml │ ├── 2-release-bot.yml │ ├── 2-release-dashboard.yml │ └── codeql-analysis.yml ├── .gitignore ├── .idea ├── .gitignore ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── copyright │ ├── SkyBot.xml │ └── profiles_settings.xml ├── discord.xml ├── jarRepositories.xml ├── jsonSchemas.xml ├── kotlinc.xml └── sqldialects.xml ├── LICENSE ├── README.md ├── assets ├── bot ├── .dockerignore ├── .gitignore ├── Dockerfile ├── assets │ ├── lottieconverter │ └── lottieconverter_musl ├── build.gradle.kts ├── docker-compose.yml ├── gradle.properties ├── linters │ └── pmd.xml ├── src │ └── main │ │ ├── java │ │ ├── fredboat │ │ │ └── audio │ │ │ │ └── player │ │ │ │ └── LavalinkManager.java │ │ └── me │ │ │ └── duncte123 │ │ │ └── skybot │ │ │ ├── CommandManager.java │ │ │ ├── EventManager.java │ │ │ ├── Settings.java │ │ │ ├── ShardWatcher.java │ │ │ ├── SkyBot.java │ │ │ ├── Variables.java │ │ │ ├── audio │ │ │ ├── AudioLoader.java │ │ │ ├── BigChungusPlaylist.java │ │ │ ├── GuildMusicManager.java │ │ │ ├── TrackScheduler.java │ │ │ └── UUIDUserData.java │ │ │ ├── commands │ │ │ ├── animals │ │ │ │ ├── AlpacaCommand.java │ │ │ │ ├── DogCommand.java │ │ │ │ ├── KittyCommand.java │ │ │ │ ├── LlamaCommand.java │ │ │ │ └── SealCommand.java │ │ │ ├── essentials │ │ │ │ ├── RemindmeCommand.java │ │ │ │ ├── ShardInfoCommand.java │ │ │ │ ├── TestTagCommand.java │ │ │ │ ├── TokenCommand.java │ │ │ │ ├── TranslateCommand.java │ │ │ │ └── WolframAlphaCommand.java │ │ │ ├── funcmds │ │ │ │ ├── CSShumorCommand.java │ │ │ │ ├── ColorCommand.java │ │ │ │ ├── ExplosmCommand.java │ │ │ │ ├── LoadingBarCommand.java │ │ │ │ ├── LoveCommand.java │ │ │ │ ├── OrlyCommand.java │ │ │ │ ├── TagCommand.java │ │ │ │ ├── UrbanCommand.java │ │ │ │ └── YodaSpeakCommand.java │ │ │ ├── guild │ │ │ │ ├── GuildInfoCommand.java │ │ │ │ ├── GuildJoinsCommand.java │ │ │ │ ├── mod │ │ │ │ │ ├── AnnounceCommand.java │ │ │ │ │ ├── AutoBanBypassCommand.java │ │ │ │ │ ├── BanCommand.java │ │ │ │ │ ├── CleanupCommand.java │ │ │ │ │ ├── HackbanCommand.java │ │ │ │ │ ├── KickCommand.java │ │ │ │ │ ├── ModBaseCommand.java │ │ │ │ │ ├── MuteCommand.java │ │ │ │ │ ├── PurgeChannelCommand.java │ │ │ │ │ ├── PurgeUserCommand.java │ │ │ │ │ ├── SoftbanCommand.java │ │ │ │ │ ├── TempBanCommand.java │ │ │ │ │ ├── TempMuteCommand.java │ │ │ │ │ ├── UnbanCommand.java │ │ │ │ │ ├── UnmuteCommand.java │ │ │ │ │ └── UnwarnCommand.java │ │ │ │ └── owner │ │ │ │ │ ├── CustomCommandCommand.java │ │ │ │ │ ├── ForceDisconnectCommand.java │ │ │ │ │ ├── LockEmoteCommand.java │ │ │ │ │ ├── UnlockEmoteCommand.java │ │ │ │ │ └── settings │ │ │ │ │ ├── AutoRoleCommand.java │ │ │ │ │ ├── MuteRoleCommand.java │ │ │ │ │ ├── SetColorCommand.java │ │ │ │ │ ├── SetDescriptionCommand.java │ │ │ │ │ ├── SetJoinMessageCommand.java │ │ │ │ │ ├── SetLeaveMessageCommand.java │ │ │ │ │ ├── SetLogChannelCommand.java │ │ │ │ │ ├── SetPrefixCommand.java │ │ │ │ │ ├── SetRateLimitsCommand.java │ │ │ │ │ ├── SetWelcomeChannelCommand.java │ │ │ │ │ ├── SettingsBase.java │ │ │ │ │ ├── SettingsCommand.java │ │ │ │ │ ├── ToggleAnnounceTracksCommand.java │ │ │ │ │ ├── ToggleAutoDehoistCommand.java │ │ │ │ │ ├── ToggleFilterInvitesCommand.java │ │ │ │ │ ├── ToggleJoinMessageCommand.java │ │ │ │ │ ├── ToggleKickModeCommand.java │ │ │ │ │ ├── ToggleSpamFilterCommand.java │ │ │ │ │ └── ToggleSwearFilterCommand.java │ │ │ ├── image │ │ │ │ ├── AchievementCommand.java │ │ │ │ ├── CaptchaCommand.java │ │ │ │ ├── ClintCommand.java │ │ │ │ ├── DeleteCommand.java │ │ │ │ ├── DidYouMeanCommand.java │ │ │ │ ├── FactsCommand.java │ │ │ │ ├── ImageCommandBase.java │ │ │ │ ├── JokeoverheadCommand.java │ │ │ │ ├── LinusCommand.java │ │ │ │ ├── NoPatronImageCommand.java │ │ │ │ ├── PcCheckCommand.java │ │ │ │ ├── PornHubCommand.java │ │ │ │ ├── SaltyCommand.java │ │ │ │ ├── ScrollCommand.java │ │ │ │ ├── ShitCommand.java │ │ │ │ ├── TheSearchCommand.java │ │ │ │ ├── duncte123gen │ │ │ │ │ ├── DrakeCommand.java │ │ │ │ │ ├── IWantToDieCommand.java │ │ │ │ │ └── ItsFreeRealEstateCommand.java │ │ │ │ └── filter │ │ │ │ │ ├── BlackAndWhiteCommand.java │ │ │ │ │ ├── BlurCommand.java │ │ │ │ │ ├── DeepfryCommand.java │ │ │ │ │ ├── FilterBase.java │ │ │ │ │ ├── InvertCommand.java │ │ │ │ │ ├── PixelateCommand.java │ │ │ │ │ └── SaturateCommand.java │ │ │ ├── lgbtq │ │ │ │ ├── FlagCommand.java │ │ │ │ ├── PronounsCheckCommand.java │ │ │ │ └── SetPronounsCommand.java │ │ │ ├── music │ │ │ │ └── SeekCommand.java │ │ │ ├── uncategorized │ │ │ │ ├── BotinfoCommand.java │ │ │ │ ├── ChangeLogCommand.java │ │ │ │ ├── HelpCommand.java │ │ │ │ ├── PingCommand.java │ │ │ │ ├── VoteCommand.java │ │ │ │ └── YesNoCommand.java │ │ │ └── utils │ │ │ │ └── EnlargeCommand.java │ │ │ ├── database │ │ │ ├── DummyRedisConnection.java │ │ │ ├── RedisConnection.java │ │ │ └── RedisDB.java │ │ │ ├── exceptions │ │ │ └── LimitReachedException.java │ │ │ ├── listeners │ │ │ ├── BaseListener.java │ │ │ ├── GuildListener.java │ │ │ ├── GuildMemberListener.java │ │ │ ├── InviteTrackingListener.java │ │ │ ├── MessageListener.java │ │ │ └── ReadyShutdownListener.java │ │ │ ├── logging │ │ │ └── SentryFilter.java │ │ │ ├── objects │ │ │ ├── CooldownScope.java │ │ │ ├── Emotes.java │ │ │ ├── FakePendingRequest.java │ │ │ ├── GuildMemberInfo.java │ │ │ ├── TriConsumer.java │ │ │ ├── apis │ │ │ │ ├── BlargBot.java │ │ │ │ └── alexflipnote │ │ │ │ │ ├── Alexflipnote.java │ │ │ │ │ └── FlipnoteColourObj.java │ │ │ ├── command │ │ │ │ ├── Command.java │ │ │ │ ├── CommandContext.java │ │ │ │ ├── Flag.java │ │ │ │ └── MusicCommand.java │ │ │ ├── config │ │ │ │ └── DunctebotConfig.java │ │ │ ├── discord │ │ │ │ ├── InviteData.java │ │ │ │ └── MessageData.java │ │ │ ├── jagtag │ │ │ │ └── DiscordMethods.java │ │ │ ├── pairs │ │ │ │ └── LongLongPair.java │ │ │ └── user │ │ │ │ ├── ConsoleUser.java │ │ │ │ ├── FakeUser.java │ │ │ │ └── UnknownUser.java │ │ │ ├── utils │ │ │ ├── AirUtils.java │ │ │ ├── AudioUtils.java │ │ │ ├── CommandUtils.java │ │ │ ├── Debouncer.java │ │ │ ├── GuildSettingsUtils.java │ │ │ ├── GuildUtils.java │ │ │ ├── HelpEmbeds.java │ │ │ ├── MapUtils.java │ │ │ ├── ModerationUtils.java │ │ │ ├── MusicEmbedUtils.java │ │ │ ├── PerspectiveApi.java │ │ │ └── TwemojiParser.java │ │ │ └── websocket │ │ │ ├── ReconnectTask.java │ │ │ └── SocketHandler.java │ │ ├── kotlin │ │ └── me │ │ │ └── duncte123 │ │ │ └── skybot │ │ │ ├── ReactionCacheElement.kt │ │ │ ├── ReactionHandler.kt │ │ │ ├── commands │ │ │ ├── admin │ │ │ │ ├── BlackListCommand.kt │ │ │ │ └── VcAutoRoleCommand.kt │ │ │ ├── animals │ │ │ │ └── BirbCommand.kt │ │ │ ├── essentials │ │ │ │ ├── ClearLeftGuildsCommand.kt │ │ │ │ ├── CommandDumpCommand.kt │ │ │ │ ├── RemindersCommand.kt │ │ │ │ ├── RestartShardCommand.kt │ │ │ │ ├── StatsCommand.kt │ │ │ │ └── eval │ │ │ │ │ └── EvalCommand.kt │ │ │ ├── funCmds │ │ │ │ ├── AdviceCommand.kt │ │ │ │ ├── ChatCommand.kt │ │ │ │ ├── CoinCommand.kt │ │ │ │ ├── DeletCommand.kt │ │ │ │ ├── DiscordMemesCommand.kt │ │ │ │ ├── EveryoneCommand.kt │ │ │ │ ├── FakeWordCommand.kt │ │ │ │ ├── JokeCommand.kt │ │ │ │ ├── MemeCommand.kt │ │ │ │ ├── OldestCommand.kt │ │ │ │ ├── TrashCommand.kt │ │ │ │ ├── XkcdCommand.kt │ │ │ │ └── YoungestCommand.kt │ │ │ ├── mod │ │ │ │ ├── DeHoistUtils.kt │ │ │ │ ├── SlowModeCommand.kt │ │ │ │ ├── VoiceKickCommand.kt │ │ │ │ ├── WarnCommand.kt │ │ │ │ └── WarningsCommand.kt │ │ │ ├── music │ │ │ │ ├── BassBoostCommand.kt │ │ │ │ ├── ForceSkip.kt │ │ │ │ ├── JoinCommand.kt │ │ │ │ ├── LeaveCommand.kt │ │ │ │ ├── LoadCommand.kt │ │ │ │ ├── LyricsCommand.kt │ │ │ │ ├── NowPlayingCommand.kt │ │ │ │ ├── PPlayCommand.kt │ │ │ │ ├── PauseCommand.kt │ │ │ │ ├── PlayCommand.kt │ │ │ │ ├── PlayRawCommand.kt │ │ │ │ ├── QueueCommand.kt │ │ │ │ ├── RadioCommand.kt │ │ │ │ ├── ReaddCommand.kt │ │ │ │ ├── RepeatCommand.kt │ │ │ │ ├── RepeatQueueCommand.kt │ │ │ │ ├── RestartCommand.kt │ │ │ │ ├── SaveCommand.kt │ │ │ │ ├── SearchCommand.kt │ │ │ │ ├── ShuffleCommand.kt │ │ │ │ ├── SkipCommand.kt │ │ │ │ ├── StopCommand.kt │ │ │ │ └── VolumeCommand.kt │ │ │ ├── nsfw │ │ │ │ ├── CarsAndHentaiCommand.kt │ │ │ │ ├── HentaiCommand.kt │ │ │ │ ├── LewdKitsuneCommand.kt │ │ │ │ └── LewdNekoCommand.kt │ │ │ ├── patreon │ │ │ │ └── ScreenshotCommand.kt │ │ │ ├── uncategorized │ │ │ │ ├── AvatarCommand.kt │ │ │ │ ├── CookieCommand.kt │ │ │ │ ├── InviteCommand.kt │ │ │ │ ├── IssueCommand.kt │ │ │ │ ├── KickMeCommand.kt │ │ │ │ ├── QuoteCommand.kt │ │ │ │ ├── ReverseCommand.kt │ │ │ │ ├── RolesCommand.kt │ │ │ │ ├── ShortenCommand.kt │ │ │ │ ├── SuggestCommand.kt │ │ │ │ ├── UnshortenCommand.kt │ │ │ │ ├── UptimeCommand.kt │ │ │ │ └── UserinfoCommand.kt │ │ │ ├── utils │ │ │ │ ├── EmoteCommand.kt │ │ │ │ └── RoleInfoCommand.kt │ │ │ └── weeb │ │ │ │ ├── B1nzyCommand.kt │ │ │ │ ├── DanceCommand.kt │ │ │ │ ├── HugCommand.kt │ │ │ │ ├── LewdCommand.kt │ │ │ │ ├── LickCommand.kt │ │ │ │ ├── MeguminCommand.kt │ │ │ │ ├── OwoCommand.kt │ │ │ │ ├── PatCommand.kt │ │ │ │ ├── PunchCommand.kt │ │ │ │ ├── ShootCommand.kt │ │ │ │ ├── ShrugCommand.kt │ │ │ │ ├── WeebCommand.kt │ │ │ │ └── WeebCommandBase.kt │ │ │ ├── database │ │ │ └── DataTimers.kt │ │ │ ├── entities │ │ │ └── jda │ │ │ │ ├── DunctebotGuild.kt │ │ │ │ └── FakeMember.kt │ │ │ ├── extensions │ │ │ ├── AudioTrack.kt │ │ │ ├── Boolean.kt │ │ │ ├── Process.kt │ │ │ ├── ShardManager.kt │ │ │ ├── String.kt │ │ │ ├── Task.kt │ │ │ ├── Time4J.kt │ │ │ ├── User.kt │ │ │ └── channel.kt │ │ │ ├── objects │ │ │ ├── AudioData.kt │ │ │ ├── DBMap.kt │ │ │ ├── EvalFunctions.kt │ │ │ ├── RadioStream.kt │ │ │ ├── SlashSupport.kt │ │ │ └── TrackUserData.kt │ │ │ ├── utils │ │ │ ├── EarthUtils.kt │ │ │ ├── FinderUtils.kt │ │ │ ├── SpamCache.kt │ │ │ └── SpamFilter.kt │ │ │ └── web │ │ │ ├── SocketTypes.kt │ │ │ ├── WebSocketClient.kt │ │ │ ├── handlers │ │ │ ├── CustomCommandHandler.kt │ │ │ ├── DataUpdateHandler.kt │ │ │ ├── GuildSettingsHandler.kt │ │ │ ├── PongHandler.kt │ │ │ └── RequestHandler.kt │ │ │ └── tasks │ │ │ └── WSPingTask.kt │ │ └── resources │ │ ├── dbchangelog.xml │ │ ├── legacy_logback.groovy │ │ ├── logback.xml │ │ ├── sentry.properties │ │ └── yes.jpg └── testscript.groovy ├── botpages ├── SkyBot.html └── SkyBot.md ├── build.gradle.kts ├── dashboard ├── .dockerignore ├── .editorconfig ├── .gitignore ├── Dockerfile ├── build.gradle.kts ├── docker-compose.yml └── src │ └── main │ ├── kotlin │ └── com │ │ └── dunctebot │ │ ├── dashboard │ │ ├── Container.kt │ │ ├── DiscordError.kt │ │ ├── Main.kt │ │ ├── WebHelpers.kt │ │ ├── WebServer.kt │ │ ├── bodies │ │ │ └── PatronBody.kt │ │ ├── constants │ │ │ └── ContentType.kt │ │ ├── controllers │ │ │ ├── DashboardController.kt │ │ │ ├── GuildController.kt │ │ │ ├── RootController.kt │ │ │ ├── SettingsController.kt │ │ │ └── api │ │ │ │ ├── CustomCommandController.kt │ │ │ │ ├── DataController.kt │ │ │ │ ├── GuildApiController.kt │ │ │ │ ├── OauthController.kt │ │ │ │ └── SettingsApiController.kt │ │ ├── rendering │ │ │ └── WebVariables.kt │ │ ├── tasks │ │ │ ├── DashboardTasks.kt │ │ │ ├── ReconnectTask.kt │ │ │ └── WSPingTask.kt │ │ ├── utils │ │ │ ├── DataUtils.kt │ │ │ └── HashUtils.kt │ │ └── websocket │ │ │ ├── WebsocketClient.kt │ │ │ ├── WebsocketServer.kt │ │ │ └── handlers │ │ │ ├── DataUpdateHandler.kt │ │ │ ├── FetchDataHandler.kt │ │ │ ├── PongHandler.kt │ │ │ ├── RolesHashHandler.kt │ │ │ └── base │ │ │ └── SocketHandler.kt │ │ ├── duncteapi │ │ └── DuncteApi.kt │ │ └── jda │ │ ├── JDARestClient.kt │ │ ├── MemberPaginationAction.kt │ │ ├── impl │ │ └── MemberPaginationActionImpl.kt │ │ ├── json │ │ ├── JsonChannel.kt │ │ ├── JsonGuild.kt │ │ └── JsonRole.kt │ │ └── oauth │ │ ├── OauthSession.kt │ │ └── OauthSessionController.kt │ └── resources │ ├── logback.xml │ ├── public │ ├── css │ │ ├── materialize.custom.css │ │ └── style.css │ ├── favicon.ico │ ├── googleb737aaf3965f2882.html │ ├── img │ │ └── favicon.png │ ├── js │ │ ├── hinting.js │ │ ├── main.js │ │ └── wordlist.js │ └── robots.txt │ └── vue │ ├── components │ ├── app-menu.vue │ └── settings │ │ ├── app-settings-basic.vue │ │ ├── app-settings-custom-commands.vue │ │ ├── app-settings-join-leave.vue │ │ ├── app-settings-moderation.vue │ │ └── parts │ │ ├── app-settings-select-list.vue │ │ ├── app-settings-switch.vue │ │ └── app-settings-warnactions.vue │ ├── layout.html │ └── views │ ├── errors │ ├── 404.vue │ ├── 500.vue │ └── discord │ │ ├── noGuild.vue │ │ ├── noPerms.vue │ │ └── wat.vue │ ├── guilds.vue │ ├── oneGuildRegister.vue │ ├── roles.vue │ └── settings.vue ├── docker-compose.yml ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jda_rename_java.sh ├── jda_rename_kotlin.sh ├── release.sh ├── settings.gradle.kts └── shared ├── .editorconfig ├── .gitignore ├── LICENSE ├── build.gradle.kts └── src └── main ├── java ├── com │ ├── dunctebot │ │ └── models │ │ │ ├── settings │ │ │ ├── GuildSetting.java │ │ │ ├── ProfanityFilterType.java │ │ │ └── WarnAction.java │ │ │ └── utils │ │ │ ├── DateUtils.java │ │ │ └── Utils.java │ └── jagrosh │ │ └── jdautilities │ │ ├── commons │ │ └── utils │ │ │ └── FinderUtil.java │ │ └── oauth2 │ │ ├── OAuth2Client.java │ │ ├── Scope.java │ │ ├── entities │ │ ├── OAuth2Guild.java │ │ ├── OAuth2User.java │ │ └── impl │ │ │ ├── OAuth2ClientImpl.java │ │ │ ├── OAuth2GuildImpl.java │ │ │ └── OAuth2UserImpl.java │ │ ├── exceptions │ │ ├── InvalidStateException.java │ │ └── MissingScopeException.java │ │ ├── requests │ │ ├── OAuth2Action.java │ │ ├── OAuth2Requester.java │ │ └── OAuth2URL.java │ │ ├── session │ │ ├── DefaultSessionController.java │ │ ├── Session.java │ │ ├── SessionController.java │ │ └── SessionData.java │ │ └── state │ │ ├── DefaultStateController.java │ │ └── StateController.java └── me │ └── duncte123 │ └── skybot │ ├── objects │ ├── Tag.java │ └── command │ │ ├── CommandCategory.java │ │ ├── CommandResult.java │ │ ├── CustomCommand.java │ │ └── ICommand.java │ └── utils │ └── ThreadUtils.java └── kotlin └── me └── duncte123 └── skybot ├── database ├── AbstractDatabase.kt ├── MariaDBDatabase.kt └── PostgreDatabase.kt ├── extensions └── DatabaseExtensions.kt ├── objects └── api │ ├── DuncteApis.kt │ └── WebObjects.kt └── utils └── TextUtils.kt /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | 10 | [gradlew] 11 | end_of_line = lf 12 | 13 | [*.{kt,kts}] 14 | ktlint_code_style = ktlint_official 15 | ktlint_standard = enabled 16 | ktlint_experimental = disabled 17 | ktlint_custom-rule-set = disabled 18 | ktlint_standard_filename = disabled 19 | ktlint_standard_function-signature = disabled 20 | ktlint_standard_no-wildcard-imports = disabled 21 | ktlint_standard_argument-list-wrapping = disabled 22 | ktlint_standard_string-template-indent = disabled 23 | ktlint_standard_trailing-comma-on-call-site = disabled 24 | ktlint_standard_multiline-expression-wrapping = disabled 25 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto -------------------------------------------------------------------------------- /.github/FAQ.txt: -------------------------------------------------------------------------------- 1 | Q: How can I add the bot to my server? 2 | A: You can add the bot to your server by following the instructions on this page 3 | 4 | Q: Is the bot open source? 5 | A: Yes, you can find the source at 6 | 7 | Q: ARE YOU CRAZY OPENING UP EVAL TO PATRONS?!?!?!?! 8 | A: Nope, the so called "patreon eval" is highly sandboxed and only has access to 5% of all the java classes 9 | 10 | Q: can I support development of the bot? 11 | A: Yes you can, you can become a patron () or donate via paypal () 12 | 13 | Q: Why don't commands work in <#191245668617158656>? 14 | A: Read :clap: The :clap: Channel :clap: Topics :clap: 15 | 16 | Q: Why is the bot offline? 17 | A: Maintenance or an update 18 | 19 | Q: How can I help? 20 | A: By suggesting our bot but never advertise it! 21 | If the bot responds with an error you can try looking it up in the source code and send us a fix using githubs Pull-Requests. (from and to branch master only) 22 | 23 | Q: I need help with command / module xxx can you help me? 24 | A: Yes I am sure. We have a playlist of YouTube-Tutorials. Try checking it out. Maybe we covered your topic previously. Otherwise we are still here for helping you. :D 25 | Tutorials: 26 | 27 | Q: Can the bot do rainbow roles? 28 | A: No it can't, rainbow roles are against the discord terms of service 29 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [duncte123] 2 | custom: https://paypal.me/duncte123 3 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Describe the bug** 8 | A clear and concise description of what the bug is. 9 | 10 | **To Reproduce** 11 | Steps to reproduce the behavior: 12 | 1. Go to '...' 13 | 2. Click on '....' 14 | 3. Scroll down to '....' 15 | 4. See error 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Additional context** 24 | Add any other context about the problem here. 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Is your feature request related to a problem? Please describe.** 8 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 9 | 10 | **Describe the solution you'd like** 11 | A clear and concise description of what you want to happen. 12 | 13 | **Describe alternatives you've considered** 14 | A clear and concise description of any alternative solutions or features you've considered. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | [guide]: https://github.com/DuncteBot/SkyBot/wiki/Structure-Guide 2 | 3 | Pull Request Etiquette 4 | --- 5 | 6 | 10 | 11 | - [ ] I have checked the PRs for upcoming features/bug fixes. 12 | - [ ] I have read the [structure guide][guide]. 13 | 14 | 19 | 20 | 21 | Fixes NaN 22 | 23 | - [ ] I have tested my changes. 24 | - [ ] I didn't test my changes. I will do that in the following 7 days and agree that this Pull request will be closed if I don't test it in the named time span. 25 | - [ ] I know the language good enough for providing high-quality code. 26 | 27 | Description 28 | --- 29 | 30 | Replace this sentence with a general description of what your Pull Request does. 31 | -------------------------------------------------------------------------------- /.github/musl-lavaplayer-natives/linux-x86-64/libconnector.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncteBot/SkyBot/07ffb14823ba4446478b27eb7057b32b38aceff5/.github/musl-lavaplayer-natives/linux-x86-64/libconnector.so -------------------------------------------------------------------------------- /.github/sentry.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Skybot, a multipurpose discord bot 4 | # Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 5 | # 6 | # This program is free software: you can redistribute it and/or modify 7 | # it under the terms of the GNU Affero General Public License as published 8 | # by the Free Software Foundation, either version 3 of the License, or 9 | # (at your option) any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU Affero General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU Affero General Public License 17 | # along with this program. If not, see . 18 | # 19 | 20 | curl -sL https://sentry.io/get-cli/ | bash 21 | SENTRY_RELEASE=$(./gradlew --no-daemon -q botVersion > tmp.txt && cat tmp.txt | grep "v:" | sed "s/v: //") 22 | sentry-cli releases new $SENTRY_RELEASE 23 | sentry-cli releases set-commits --auto $SENTRY_RELEASE 24 | sentry-cli releases deploys $SENTRY_RELEASE new -e "development" 25 | sentry-cli releases finalize $SENTRY_RELEASE 26 | -------------------------------------------------------------------------------- /.github/workflows/2-release-dashboard.yml: -------------------------------------------------------------------------------- 1 | # This workflow will build a Java project with Gradle 2 | # For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle 3 | 4 | name: Release Dashboard 5 | 6 | # Run manually 7 | on: workflow_dispatch 8 | 9 | jobs: 10 | build_docker: 11 | runs-on: ubuntu-latest 12 | concurrency: 13 | group: ${{ github.ref }} 14 | cancel-in-progress: true 15 | steps: 16 | - uses: actions/checkout@v3 17 | 18 | - name: Set up QEMU 19 | uses: docker/setup-qemu-action@v2 20 | 21 | - name: Set up Docker Buildx 22 | uses: docker/setup-buildx-action@v2 23 | 24 | - name: Login to Github packages 25 | uses: docker/login-action@v2 26 | with: 27 | username: duncte123 28 | password: ${{ secrets.DOCKER_TOKEN }} 29 | 30 | - name: Build and push 31 | id: docker_build 32 | uses: docker/build-push-action@v3 33 | with: 34 | file: ./dashboard/Dockerfile 35 | context: ./ 36 | push: true 37 | tags: dunctebot/dashboard:latest 38 | cache-from: type=gha 39 | cache-to: type=gha 40 | build-args: | 41 | is_ci=true 42 | git_sha=${{ github.sha }} 43 | 44 | - name: Image digest 45 | run: echo ${{ steps.docker_build.outputs.digest }} 46 | 47 | - name: Trigger webhook 48 | uses: distributhor/workflow-webhook@v3 49 | env: 50 | webhook_url: ${{ secrets.DASH_WEBHOOK_URL }} 51 | -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/copyright/SkyBot.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/discord.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/jsonSchemas.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /.idea/kotlinc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/sqldialects.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /assets: -------------------------------------------------------------------------------- 1 | bot/assets/ -------------------------------------------------------------------------------- /bot/.dockerignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .github/ 3 | botpages/ 4 | build/ 5 | -------------------------------------------------------------------------------- /bot/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM azul/zulu-openjdk-alpine:21 AS builder 2 | 3 | WORKDIR /skybot 4 | 5 | # setup CI flag 6 | ARG is_ci 7 | ARG git_sha 8 | ENV CI=$is_ci 9 | ENV GIT_HASH=$git_sha 10 | 11 | COPY . . 12 | RUN ./gradlew --no-daemon :bot:build 13 | 14 | FROM azul/zulu-openjdk-alpine:21-jre 15 | 16 | # add libstdc++ for playing back mp3's with lavaplayer 17 | # also add some fonts 18 | RUN apk add --no-cache libstdc++ fontconfig font-noto 19 | 20 | COPY ./assets/lottieconverter_musl /skybot/assets/lottieconverter 21 | 22 | WORKDIR /skybot 23 | COPY --from=builder /skybot/bot/build/libs/bot*-prod.jar ./skybot.jar 24 | 25 | CMD ["java", "-Xms4G", "-Xmx4G", "-jar", "skybot.jar"] 26 | -------------------------------------------------------------------------------- /bot/assets/lottieconverter: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncteBot/SkyBot/07ffb14823ba4446478b27eb7057b32b38aceff5/bot/assets/lottieconverter -------------------------------------------------------------------------------- /bot/assets/lottieconverter_musl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncteBot/SkyBot/07ffb14823ba4446478b27eb7057b32b38aceff5/bot/assets/lottieconverter_musl -------------------------------------------------------------------------------- /bot/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.7" 2 | services: 3 | skybot: 4 | container_name: skybot 5 | build: 6 | context: . 7 | args: 8 | - is_ci=true 9 | - git_sha=DEV 10 | environment: 11 | # Bot settings 12 | - BOT_ADMINS=191231307290771456,311769499995209728 13 | - BOT_PREFIX=db! 14 | - BOT_TOTAL_SHARDS=1 15 | - BOT_TOKEN= 16 | 17 | # Api settings 18 | - API_ALEXFLIPNOTE= 19 | - API_YOUTUBECACHE_ENDPOINT= 20 | - API_YOUTUBECACHE_TOKEN= 21 | - API_GOOGLE= 22 | - API_WEEBSH= 23 | - API_KSOFT= 24 | - API_BLARGBOT= 25 | - API_WOLFRAMALPHA= 26 | - API_THECATAPI= 27 | - API_GENIUS= 28 | 29 | # Lavalink settings 30 | - LAVALINK_ENABLE=false 31 | - LAVALINK_NODE_COUNT=1 32 | - LAVALINK_NODE_0_HOST= 33 | - LAVALINK_NODE_0_PASS= 34 | - LAVALINK_NODE_0_REGION= 35 | 36 | # Sentry settings 37 | - SENTRY_ENABLED=false 38 | - SENTRY_DSN= 39 | 40 | # Websocket settings 41 | - WEBSOCKET_URL= 42 | - WEBSOCKET_PASSWORD=admin123 43 | - WEBSOCKET_ENABLE=false 44 | 45 | # Options are: psql, web 46 | - USE_DATABASE=psql 47 | - JDBC_URI=jdbc:postgresql://localhost:5432/skybot?user=root&password=root 48 | # - REDIS_HOST=localhost 49 | - REDIS_HOST=disabled 50 | -------------------------------------------------------------------------------- /bot/gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Skybot, a multipurpose discord bot 3 | # Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | # 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU Affero General Public License as published 7 | # by the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU Affero General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Affero General Public License 16 | # along with this program. If not, see . 17 | # 18 | 19 | #org.gradle.jvmargs=-Xmx1024M -XX:MaxPermSize=512m -Dkotlin.compiler.execution.strategy="in-process" -Dkotlin.daemon.jvm.options=-Xmx512M 20 | #org.gradle.jvmargs=-Xmx1g -XX:MaxPermSize=512m -Dkotlin.compiler.execution.strategy="in-process" 21 | 22 | kotlin.code.style=official 23 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/audio/BigChungusPlaylist.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.audio; 20 | 21 | import dev.arbjerg.lavalink.client.player.Track; 22 | 23 | import java.util.List; 24 | 25 | public class BigChungusPlaylist { 26 | private final int originalSize; 27 | private final String name; 28 | private final List tracks; 29 | 30 | public BigChungusPlaylist(String name, List tracks, int originalSize) { 31 | this.name = name; 32 | this.tracks = tracks; 33 | this.originalSize = originalSize; 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public List getTracks() { 41 | return tracks; 42 | } 43 | 44 | public int getOriginalSize() { 45 | return originalSize; 46 | } 47 | 48 | public boolean isBig() { 49 | return originalSize > tracks.size(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/audio/UUIDUserData.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.audio; 20 | 21 | import java.util.UUID; 22 | 23 | public record UUIDUserData(String uuid) { 24 | public UUIDUserData() { 25 | this(UUID.randomUUID().toString()); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/animals/AlpacaCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.animals; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import me.duncte123.skybot.objects.command.Command; 23 | import me.duncte123.skybot.objects.command.CommandCategory; 24 | import me.duncte123.skybot.objects.command.CommandContext; 25 | 26 | import javax.annotation.Nonnull; 27 | 28 | import static me.duncte123.botcommons.messaging.EmbedUtils.embedImage; 29 | import static me.duncte123.botcommons.messaging.MessageUtils.sendEmbed; 30 | 31 | public class AlpacaCommand extends Command { 32 | 33 | public AlpacaCommand() { 34 | this.category = CommandCategory.ANIMALS; 35 | this.name = "alpaca"; 36 | this.help = "Shows an alpaca"; 37 | } 38 | 39 | @Override 40 | public void execute(@Nonnull CommandContext ctx) { 41 | // https://apis.duncte123.me/animal/alpaca 42 | final JsonNode json = ctx.getApis().getAnimal("alpaca"); 43 | 44 | sendEmbed(ctx, embedImage(json.get("file").asText())); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/animals/LlamaCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.animals; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import me.duncte123.botcommons.messaging.EmbedUtils; 23 | import me.duncte123.skybot.objects.command.Command; 24 | import me.duncte123.skybot.objects.command.CommandCategory; 25 | import me.duncte123.skybot.objects.command.CommandContext; 26 | 27 | import javax.annotation.Nonnull; 28 | 29 | import static me.duncte123.botcommons.messaging.MessageUtils.sendEmbed; 30 | 31 | public class LlamaCommand extends Command { 32 | 33 | public LlamaCommand() { 34 | this.category = CommandCategory.ANIMALS; 35 | this.name = "llama"; 36 | this.help = "Shows a llama"; 37 | } 38 | 39 | @Override 40 | public void execute(@Nonnull CommandContext ctx) { 41 | // https://apis.duncte123.me/animal/llama 42 | final JsonNode json = ctx.getApis().getAnimal("llama"); 43 | 44 | sendEmbed(ctx, EmbedUtils.embedImage(json.get("file").asText())); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/funcmds/OrlyCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.funcmds; 20 | 21 | import me.duncte123.botcommons.messaging.EmbedUtils; 22 | import me.duncte123.skybot.objects.command.Command; 23 | import me.duncte123.skybot.objects.command.CommandCategory; 24 | import me.duncte123.skybot.objects.command.CommandContext; 25 | 26 | import javax.annotation.Nonnull; 27 | 28 | import static me.duncte123.botcommons.messaging.MessageUtils.sendEmbed; 29 | 30 | public class OrlyCommand extends Command { 31 | public OrlyCommand() { 32 | this.category = CommandCategory.FUN; 33 | this.name = "orly"; 34 | this.help = "Shows a random O Rly image from @ThePracticalDev on twitter"; 35 | } 36 | 37 | @Override 38 | public void execute(@Nonnull CommandContext ctx) { 39 | final String imageUrl = ctx.getApis().getOrlyImage(); 40 | 41 | sendEmbed(ctx, EmbedUtils.embedImage(imageUrl)); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/guild/owner/settings/AutoRoleCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.guild.owner.settings; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class AutoRoleCommand extends SettingsBase { 26 | 27 | public AutoRoleCommand() { 28 | this.name = "autorole"; 29 | this.help = "Sets the role that members get when they join the server"; 30 | this.usage = "<@role/disable>"; 31 | } 32 | 33 | @Override 34 | public void execute(@Nonnull CommandContext ctx) { 35 | final String inp = ctx.getArgs().isEmpty() ? null : ctx.getArgsRaw(); 36 | 37 | this.showNewHelp(ctx, "autoRole", inp); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/guild/owner/settings/MuteRoleCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.guild.owner.settings; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class MuteRoleCommand extends SettingsBase { 26 | 27 | public MuteRoleCommand() { 28 | this.name = "muterole"; 29 | this.aliases = new String[]{ 30 | "spamrole" 31 | }; 32 | this.help = "Sets the role that the user gets when they are muted"; 33 | this.usage = "<@role/disable>"; 34 | } 35 | 36 | @Override 37 | public void execute(@Nonnull CommandContext ctx) { 38 | final String inp = ctx.getArgs().isEmpty() ? null : ctx.getArgsRaw(); 39 | 40 | this.showNewHelp(ctx, "muteRole", inp); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/guild/owner/settings/SetColorCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.guild.owner.settings; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class SetColorCommand extends SettingsBase { 26 | public SetColorCommand() { 27 | this.name = "setcolor"; 28 | this.aliases = new String[]{ 29 | "setembedcolor", 30 | }; 31 | this.help = "Sets the color of the embeds that the bot sends"; 32 | this.usage = ""; 33 | } 34 | 35 | @Override 36 | public void execute(@Nonnull CommandContext ctx) { 37 | final String inp = ctx.getArgs().isEmpty() ? null : ctx.getArgsRaw(); 38 | 39 | this.showNewHelp(ctx, "embedColor", inp); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/guild/owner/settings/SetDescriptionCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.guild.owner.settings; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class SetDescriptionCommand extends SettingsBase { 26 | 27 | public SetDescriptionCommand() { 28 | this.requiresArgs = true; 29 | this.name = "setdescription"; 30 | this.help = "Sets a custom description viewable in `{prefix}serverinfo`"; 31 | this.usage = ""; 32 | } 33 | 34 | @Override 35 | public void execute(@Nonnull CommandContext ctx) { 36 | final String inp = ctx.getArgs().isEmpty() ? null : ctx.getArgsRaw(); 37 | 38 | this.showNewHelp(ctx, "description", inp); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/guild/owner/settings/SetJoinMessageCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.guild.owner.settings; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class SetJoinMessageCommand extends SettingsBase { 26 | 27 | public SetJoinMessageCommand() { 28 | this.name = "setjoinmessage"; 29 | this.aliases = new String[]{ 30 | "setwelcomemessage", 31 | }; 32 | this.help = "Sets the message that the bot shows when a new member joins"; 33 | this.usage = ""; 34 | } 35 | 36 | @Override 37 | public void execute(@Nonnull CommandContext ctx) { 38 | if (ctx.getArgs().isEmpty()) { 39 | this.sendUsageInstructions(ctx); 40 | return; 41 | } 42 | 43 | this.showNewHelp(ctx, "joinMessage", ctx.getArgsRaw()); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/guild/owner/settings/SetLeaveMessageCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.guild.owner.settings; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | import static me.duncte123.botcommons.messaging.MessageUtils.sendMsg; 26 | 27 | public class SetLeaveMessageCommand extends SettingsBase { 28 | 29 | public SetLeaveMessageCommand() { 30 | this.name = "setleavemessage"; 31 | this.help = "Sets the message that the bot shows when a member leaves"; 32 | this.usage = ""; 33 | } 34 | 35 | @Override 36 | public void execute(@Nonnull CommandContext ctx) { 37 | if (ctx.getArgs().isEmpty()) { 38 | sendMsg(ctx, "Correct usage is `" + ctx.getPrefix() + "setleavemessage `"); 39 | return; 40 | } 41 | 42 | this.showNewHelp(ctx, "leaveMessage", ctx.getArgsRaw()); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/guild/owner/settings/SetLogChannelCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.guild.owner.settings; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class SetLogChannelCommand extends SettingsBase { 26 | 27 | public SetLogChannelCommand() { 28 | this.name = "setlogchannel"; 29 | this.help = "Sets the channel for the modlogs"; 30 | this.usage = "<#channel/disable>"; 31 | } 32 | 33 | @Override 34 | public void execute(@Nonnull CommandContext ctx) { 35 | final String inp = ctx.getArgs().isEmpty() ? null : ctx.getArgsJoined(); 36 | 37 | this.showNewHelp(ctx, "logChannel", inp); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/guild/owner/settings/SetPrefixCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.guild.owner.settings; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class SetPrefixCommand extends SettingsBase { 26 | 27 | public SetPrefixCommand() { 28 | this.name = "setprefix"; 29 | this.help = "Sets the new prefix to use on this server"; 30 | this.usage = ""; 31 | } 32 | 33 | @Override 34 | public void execute(@Nonnull CommandContext ctx) { 35 | final String inp = ctx.getArgs().isEmpty() ? null : ctx.getArgsRaw(); 36 | 37 | this.showNewHelp(ctx, "prefix", inp); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/guild/owner/settings/SetRateLimitsCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | package me.duncte123.skybot.commands.guild.owner.settings; 19 | 20 | import me.duncte123.skybot.objects.command.CommandContext; 21 | 22 | import javax.annotation.Nonnull; 23 | 24 | public class SetRateLimitsCommand extends SettingsBase { 25 | 26 | public SetRateLimitsCommand() { 27 | this.name = "setratelimits"; 28 | this.help = "Sets our cooldown in minutes for un-muting your spammer of choice.\n"; 29 | this.extraInfo = "Example: `{prefix}setratelimits 20|45|60|120|240|2400`"; 30 | this.usage = "<1|2|3|4|5|6/default>"; 31 | } 32 | 33 | @Override 34 | public void execute(@Nonnull CommandContext ctx) { 35 | final String inp = ctx.getArgs().isEmpty() ? null : ctx.getArgsRaw(); 36 | 37 | this.showNewHelp(ctx, "rateLimits", inp); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/guild/owner/settings/SetWelcomeChannelCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.guild.owner.settings; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class SetWelcomeChannelCommand extends SettingsBase { 26 | 27 | public SetWelcomeChannelCommand() { 28 | this.name = "setwelcomechannel"; 29 | this.aliases = new String[]{ 30 | "setleavechannel", 31 | "setwelcomeleavechannel", 32 | }; 33 | this.help = "Sets the channel that displays the welcome and leave messages"; 34 | this.usage = "<#chanel>"; 35 | } 36 | 37 | @Override 38 | public void execute(@Nonnull CommandContext ctx) { 39 | final String inp = ctx.getArgs().isEmpty() ? null : ctx.getArgsRaw(); 40 | 41 | this.showNewHelp(ctx, "prefix", inp); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/guild/owner/settings/ToggleAnnounceTracksCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.guild.owner.settings; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class ToggleAnnounceTracksCommand extends SettingsBase { 26 | 27 | public ToggleAnnounceTracksCommand() { 28 | this.name = "toggleannouncetracks"; 29 | this.help = "Toggles if the bot should announce the next playing track"; 30 | } 31 | 32 | @Override 33 | public void execute(@Nonnull CommandContext ctx) { 34 | this.showNewHelp(ctx, "announceTracks", null); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/guild/owner/settings/ToggleAutoDehoistCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.guild.owner.settings; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class ToggleAutoDehoistCommand extends SettingsBase { 26 | 27 | public ToggleAutoDehoistCommand() { 28 | this.name = "toggleautodehoist"; 29 | this.help = "Toggles if the bot should auto de-hoist users"; 30 | } 31 | 32 | @Override 33 | public void execute(@Nonnull CommandContext ctx) { 34 | this.showNewHelp(ctx, "autoDehoist", null); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/guild/owner/settings/ToggleFilterInvitesCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.guild.owner.settings; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class ToggleFilterInvitesCommand extends SettingsBase { 26 | 27 | public ToggleFilterInvitesCommand() { 28 | this.name = "togglefilterinvites"; 29 | this.help = "Toggles if the bot should delete messages that contain invite links"; 30 | } 31 | 32 | @Override 33 | public void execute(@Nonnull CommandContext ctx) { 34 | this.showNewHelp(ctx, "filterInvites", null); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/guild/owner/settings/ToggleJoinMessageCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.guild.owner.settings; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class ToggleJoinMessageCommand extends SettingsBase { 26 | 27 | public ToggleJoinMessageCommand() { 28 | this.name = "togglejoinmessage"; 29 | this.aliases = new String[]{ 30 | "enablejoinmessage", 31 | "disablejoinmessage", 32 | }; 33 | this.help = "Turns the join message on or off"; 34 | } 35 | 36 | @Override 37 | public void execute(@Nonnull CommandContext ctx) { 38 | this.showNewHelp(ctx, "joinMessageState", null); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/guild/owner/settings/ToggleKickModeCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.guild.owner.settings; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class ToggleKickModeCommand extends SettingsBase { 26 | 27 | public ToggleKickModeCommand() { 28 | this.name = "togglekickmode"; 29 | this.help = "Toggles whether we should kick spammers or assign a role to them"; 30 | } 31 | 32 | @Override 33 | public void execute(@Nonnull CommandContext ctx) { 34 | this.showNewHelp(ctx, "kickMode", null); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/guild/owner/settings/ToggleSpamFilterCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.guild.owner.settings; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class ToggleSpamFilterCommand extends SettingsBase { 26 | 27 | public ToggleSpamFilterCommand() { 28 | this.name = "togglespamfilter"; 29 | this.help = "Toggles whether we should handle your incoming spam"; 30 | } 31 | 32 | @Override 33 | public void execute(@Nonnull CommandContext ctx) { 34 | this.showNewHelp(ctx, "swearFilter", null); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/guild/owner/settings/ToggleSwearFilterCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.guild.owner.settings; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class ToggleSwearFilterCommand extends SettingsBase { 26 | 27 | public ToggleSwearFilterCommand() { 28 | this.name = "toggleswearfilter"; 29 | this.aliases = new String[]{ 30 | "enableswearfilter", 31 | "disableswearfilter" 32 | }; 33 | this.help = "Turns the swearword filter on or off.\n" + 34 | "The default filter type is `Very Toxic`, this can be changed on the dashboard"; 35 | } 36 | 37 | @Override 38 | public void execute(@Nonnull CommandContext ctx) { 39 | this.showNewHelp(ctx, "swearFilter", null); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/AchievementCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class AchievementCommand extends NoPatronImageCommand { 26 | 27 | public AchievementCommand() { 28 | this.name = "achievement"; 29 | this.help = "You got an achievement!"; 30 | this.usage = ""; 31 | } 32 | 33 | @Override 34 | public void execute(@Nonnull CommandContext ctx) { 35 | 36 | if (!passes(ctx)) { 37 | return; 38 | } 39 | 40 | ctx.getAlexFlipnote().getAchievement(parseTextArgsForImage(ctx)) 41 | .async((image) -> handleBasicImage(ctx, image)); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/CaptchaCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class CaptchaCommand extends NoPatronImageCommand { 26 | 27 | public CaptchaCommand() { 28 | this.name = "captcha"; 29 | this.help = "Checks if you are a robot"; 30 | this.usage = ""; 31 | } 32 | 33 | @Override 34 | public void execute(@Nonnull CommandContext ctx) { 35 | if (!passes(ctx)) { 36 | return; 37 | } 38 | 39 | ctx.getAlexFlipnote().getCaptcha(parseTextArgsForImage(ctx)) 40 | .async((image) -> handleBasicImage(ctx, image)); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/ClintCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class ClintCommand extends ImageCommandBase { 26 | 27 | public ClintCommand() { 28 | this.requiresArgs = false; 29 | this.name = "clint"; 30 | this.help = "Shows a picture of Clint staring at something on a monitor."; 31 | this.usage = "[image url]"; 32 | } 33 | 34 | @Override 35 | public void execute(@Nonnull CommandContext ctx) { 36 | if (!passes(ctx)) { 37 | return; 38 | } 39 | 40 | final String url = getImageFromCommand(ctx); 41 | 42 | if (url != null) { 43 | ctx.getBlargbot().getClint(url).async((image) -> handleBasicImage(ctx, image)); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/DeleteCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class DeleteCommand extends ImageCommandBase { 26 | 27 | public DeleteCommand() { 28 | this.name = "delete"; 29 | this.help = "Creates a delete button"; 30 | this.usage = ""; 31 | } 32 | 33 | @Override 34 | public void execute(@Nonnull CommandContext ctx) { 35 | if (!passes(ctx)) { 36 | return; 37 | } 38 | 39 | ctx.getBlargbot().getDelete(parseTextArgsForImage(ctx)).async((image) -> handleBasicImage(ctx, image)); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/DidYouMeanCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class DidYouMeanCommand extends NoPatronImageCommand { 26 | 27 | public DidYouMeanCommand() { 28 | this.name = "didyoumean"; 29 | this.help = "Did you type your search wrong?"; 30 | this.usage = "|"; 31 | } 32 | 33 | @Override 34 | public void execute(@Nonnull CommandContext ctx) { 35 | if (!passes(ctx)) { 36 | return; 37 | } 38 | 39 | final String[] split = splitString(ctx); 40 | 41 | if (split == null) { 42 | return; 43 | } 44 | 45 | ctx.getAlexFlipnote().getDidYouMean(split[0], split[1]) 46 | .async((image) -> handleBasicImage(ctx, image)); 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/FactsCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class FactsCommand extends NoPatronImageCommand { 26 | 27 | public FactsCommand() { 28 | this.name = "facts"; 29 | this.help = "Show people the facts"; 30 | this.usage = ""; 31 | } 32 | 33 | @Override 34 | public void execute(@Nonnull CommandContext ctx) { 35 | if (!passes(ctx)) { 36 | return; 37 | } 38 | 39 | ctx.getAlexFlipnote().getFacts(parseTextArgsForImage(ctx)) 40 | .async((image) -> handleBasicImage(ctx, image)); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/JokeoverheadCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class JokeoverheadCommand extends NoPatronImageCommand { 26 | 27 | public JokeoverheadCommand() { 28 | this.name = "jokeoverhead"; 29 | this.aliases = new String[]{ 30 | "woosh", 31 | }; 32 | this.help = "You just got wooshed"; 33 | this.usage = "[@user/url]"; 34 | } 35 | 36 | @Override 37 | public void execute(@Nonnull CommandContext ctx) { 38 | if (!passes(ctx)) { 39 | return; 40 | } 41 | 42 | final String url = getImageFromCommand(ctx); 43 | if (url != null) { 44 | ctx.getAlexFlipnote().getJokeoverhead(url).async((image) -> handleBasicImage(ctx, image)); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/LinusCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class LinusCommand extends ImageCommandBase { 26 | 27 | public LinusCommand() { 28 | this.requiresArgs = false; 29 | this.name = "linus"; 30 | this.help = "Shows a picture of Linus pointing to something on a monitor."; 31 | this.usage = "[@user/url]"; 32 | } 33 | 34 | @Override 35 | public void execute(@Nonnull CommandContext ctx) { 36 | if (!passes(ctx)) { 37 | return; 38 | } 39 | 40 | final String url = getImageFromCommand(ctx); 41 | 42 | if (url != null) { 43 | ctx.getBlargbot().getLinus(url).async((image) -> handleBasicImage(ctx, image)); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/NoPatronImageCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image; 20 | 21 | import me.duncte123.skybot.objects.command.CommandCategory; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public abstract class NoPatronImageCommand extends ImageCommandBase { 26 | 27 | @Nonnull 28 | @Override 29 | public CommandCategory getCategory() { 30 | return CommandCategory.FUN; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/PcCheckCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class PcCheckCommand extends ImageCommandBase { 26 | 27 | public PcCheckCommand() { 28 | this.name = "pccheck"; 29 | this.help = "Your pc needs to be checked, but for what?"; 30 | this.usage = ""; 31 | } 32 | 33 | @Override 34 | public void execute(@Nonnull CommandContext ctx) { 35 | if (!passes(ctx)) { 36 | return; 37 | } 38 | 39 | ctx.getBlargbot().getPcCheck(parseTextArgsForImage(ctx)).async((image) -> handleBasicImage(ctx, image)); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/SaltyCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class SaltyCommand extends NoPatronImageCommand { 26 | 27 | public SaltyCommand() { 28 | this.name = "salty"; 29 | this.help = "Someones being salty today"; 30 | this.usage = "[@user/url]"; 31 | } 32 | 33 | @Override 34 | public void execute(@Nonnull CommandContext ctx) { 35 | if (!passes(ctx)) { 36 | return; 37 | } 38 | 39 | final String url = getImageFromCommand(ctx); 40 | if (url != null) { 41 | ctx.getAlexFlipnote().getSalty(url).async((image) -> handleBasicImage(ctx, image)); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/ScrollCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class ScrollCommand extends ImageCommandBase { 26 | 27 | public ScrollCommand() { 28 | this.name = "scroll"; 29 | this.help = "The scroll of truth"; 30 | this.usage = ""; 31 | } 32 | 33 | @Override 34 | public void execute(@Nonnull CommandContext ctx) { 35 | if (!passes(ctx)) { 36 | return; 37 | } 38 | 39 | ctx.getAlexFlipnote().getScroll(parseTextArgsForImage(ctx)) 40 | .async((image) -> handleBasicImage(ctx, image)); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/TheSearchCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | import javax.annotation.Nonnull; 24 | 25 | public class TheSearchCommand extends ImageCommandBase { 26 | 27 | public TheSearchCommand() { 28 | this.name = "thesearch"; 29 | this.help = "Go on a journey to find intelligent life"; 30 | this.usage = ""; 31 | } 32 | 33 | @Override 34 | public void execute(@Nonnull CommandContext ctx) { 35 | if (!passes(ctx)) { 36 | return; 37 | } 38 | 39 | ctx.getBlargbot().getTheSearch(parseTextArgsForImage(ctx)).async((image) -> handleBasicImage(ctx, image)); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/duncte123gen/IWantToDieCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image.duncte123gen; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import kotlin.Pair; 23 | import me.duncte123.skybot.commands.image.NoPatronImageCommand; 24 | import me.duncte123.skybot.objects.command.CommandContext; 25 | 26 | import javax.annotation.Nonnull; 27 | 28 | public class IWantToDieCommand extends NoPatronImageCommand { 29 | 30 | public IWantToDieCommand() { 31 | this.name = "iwanttodie"; 32 | this.help = "You have decided that you want to die"; 33 | this.usage = ""; 34 | } 35 | 36 | @Override 37 | public void execute(@Nonnull CommandContext ctx) { 38 | if (!passes(ctx)) { 39 | return; 40 | } 41 | 42 | final Pair iWantToDie = ctx.getApis().getIWantToDie(parseTextArgsForImage(ctx)); 43 | 44 | handleBasicImage(ctx, iWantToDie); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/duncte123gen/ItsFreeRealEstateCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image.duncte123gen; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import kotlin.Pair; 23 | import me.duncte123.skybot.commands.image.NoPatronImageCommand; 24 | import me.duncte123.skybot.objects.command.CommandContext; 25 | 26 | import javax.annotation.Nonnull; 27 | 28 | public class ItsFreeRealEstateCommand extends NoPatronImageCommand { 29 | 30 | public ItsFreeRealEstateCommand() { 31 | this.name = "freerealestate"; 32 | this.help = "It's free real estate"; 33 | this.usage = ""; 34 | } 35 | 36 | @Override 37 | public void execute(@Nonnull CommandContext ctx) { 38 | if (!passes(ctx)) { 39 | return; 40 | } 41 | 42 | final Pair freeRealEstate = ctx.getApis().getFreeRealEstate(parseTextArgsForImage(ctx)); 43 | 44 | handleBasicImage(ctx, freeRealEstate); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/filter/BlackAndWhiteCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image.filter; 20 | 21 | public class BlackAndWhiteCommand extends FilterBase { 22 | 23 | @Override 24 | /* package */ String getFilterName() { 25 | return "b&w"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/filter/BlurCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image.filter; 20 | 21 | public class BlurCommand extends FilterBase { 22 | } 23 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/filter/DeepfryCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image.filter; 20 | 21 | public class DeepfryCommand extends FilterBase { 22 | } 23 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/filter/InvertCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image.filter; 20 | 21 | public class InvertCommand extends FilterBase { 22 | } 23 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/filter/PixelateCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image.filter; 20 | 21 | public class PixelateCommand extends FilterBase { 22 | } 23 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/commands/image/filter/SaturateCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.image.filter; 20 | 21 | public class SaturateCommand extends FilterBase { 22 | 23 | @Override 24 | /* package */ String getFilterName() { 25 | return "darken"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/database/RedisDB.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.database; 20 | 21 | import me.duncte123.skybot.objects.discord.MessageData; 22 | import org.jetbrains.annotations.NotNull; 23 | import org.jetbrains.annotations.Nullable; 24 | 25 | import java.util.List; 26 | 27 | public interface RedisDB { 28 | void storeMessage(@NotNull MessageData data); 29 | @Nullable 30 | MessageData getAndUpdateMessage(@NotNull String messageId, @NotNull MessageData updateData); 31 | @Nullable 32 | MessageData getAndDeleteMessage(@NotNull String messageId); 33 | @NotNull 34 | List getAndDeleteMessages(@NotNull List messageIds); 35 | void deleteMessage(@NotNull String messageId); 36 | void deleteMessages(@NotNull List messageIds); 37 | void shutdown(); 38 | } 39 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/exceptions/LimitReachedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.exceptions; 20 | 21 | public class LimitReachedException extends RuntimeException { 22 | private final int size; 23 | 24 | public LimitReachedException(String message, int size) { 25 | super(message); 26 | 27 | this.size = size; 28 | } 29 | 30 | public int getSize() { 31 | return size; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/logging/SentryFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.logging; 20 | 21 | import ch.qos.logback.classic.spi.ILoggingEvent; 22 | import ch.qos.logback.core.filter.Filter; 23 | import ch.qos.logback.core.spi.FilterReply; 24 | 25 | public class SentryFilter extends Filter { 26 | 27 | @Override 28 | public FilterReply decide(ILoggingEvent event) { 29 | final String message = event.getMessage(); 30 | 31 | // TODO: check these filters, do we still need them? 32 | final boolean shouldIgnore = event.getFormattedMessage() 33 | .startsWith("Got disconnected from WebSocket") || 34 | message.contains("Ignoring deprecated socket close linger time") || 35 | message.contains("Using SQLite as the database") || 36 | message.contains("Please note that is is not recommended for production"); 37 | 38 | if (shouldIgnore) { 39 | return FilterReply.DENY; 40 | } 41 | 42 | return FilterReply.NEUTRAL; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/objects/CooldownScope.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.objects; 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext; 22 | 23 | public enum CooldownScope { 24 | 25 | USER("USER:%s", ""), 26 | GUILD("GUILD:%s", " in this server"); 27 | 28 | private final String pattern; 29 | private final String extraErrorMsg; 30 | 31 | CooldownScope(String pattern, String extraErrorMsg) { 32 | this.pattern = pattern; 33 | this.extraErrorMsg = extraErrorMsg; 34 | } 35 | 36 | public String getExtraErrorMsg() { 37 | return extraErrorMsg; 38 | } 39 | 40 | public String formatKey(String commandName, CommandContext ctx) { 41 | return commandName + '|' + this.pattern.formatted((Object[]) getCorrectIds(ctx).split(",")); 42 | } 43 | 44 | private String getCorrectIds(CommandContext ctx) { 45 | return switch (this) { 46 | case USER -> ctx.getAuthor().getId(); 47 | case GUILD -> ctx.getGuild().getId(); 48 | }; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/objects/TriConsumer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.objects; 20 | 21 | import java.util.Objects; 22 | 23 | @FunctionalInterface 24 | @SuppressWarnings("PMD") 25 | public interface TriConsumer { 26 | 27 | void accept(T t, U u, K k); 28 | 29 | default TriConsumer andThen(TriConsumer after) { 30 | Objects.requireNonNull(after); 31 | 32 | return (l, r, k) -> { 33 | accept(l, r, k); 34 | after.accept(l, r, k); 35 | }; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/objects/apis/alexflipnote/FlipnoteColourObj.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.objects.apis.alexflipnote; 20 | 21 | import com.fasterxml.jackson.annotation.JsonProperty; 22 | 23 | @SuppressWarnings("PMD") 24 | public class FlipnoteColourObj { 25 | public String blackorwhite_text; 26 | public int brightness; 27 | public String hex; 28 | public String image; 29 | @JsonProperty("int") 30 | public int integer; 31 | public String name; 32 | public String rgb; 33 | } 34 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/objects/command/Flag.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.objects.command; 20 | 21 | import javax.annotation.Nonnull; 22 | import javax.annotation.Nullable; 23 | 24 | @SuppressWarnings("PMD.ShortClassName") 25 | public class Flag { 26 | private final Character shortFlag; 27 | private final String word; 28 | private final String desc; 29 | 30 | public Flag(Character flag, String word, String desc) { 31 | this.shortFlag = flag; 32 | this.word = word; 33 | this.desc = desc; 34 | } 35 | 36 | public Flag(char flag, String desc) { 37 | this(flag, null, desc); 38 | } 39 | 40 | public Flag(@Nonnull String word, String desc) { 41 | this(null, word, desc); 42 | } 43 | 44 | @Nullable 45 | public Character getFlag() { 46 | return shortFlag; 47 | } 48 | 49 | @Nullable 50 | public String getWord() { 51 | return word; 52 | } 53 | 54 | public String getDesc() { 55 | return desc; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/objects/pairs/LongLongPair.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.objects.pairs; 20 | 21 | public class LongLongPair { 22 | private final long first; 23 | private final long second; 24 | 25 | public LongLongPair(long left, long right) { 26 | this.first = left; 27 | this.second = right; 28 | } 29 | 30 | public long getFirst() { 31 | return first; 32 | } 33 | 34 | public long getSecond() { 35 | return second; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/objects/user/ConsoleUser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.objects.user; 20 | 21 | public class ConsoleUser extends FakeUser { 22 | public ConsoleUser() { 23 | super("DuncteBot", 210363111729790977L, 1758); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/objects/user/UnknownUser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.objects.user; 20 | 21 | public class UnknownUser extends FakeUser { 22 | public UnknownUser() { 23 | super("UnknownUser", 210363111729790977L, 0); 24 | } 25 | 26 | public UnknownUser(long userId) { 27 | super("UnknownUser", userId, 0); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/utils/Debouncer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.utils; 20 | 21 | import java.util.concurrent.atomic.AtomicLong; 22 | import java.util.function.Consumer; 23 | 24 | public class Debouncer implements Consumer { 25 | 26 | private final Consumer consumer; 27 | private final AtomicLong lastCalled = new AtomicLong(0); 28 | private final long interval; 29 | 30 | public Debouncer(Consumer consumer, long interval) { 31 | this.consumer = consumer; 32 | this.interval = interval; 33 | } 34 | 35 | @Override 36 | public void accept(T arg) { 37 | if (lastCalled.get() + interval < System.currentTimeMillis()) { 38 | lastCalled.set(System.currentTimeMillis()); 39 | consumer.accept(arg); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /bot/src/main/java/me/duncte123/skybot/websocket/SocketHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.websocket; 20 | 21 | import com.fasterxml.jackson.databind.JsonNode; 22 | import io.sentry.Sentry; 23 | import me.duncte123.skybot.web.WebSocketClient; 24 | import org.slf4j.Logger; 25 | import org.slf4j.LoggerFactory; 26 | 27 | import javax.annotation.Nonnull; 28 | 29 | public abstract class SocketHandler { 30 | protected static final Logger LOG = LoggerFactory.getLogger(SocketHandler.class); 31 | 32 | protected final WebSocketClient client; 33 | 34 | public SocketHandler(@Nonnull WebSocketClient client) { 35 | this.client = client; 36 | } 37 | 38 | public void handle(@Nonnull JsonNode raw) { 39 | try { 40 | handleInternally(raw.get("d")); 41 | } catch (Exception e) { 42 | Sentry.captureException(e); 43 | } 44 | } 45 | 46 | protected abstract void handleInternally(@Nonnull JsonNode data); 47 | } 48 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/ReactionCacheElement.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot 20 | 21 | import net.dv8tion.jda.api.events.interaction.component.StringSelectInteractionEvent 22 | 23 | data class ReactionCacheElement(val msgID: Long, val authorId: Long) { 24 | override fun equals(other: Any?): Boolean { 25 | if (other == null) { 26 | return false 27 | } 28 | 29 | if (other is StringSelectInteractionEvent) { 30 | return other.user.idLong == this.authorId 31 | } 32 | 33 | if (other is ReactionCacheElement) { 34 | return other.authorId == this.authorId 35 | } 36 | 37 | return false 38 | } 39 | 40 | override fun hashCode(): Int { 41 | var result = msgID.hashCode() 42 | result = 31 * result + authorId.hashCode() 43 | return result 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/animals/BirbCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.animals 20 | 21 | import com.github.natanbc.reliqua.limiter.RateLimiter 22 | import me.duncte123.botcommons.messaging.EmbedUtils 23 | import me.duncte123.botcommons.messaging.MessageUtils.sendEmbed 24 | import me.duncte123.botcommons.web.WebUtils 25 | import me.duncte123.skybot.objects.command.Command 26 | import me.duncte123.skybot.objects.command.CommandCategory 27 | import me.duncte123.skybot.objects.command.CommandContext 28 | 29 | class BirbCommand : Command() { 30 | init { 31 | this.category = CommandCategory.ANIMALS 32 | this.name = "bird" 33 | this.aliases = arrayOf("birb") 34 | this.help = "Shows a bird" 35 | } 36 | 37 | override fun execute(ctx: CommandContext) { 38 | WebUtils.ins.getJSONArray("https://shibe.online/api/birds") { it.setRateLimiter(RateLimiter.directLimiter()) }.async { 39 | sendEmbed(ctx, EmbedUtils.embedImage(it[0].asText())) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/funCmds/DeletCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.funCmds 20 | 21 | import me.duncte123.botcommons.messaging.MessageUtils.sendEmbed 22 | import me.duncte123.skybot.commands.weeb.WeebCommandBase 23 | import me.duncte123.skybot.objects.command.CommandCategory 24 | import me.duncte123.skybot.objects.command.CommandContext 25 | import me.duncte123.weebJava.configs.ImageConfig 26 | 27 | class DeletCommand : WeebCommandBase() { 28 | init { 29 | this.displayAliasesInHelp = false 30 | this.category = CommandCategory.FUN 31 | this.name = "delet" 32 | this.aliases = arrayOf("deletthis", "deletethis") 33 | this.help = "Delet this" 34 | } 35 | 36 | override fun execute(ctx: CommandContext) { 37 | // delet_this 38 | ctx.weebApi.getRandomImage( 39 | ImageConfig.Builder() 40 | .setType("delet_this") 41 | .build() 42 | ).async { sendEmbed(ctx, getWeebEmbedImage(it.url)) } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/funCmds/DiscordMemesCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.funCmds 20 | 21 | import me.duncte123.botcommons.messaging.MessageUtils.sendEmbed 22 | import me.duncte123.skybot.commands.weeb.WeebCommandBase 23 | import me.duncte123.skybot.objects.command.CommandCategory 24 | import me.duncte123.skybot.objects.command.CommandContext 25 | import me.duncte123.weebJava.configs.ImageConfig 26 | 27 | class DiscordMemesCommand : WeebCommandBase() { 28 | init { 29 | this.displayAliasesInHelp = false 30 | this.category = CommandCategory.FUN 31 | this.name = "discordmeme" 32 | this.aliases = arrayOf("dmeme", "discordmemes", "dmemes") 33 | this.help = "Shows a discord meme" 34 | } 35 | 36 | override fun execute(ctx: CommandContext) { 37 | ctx.weebApi.getRandomImage(ImageConfig.Builder().setType("discord_memes").build()).async { 38 | sendEmbed(ctx, getWeebEmbedImage(it.url)) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/funCmds/EveryoneCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.funCmds 20 | 21 | import me.duncte123.botcommons.messaging.MessageUtils.sendEmbed 22 | import me.duncte123.skybot.commands.weeb.WeebCommandBase 23 | import me.duncte123.skybot.objects.command.CommandCategory 24 | import me.duncte123.skybot.objects.command.CommandContext 25 | import me.duncte123.weebJava.configs.ImageConfig 26 | 27 | class EveryoneCommand : WeebCommandBase() { 28 | init { 29 | this.category = CommandCategory.FUN 30 | this.name = "everyone" 31 | this.help = "Useful for when everyone is being pinged again" 32 | } 33 | 34 | override fun execute(ctx: CommandContext) { 35 | ctx.weebApi.getRandomImage(ImageConfig.Builder().setTags(listOf("everyone")).build()).async { 36 | sendEmbed(ctx, getWeebEmbedImage(it.url)) 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/funCmds/OldestCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.funCmds 20 | 21 | import me.duncte123.skybot.objects.CooldownScope 22 | import me.duncte123.skybot.objects.command.Command 23 | import me.duncte123.skybot.objects.command.CommandCategory 24 | import me.duncte123.skybot.objects.command.CommandContext 25 | import me.duncte123.skybot.utils.EarthUtils.sendYoungestOldesetEmbed 26 | 27 | class OldestCommand : Command() { 28 | init { 29 | this.category = CommandCategory.FUN 30 | this.name = "oldest" 31 | this.help = "Shows the oldest member in the server" 32 | this.cooldown = 10 33 | this.cooldownScope = CooldownScope.GUILD 34 | this.cooldownKey = { _, _ -> "youngest|oldest" } 35 | } 36 | 37 | override fun execute(ctx: CommandContext) { 38 | sendYoungestOldesetEmbed(ctx, true) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/funCmds/YoungestCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.funCmds 20 | 21 | import me.duncte123.skybot.objects.CooldownScope 22 | import me.duncte123.skybot.objects.command.Command 23 | import me.duncte123.skybot.objects.command.CommandCategory 24 | import me.duncte123.skybot.objects.command.CommandContext 25 | import me.duncte123.skybot.utils.EarthUtils.sendYoungestOldesetEmbed 26 | 27 | class YoungestCommand : Command() { 28 | init { 29 | this.category = CommandCategory.FUN 30 | this.name = "youngest" 31 | this.help = "Shows the youngest member in the server" 32 | this.cooldown = 10 33 | this.cooldownScope = CooldownScope.GUILD 34 | this.cooldownKey = { _, _ -> "youngest|oldest" } 35 | } 36 | 37 | override fun execute(ctx: CommandContext) { 38 | sendYoungestOldesetEmbed(ctx, false) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/music/PlayRawCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.music 20 | 21 | class PlayRawCommand : PlayCommand(skipParsing = true) { 22 | init { 23 | this.displayAliasesInHelp = false 24 | } 25 | 26 | override fun getName(): String = "playrw" 27 | 28 | override fun getAliases() = arrayOf("prw") 29 | } 30 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/nsfw/HentaiCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.nsfw 20 | 21 | import me.duncte123.botcommons.messaging.EmbedUtils 22 | import me.duncte123.botcommons.messaging.MessageUtils.sendEmbed 23 | import me.duncte123.botcommons.web.WebUtils 24 | import me.duncte123.skybot.Settings.NEKKO_BASE 25 | import me.duncte123.skybot.objects.command.Command 26 | import me.duncte123.skybot.objects.command.CommandCategory 27 | import me.duncte123.skybot.objects.command.CommandContext 28 | 29 | class HentaiCommand : Command() { 30 | init { 31 | this.category = CommandCategory.NSFW 32 | this.name = "hentai" 33 | this.help = "Just some hentai" 34 | } 35 | 36 | override fun execute(ctx: CommandContext) { 37 | val t = if (ctx.random.nextInt(2) == 1) "hentai" else "hentai_anal" 38 | WebUtils.ins.getJSONObject("$NEKKO_BASE$t").async { 39 | sendEmbed(ctx, EmbedUtils.embedImage(it["message"].asText())) 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/nsfw/LewdKitsuneCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.nsfw 20 | 21 | import me.duncte123.botcommons.messaging.EmbedUtils 22 | import me.duncte123.botcommons.messaging.MessageUtils.sendEmbed 23 | import me.duncte123.botcommons.web.WebUtils 24 | import me.duncte123.skybot.Settings.NEKKO_BASE 25 | import me.duncte123.skybot.objects.command.Command 26 | import me.duncte123.skybot.objects.command.CommandCategory 27 | import me.duncte123.skybot.objects.command.CommandContext 28 | 29 | class LewdKitsuneCommand : Command() { 30 | init { 31 | this.category = CommandCategory.NSFW 32 | this.name = "lewdkitsune" 33 | this.help = "Shows you a lewd kitsune" 34 | } 35 | 36 | override fun execute(ctx: CommandContext) { 37 | WebUtils.ins.getJSONObject("${NEKKO_BASE}lewdkitsune").async { 38 | sendEmbed(ctx, EmbedUtils.embedImage(it["message"].asText())) 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/nsfw/LewdNekoCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.nsfw 20 | 21 | import me.duncte123.botcommons.messaging.EmbedUtils 22 | import me.duncte123.botcommons.messaging.MessageUtils.sendEmbed 23 | import me.duncte123.botcommons.web.WebUtils 24 | import me.duncte123.skybot.objects.command.Command 25 | import me.duncte123.skybot.objects.command.CommandCategory 26 | import me.duncte123.skybot.objects.command.CommandContext 27 | 28 | class LewdNekoCommand : Command() { 29 | init { 30 | this.category = CommandCategory.NSFW 31 | this.name = "lewdneko" 32 | this.help = "Gives a very lewd neko" 33 | } 34 | 35 | override fun execute(ctx: CommandContext) { 36 | WebUtils.ins.getJSONObject("https://nekos.life/api/v2/img/lewd").async { 37 | sendEmbed(ctx, EmbedUtils.embedImage(it["url"].asText())) 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/uncategorized/CookieCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.uncategorized 20 | 21 | import me.duncte123.botcommons.messaging.MessageUtils.sendMsg 22 | import me.duncte123.skybot.objects.command.Command 23 | import me.duncte123.skybot.objects.command.CommandContext 24 | 25 | class CookieCommand : Command() { 26 | init { 27 | this.name = "cookie" 28 | this.help = "blobnomcookie" 29 | } 30 | 31 | override fun execute(ctx: CommandContext) { 32 | sendMsg(ctx, "<:blobnomcookie_secret:317636549342789632>") 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/uncategorized/InviteCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.uncategorized 20 | 21 | import me.duncte123.botcommons.messaging.MessageUtils.sendMsg 22 | import me.duncte123.skybot.objects.command.Command 23 | import me.duncte123.skybot.objects.command.CommandContext 24 | 25 | class InviteCommand : Command() { 26 | init { 27 | this.name = "invite" 28 | this.help = "Gives you the bot invite link" 29 | } 30 | 31 | override fun execute(ctx: CommandContext) { 32 | sendMsg(ctx, "Invite me with this link:\n") 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/uncategorized/ReverseCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.uncategorized 20 | 21 | import me.duncte123.botcommons.messaging.MessageUtils 22 | import me.duncte123.skybot.objects.command.Command 23 | import me.duncte123.skybot.objects.command.CommandContext 24 | 25 | class ReverseCommand : Command() { 26 | init { 27 | this.name = "reverse" 28 | this.help = "Reverses a string" 29 | this.usage = "" 30 | } 31 | 32 | override fun execute(ctx: CommandContext) { 33 | if (ctx.args.isEmpty()) { 34 | this.sendUsageInstructions(ctx) 35 | return 36 | } 37 | 38 | val message = """**${ctx.author.asTag}:** 39 | |**Input:** ${ctx.argsRaw} 40 | |**Output:** ${ctx.argsRaw.reversed()} 41 | """.trimMargin() 42 | 43 | MessageUtils.sendMsg(ctx, message) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/uncategorized/SuggestCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.uncategorized 20 | 21 | import me.duncte123.botcommons.messaging.MessageUtils 22 | import me.duncte123.skybot.objects.command.Command 23 | import me.duncte123.skybot.objects.command.CommandContext 24 | 25 | class SuggestCommand : Command() { 26 | init { 27 | this.name = "suggest" 28 | this.help = "Suggest a new feature for DuncteBot!" 29 | } 30 | 31 | override fun execute(ctx: CommandContext) { 32 | MessageUtils.sendMsg( 33 | ctx, 34 | """You can leave you suggestions for the bot on his page: https://duncte.bot/suggest 35 | |Make sure to join our Discord server so we can contact you when needed: 36 | """.trimMargin() 37 | ) 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/uncategorized/UptimeCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.uncategorized 20 | 21 | import me.duncte123.botcommons.messaging.MessageUtils.sendMsg 22 | import me.duncte123.skybot.objects.command.Command 23 | import me.duncte123.skybot.objects.command.CommandContext 24 | import me.duncte123.skybot.utils.AirUtils 25 | import java.lang.management.ManagementFactory 26 | 27 | class UptimeCommand : Command() { 28 | init { 29 | this.name = "uptime" 30 | this.help = "Shows the bot's uptime" 31 | } 32 | 33 | override fun execute(ctx: CommandContext) { 34 | sendMsg(ctx, AirUtils.getUptime(ManagementFactory.getRuntimeMXBean().uptime)) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/weeb/B1nzyCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.weeb 20 | 21 | import me.duncte123.botcommons.messaging.MessageUtils.sendEmbed 22 | import me.duncte123.skybot.objects.command.CommandContext 23 | import me.duncte123.weebJava.configs.ImageConfig 24 | 25 | class B1nzyCommand : WeebCommandBase() { 26 | init { 27 | this.name = "b1nzy" 28 | this.help = "Shows a b1nzy meme" 29 | } 30 | 31 | override fun execute(ctx: CommandContext) { 32 | sendEmbed(ctx, getWeebEmbedImage(ctx.weebApi.getRandomImage(ImageConfig.Builder().setTags(listOf("b1nzy")).build()).execute().url)) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/weeb/DanceCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.weeb 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext 22 | 23 | class DanceCommand : WeebCommandBase() { 24 | init { 25 | this.name = "dance" 26 | this.help = "Do a little dance" 27 | this.userAction = true 28 | } 29 | 30 | override fun execute(ctx: CommandContext) { 31 | singleAction("dance", "is dancing", ctx) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/weeb/HugCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.weeb 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext 22 | 23 | class HugCommand : WeebCommandBase() { 24 | init { 25 | this.name = "hug" 26 | this.help = "Hug a user" 27 | this.userAction = true 28 | } 29 | 30 | override fun execute(ctx: CommandContext) { 31 | requestAndSend("hug", "hugs", ctx) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/weeb/LewdCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.weeb 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext 22 | 23 | class LewdCommand : WeebCommandBase() { 24 | init { 25 | this.name = "lewd" 26 | this.help = "Someone's being a bit lewd" 27 | this.userAction = true 28 | } 29 | 30 | override fun execute(ctx: CommandContext) { 31 | singleAction("lewd", "is being lewd", ctx) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/weeb/LickCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.weeb 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext 22 | 23 | class LickCommand : WeebCommandBase() { 24 | init { 25 | this.name = "lick" 26 | this.help = "Lick someone" 27 | this.userAction = true 28 | } 29 | 30 | override fun execute(ctx: CommandContext) { 31 | requestAndSend("lick", "licks", ctx) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/weeb/MeguminCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.weeb 20 | 21 | import me.duncte123.botcommons.messaging.MessageUtils.sendEmbed 22 | import me.duncte123.skybot.objects.command.CommandContext 23 | import me.duncte123.weebJava.configs.ImageConfig 24 | 25 | class MeguminCommand : WeebCommandBase() { 26 | init { 27 | this.name = "megumin" 28 | this.help = "EXPLOSION!!!!!" 29 | } 30 | 31 | override fun execute(ctx: CommandContext) { 32 | val quote = ctx.apis.getMeguminQuote() 33 | val img = ctx.weebApi.getRandomImage( 34 | ImageConfig.Builder() 35 | .setType("megumin") 36 | .build() 37 | ) 38 | 39 | sendEmbed(ctx, getWeebEmbedImageAndDesc(quote, img.execute().url)) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/weeb/OwoCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.weeb 20 | 21 | import me.duncte123.botcommons.messaging.MessageUtils.sendEmbed 22 | import me.duncte123.skybot.objects.command.CommandContext 23 | import me.duncte123.weebJava.configs.ImageConfig 24 | 25 | class OwoCommand : WeebCommandBase() { 26 | init { 27 | this.name = "owo" 28 | this.help = "OwO what's this" 29 | } 30 | 31 | override fun execute(ctx: CommandContext) { 32 | sendEmbed(ctx, getWeebEmbedImage(ctx.weebApi.getRandomImage(ImageConfig.Builder().setType("owo").build()).execute().url)) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/weeb/PatCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.weeb 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext 22 | 23 | class PatCommand : WeebCommandBase() { 24 | init { 25 | this.name = "pat" 26 | this.help = "Pat someone" 27 | this.userAction = true 28 | } 29 | 30 | override fun execute(ctx: CommandContext) { 31 | requestAndSend("pat", "pats", ctx) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/weeb/PunchCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.weeb 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext 22 | 23 | class PunchCommand : WeebCommandBase() { 24 | init { 25 | this.name = "punch" 26 | this.help = "Punch someone in their face" 27 | this.userAction = true 28 | } 29 | 30 | override fun execute(ctx: CommandContext) { 31 | requestAndSend("punch", "punches", ctx) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/weeb/ShootCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.weeb 20 | 21 | import me.duncte123.skybot.objects.command.CommandContext 22 | 23 | class ShootCommand : WeebCommandBase() { 24 | init { 25 | this.name = "shoot" 26 | this.help = "Shoot someone" 27 | this.userAction = true 28 | } 29 | 30 | override fun execute(ctx: CommandContext) { 31 | requestAndSend("bang", "shoots", ctx) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/commands/weeb/ShrugCommand.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.commands.weeb 20 | 21 | import me.duncte123.botcommons.messaging.MessageUtils.sendEmbed 22 | import me.duncte123.skybot.objects.command.CommandContext 23 | import me.duncte123.weebJava.configs.ImageConfig 24 | 25 | class ShrugCommand : WeebCommandBase() { 26 | init { 27 | this.name = "shrug" 28 | this.help = "¯\\\\_(ツ)\\_/¯" 29 | } 30 | 31 | override fun execute(ctx: CommandContext) { 32 | sendEmbed( 33 | ctx, 34 | getWeebEmbedImageAndDesc( 35 | "${ctx.member!!.asMention} shrugs", 36 | ctx.weebApi.getRandomImage(ImageConfig.Builder().setType("shrug").build()).execute().url 37 | ) 38 | ) 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/entities/jda/DunctebotGuild.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.entities.jda 20 | 21 | import com.dunctebot.models.settings.GuildSetting 22 | import me.duncte123.botcommons.messaging.EmbedUtils 23 | import me.duncte123.skybot.Variables 24 | import me.duncte123.skybot.utils.AirUtils 25 | import me.duncte123.skybot.utils.GuildSettingsUtils 26 | import net.dv8tion.jda.api.entities.Guild 27 | 28 | class DunctebotGuild(private val guild: Guild, private val variables: Variables) : Guild by guild { 29 | var settings: GuildSetting 30 | get() = GuildSettingsUtils.getGuild(this.idLong, this.variables) 31 | set(settings) = GuildSettingsUtils.updateGuildSettings(this.idLong, settings, this.variables) 32 | 33 | val color: Int 34 | get() = EmbedUtils.getColorOrDefault(this.idLong) 35 | 36 | val hexColor = AirUtils.colorToHex(color) 37 | 38 | override fun toString() = this.guild.toString() 39 | } 40 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/extensions/Boolean.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.extensions 20 | 21 | import me.duncte123.skybot.Settings 22 | 23 | fun Boolean.toEmoji() = if (this) Settings.YES_STATIC else Settings.NO_STATIC 24 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/extensions/Process.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.extensions 20 | 21 | import java.util.* 22 | 23 | fun Process.getString(): String { 24 | this.inputStream.use { s -> 25 | Scanner(s).use { scanner -> 26 | return buildString { 27 | while (scanner.hasNextLine()) { 28 | appendLine(scanner.nextLine()) 29 | } 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/extensions/ShardManager.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.extensions 20 | 21 | import net.dv8tion.jda.api.sharding.ShardManager 22 | 23 | fun ShardManager.isUnavailable(guildId: Long): Boolean { 24 | return this.shardCache.any { it.isUnavailable(guildId) } 25 | } 26 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/extensions/String.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.extensions 20 | 21 | import me.duncte123.botcommons.StringUtils 22 | import me.duncte123.skybot.objects.command.Command 23 | 24 | fun String.stripFlags(command: Command): String { 25 | var text = this 26 | 27 | for (f in command.flags) { 28 | if (f.word != null) { 29 | text = text.replace("--" + f.word, "") 30 | } 31 | 32 | text = text.replace("-" + f.flag, "") 33 | } 34 | 35 | return text.trim() 36 | } 37 | 38 | fun String.abbreviate(length: Int) = StringUtils.abbreviate(this, length)!! 39 | 40 | fun String.escapeMarkDown(): String { 41 | return this.replace("_", "\\_") 42 | .replace("*", "\\*") 43 | .replace("`", "\\`") 44 | .replace("|", "\\|") 45 | .replace(">", "\\?") 46 | .replace("~", "\\~") 47 | } 48 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/extensions/Task.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.extensions 20 | 21 | import net.dv8tion.jda.api.utils.concurrent.Task 22 | import java.util.concurrent.CompletableFuture 23 | import java.util.concurrent.ExecutionException 24 | 25 | @Throws(InterruptedException::class, ExecutionException::class) 26 | fun Task.sync(): T { 27 | val retrieveFuture = CompletableFuture() 28 | 29 | this.onSuccess { retrieveFuture.complete(it) } 30 | this.onError { retrieveFuture.completeExceptionally(it) } 31 | 32 | return retrieveFuture.get() 33 | } 34 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/extensions/User.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.extensions 20 | 21 | import net.dv8tion.jda.api.entities.User 22 | 23 | fun User.getStaticAvatarUrl(): String { 24 | if (this.avatarId == null) { 25 | return this.defaultAvatarUrl 26 | } 27 | 28 | return User.AVATAR_URL.format(this.id, this.avatarId, "png") 29 | } 30 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/extensions/channel.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.extensions 20 | 21 | import net.dv8tion.jda.api.entities.channel.attribute.IAgeRestrictedChannel 22 | import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion 23 | 24 | val MessageChannelUnion.isNSFW: Boolean 25 | get() { 26 | if (this is IAgeRestrictedChannel) { 27 | return this.isNSFW 28 | } 29 | 30 | return false 31 | } 32 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/objects/AudioData.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.objects 20 | 21 | import me.duncte123.skybot.Variables 22 | import net.dv8tion.jda.api.JDA 23 | import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel 24 | import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent 25 | 26 | data class AudioData( 27 | val guildId: Long, 28 | val userId: Long, 29 | val channelId: Long, 30 | val replyToMessage: Long, 31 | val jda: JDA, 32 | val variables: Variables, 33 | ) { 34 | val channel: MessageChannel 35 | get() = jda.getChannelById(MessageChannel::class.java, channelId)!! 36 | 37 | companion object { 38 | fun fromSlash(event: SlashCommandInteractionEvent, variables: Variables): AudioData = AudioData( 39 | event.guild!!.idLong, 40 | event.user.idLong, 41 | event.channel.idLong, 42 | event.hook.retrieveOriginal().complete().idLong, 43 | event.jda, 44 | variables 45 | ) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/objects/DBMap.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.objects 20 | 21 | import net.jodah.expiringmap.ExpiringMap 22 | 23 | /** 24 | * Custom wrapper for [ExpiringMap] that has a nullable getter for [getIfPresent] 25 | */ 26 | class DBMap(private val realMap: ExpiringMap) : MutableMap by realMap { 27 | fun getIfPresent(key: K): V? { 28 | return if (realMap.containsKey(key)) { 29 | realMap[key] 30 | } else { 31 | null 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/objects/RadioStream.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.objects 20 | 21 | class RadioStream(var name: String, val url: String, val website: String) { 22 | // private fun hasWebsite() = !website.isNullOrBlank() 23 | 24 | // fun toEmbedString(): String = "[$name]($url) ${if (hasWebsite()) "from [$website]($website)" else ""}" 25 | fun toEmbedString(): String = "[$name]($url) from [$website]($website)" 26 | 27 | override fun equals(other: Any?): Boolean { 28 | if (other !is RadioStream) { 29 | return false 30 | } 31 | 32 | return this.name == other.name && this.url == other.url && this.website == other.website 33 | } 34 | 35 | override fun hashCode(): Int { 36 | var result = name.hashCode() 37 | result = 31 * result + url.hashCode() 38 | result = 31 * result + website.hashCode() 39 | return result 40 | } 41 | 42 | override fun toString(): String { 43 | return "RadioStream(name='$name', url='$url', website=$website)" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/objects/TrackUserData.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.objects 20 | 21 | import gnu.trove.list.TLongList 22 | import gnu.trove.list.array.TLongArrayList 23 | 24 | data class TrackUserData(val requester: Long) { 25 | val votes: TLongList = TLongArrayList() 26 | var forceAnnounce: Boolean = false 27 | } 28 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/web/SocketTypes.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.web 20 | 21 | object SocketTypes { 22 | const val ROLES_PUT_HASH = "ROLES_PUT_HASH" 23 | const val DATA_UPDATE = "DATA_UPDATE" 24 | const val FETCH_DATA = "FETCH_DATA" 25 | const val GUILD_SETTINGS = "GUILD_SETTINGS" 26 | const val CUSTOM_COMMANDS = "CUSTOM_COMMANDS" 27 | const val PONG = "PONG" 28 | } 29 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/web/handlers/PongHandler.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.web.handlers 20 | 21 | import com.fasterxml.jackson.databind.JsonNode 22 | import me.duncte123.skybot.web.WebSocketClient 23 | import me.duncte123.skybot.websocket.SocketHandler 24 | 25 | class PongHandler(client: WebSocketClient) : SocketHandler(client) { 26 | override fun handleInternally(data: JsonNode) { 27 | LOG.debug("Got pong event") 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /bot/src/main/kotlin/me/duncte123/skybot/web/tasks/WSPingTask.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.web.tasks 20 | 21 | import me.duncte123.skybot.web.WebSocketClient 22 | import net.dv8tion.jda.api.utils.data.DataObject 23 | 24 | class WSPingTask(private val client: WebSocketClient) : Runnable { 25 | override fun run() { 26 | client.send( 27 | DataObject.empty().put("t", "PING") 28 | ) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /bot/src/main/resources/sentry.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Skybot, a multipurpose discord bot 3 | # Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | # 5 | # This program is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU Affero General Public License as published 7 | # by the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU Affero General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU Affero General Public License 16 | # along with this program. If not, see . 17 | # 18 | 19 | stacktrace.app.packages=ml.duncte123,me.duncte123 20 | mdctags=jda.shard 21 | -------------------------------------------------------------------------------- /bot/src/main/resources/yes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncteBot/SkyBot/07ffb14823ba4446478b27eb7057b32b38aceff5/bot/src/main/resources/yes.jpg -------------------------------------------------------------------------------- /bot/testscript.groovy: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | import me.duncte123.botcommons.messaging.EmbedUtils 19 | 20 | static def quick_mafs(int x) { 21 | def the_thing = x + 2 -1 22 | return the_thing 23 | } 24 | 25 | //channel.sendFile(new URL("https://i.redd.it/byolwd5dnaqz.jpg").openStream(), "filename.png", new MessageBuilder() 26 | //.setEmbed(EmbedUtils.defaultEmbed().setImage("attachment://filename.png").build()).build()).queue() 27 | 28 | channel.sendMessage("This has an embed with an image!") 29 | .addFile(new URL("https://i.redd.it/byolwd5dnaqz.jpg").openStream(), "alpaca.png") 30 | .embed(EmbedUtils.embedImage("attachment://alpaca.png")) 31 | .queue() 32 | 33 | return quick_mafs(2) + "\nThe thing goes skrra" 34 | -------------------------------------------------------------------------------- /botpages/SkyBot.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | DuncteBot is a bot with a lot of features like mod commands. 4 | 5 | If you require any support, please join our [Discord server][guild] 6 | 7 | ## List of commands 8 | The list with commands can be found on [our website][commandList] ([https://duncte.bot/commands][commandList]) 9 | 10 | 11 | ## The join and leave messages use a special notation 12 | 13 | The documentation can be found here: [https://github.com/DuncteBot/SkyBot/wiki/JagTag](https://github.com/DuncteBot/SkyBot/wiki/JagTag) 14 | 15 | 16 | If you don't want the bot to respond to commands in a certain channel make sure to add `-commands` to the channel topic. 17 | 18 | [guild]: https://duncte.bot/server 19 | [commandList]: https://duncte.bot/commands 20 | -------------------------------------------------------------------------------- /dashboard/.dockerignore: -------------------------------------------------------------------------------- 1 | Dockerfile 2 | .dockerignore 3 | .git/ 4 | .gitattributes 5 | .gitignore 6 | build/ 7 | -------------------------------------------------------------------------------- /dashboard/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | 10 | [gradlew.bat] 11 | end_of_line = crlf 12 | -------------------------------------------------------------------------------- /dashboard/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | .gradle/ 3 | build/ 4 | out/ 5 | ../docker-compose.override.yml 6 | !.idea/copyright/* 7 | !.idea/copyright/dasboard.xml 8 | !.idea/copyright/profiles_settings.xml 9 | -------------------------------------------------------------------------------- /dashboard/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM azul/zulu-openjdk-alpine:21 AS builder 2 | 3 | WORKDIR /skybot 4 | COPY . . 5 | RUN ./gradlew --no-daemon :dashboard:build 6 | 7 | FROM azul/zulu-openjdk-alpine:21-jre 8 | 9 | WORKDIR /skybot 10 | COPY --from=builder /skybot/dashboard/build/libs/dashboard*-all.jar ./dashboard.jar 11 | 12 | ENTRYPOINT ["java", "-jar", "dashboard.jar"] 13 | -------------------------------------------------------------------------------- /dashboard/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | // java 3 | application 4 | kotlin("jvm") 5 | id("com.github.johnrengelman.shadow") 6 | } 7 | 8 | group = "com.dunctebot" 9 | version = "1.0" 10 | 11 | 12 | dependencies { 13 | implementation(projects.shared) 14 | implementation(libs.logback.newSlf4j) 15 | implementation(libs.bundles.json) 16 | implementation(libs.bundles.dashWeb) 17 | implementation(libs.expiringmap) 18 | implementation(libs.trove) 19 | implementation(libs.jda) { 20 | exclude(module = "opus-java") 21 | } 22 | } 23 | 24 | java { 25 | sourceCompatibility = JavaVersion.VERSION_21 26 | targetCompatibility = JavaVersion.VERSION_21 27 | } 28 | 29 | application { 30 | mainClass.set("com.dunctebot.dashboard.MainKt") 31 | } 32 | 33 | tasks { 34 | shadowJar { 35 | archiveClassifier.set("-all") 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /dashboard/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.8" 2 | services: 3 | dunctebot-dashboard: 4 | container_name: dunctebot-dashboard 5 | build: 6 | context: . 7 | ports: 8 | - "2000:4567" 9 | environment: 10 | - IS_LOCAL=false 11 | # set to dash_is_server to disable ws client and start ws server from dashboard 12 | - WS_URL=ws://localhost:3748/ 13 | - WS_SERVER_TOKEN=admin123 14 | - BOT_TOKEN= 15 | - OAUTH_CLIENT_ID= 16 | - OAUTH_CLIENT_SECRET= 17 | - OAUTH_REDIRECT_URI= 18 | - CAPTCHA_SITEKEY= 19 | - CAPTCHA_SECRET= 20 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/dashboard/Container.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.dashboard 2 | 3 | import com.dunctebot.dashboard.websocket.WebsocketClient 4 | import com.dunctebot.duncteapi.DuncteApi 5 | import com.dunctebot.jda.JDARestClient 6 | import com.fasterxml.jackson.databind.json.JsonMapper 7 | import okhttp3.OkHttpClient 8 | 9 | val restJDA = JDARestClient(System.getenv("BOT_TOKEN")) 10 | val duncteApis = DuncteApi("Bot ${System.getenv("BOT_TOKEN")}") 11 | 12 | val httpClient = OkHttpClient() 13 | val jsonMapper = JsonMapper() 14 | lateinit var webSocket: WebsocketClient 15 | 16 | val server = WebServer() 17 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/dashboard/DiscordError.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.dashboard 2 | 3 | enum class DiscordError(val title: String, val component: String) { 4 | NO_GUILD("Server not found", "error-discord-no-guild"), 5 | NO_PERMS("You are missing some permissions!", "error-discord-no-perms"), 6 | WAT("WAT", "error-discord-wat"), 7 | ; 8 | } 9 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/dashboard/Main.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.dashboard 2 | 3 | import com.dunctebot.dashboard.tasks.DashboardTasks 4 | import org.slf4j.LoggerFactory 5 | import java.util.concurrent.Executors 6 | 7 | val systemPool = Executors.newSingleThreadScheduledExecutor { 8 | val t = Thread(it, "System Pool") 9 | t.isDaemon = true 10 | return@newSingleThreadScheduledExecutor t 11 | } 12 | 13 | fun main() { 14 | Runtime.getRuntime().addShutdownHook(Thread { 15 | server.shutdown() 16 | }) 17 | 18 | val logger = LoggerFactory.getLogger("Main") 19 | 20 | // start tasks 21 | DashboardTasks() 22 | 23 | server.start() 24 | 25 | logger.info("Dashboard ready") 26 | } 27 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/dashboard/bodies/PatronBody.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.dashboard.bodies 2 | 3 | import com.fasterxml.jackson.annotation.JsonIgnoreProperties 4 | 5 | @JsonIgnoreProperties(ignoreUnknown = true) 6 | data class PatronBody(val userId: String?, val guildId: String?, val token: String?) 7 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/dashboard/constants/ContentType.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.dashboard.constants 2 | 3 | object ContentType { 4 | const val JSON = "application/json" 5 | const val HTML = "text/html" 6 | } 7 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/dashboard/controllers/DashboardController.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.dashboard.controllers 2 | 3 | import com.dunctebot.dashboard.* 4 | import com.dunctebot.dashboard.WebServer.Companion.OLD_PAGE 5 | import com.dunctebot.dashboard.WebServer.Companion.SESSION_ID 6 | import com.dunctebot.dashboard.WebServer.Companion.USER_ID 7 | import io.javalin.http.Context 8 | import io.javalin.http.RedirectResponse 9 | import net.dv8tion.jda.api.Permission 10 | 11 | object DashboardController { 12 | fun before(ctx: Context) { 13 | if (ctx.sessionAttribute(USER_ID) == null || ctx.sessionAttribute(SESSION_ID) == null) { 14 | ctx.sessionAttribute(OLD_PAGE, ctx.path()) 15 | ctx.redirect("/") 16 | 17 | throw RedirectResponse() 18 | } 19 | 20 | val guild = ctx.fetchGuild() ?: throw haltDiscordError(ctx, DiscordError.NO_GUILD, ctx.guildId) 21 | 22 | val member = try { 23 | restJDA.retrieveMemberById(guild, ctx.userId).complete() 24 | } catch (e: Exception) { 25 | e.printStackTrace() 26 | throw haltDiscordError(ctx, DiscordError.WAT) 27 | } 28 | 29 | if (!member.hasPermission(Permission.MANAGE_SERVER)) { 30 | throw haltDiscordError(ctx, DiscordError.NO_PERMS) 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/dashboard/controllers/api/DataController.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.dashboard.controllers.api 2 | 3 | import com.dunctebot.dashboard.* 4 | import com.fasterxml.jackson.databind.node.ObjectNode 5 | import io.javalin.http.Context 6 | 7 | object DataController { 8 | fun updateData(ctx: Context) { 9 | ctx.authOrFail() 10 | 11 | // parse the data to make sure that it is proper json 12 | val updateData = ctx.jsonBody 13 | val wsRequest = jsonMapper.createObjectNode() 14 | .put("t", "DATA_UPDATE") 15 | .set("d", updateData) 16 | 17 | // send the data to all instances that are connected 18 | webSocket.broadcast(wsRequest) 19 | 20 | ctx.json( 21 | jsonMapper.createObjectNode().put("success", true) 22 | ) 23 | } 24 | 25 | fun invalidateTokens(ctx: Context) { 26 | ctx.authOrFail() 27 | 28 | duncteApis.validTokens.clear() 29 | 30 | ctx.result("ok") 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/dashboard/rendering/WebVariables.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.dashboard.rendering 2 | 3 | class WebVariables { 4 | private var map = mutableMapOf() 5 | 6 | fun put(key: String, value: Any): WebVariables { 7 | map[key] = value 8 | return this 9 | } 10 | 11 | fun toMap(): Map { 12 | return map 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/dashboard/tasks/ReconnectTask.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.dashboard.tasks 2 | 3 | import com.dunctebot.dashboard.websocket.WebsocketClient 4 | import com.neovisionaries.ws.client.WebSocket 5 | import com.neovisionaries.ws.client.WebSocketState 6 | import org.slf4j.LoggerFactory 7 | 8 | class ReconnectTask(private val client: WebsocketClient): Runnable { 9 | private val logger = LoggerFactory.getLogger(ReconnectTask::class.java) 10 | 11 | override fun run() { 12 | try { 13 | val socket: WebSocket = client.socket 14 | if (!socket.isOpen && socket.state != WebSocketState.CONNECTING && 15 | System.currentTimeMillis() - client.lastReconnectAttempt > client.reconnectInterval && 16 | client.mayReconnect) { 17 | client.attemptReconnect() 18 | } 19 | } catch (e: Exception) { 20 | logger.error("Caught exception in reconnect thread", e) 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/dashboard/tasks/WSPingTask.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.dashboard.tasks 2 | 3 | import com.dunctebot.dashboard.jsonMapper 4 | import com.dunctebot.dashboard.websocket.WebsocketClient 5 | 6 | class WSPingTask(private val client: WebsocketClient): Runnable { 7 | override fun run() { 8 | client.broadcast( 9 | jsonMapper.createObjectNode() 10 | .put("t", "PING") 11 | ) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/dashboard/utils/DataUtils.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.dashboard.utils 2 | 3 | import com.dunctebot.dashboard.duncteApis 4 | import com.dunctebot.dashboard.jsonMapper 5 | import com.dunctebot.dashboard.webSocket 6 | import com.dunctebot.models.settings.GuildSetting 7 | import com.fasterxml.jackson.databind.JsonNode 8 | import java.util.concurrent.CompletableFuture 9 | 10 | fun fetchGuildData(guildId: String): Pair { 11 | val future = CompletableFuture() 12 | val json = jsonMapper.createObjectNode() 13 | 14 | json.putArray("guild_settings") 15 | .add(guildId) 16 | json.putArray("guild_patron_status") 17 | .add(guildId) 18 | 19 | webSocket.requestData(json, future::complete) 20 | 21 | val result = future.get() 22 | var guildSetting = result["guild_settings"][guildId] 23 | 24 | // fallback in case the bots don't have it 25 | if (guildSetting == null || guildSetting.isNull) { 26 | guildSetting = duncteApis.fetchGuildSetting(guildId.toLong()) 27 | } 28 | 29 | val settingParsed = jsonMapper.readValue(guildSetting.traverse(), GuildSetting::class.java) 30 | val patreonStatus = result["guild_patron_status"][guildId].asBoolean() 31 | 32 | return settingParsed to patreonStatus 33 | } 34 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/dashboard/utils/HashUtils.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.dashboard.utils 2 | 3 | import java.security.MessageDigest 4 | 5 | /** 6 | * Hashing Utils [https://www.samclarke.com/kotlin-hash-strings/](https://www.samclarke.com/kotlin-hash-strings/) 7 | * @author Sam Clarke 8 | * @license MIT 9 | */ 10 | object HashUtils { 11 | private const val HEX_CHARS = "0123456789ABCDEF" 12 | 13 | fun sha512(input: String) = hashString("SHA-512", input) 14 | 15 | fun sha256(input: String) = hashString("SHA-256", input) 16 | 17 | fun sha1(input: String) = hashString("SHA-1", input) 18 | 19 | /** 20 | * Supported algorithms on Android: 21 | * 22 | * Algorithm Supported API Levels 23 | * MD5 1+ 24 | * SHA-1 1+ 25 | * SHA-224 1-8,22+ 26 | * SHA-256 1+ 27 | * SHA-384 1+ 28 | * SHA-512 1+ 29 | */ 30 | private fun hashString(type: String, input: String): String { 31 | val bytes = MessageDigest 32 | .getInstance(type) 33 | .digest(input.toByteArray()) 34 | 35 | return buildString(bytes.size * 2) { 36 | bytes.forEach { 37 | val i = it.toInt() 38 | append(HEX_CHARS[i shr 4 and 0x0f]) 39 | append(HEX_CHARS[i and 0x0f]) 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/dashboard/websocket/handlers/DataUpdateHandler.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.dashboard.websocket.handlers 2 | 3 | import com.dunctebot.dashboard.restJDA 4 | import com.dunctebot.dashboard.websocket.handlers.base.SocketHandler 5 | import com.fasterxml.jackson.databind.JsonNode 6 | 7 | class DataUpdateHandler : SocketHandler() { 8 | override fun handleInternally(data: JsonNode?) { 9 | if (data!!.has("guilds")) { 10 | data["guilds"]["invalidate"].forEach { 11 | restJDA.invalidateGuild(it.asLong()) 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/dashboard/websocket/handlers/FetchDataHandler.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.dashboard.websocket.handlers 2 | 3 | import com.dunctebot.dashboard.websocket.handlers.base.SocketHandler 4 | import com.fasterxml.jackson.databind.JsonNode 5 | 6 | class FetchDataHandler : SocketHandler() { 7 | val waitingMap = mutableMapOf Unit>() 8 | 9 | override fun handleInternally(data: JsonNode?) { 10 | val identifier = data!!["identifier"].asText() 11 | 12 | if (waitingMap.containsKey(identifier)) { 13 | waitingMap[identifier]!!(data) 14 | 15 | waitingMap.remove(identifier) 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/dashboard/websocket/handlers/PongHandler.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.dashboard.websocket.handlers 2 | 3 | import com.dunctebot.dashboard.websocket.handlers.base.SocketHandler 4 | import com.fasterxml.jackson.databind.JsonNode 5 | 6 | class PongHandler : SocketHandler() { 7 | override fun handleInternally(data: JsonNode?) { 8 | logger.debug("Got pong event") 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/dashboard/websocket/handlers/RolesHashHandler.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.dashboard.websocket.handlers 2 | 3 | import com.dunctebot.dashboard.controllers.GuildController 4 | import com.dunctebot.dashboard.websocket.handlers.base.SocketHandler 5 | import com.fasterxml.jackson.databind.JsonNode 6 | 7 | class RolesHashHandler : SocketHandler() { 8 | override fun handleInternally(data: JsonNode?) { 9 | val hash = data!!["hash"].asText() 10 | val guildId = data["guild_id"].asLong() 11 | 12 | logger.debug("Adding hash for $guildId: $hash") 13 | 14 | GuildController.guildHashes.put(hash, guildId) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/dashboard/websocket/handlers/base/SocketHandler.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.dashboard.websocket.handlers.base 2 | 3 | import com.fasterxml.jackson.databind.JsonNode 4 | import org.slf4j.Logger 5 | import org.slf4j.LoggerFactory 6 | 7 | abstract class SocketHandler { 8 | protected val logger: Logger = LoggerFactory.getLogger(this.javaClass) 9 | 10 | fun handle(raw: JsonNode) { 11 | try { 12 | handleInternally(raw["d"]) 13 | } catch (e: Throwable) { 14 | logger.error("Unhandled exception in socket handler", e) 15 | } 16 | } 17 | 18 | protected abstract fun handleInternally(data: JsonNode?) 19 | } 20 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/jda/MemberPaginationAction.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.jda 2 | 3 | import net.dv8tion.jda.api.entities.Guild 4 | import net.dv8tion.jda.api.entities.Member 5 | import net.dv8tion.jda.api.requests.restaction.pagination.PaginationAction 6 | 7 | interface MemberPaginationAction : PaginationAction { 8 | val guild: Guild 9 | } 10 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/jda/json/JsonChannel.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.jda.json 2 | 3 | import net.dv8tion.jda.api.entities.channel.concrete.TextChannel 4 | 5 | class JsonChannel(channel: TextChannel) { 6 | val id = channel.id 7 | val name = channel.name 8 | } 9 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/jda/json/JsonGuild.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.jda.json 2 | 3 | import net.dv8tion.jda.api.entities.Guild 4 | 5 | class JsonGuild(guild: Guild) { 6 | val id = guild.id 7 | val name = guild.name 8 | } 9 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/jda/json/JsonRole.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.jda.json 2 | 3 | import net.dv8tion.jda.api.entities.Role 4 | 5 | open class JsonRole(role: Role) { 6 | val id = role.id 7 | val name = role.name 8 | } 9 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/jda/oauth/OauthSession.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.jda.oauth 2 | 3 | import com.jagrosh.jdautilities.oauth2.Scope 4 | import com.jagrosh.jdautilities.oauth2.session.Session 5 | import com.jagrosh.jdautilities.oauth2.session.SessionData 6 | import java.time.OffsetDateTime 7 | 8 | class OauthSession constructor( 9 | private val accessToken: String, 10 | private val refreshToken: String, 11 | private val tokenType: String, 12 | private val expiration: OffsetDateTime, 13 | private val scopes: Array 14 | ) : Session { 15 | constructor(data: SessionData) : this( 16 | data.accessToken, 17 | data.refreshToken, 18 | data.tokenType, 19 | data.expiration, 20 | data.scopes 21 | ) 22 | 23 | override fun getAccessToken() = accessToken 24 | override fun getRefreshToken() = refreshToken 25 | override fun getScopes() = scopes 26 | override fun getTokenType() = tokenType 27 | override fun getExpiration() = expiration 28 | } 29 | -------------------------------------------------------------------------------- /dashboard/src/main/kotlin/com/dunctebot/jda/oauth/OauthSessionController.kt: -------------------------------------------------------------------------------- 1 | package com.dunctebot.jda.oauth 2 | 3 | import com.jagrosh.jdautilities.oauth2.session.SessionController 4 | import com.jagrosh.jdautilities.oauth2.session.SessionData 5 | 6 | class OauthSessionController : SessionController { 7 | val sessions = mutableMapOf() 8 | 9 | override fun getSession(identifier: String) = sessions[identifier] 10 | 11 | override fun createSession(data: SessionData): OauthSession { 12 | val created = OauthSession(data) 13 | sessions[data.identifier] = created 14 | return created 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /dashboard/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | [%d{dd-MM-yyyy HH:mm:ss, -5}] [%boldCyan(%thread)] [%boldGreen(%logger{36})] %level - %msg%n 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /dashboard/src/main/resources/public/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | display: flex; 3 | min-height: 100vh; 4 | flex-direction: column; 5 | color: #FFFFFF; 6 | } 7 | 8 | main { 9 | flex: 1 0 auto; 10 | } 11 | 12 | .promo { 13 | width: 100%; 14 | } 15 | 16 | .promo i { 17 | margin: 40px 0; 18 | color: var(--color); 19 | font-size: 7rem; 20 | display: block; 21 | } 22 | 23 | .bg { 24 | background: var(--color) !important; 25 | } 26 | 27 | .bg:hover { 28 | background: #052e6a !important; 29 | } 30 | 31 | .promo-caption { 32 | font-size: 1.7rem; 33 | font-weight: 500; 34 | margin-top: 5px; 35 | margin-bottom: 0; 36 | } 37 | 38 | .delay-1 { 39 | animation-delay: 300ms; 40 | } 41 | 42 | .delay-2 { 43 | animation-delay: 600ms; 44 | } 45 | 46 | .delay-3 { 47 | animation-delay: 900ms; 48 | } 49 | 50 | .collection .collection-item:nth-child(even) { 51 | background-color: #6f7b82; 52 | } 53 | 54 | table.striped > tbody > tr > th { 55 | background-color: #36393f; 56 | } 57 | 58 | table.striped > tbody > tr:nth-child(odd) > td { 59 | background-color: #6f7b82; 60 | } 61 | 62 | .input-field.textarea { 63 | border: 1px solid #99AAB5; 64 | } 65 | 66 | .toast { 67 | background-color: #626161 !important; 68 | } 69 | 70 | button, input, optgroup, select, textarea { 71 | color: #ffffff; 72 | } 73 | 74 | code { 75 | background: #23272A; 76 | } 77 | 78 | /* Stolen from discordapp.com */ 79 | pre.code-block { 80 | background: #2f3136; 81 | border-color: rgba(32,34,37,.3); 82 | border-radius: 5px; 83 | border-style: solid; 84 | border-width: 2px; 85 | white-space: pre-wrap; 86 | padding: .5em; 87 | } 88 | 89 | pre.code-block code { 90 | background: #2f3136; 91 | color: #839496; 92 | } 93 | 94 | /*.oh { 95 | overflow: hidden; 96 | }*/ 97 | -------------------------------------------------------------------------------- /dashboard/src/main/resources/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncteBot/SkyBot/07ffb14823ba4446478b27eb7057b32b38aceff5/dashboard/src/main/resources/public/favicon.ico -------------------------------------------------------------------------------- /dashboard/src/main/resources/public/googleb737aaf3965f2882.html: -------------------------------------------------------------------------------- 1 | google-site-verification: googleb737aaf3965f2882.html 2 | -------------------------------------------------------------------------------- /dashboard/src/main/resources/public/img/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncteBot/SkyBot/07ffb14823ba4446478b27eb7057b32b38aceff5/dashboard/src/main/resources/public/img/favicon.png -------------------------------------------------------------------------------- /dashboard/src/main/resources/public/js/main.js: -------------------------------------------------------------------------------- 1 | function toast(message, displayLength = 4000) { 2 | M.toast({ 3 | html: message, 4 | displayLength, 5 | }); 6 | } 7 | 8 | // We had to rename this form _ to id because 9 | // the fucking patreon button has lodash set on the window 10 | function id(el) { 11 | return document.getElementById(el); 12 | } 13 | 14 | function hide(itemId) { 15 | id(itemId).style.display = 'none'; 16 | } 17 | 18 | function unHide(itemId) { 19 | id(itemId).style.display = 'block'; 20 | } 21 | 22 | document.addEventListener('DOMContentLoaded', () => { 23 | id('year').innerHTML = `${(new Date()).getFullYear()}`; 24 | }); 25 | 26 | function getMessage(m) { 27 | switch (m) { 28 | case 'missing_input': 29 | return 'Please fill in all fields'; 30 | case 'no_user': 31 | return 'The specified user id did not resolve any users.'; 32 | case 'no_guild': 33 | return 'The specified server id did not resolve any servers.'; 34 | default: 35 | return m; 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /dashboard/src/main/resources/public/robots.txt: -------------------------------------------------------------------------------- 1 | User-Agent: * 2 | Disallow: / 3 | -------------------------------------------------------------------------------- /dashboard/src/main/resources/vue/components/settings/parts/app-settings-switch.vue: -------------------------------------------------------------------------------- 1 | 19 | 20 | 55 | -------------------------------------------------------------------------------- /dashboard/src/main/resources/vue/views/errors/404.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | -------------------------------------------------------------------------------- /dashboard/src/main/resources/vue/views/errors/500.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | -------------------------------------------------------------------------------- /dashboard/src/main/resources/vue/views/errors/discord/noGuild.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 26 | -------------------------------------------------------------------------------- /dashboard/src/main/resources/vue/views/errors/discord/noPerms.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 20 | -------------------------------------------------------------------------------- /dashboard/src/main/resources/vue/views/errors/discord/wat.vue: -------------------------------------------------------------------------------- 1 | 12 | 13 | 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DuncteBot/SkyBot/07ffb14823ba4446478b27eb7057b32b38aceff5/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | git push 3 | git checkout master 4 | git pull 5 | git merge development 6 | git push 7 | git checkout development 8 | -------------------------------------------------------------------------------- /shared/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | 10 | [gradlew.bat] 11 | end_of_line = crlf 12 | -------------------------------------------------------------------------------- /shared/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle/ 2 | build/ 3 | out/ 4 | .env 5 | !.idea/copyright/* 6 | !.idea/copyright/dasboard.xml 7 | !.idea/copyright/profiles_settings.xml 8 | -------------------------------------------------------------------------------- /shared/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Duncan Sterken 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /shared/src/main/java/com/jagrosh/jdautilities/oauth2/exceptions/InvalidStateException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jagrosh.jdautilities.oauth2.exceptions; 17 | 18 | /** 19 | * Exception raised when the provided OAuth2 state is not valid. 20 | * 21 | *

Not to be confused with {@link IllegalStateException IllegalStateException} 22 | * 23 | * @author John Grosh (john.a.grosh@gmail.com) 24 | */ 25 | public class InvalidStateException extends Exception 26 | { 27 | public InvalidStateException(String message) 28 | { 29 | super(message); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /shared/src/main/java/com/jagrosh/jdautilities/oauth2/exceptions/MissingScopeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jagrosh.jdautilities.oauth2.exceptions; 17 | 18 | import com.jagrosh.jdautilities.oauth2.Scope; 19 | 20 | /** 21 | * Exception raised whenever attempting to perform an action or function 22 | * with a missing {@link Scope Scope}. 23 | * 24 | * @author Kaidan Gustave 25 | */ 26 | public class MissingScopeException extends RuntimeException 27 | { 28 | private static final String FORMAT = "Cannot %s without '%s' scope!"; 29 | 30 | public MissingScopeException(String action, Scope missing) 31 | { 32 | super(String.format(FORMAT, action, missing.getText())); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /shared/src/main/java/com/jagrosh/jdautilities/oauth2/state/DefaultStateController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016-2018 John Grosh (jagrosh) & Kaidan Gustave (TheMonitorLizard) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.jagrosh.jdautilities.oauth2.state; 17 | 18 | import java.util.HashMap; 19 | 20 | /** 21 | * The default {@link StateController StateController} implementation. 22 | * 23 | * @author John Grosh (john.a.grosh@gmail.com) 24 | */ 25 | public class DefaultStateController implements StateController 26 | { 27 | private final static String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; 28 | private final HashMap states = new HashMap<>(); 29 | 30 | @Override 31 | public String generateNewState(String redirectUri) 32 | { 33 | String state = randomState(); 34 | states.put(state, redirectUri); 35 | return state; 36 | } 37 | 38 | @Override 39 | public String consumeState(String state) 40 | { 41 | return states.remove(state); 42 | } 43 | 44 | private static String randomState() 45 | { 46 | StringBuilder sb = new StringBuilder(); 47 | for(int i = 0; i < 10; i++) 48 | sb.append(CHARACTERS.charAt((int)(Math.random()*CHARACTERS.length()))); 49 | return sb.toString(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /shared/src/main/java/me/duncte123/skybot/objects/command/CommandResult.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.objects.command; 20 | 21 | public enum CommandResult { 22 | SUCCESS, 23 | LIMIT_REACHED, 24 | COMMAND_EXISTS, 25 | UNKNOWN, 26 | } 27 | -------------------------------------------------------------------------------- /shared/src/main/java/me/duncte123/skybot/objects/command/ICommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | package me.duncte123.skybot.objects.command; 20 | 21 | import javax.annotation.Nonnull; 22 | 23 | public interface ICommand { 24 | 25 | // TODO: generics with custom command context and use this method for executing them 26 | void executeCommand(@Nonnull CTX ctx); 27 | 28 | @Nonnull 29 | String getName(); 30 | 31 | @Nonnull 32 | default String[] getAliases() { 33 | return new String[0]; 34 | } 35 | 36 | @Nonnull 37 | String getHelp(@Nonnull String invoke, @Nonnull String prefix); 38 | 39 | @Nonnull 40 | CommandCategory getCategory(); 41 | 42 | default boolean isCustom() { 43 | return false; 44 | } 45 | 46 | boolean shouldDisplayAliasesInHelp(); 47 | 48 | default String gerNameForLogger() { 49 | return getClass().getSimpleName(); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /shared/src/main/kotlin/me/duncte123/skybot/utils/TextUtils.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Skybot, a multipurpose discord bot 3 | * Copyright (C) 2017 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan & Maurice R S "Sanduhr32" 4 | * 5 | * This program is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU Affero General Public License as published 7 | * by the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * This program is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU Affero General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU Affero General Public License 16 | * along with this program. If not, see . 17 | */ 18 | 19 | @file:JvmName("TextUtils") 20 | 21 | package me.duncte123.skybot.utils 22 | 23 | /** 24 | * Slices text into chunks to make it manageable 25 | */ 26 | fun String.chunkForEmbed(limit: Int = 2000): List { 27 | val lines = this.split("\n") 28 | val chunks = mutableListOf() 29 | 30 | var chunk = "" 31 | lines.forEach { line -> 32 | if (chunk.length + line.length > limit && chunk.isNotEmpty()) { 33 | chunks.add(chunk) 34 | chunk = "" 35 | } 36 | if (line.length > limit) { 37 | line.chunked(limit).forEach { chunks.add(it) } 38 | } else { 39 | chunk += "$line\n" 40 | } 41 | } 42 | 43 | return chunks 44 | } 45 | --------------------------------------------------------------------------------