import { Collections , Command } from 'detritus-client' ; import { Response } from 'detritus-rest' ; import { HTTPMethods } from 'detritus-rest/lib/constants' ; import { GuildAllowlistTypes , GuildBlocklistTypes , GuildDisableCommandsTypes , } from '../constants' ; import GuildSettingsStore from '../stores/guildsettings' ; import UserStore from '../stores/users' ; import * as Endpoints from './endpoints' ; import * as raw from './raw' ; import { RequestContext } from './raw' ; import { GoogleSearchImageResult } from './structures/googlesearchimageresult' ; import { GuildSettings , GuildSettingsLogger , GuildSettingsPrefix , } from './structures/guildsettings' ; import { User } from './structures/user' ; import { RestOptions , RestResponses } from './types' ; export { request } from './raw' ; export { Endpoints , RequestContext , raw } ; export async function createGuildAllowlist ( context , guildId , allowlistId , type ) { return raw . createGuildAllowlist ( context , guildId , allowlistId , type ) ; } export async function createGuildBlocklist ( context , guildId , blocklistId , type ) { return raw . createGuildBlocklist ( context , guildId , blocklistId , type ) ; } export async function createGuildDisabledCommand ( context , guildId , command , disabledId , type ) { return raw . createGuildDisabledCommand ( context , guildId , command , disabledId , type ) ; } export async function createGuildLogger ( context , guildId , options ) { const data = await raw . createGuildLogger ( context , guildId , options ) ; const collection = new Collections . BaseCollection < string , GuildSettingsLogger > ( ) ; for ( let raw of data ) { const item = new GuildSettingsLogger ( raw ) ; collection . set ( item . key , item ) ; } if ( GuildSettingsStore . has ( guildId ) ) { const settings = GuildSettingsStore . get ( guildId ) as GuildSettings ; settings . merge ( { loggers : data } ) ; } return collection ; } export async function createGuildPrefix ( context , guildId , prefix ) { const data = await raw . createGuildPrefix ( context , guildId , prefix ) ; const collection = new Collections . BaseCollection < string , GuildSettingsPrefix > ( ) ; for ( let raw of data ) { const item = new GuildSettingsPrefix ( raw ) ; collection . set ( item . prefix , item ) ; } if ( GuildSettingsStore . has ( guildId ) ) { const settings = GuildSettingsStore . get ( guildId ) as GuildSettings ; settings . merge ( { prefixes : data } ) ; } return collection ; } export async function createUserCommand ( context , userId , command , options ) { return raw . createUserCommand ( context , userId , command , options ) ; } export async function deleteGuildAllowlist ( context , guildId , allowlistId , type ) { return raw . deleteGuildAllowlist ( context , guildId , allowlistId , type ) ; } export async function deleteGuildBlocklist ( context , guildId , blocklistId , type ) { return raw . deleteGuildBlocklist ( context , guildId , blocklistId , type ) ; } export async function deleteGuildDisabledCommand ( context , guildId , command , disabledId , type ) { return raw . deleteGuildDisabledCommand ( context , guildId , command , disabledId , type ) ; } export async function deleteGuildLogger ( context , guildId , options ) { const data = await raw . deleteGuildLogger ( context , guildId , options ) ; const collection = new Collections . BaseCollection < string , GuildSettingsLogger > ( ) ; for ( let raw of data ) { const item = new GuildSettingsLogger ( raw ) ; collection . set ( item . key , item ) ; } if ( GuildSettingsStore . has ( guildId ) ) { const settings = GuildSettingsStore . get ( guildId ) as GuildSettings ; settings . merge ( { loggers : data } ) ; } return collection ; } export async function deleteGuildPrefix ( context , guildId , prefix ) { const data = await raw . deleteGuildPrefix ( context , guildId , prefix ) ; const collection = new Collections . BaseCollection < string , GuildSettingsPrefix > ( ) ; for ( let raw of data ) { const item = new GuildSettingsPrefix ( raw ) ; collection . set ( item . prefix , item ) ; } if ( GuildSettingsStore . has ( guildId ) ) { const settings = GuildSettingsStore . get ( guildId ) as GuildSettings ; settings . merge ( { prefixes : data } ) ; } return collection ; } export async function deleteTag ( context , options ) { return raw . deleteTag ( context , options ) ; } export async function editGuildSettings ( context , guildId , options = { } ) { const data = await raw . editGuildSettings ( context , guildId , options ) ; let settings ; if ( GuildSettingsStore . has ( guildId ) ) { settings = GuildSettingsStore . get ( guildId ) as GuildSettings ; settings . merge ( data ) ; } else { settings = new GuildSettings ( data ) ; GuildSettingsStore . set ( settings . id , settings ) ; } return settings ; } export async function editUser ( context , userId , options ) { const data = await raw . editUser ( context , userId , options ) ; let user ; if ( UserStore . has ( userId ) ) { user = UserStore . get ( userId ) as User ; user . merge ( data ) ; } else { user = new User ( data ) ; UserStore . set ( user . id , user ) ; } return user ; } export async function fetchGuildSettings ( context , guildId ) { const data = await raw . fetchGuildSettings ( context , guildId ) ; let settings ; if ( GuildSettingsStore . has ( guildId ) ) { settings = GuildSettingsStore . get ( guildId ) as GuildSettings ; settings . merge ( data ) ; } else { settings = new GuildSettings ( data ) ; GuildSettingsStore . set ( settings . id , settings ) ; } return settings ; } export async function fetchTag ( context , options ) { return raw . fetchTag ( context , options ) ; } export async function fetchTagRandom ( context , options = { } ) { return raw . fetchTagRandom ( context , options ) ; } export async function fetchTagsServer ( context , guildId , options = { } ) { return raw . fetchTagsServer ( context , guildId , options ) ; } export async function fetchUser ( context , userId ) { const data = await raw . fetchUser ( context , userId ) ; let user ; if ( UserStore . has ( userId ) ) { user = UserStore . get ( userId ) as User ; user . merge ( data ) ; } else { user = new User ( data ) ; UserStore . set ( user . id , user ) ; } return user ; } export async function fetchUserTags ( context , userId , options = { } ) { return raw . fetchUserTags ( context , userId , options ) ; } export async function funASCII ( context , options ) { return raw . funASCII ( context , options ) ; } export async function funTextToSpeech ( context , options ) { return raw . funTextToSpeech ( context , options ) ; } export async function googleContentVisionLabels ( context , options ) { return raw . googleContentVisionLabels ( context , options ) ; } export async function googleContentVisionOCR ( context , options ) { return raw . googleContentVisionOCR ( context , options ) ; } export async function googleContentVisionSafeSearch ( context , options ) { return raw . googleContentVisionSafeSearch ( context , options ) ; } export async function googleContentVisionWebDetection ( context , options ) { return raw . googleContentVisionWebDetection ( context , options ) ; } export async function googleTranslate ( context , options ) { return raw . googleTranslate ( context , options ) ; } export async function imageCreateTombstone ( context , options ) { return raw . imageCreateTombstone ( context , options ) ; } export async function imageInformationExif ( context , options ) { return raw . imageInformationExif ( context , options ) ; } export async function imageManipulationAscii ( context , options ) { return raw . imageManipulationAscii ( context , options ) ; } export async function imageManipulationBlur ( context , options ) { return raw . imageManipulationBlur ( context , options ) ; } export async function imageManipulationBlurple ( context , options ) { return raw . imageManipulationBlurple ( context , options ) ; } export async function imageManipulationCircle ( context , options ) { return raw . imageManipulationCircle ( context , options ) ; } export async function imageManipulationDeepfry ( context , options ) { return raw . imageManipulationDeepfry ( context , options ) ; } export async function imageManipulationExplode ( context , options ) { return raw . imageManipulationExplode ( context , options ) ; } export async function imageManipulationEyes ( context , options ) { return raw . imageManipulationEyes ( context , options ) ; } export async function imageManipulationFlip ( context , options ) { return raw . imageManipulationFlip ( context , options ) ; } export async function imageManipulationFlop ( context , options ) { return raw . imageManipulationFlop ( context , options ) ; } export async function imageManipulationGlitch ( context , options ) { return raw . imageManipulationGlitch ( context , options ) ; } export async function imageManipulationGold ( context , options ) { return raw . imageManipulationGold ( context , options ) ; } export async function imageManipulationGrayscale ( context , options ) { return raw . imageManipulationGrayscale ( context , options ) ; } export async function imageManipulationImplode ( context , options ) { return raw . imageManipulationImplode ( context , options ) ; } export async function imageManipulationInvert ( context , options ) { return raw . imageManipulationInvert ( context , options ) ; } export async function imageManipulationJPEG ( context , options ) { return raw . imageManipulationJPEG ( context , options ) ; } export async function imageManipulationLegofy ( context , options ) { return raw . imageManipulationLegofy ( context , options ) ; } export async function imageManipulationMagik ( context , options ) { return raw . imageManipulationMagik ( context , options ) ; } export async function imageManipulationMagikGif ( context , options ) { return raw . imageManipulationMagikGif ( context , options ) ; } export async function imageManipulationMeme ( context , options ) { return raw . imageManipulationMeme ( context , options ) ; } export async function imageManipulationMirrorBottom ( context , options ) { return raw . imageManipulationMirrorBottom ( context , options ) ; } export async function imageManipulationMirrorLeft ( context , options ) { return raw . imageManipulationMirrorLeft ( context , options ) ; } export async function imageManipulationMirrorRight ( context , options ) { return raw . imageManipulationMirrorRight ( context , options ) ; } export async function imageManipulationMirrorTop ( context , options ) { return raw . imageManipulationMirrorTop ( context , options ) ; } export async function imageManipulationPixelate ( context , options ) { return raw . imageManipulationPixelate ( context , options ) ; } export async function imageManipulationRain ( context , options ) { return raw . imageManipulationRain ( context , options ) ; } export async function imageManipulationRainGold ( context , options ) { return raw . imageManipulationRainGold ( context , options ) ; } export async function imageManipulationSharpen ( context , options ) { return raw . imageManipulationSharpen ( context , options ) ; } export async function imageManipulationSpin ( context , options ) { return raw . imageManipulationSpin ( context , options ) ; } export async function imageManipulationWall ( context , options ) { return raw . imageManipulationWall ( context , options ) ; } export async function imageOverlayFlagIsrael ( context , options ) { return raw . imageOverlayFlagIsrael ( context , options ) ; } export async function imageOverlayFlagLGBT ( context , options ) { return raw . imageOverlayFlagLGBT ( context , options ) ; } export async function imageOverlayFlagNorthKorea ( context , options ) { return raw . imageOverlayFlagNorthKorea ( context , options ) ; } export async function imageOverlayFlagRussia ( context , options ) { return raw . imageOverlayFlagRussia ( context , options ) ; } export async function imageOverlayFlagTrans ( context , options ) { return raw . imageOverlayFlagTrans ( context , options ) ; } export async function imageOverlayFlagUK ( context , options ) { return raw . imageOverlayFlagUK ( context , options ) ; } export async function imageOverlayFlagUSA ( context , options ) { return raw . imageOverlayFlagUSA ( context , options ) ; } export async function imageOverlayFlagUSSR ( context , options ) { return raw . imageOverlayFlagUSSR ( context , options ) ; } export async function imageOverlayHalfLifePistol ( context , options ) { return raw . imageOverlayHalfLifePistol ( context , options ) ; } export async function imageOverlayHalfLifeShotgun ( context , options ) { return raw . imageOverlayHalfLifeShotgun ( context , options ) ; } export async function imageOverlayHalfLifeSMG ( context , options ) { return raw . imageOverlayHalfLifeSMG ( context , options ) ; } export async function imageOverlayShutterstock ( context , options ) { return raw . imageOverlayShutterstock ( context , options ) ; } export async function imageToolsBackgroundRemove ( context , options ) { return raw . imageToolsBackgroundRemove ( context , options ) ; } export async function imageToolsConvert ( context , options ) { return raw . imageToolsConvert ( context , options ) ; } export async function imageToolsGifReverse ( context , options ) { return raw . imageToolsGifReverse ( context , options ) ; } export async function imageToolsGifSeeSaw ( context , options ) { return raw . imageToolsGifSeeSaw ( context , options ) ; } export async function imageToolsGifSpeed ( context , options ) { return raw . imageToolsGifSpeed ( context , options ) ; } export async function imageToolsResize ( context , options ) { return raw . imageToolsResize ( context , options ) ; } export async function imageToolsRotate ( context , options ) { return raw . imageToolsRotate ( context , options ) ; } export async function putGuildSettings ( context , guildId , options ) { const data = await raw . putGuildSettings ( context , guildId , options ) ; let settings ; if ( GuildSettingsStore . has ( guildId ) ) { settings = GuildSettingsStore . get ( guildId ) as GuildSettings ; settings . merge ( data ) ; } else { settings = new GuildSettings ( data ) ; GuildSettingsStore . set ( settings . id , settings ) ; } return settings ; } export async function putInfoDiscord ( context , options ) { return raw . putInfoDiscord ( context , options ) ; } export async function putTag ( context , options ) { return raw . putTag ( context , options ) ; } export async function putUser ( context , userId , options ) { const data = await raw . putUser ( context , userId , options ) ; let user ; if ( UserStore . has ( userId ) ) { user = UserStore . get ( userId ) as User ; user . merge ( data ) ; } else { user = new User ( data ) ; UserStore . set ( user . id , user ) ; } return user ; } export async function searchDuckDuckGo ( context , options ) { return raw . searchDuckDuckGo ( context , options ) ; } export async function searchDuckDuckGoImages ( context , options ) { return raw . searchDuckDuckGoImages ( context , options ) ; } export async function searchE621 ( context , options ) { return raw . searchE621 ( context , options ) ; } export async function searchE926 ( context , options ) { return raw . searchE926 ( context , options ) ; } export async function searchGoogle ( context , options ) { return raw . searchGoogle ( context , options ) ; } export async function searchGoogleImages ( context , options ) { const data = await raw . searchGoogleImages ( context , options ) ; const collection = [ ] ; for ( let raw of data ) { const result = new GoogleSearchImageResult ( raw ) ; collection . push ( result ) ; } return collection ; } export async function searchGoogleReverseImages ( context , options ) { return raw . searchGoogleReverseImages ( context , options ) ; } export async function searchReddit ( context , options ) { return raw . searchReddit ( context , options ) ; } export async function searchRule34 ( context , options ) { return raw . searchRule34 ( context , options ) ; } export async function searchRule34Paheal ( context , options ) { return raw . searchRule34Paheal ( context , options ) ; } export async function searchSteam ( context , options ) { return raw . searchSteam ( context , options ) ; } export async function searchSteamEmoji ( context , emoji ) { return raw . searchSteamEmoji ( context , emoji ) ; } export async function searchSteamEmojis ( context , options ) { return raw . searchSteamEmojis ( context , options ) ; } export async function searchSteamProfile ( context , options ) { return raw . searchSteamProfile ( context , options ) ; } export async function searchUrban ( context , options ) { return raw . searchUrban ( context , options ) ; } export async function searchUrbanRandom ( context , options = { } ) { return raw . searchUrbanRandom ( context , options ) ; } export async function searchWikihow ( context , options ) { return raw . searchWikihow ( context , options ) ; } export async function searchWikihowRandom ( context , options = { } ) { return raw . searchWikihowRandom ( context , options ) ; } export async function searchWolframAlpha ( context , options ) { return raw . searchWolframAlpha ( context , options ) ; } export async function searchYoutube ( context , options ) { return raw . searchYoutube ( context , options ) ; } export async function uploadCommands ( context , options ) { return raw . uploadCommands ( context , options ) ; } export async function utilitiesFetchData ( context , options ) { return raw . utilitiesFetchData ( context , options ) ; } export async function utilitiesFetchImage ( context , options ) { return raw . utilitiesFetchImage ( context , options ) ; } export async function utilitiesFetchMedia ( context , options ) { return raw . utilitiesFetchMedia ( context , options ) ; } export async function utilitiesFetchText ( context , options ) { return raw . utilitiesFetchText ( context , options ) ; } export async function utilitiesQrCreate ( context , options ) { return raw . utilitiesQrCreate ( context , options ) ; } export async function utilitiesQrScan ( context , options ) { return raw . utilitiesQrScan ( context , options ) ; } export async function utilitiesScreenshot ( context , options ) { return raw . utilitiesScreenshot ( context , options ) ; }