mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-12-20 23:17:18 +01:00
Compare commits
100 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d93ab482c | ||
|
|
e0761bf3b9 | ||
|
|
a589fbede0 | ||
|
|
6422c1aad4 | ||
|
|
aa8953dd8e | ||
|
|
fa79a51c46 | ||
|
|
2431f69391 | ||
|
|
3cd3320e02 | ||
|
|
aca50cab7c | ||
|
|
5d5d5b7920 | ||
|
|
cbd8f8b028 | ||
|
|
b08a024298 | ||
|
|
0ef37e977c | ||
|
|
233fc103f9 | ||
|
|
8d15f4b6e9 | ||
|
|
c0d142ab34 | ||
|
|
f77ec9482f | ||
|
|
4fc1e892f7 | ||
|
|
015047a935 | ||
|
|
bc1fc1d245 | ||
|
|
2a069f3040 | ||
|
|
d295828545 | ||
|
|
483ac37bdb | ||
|
|
78dc76e6b4 | ||
|
|
e29070af49 | ||
|
|
1f25b3ea60 | ||
|
|
52cfa235be | ||
|
|
ec7f1183d8 | ||
|
|
a788e059a5 | ||
|
|
5f20ffc4de | ||
|
|
08106156c4 | ||
|
|
60119ff8fa | ||
|
|
f4720ae77a | ||
|
|
c9fb257f48 | ||
|
|
475a428366 | ||
|
|
42ac0e32b7 | ||
|
|
3e75e36cdf | ||
|
|
ac7d18f297 | ||
|
|
39473a68f4 | ||
|
|
5a57bf2fbf | ||
|
|
15e85f1394 | ||
|
|
e8fa9e0259 | ||
|
|
c551390999 | ||
|
|
804a5abb29 | ||
|
|
68551e4466 | ||
|
|
4618577ae4 | ||
|
|
2f428962c8 | ||
|
|
34a78dc166 | ||
|
|
49df7b75ee | ||
|
|
0d927f5d72 | ||
|
|
44243aadd2 | ||
|
|
aa3952fd45 | ||
|
|
ebe60ebf4b | ||
|
|
fa9c3a5821 | ||
|
|
f238588abe | ||
|
|
39524098f1 | ||
|
|
ea63899c9a | ||
|
|
8f11e08150 | ||
|
|
b8b5e89216 | ||
|
|
87387999f3 | ||
|
|
d6a56feb87 | ||
|
|
9c94fb7afc | ||
|
|
2f3684e251 | ||
|
|
7afc05e52b | ||
|
|
eca11b73ba | ||
|
|
5c54dc6a95 | ||
|
|
9330cd4eb3 | ||
|
|
7576409ceb | ||
|
|
f278d151d6 | ||
|
|
b3b57d5b2b | ||
|
|
c4130c589f | ||
|
|
2d24860905 | ||
|
|
eb90d9bc99 | ||
|
|
b87e68b9fc | ||
|
|
a1a71ee031 | ||
|
|
c4b9b4c0a5 | ||
|
|
b3f9f9e47a | ||
|
|
a2421afca1 | ||
|
|
e2cbd7d5cf | ||
|
|
2725387112 | ||
|
|
7248351469 | ||
|
|
e253dc2038 | ||
|
|
38f0a53cd8 | ||
|
|
1c7fee69ea | ||
|
|
2b85b3a035 | ||
|
|
11fb1fa25c | ||
|
|
8dc0ca18f5 | ||
|
|
7e39fab21a | ||
|
|
da139c6a81 | ||
|
|
27521f209d | ||
|
|
e6cbdfaf30 | ||
|
|
fd62cafe33 | ||
|
|
d749250e1b | ||
|
|
c205261ee9 | ||
|
|
4af93aff14 | ||
|
|
d246ee8430 | ||
|
|
6419fc0f4d | ||
|
|
0213ffe632 | ||
|
|
5f364605ab | ||
|
|
3e9f25502b |
@@ -1,106 +1,30 @@
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
project(SqMod)
|
||||
|
||||
# This plug-in only works on 64-bit
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
||||
message(FATAL_ERROR "SqMod does not support 32-but platforms anymore.")
|
||||
message(FATAL_ERROR "SqMod does not support 32-bit platforms anymore.")
|
||||
endif()
|
||||
|
||||
# Tell CMake where to find our scripts
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/vendor/POCO/cmake)
|
||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${PROJECT_SOURCE_DIR}/vendor/POCO/cmake)
|
||||
|
||||
# Several plugin options
|
||||
option(ENABLE_API21 "Build for 2.1 API." OFF)
|
||||
option(ENABLE_DISCORD "Enable built-in Discord support" OFF)
|
||||
option(ENABLE_DISCORD_VOICE "Enable voice support in Discord library" OFF)
|
||||
option(ENABLE_OFFICIAL "Enable compatibility with official legacy plug-in" ON)
|
||||
# As a fall-back for certain situations (mainly some docker ubuntu containers)
|
||||
option(ENABLE_BUILTIN_MYSQL_C "Enable built-in MySQL connector library" OFF)
|
||||
#option(FORCE_32BIT_BIN "Create a 32-bit executable binary if the compiler defaults to 64-bit." OFF)
|
||||
# This option should only be available in certain conditions
|
||||
if(WIN32 AND MINGW)
|
||||
option(COPY_DEPENDENCIES "Copy deppendent DLLs into the deps folder." OFF)
|
||||
option(COPY_DEPENDENCIES "Copy dependent DLLs into the deps folder." OFF)
|
||||
endif()
|
||||
# Discord suppport
|
||||
option(ENABLE_DISCORD "Enable built-in Discord support." ON)
|
||||
|
||||
# C++14 is mandatory
|
||||
set(CPP_STD_NUMBER 14)
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
# C++ standard availability check
|
||||
if(${CMAKE_CXX_COMPILER_ID} MATCHES "(GNU)+")
|
||||
# Specific flags
|
||||
set(CPP_STD_COMPILER_FLAG "-std=c++14")
|
||||
# Don't even bother with previous version
|
||||
if(CPP_STD_NUMBER LESS 20 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
|
||||
check_cxx_compiler_flag(-std=c++20 HAVE_FLAG_STD_CXX20)
|
||||
check_cxx_compiler_flag(-std=c++2a HAVE_FLAG_STD_CXX2A)
|
||||
if(HAVE_FLAG_STD_CXX20 OR HAVE_FLAG_STD_CXX2A)
|
||||
# We can use C++20
|
||||
set(CPP_STD_NUMBER 20)
|
||||
# Specific flags
|
||||
if (HAVE_FLAG_STD_CXX2A AND NOT HAVE_FLAG_STD_CXX20)
|
||||
set(CPP_STD_COMPILER_FLAG "-std=c++2a")
|
||||
else()
|
||||
set(CPP_STD_COMPILER_FLAG "-std=c++20")
|
||||
endif()
|
||||
# Need these workarounds for older CMake
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
|
||||
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++20")
|
||||
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++20")
|
||||
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
|
||||
set(CMAKE_CXX20_STANDARD_COMPILE_OPTION "-std=c++2a")
|
||||
set(CMAKE_CXX20_EXTENSION_COMPILE_OPTION "-std=gnu++2a")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
# Don't even bother with previous version
|
||||
if(CPP_STD_NUMBER LESS 17 AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)
|
||||
check_cxx_compiler_flag(-std=c++17 HAVE_FLAG_STD_CXX17)
|
||||
check_cxx_compiler_flag(-std=c++1z HAVE_FLAG_STD_CXX1Z)
|
||||
if(HAVE_FLAG_STD_CXX17 OR HAVE_FLAG_STD_CXX1Z)
|
||||
# We can use C++17
|
||||
set(CPP_STD_NUMBER 17)
|
||||
# Specific flags
|
||||
if (HAVE_FLAG_STD_CXX1Z AND NOT HAVE_FLAG_STD_CXX17)
|
||||
set(CPP_STD_COMPILER_FLAG "-std=c++1z")
|
||||
else()
|
||||
set(CPP_STD_COMPILER_FLAG "-std=c++17")
|
||||
endif()
|
||||
# Need these workarounds for older CMake
|
||||
if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
|
||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0)
|
||||
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
|
||||
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
|
||||
elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
|
||||
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++1z")
|
||||
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++1z")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
# C++14 is mandatory
|
||||
set(CPP_STD_NUMBER 14)
|
||||
endif()
|
||||
|
||||
message(STATUS "SqMod: Using C++${CPP_STD_NUMBER} standard.")
|
||||
|
||||
# Default to the identified standard
|
||||
if(CMAKE_VERSION VERSION_LESS "3.1")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CPP_STD_COMPILER_FLAG}")
|
||||
else()
|
||||
# Apparently the above does not work with cmake from on debian 8
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CPP_STD_COMPILER_FLAG}")
|
||||
# F* you too Debian. What can I say.
|
||||
if(CMAKE_VERSION VERSION_LESS "3.8.0" AND CPP_STD_NUMBER LESS 17)
|
||||
# Try the standard method as well
|
||||
set(CMAKE_CXX_STANDARD ${CPP_STD_NUMBER})
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
endif()
|
||||
endif()
|
||||
# C++17 is mandatory (globally)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Strip binary
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s -g")
|
||||
|
||||
152
cmake/FindFFmpeg.cmake
Normal file
152
cmake/FindFFmpeg.cmake
Normal file
@@ -0,0 +1,152 @@
|
||||
# vim: ts=2 sw=2
|
||||
# - Try to find the required ffmpeg components(default: AVFORMAT, AVUTIL, AVCODEC)
|
||||
#
|
||||
# Once done this will define
|
||||
# FFMPEG_FOUND - System has the all required components.
|
||||
# FFMPEG_INCLUDE_DIRS - Include directory necessary for using the required components headers.
|
||||
# FFMPEG_LIBRARIES - Link these to use the required ffmpeg components.
|
||||
# FFMPEG_DEFINITIONS - Compiler switches required for using the required ffmpeg components.
|
||||
#
|
||||
# For each of the components it will additionally set.
|
||||
# - AVCODEC
|
||||
# - AVDEVICE
|
||||
# - AVFORMAT
|
||||
# - AVFILTER
|
||||
# - AVUTIL
|
||||
# - POSTPROC
|
||||
# - SWSCALE
|
||||
# - SWRESAMPLE
|
||||
# the following variables will be defined
|
||||
# <component>_FOUND - System has <component>
|
||||
# <component>_INCLUDE_DIRS - Include directory necessary for using the <component> headers
|
||||
# <component>_LIBRARIES - Link these to use <component>
|
||||
# <component>_DEFINITIONS - Compiler switches required for using <component>
|
||||
# <component>_VERSION - The components version
|
||||
#
|
||||
# Copyright (c) 2006, Matthias Kretz, <kretz@kde.org>
|
||||
# Copyright (c) 2008, Alexander Neundorf, <neundorf@kde.org>
|
||||
# Copyright (c) 2011, Michael Jansen, <kde@michael-jansen.biz>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
# The default components were taken from a survey over other FindFFMPEG.cmake files
|
||||
if (NOT FFmpeg_FIND_COMPONENTS)
|
||||
set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL)
|
||||
endif ()
|
||||
|
||||
#
|
||||
### Macro: set_component_found
|
||||
#
|
||||
# Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIRS is present.
|
||||
#
|
||||
macro(set_component_found _component )
|
||||
if (${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS)
|
||||
# message(STATUS " - ${_component} found.")
|
||||
set(${_component}_FOUND TRUE)
|
||||
else ()
|
||||
# message(STATUS " - ${_component} not found.")
|
||||
endif ()
|
||||
endmacro()
|
||||
|
||||
#
|
||||
### Macro: find_component
|
||||
#
|
||||
# Checks for the given component by invoking pkgconfig and then looking up the libraries and
|
||||
# include directories.
|
||||
#
|
||||
macro(find_component _component _pkgconfig _library _header)
|
||||
|
||||
if (NOT WIN32)
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(PC_${_component} ${_pkgconfig})
|
||||
endif ()
|
||||
endif (NOT WIN32)
|
||||
|
||||
find_path(${_component}_INCLUDE_DIRS ${_header}
|
||||
HINTS
|
||||
${PC_${_component}_INCLUDEDIR}
|
||||
${PC_${_component}_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES
|
||||
ffmpeg
|
||||
)
|
||||
|
||||
find_library(${_component}_LIBRARIES NAMES ${_library}
|
||||
HINTS
|
||||
${PC_${_component}_LIBDIR}
|
||||
${PC_${_component}_LIBRARY_DIRS}
|
||||
)
|
||||
|
||||
set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.")
|
||||
set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.")
|
||||
|
||||
set_component_found(${_component})
|
||||
|
||||
mark_as_advanced(
|
||||
${_component}_INCLUDE_DIRS
|
||||
${_component}_LIBRARIES
|
||||
${_component}_DEFINITIONS
|
||||
${_component}_VERSION)
|
||||
|
||||
endmacro()
|
||||
|
||||
|
||||
# Check for cached results. If there are skip the costly part.
|
||||
if (NOT FFMPEG_LIBRARIES)
|
||||
|
||||
# Check for all possible component.
|
||||
find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
|
||||
find_component(AVFORMAT libavformat avformat libavformat/avformat.h)
|
||||
find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
|
||||
find_component(AVUTIL libavutil avutil libavutil/avutil.h)
|
||||
find_component(AVFILTER libavfilter avfilter libavfilter/avfilter.h)
|
||||
find_component(SWSCALE libswscale swscale libswscale/swscale.h)
|
||||
find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h)
|
||||
find_component(SWRESAMPLE libswresample swresample libswresample/swresample.h)
|
||||
|
||||
# Check if the required components were found and add their stuff to the FFMPEG_* vars.
|
||||
foreach (_component ${FFmpeg_FIND_COMPONENTS})
|
||||
if (${_component}_FOUND)
|
||||
# message(STATUS "Required component ${_component} present.")
|
||||
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES})
|
||||
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS})
|
||||
list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS})
|
||||
else ()
|
||||
# message(STATUS "Required component ${_component} missing.")
|
||||
endif ()
|
||||
endforeach ()
|
||||
|
||||
# Build the include path with duplicates removed.
|
||||
if (FFMPEG_INCLUDE_DIRS)
|
||||
list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
|
||||
endif ()
|
||||
|
||||
# cache the vars.
|
||||
set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "The FFmpeg include directories." FORCE)
|
||||
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "The FFmpeg libraries." FORCE)
|
||||
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} CACHE STRING "The FFmpeg cflags." FORCE)
|
||||
|
||||
mark_as_advanced(FFMPEG_INCLUDE_DIRS
|
||||
FFMPEG_LIBRARIES
|
||||
FFMPEG_DEFINITIONS)
|
||||
|
||||
endif ()
|
||||
|
||||
# Now set the noncached _FOUND vars for the components.
|
||||
foreach (_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWSCALE)
|
||||
set_component_found(${_component})
|
||||
endforeach ()
|
||||
|
||||
# Compile the list of required vars
|
||||
set(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS)
|
||||
foreach (_component ${FFmpeg_FIND_COMPONENTS})
|
||||
list(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS)
|
||||
endforeach ()
|
||||
|
||||
# Give a nice error message if some of the required vars are missing.
|
||||
find_package_handle_standard_args(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS})
|
||||
36
cmake/FindOpus.cmake
Normal file
36
cmake/FindOpus.cmake
Normal file
@@ -0,0 +1,36 @@
|
||||
# OPUS_FOUND - system has opus
|
||||
# OPUS_INCLUDE_DIRS - the opus include directory
|
||||
# OPUS_LIBRARIES - The libraries needed to use opus
|
||||
|
||||
find_path(OPUS_INCLUDE_DIRS
|
||||
NAMES opus/opus.h
|
||||
PATH_SUFFIXES include
|
||||
)
|
||||
if(OPUS_INCLUDE_DIRS)
|
||||
set(HAVE_OPUS_OPUS_H 1)
|
||||
endif()
|
||||
|
||||
if(OPUS_USE_STATIC_LIBS)
|
||||
find_library(OPUS_LIBRARIES NAMES "libopus.a")
|
||||
else()
|
||||
find_library(OPUS_LIBRARIES NAMES opus)
|
||||
endif()
|
||||
|
||||
if(OPUS_LIBRARIES)
|
||||
if(OPUS_USE_STATIC_LIBS)
|
||||
find_library(LIBM NAMES "libm.a" "libm.tbd")
|
||||
else()
|
||||
find_library(LIBM NAMES m)
|
||||
endif()
|
||||
if(LIBM)
|
||||
list(APPEND OPUS_LIBRARIES ${LIBM})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Opus
|
||||
DEFAULT_MSG
|
||||
OPUS_INCLUDE_DIRS OPUS_LIBRARIES HAVE_OPUS_OPUS_H
|
||||
)
|
||||
|
||||
mark_as_advanced(OPUS_INCLUDE_DIRS OPUS_LIBRARIES HAVE_OPUS_OPUS_H)
|
||||
293
cmake/FindSodium.cmake
Normal file
293
cmake/FindSodium.cmake
Normal file
@@ -0,0 +1,293 @@
|
||||
# Written in 2016 by Henrik Steffen Gaßmann <henrik@gassmann.onl>
|
||||
#
|
||||
# To the extent possible under law, the author(s) have dedicated all copyright
|
||||
# and related and neighboring rights to this software to the public domain
|
||||
# worldwide. This software is distributed without any warranty.
|
||||
#
|
||||
# You should have received a copy of the CC0 Public Domain Dedication along with
|
||||
# this software. If not, see
|
||||
#
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
#
|
||||
# ##############################################################################
|
||||
# Tries to find the local libsodium installation.
|
||||
#
|
||||
# On Windows the sodium_DIR environment variable is used as a default hint which
|
||||
# can be overridden by setting the corresponding cmake variable.
|
||||
#
|
||||
# Once done the following variables will be defined:
|
||||
#
|
||||
# sodium_FOUND sodium_INCLUDE_DIR sodium_LIBRARY_DEBUG sodium_LIBRARY_RELEASE
|
||||
# sodium_VERSION_STRING
|
||||
#
|
||||
# Furthermore an imported "sodium" target is created.
|
||||
#
|
||||
|
||||
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
||||
set(_GCC_COMPATIBLE 1)
|
||||
endif()
|
||||
|
||||
# static library option
|
||||
if(NOT DEFINED sodium_USE_STATIC_LIBS)
|
||||
option(sodium_USE_STATIC_LIBS "enable to statically link against sodium" OFF)
|
||||
endif()
|
||||
if(NOT (sodium_USE_STATIC_LIBS EQUAL sodium_USE_STATIC_LIBS_LAST))
|
||||
unset(sodium_LIBRARY CACHE)
|
||||
unset(sodium_LIBRARY_DEBUG CACHE)
|
||||
unset(sodium_LIBRARY_RELEASE CACHE)
|
||||
unset(sodium_DLL_DEBUG CACHE)
|
||||
unset(sodium_DLL_RELEASE CACHE)
|
||||
set(sodium_USE_STATIC_LIBS_LAST
|
||||
${sodium_USE_STATIC_LIBS}
|
||||
CACHE INTERNAL "internal change tracking variable")
|
||||
endif()
|
||||
|
||||
# ##############################################################################
|
||||
# UNIX
|
||||
if(UNIX)
|
||||
# import pkg-config
|
||||
find_package(PkgConfig)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(sodium_PKG QUIET libsodium)
|
||||
endif()
|
||||
|
||||
if(sodium_USE_STATIC_LIBS)
|
||||
if(sodium_PKG_STATIC_LIBRARIES)
|
||||
foreach(_libname ${sodium_PKG_STATIC_LIBRARIES})
|
||||
if(NOT _libname MATCHES "^lib.*\\.a$") # ignore strings already ending
|
||||
# with .a
|
||||
list(INSERT sodium_PKG_STATIC_LIBRARIES 0 "lib${_libname}.a")
|
||||
endif()
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES sodium_PKG_STATIC_LIBRARIES)
|
||||
else()
|
||||
# if pkgconfig for libsodium doesn't provide static lib info, then
|
||||
# override PKG_STATIC here..
|
||||
set(sodium_PKG_STATIC_LIBRARIES libsodium.a)
|
||||
endif()
|
||||
|
||||
set(XPREFIX sodium_PKG_STATIC)
|
||||
else()
|
||||
if(sodium_PKG_LIBRARIES STREQUAL "")
|
||||
set(sodium_PKG_LIBRARIES sodium)
|
||||
endif()
|
||||
|
||||
set(XPREFIX sodium_PKG)
|
||||
endif()
|
||||
|
||||
find_path(sodium_INCLUDE_DIR sodium.h HINTS ${${XPREFIX}_INCLUDE_DIRS})
|
||||
find_library(sodium_LIBRARY_DEBUG
|
||||
NAMES ${${XPREFIX}_LIBRARIES}
|
||||
HINTS ${${XPREFIX}_LIBRARY_DIRS})
|
||||
find_library(sodium_LIBRARY_RELEASE
|
||||
NAMES ${${XPREFIX}_LIBRARIES}
|
||||
HINTS ${${XPREFIX}_LIBRARY_DIRS})
|
||||
|
||||
# ############################################################################
|
||||
# Windows
|
||||
elseif(WIN32)
|
||||
set(sodium_DIR "$ENV{sodium_DIR}" CACHE FILEPATH "sodium install directory")
|
||||
mark_as_advanced(sodium_DIR)
|
||||
|
||||
find_path(sodium_INCLUDE_DIR sodium.h
|
||||
HINTS ${sodium_DIR}
|
||||
PATH_SUFFIXES include)
|
||||
|
||||
if(MSVC)
|
||||
# detect target architecture
|
||||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/arch.cpp" [=[
|
||||
#if defined _M_IX86
|
||||
#error ARCH_VALUE x86_32
|
||||
#elif defined _M_X64
|
||||
#error ARCH_VALUE x86_64
|
||||
#endif
|
||||
#error ARCH_VALUE unknown
|
||||
]=])
|
||||
try_compile(_UNUSED_VAR "${CMAKE_CURRENT_BINARY_DIR}"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/arch.cpp"
|
||||
OUTPUT_VARIABLE _COMPILATION_LOG)
|
||||
string(REGEX
|
||||
REPLACE ".*ARCH_VALUE ([a-zA-Z0-9_]+).*"
|
||||
"\\1"
|
||||
_TARGET_ARCH
|
||||
"${_COMPILATION_LOG}")
|
||||
|
||||
# construct library path
|
||||
if(_TARGET_ARCH STREQUAL "x86_32")
|
||||
string(APPEND _PLATFORM_PATH "Win32")
|
||||
elseif(_TARGET_ARCH STREQUAL "x86_64")
|
||||
string(APPEND _PLATFORM_PATH "x64")
|
||||
else()
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"the ${_TARGET_ARCH} architecture is not supported by Findsodium.cmake."
|
||||
)
|
||||
endif()
|
||||
string(APPEND _PLATFORM_PATH "/$$CONFIG$$")
|
||||
|
||||
if(MSVC_VERSION LESS 1900)
|
||||
math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 60")
|
||||
else()
|
||||
math(EXPR _VS_VERSION "${MSVC_VERSION} / 10 - 50")
|
||||
endif()
|
||||
string(APPEND _PLATFORM_PATH "/v${_VS_VERSION}")
|
||||
|
||||
if(sodium_USE_STATIC_LIBS)
|
||||
string(APPEND _PLATFORM_PATH "/static")
|
||||
else()
|
||||
string(APPEND _PLATFORM_PATH "/dynamic")
|
||||
endif()
|
||||
|
||||
string(REPLACE "$$CONFIG$$"
|
||||
"Debug"
|
||||
_DEBUG_PATH_SUFFIX
|
||||
"${_PLATFORM_PATH}")
|
||||
string(REPLACE "$$CONFIG$$"
|
||||
"Release"
|
||||
_RELEASE_PATH_SUFFIX
|
||||
"${_PLATFORM_PATH}")
|
||||
|
||||
find_library(sodium_LIBRARY_DEBUG libsodium.lib
|
||||
HINTS ${sodium_DIR}
|
||||
PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX})
|
||||
find_library(sodium_LIBRARY_RELEASE libsodium.lib
|
||||
HINTS ${sodium_DIR}
|
||||
PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX})
|
||||
if(NOT sodium_USE_STATIC_LIBS)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES_BCK ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll")
|
||||
find_library(sodium_DLL_DEBUG libsodium
|
||||
HINTS ${sodium_DIR}
|
||||
PATH_SUFFIXES ${_DEBUG_PATH_SUFFIX})
|
||||
find_library(sodium_DLL_RELEASE libsodium
|
||||
HINTS ${sodium_DIR}
|
||||
PATH_SUFFIXES ${_RELEASE_PATH_SUFFIX})
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_BCK})
|
||||
endif()
|
||||
|
||||
elseif(_GCC_COMPATIBLE)
|
||||
if(sodium_USE_STATIC_LIBS)
|
||||
find_library(sodium_LIBRARY_DEBUG libsodium.a
|
||||
HINTS ${sodium_DIR}
|
||||
PATH_SUFFIXES lib)
|
||||
find_library(sodium_LIBRARY_RELEASE libsodium.a
|
||||
HINTS ${sodium_DIR}
|
||||
PATH_SUFFIXES lib)
|
||||
else()
|
||||
find_library(sodium_LIBRARY_DEBUG libsodium.dll.a
|
||||
HINTS ${sodium_DIR}
|
||||
PATH_SUFFIXES lib)
|
||||
find_library(sodium_LIBRARY_RELEASE libsodium.dll.a
|
||||
HINTS ${sodium_DIR}
|
||||
PATH_SUFFIXES lib)
|
||||
|
||||
file(GLOB _DLL
|
||||
LIST_DIRECTORIES false
|
||||
RELATIVE "${sodium_DIR}/bin"
|
||||
"${sodium_DIR}/bin/libsodium*.dll")
|
||||
find_library(sodium_DLL_DEBUG ${_DLL} libsodium
|
||||
HINTS ${sodium_DIR}
|
||||
PATH_SUFFIXES bin)
|
||||
find_library(sodium_DLL_RELEASE ${_DLL} libsodium
|
||||
HINTS ${sodium_DIR}
|
||||
PATH_SUFFIXES bin)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "this platform is not supported by FindSodium.cmake")
|
||||
endif()
|
||||
|
||||
# ############################################################################
|
||||
# unsupported
|
||||
else()
|
||||
message(FATAL_ERROR "this platform is not supported by FindSodium.cmake")
|
||||
endif()
|
||||
|
||||
# ##############################################################################
|
||||
# common stuff
|
||||
|
||||
# extract sodium version
|
||||
if(sodium_INCLUDE_DIR)
|
||||
set(_VERSION_HEADER "${sodium_INCLUDE_DIR}/sodium/version.h")
|
||||
if(EXISTS "${_VERSION_HEADER}")
|
||||
file(READ "${_VERSION_HEADER}" _VERSION_HEADER_CONTENT)
|
||||
string(
|
||||
REGEX
|
||||
REPLACE
|
||||
".*#define[ \t]*SODIUM_VERSION_STRING[ \t]*\"([^\n]*)\".*"
|
||||
"\\1"
|
||||
sodium_VERSION_STRING
|
||||
"${_VERSION_HEADER_CONTENT}")
|
||||
set(sodium_VERSION_STRING "${sodium_VERSION_STRING}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# communicate results
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(sodium
|
||||
REQUIRED_VARS
|
||||
sodium_LIBRARY_RELEASE
|
||||
sodium_LIBRARY_DEBUG
|
||||
sodium_INCLUDE_DIR
|
||||
VERSION_VAR
|
||||
sodium_VERSION_STRING)
|
||||
|
||||
# mark file paths as advanced
|
||||
mark_as_advanced(sodium_INCLUDE_DIR)
|
||||
mark_as_advanced(sodium_LIBRARY_DEBUG)
|
||||
mark_as_advanced(sodium_LIBRARY_RELEASE)
|
||||
if(WIN32)
|
||||
mark_as_advanced(sodium_DLL_DEBUG)
|
||||
mark_as_advanced(sodium_DLL_RELEASE)
|
||||
endif()
|
||||
|
||||
# create imported target
|
||||
if(sodium_USE_STATIC_LIBS)
|
||||
set(_LIB_TYPE STATIC)
|
||||
else()
|
||||
set(_LIB_TYPE SHARED)
|
||||
endif()
|
||||
add_library(sodium ${_LIB_TYPE} IMPORTED)
|
||||
|
||||
set_target_properties(sodium
|
||||
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${sodium_INCLUDE_DIR}"
|
||||
IMPORTED_LINK_INTERFACE_LANGUAGES
|
||||
"C")
|
||||
|
||||
if(sodium_USE_STATIC_LIBS)
|
||||
set_target_properties(sodium
|
||||
PROPERTIES INTERFACE_COMPILE_DEFINITIONS
|
||||
"SODIUM_STATIC"
|
||||
IMPORTED_LOCATION
|
||||
"${sodium_LIBRARY_RELEASE}"
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
"${sodium_LIBRARY_DEBUG}")
|
||||
else()
|
||||
if(UNIX)
|
||||
set_target_properties(sodium
|
||||
PROPERTIES IMPORTED_LOCATION
|
||||
"${sodium_LIBRARY_RELEASE}"
|
||||
IMPORTED_LOCATION_DEBUG
|
||||
"${sodium_LIBRARY_DEBUG}")
|
||||
elseif(WIN32)
|
||||
set_target_properties(sodium
|
||||
PROPERTIES IMPORTED_IMPLIB
|
||||
"${sodium_LIBRARY_RELEASE}"
|
||||
IMPORTED_IMPLIB_DEBUG
|
||||
"${sodium_LIBRARY_DEBUG}")
|
||||
if(NOT (sodium_DLL_DEBUG MATCHES ".*-NOTFOUND"))
|
||||
set_target_properties(sodium
|
||||
PROPERTIES IMPORTED_LOCATION_DEBUG
|
||||
"${sodium_DLL_DEBUG}")
|
||||
endif()
|
||||
if(NOT (sodium_DLL_RELEASE MATCHES ".*-NOTFOUND"))
|
||||
set_target_properties(sodium
|
||||
PROPERTIES IMPORTED_LOCATION_RELWITHDEBINFO
|
||||
"${sodium_DLL_RELEASE}"
|
||||
IMPORTED_LOCATION_MINSIZEREL
|
||||
"${sodium_DLL_RELEASE}"
|
||||
IMPORTED_LOCATION_RELEASE
|
||||
"${sodium_DLL_RELEASE}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Base/DynArg.hpp"
|
||||
#include "Core/Buffer.hpp"
|
||||
#include "Core/Utility.hpp"
|
||||
#include "Library/JSON.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
@@ -300,6 +301,21 @@ String AABB::ToString() const
|
||||
return fmt::format("{},{},{},{},{},{}", min.x, min.y, min.z, max.x, max.y, max.z);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void AABB::ToJSON(CtxJSON & ctx) const
|
||||
{
|
||||
if (ctx.mObjectOverArray)
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "{{min:{{x:{},y:{},z:{}}},max:{{x:{},y:{},z:{}}},",
|
||||
min.x, min.y, min.z, max.x, max.y, max.z);
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "{{min:[{},{},{}],max:[{},{},{}]}},",
|
||||
min.x, min.y, min.z, max.x, max.y, max.z);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void AABB::SetStr(SQChar delim, StackStrF & values)
|
||||
{
|
||||
@@ -793,6 +809,7 @@ void Register_AABB(HSQUIRRELVM vm)
|
||||
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< AABB >, SQFloat, SQInteger, bool, std::nullptr_t, AABB >)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &AABB::ToString)
|
||||
.Func(_SC("_tojson"), &AABB::ToJSON)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< AABB >, SQFloat, SQInteger, bool, std::nullptr_t, AABB >)
|
||||
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< AABB >, SQFloat, SQInteger, bool, std::nullptr_t, AABB >)
|
||||
|
||||
@@ -304,6 +304,11 @@ struct AABB
|
||||
*/
|
||||
SQMOD_NODISCARD String ToString() const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to convert an instance of this type to a JSON string.
|
||||
*/
|
||||
void ToJSON(CtxJSON & ctx) const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Set the values extracted from the specified string using the specified delimiter.
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "Base/DynArg.hpp"
|
||||
#include "Core/Buffer.hpp"
|
||||
#include "Core/Utility.hpp"
|
||||
#include "Library/JSON.hpp"
|
||||
#include "Library/Numeric/Random.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -360,6 +361,19 @@ String Circle::ToString() const
|
||||
return fmt::format("{},{},{}", pos.x, pos.y, rad);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Circle::ToJSON(CtxJSON & ctx) const
|
||||
{
|
||||
if (ctx.mObjectOverArray)
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "{{x:{},y:{},r:{}}},", pos.x, pos.y, rad);
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "[{},{},{}],", pos.x, pos.y, rad);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Circle::SetRadius(Value nr)
|
||||
{
|
||||
@@ -552,6 +566,7 @@ void Register_Circle(HSQUIRRELVM vm)
|
||||
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Circle >, SQFloat, SQInteger, bool, std::nullptr_t, Circle >)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &Circle::ToString)
|
||||
.Func(_SC("_toJSON"), &Circle::ToJSON)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Circle >, SQFloat, SQInteger, bool, std::nullptr_t, Circle >)
|
||||
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Circle >, SQFloat, SQInteger, bool, std::nullptr_t, Circle >)
|
||||
|
||||
@@ -341,6 +341,11 @@ struct Circle
|
||||
*/
|
||||
SQMOD_NODISCARD String ToString() const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to convert an instance of this type to a JSON string.
|
||||
*/
|
||||
void ToJSON(CtxJSON & ctx) const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Set the specified radius.
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Base/DynArg.hpp"
|
||||
#include "Core/Buffer.hpp"
|
||||
#include "Core/Utility.hpp"
|
||||
#include "Library/JSON.hpp"
|
||||
#include "Library/Numeric/Random.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -481,6 +482,19 @@ String Color3::ToString() const
|
||||
return fmt::format("{},{},{}", r, g, b);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Color3::ToJSON(CtxJSON & ctx) const
|
||||
{
|
||||
if (ctx.mObjectOverArray)
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "{{r:{},g:{},b:{}}},", r, g, b);
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "[{},{},{}],", r, g, b);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Color3::SetScalar(Value ns)
|
||||
{
|
||||
@@ -741,6 +755,7 @@ void Register_Color3(HSQUIRRELVM vm)
|
||||
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Color3 >, SQFloat, SQInteger, bool, std::nullptr_t, Color3 >)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &Color3::ToString)
|
||||
.Func(_SC("_tojson"), &Color3::ToJSON)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Color3 >, SQFloat, SQInteger, bool, std::nullptr_t, Color3 >)
|
||||
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Color3 >, SQFloat, SQInteger, bool, std::nullptr_t, Color3 >)
|
||||
|
||||
@@ -405,6 +405,11 @@ struct Color3
|
||||
*/
|
||||
SQMOD_NODISCARD String ToString() const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to convert an instance of this type to a JSON string.
|
||||
*/
|
||||
void ToJSON(CtxJSON & ctx) const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Set all components to the specified scalar value.
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Base/DynArg.hpp"
|
||||
#include "Core/Buffer.hpp"
|
||||
#include "Core/Utility.hpp"
|
||||
#include "Library/JSON.hpp"
|
||||
#include "Library/Numeric/Random.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -506,6 +507,19 @@ String Color4::ToString() const
|
||||
return fmt::format("{},{},{},{}", r, g, b, a);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Color4::ToJSON(CtxJSON & ctx) const
|
||||
{
|
||||
if (ctx.mObjectOverArray)
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "{{r:{},g:{},b:{},a:{}}},", r, g, b, a);
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "[{},{},{},{}],", r, g, b, a);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Color4::SetScalar(Value ns)
|
||||
{
|
||||
@@ -781,6 +795,7 @@ void Register_Color4(HSQUIRRELVM vm)
|
||||
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Color4 >, SQFloat, SQInteger, bool, std::nullptr_t, Color4 >)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &Color4::ToString)
|
||||
.Func(_SC("_tojson"), &Color4::ToJSON)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Color4 >, SQFloat, SQInteger, bool, std::nullptr_t, Color4 >)
|
||||
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Color4 >, SQFloat, SQInteger, bool, std::nullptr_t, Color4 >)
|
||||
|
||||
@@ -405,6 +405,11 @@ struct Color4
|
||||
*/
|
||||
SQMOD_NODISCARD String ToString() const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to convert an instance of this type to a JSON string.
|
||||
*/
|
||||
void ToJSON(CtxJSON & ctx) const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Set all components to the specified scalar value.
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "Base/DynArg.hpp"
|
||||
#include "Core/Buffer.hpp"
|
||||
#include "Core/Utility.hpp"
|
||||
#include "Library/JSON.hpp"
|
||||
#include "Library/Numeric/Random.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -349,6 +350,19 @@ String Quaternion::ToString() const
|
||||
return fmt::format("{},{},{},{}", x, y, z, w);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Quaternion::ToJSON(CtxJSON & ctx) const
|
||||
{
|
||||
if (ctx.mObjectOverArray)
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "{{x:{},y:{},z:{},w:{}}},", x, y, z, w);
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "[{},{},{},{}],", x, y, z, w);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Quaternion::SetScalar(Value ns)
|
||||
{
|
||||
@@ -775,6 +789,7 @@ void Register_Quaternion(HSQUIRRELVM vm)
|
||||
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Quaternion >, SQFloat, SQInteger, bool, std::nullptr_t, Quaternion >)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &Quaternion::ToString)
|
||||
.Func(_SC("_tojson"), &Quaternion::ToJSON)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Quaternion >, SQFloat, SQInteger, bool, std::nullptr_t, Quaternion >)
|
||||
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Quaternion >, SQFloat, SQInteger, bool, std::nullptr_t, Quaternion >)
|
||||
|
||||
@@ -296,6 +296,11 @@ struct Quaternion
|
||||
*/
|
||||
SQMOD_NODISCARD String ToString() const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to convert an instance of this type to a JSON string.
|
||||
*/
|
||||
void ToJSON(CtxJSON & ctx) const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Set all components to the specified scalar value.
|
||||
*/
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
struct CtxJSON;
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Helper constants used by the bas types.
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "Base/DynArg.hpp"
|
||||
#include "Core/Buffer.hpp"
|
||||
#include "Core/Utility.hpp"
|
||||
#include "Library/JSON.hpp"
|
||||
#include "Library/Numeric/Random.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -360,6 +361,19 @@ String Sphere::ToString() const
|
||||
return fmt::format("{},{},{},{}", pos.x, pos.y, pos.z, rad);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Sphere::ToJSON(CtxJSON & ctx) const
|
||||
{
|
||||
if (ctx.mObjectOverArray)
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "{{x:{},y:{},z:{},r:{}}},", pos.x, pos.y, pos.z, rad);
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "[{},{},{},{}],", pos.x, pos.y, pos.z, rad);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Sphere::SetRadius(Value nr)
|
||||
{
|
||||
@@ -527,6 +541,7 @@ void Register_Sphere(HSQUIRRELVM vm)
|
||||
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Sphere >, SQFloat, SQInteger, bool, std::nullptr_t, Sphere >)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &Sphere::ToString)
|
||||
.Func(_SC("_tojson"), &Sphere::ToJSON)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Sphere >, SQFloat, SQInteger, bool, std::nullptr_t, Sphere >)
|
||||
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Sphere >, SQFloat, SQInteger, bool, std::nullptr_t, Sphere >)
|
||||
|
||||
@@ -341,6 +341,11 @@ struct Sphere
|
||||
*/
|
||||
SQMOD_NODISCARD String ToString() const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to convert an instance of this type to a JSON string.
|
||||
*/
|
||||
void ToJSON(CtxJSON & ctx) const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Set the specified radius.
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Base/DynArg.hpp"
|
||||
#include "Core/Buffer.hpp"
|
||||
#include "Core/Utility.hpp"
|
||||
#include "Library/JSON.hpp"
|
||||
#include "Library/Numeric/Random.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -295,6 +296,19 @@ String Vector2::ToString() const
|
||||
return fmt::format("{},{}", x, y);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Vector2::ToJSON(CtxJSON & ctx) const
|
||||
{
|
||||
if (ctx.mObjectOverArray)
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "{{x:{},y:{}}},", x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "[{},{}],", x, y);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Vector2::SetScalar(Value ns)
|
||||
{
|
||||
@@ -428,6 +442,7 @@ void Register_Vector2(HSQUIRRELVM vm)
|
||||
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Vector2 >, SQFloat, SQInteger, bool, std::nullptr_t, Vector2 >)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &Vector2::ToString)
|
||||
.Func(_SC("_tojson"), &Vector2::ToJSON)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Vector2 >, SQFloat, SQInteger, bool, std::nullptr_t, Vector2 >)
|
||||
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Vector2 >, SQFloat, SQInteger, bool, std::nullptr_t, Vector2 >)
|
||||
|
||||
@@ -285,6 +285,11 @@ struct Vector2
|
||||
*/
|
||||
SQMOD_NODISCARD String ToString() const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to convert an instance of this type to a JSON string.
|
||||
*/
|
||||
void ToJSON(CtxJSON & ctx) const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Set all components to the specified scalar value.
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "Base/DynArg.hpp"
|
||||
#include "Core/Buffer.hpp"
|
||||
#include "Core/Utility.hpp"
|
||||
#include "Library/JSON.hpp"
|
||||
#include "Library/Numeric/Random.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -441,6 +442,19 @@ String Vector2i::ToString() const
|
||||
return fmt::format("{},{}", x, y);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Vector2i::ToJSON(CtxJSON & ctx) const
|
||||
{
|
||||
if (ctx.mObjectOverArray)
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "{{x:{},y:{}}},", x, y);
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "[{},{}],", x, y);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Vector2i::SetScalar(Value ns)
|
||||
{
|
||||
@@ -574,6 +588,7 @@ void Register_Vector2i(HSQUIRRELVM vm)
|
||||
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Vector2i >, SQFloat, SQInteger, bool, std::nullptr_t, Vector2i >)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &Vector2i::ToString)
|
||||
.Func(_SC("_tojson"), &Vector2i::ToJSON)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Vector2i >, SQFloat, SQInteger, bool, std::nullptr_t, Vector2i >)
|
||||
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Vector2i >, SQFloat, SQInteger, bool, std::nullptr_t, Vector2i >)
|
||||
|
||||
@@ -390,6 +390,11 @@ struct Vector2i
|
||||
*/
|
||||
SQMOD_NODISCARD String ToString() const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to convert an instance of this type to a JSON string.
|
||||
*/
|
||||
void ToJSON(CtxJSON & ctx) const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Set all components to the specified scalar value.
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "Base/DynArg.hpp"
|
||||
#include "Core/Buffer.hpp"
|
||||
#include "Core/Utility.hpp"
|
||||
#include "Library/JSON.hpp"
|
||||
#include "Library/Numeric/Random.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -331,6 +332,19 @@ String Vector3::ToString() const
|
||||
return fmt::format("{},{},{}", x, y, z);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Vector3::ToJSON(CtxJSON & ctx) const
|
||||
{
|
||||
if (ctx.mObjectOverArray)
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "{{x:{},y:{},z:{}}},", x, y, z);
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "[{},{},{}],", x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Vector3::SetScalar(Value ns)
|
||||
{
|
||||
@@ -696,6 +710,7 @@ void Register_Vector3(HSQUIRRELVM vm)
|
||||
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Vector3 >, SQFloat, SQInteger, bool, std::nullptr_t, Vector3 >)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &Vector3::ToString)
|
||||
.Func(_SC("_tojson"), &Vector3::ToJSON)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Vector3 >, SQFloat, SQInteger, bool, std::nullptr_t, Vector3 >)
|
||||
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Vector3 >, SQFloat, SQInteger, bool, std::nullptr_t, Vector3 >)
|
||||
|
||||
@@ -297,6 +297,11 @@ struct Vector3
|
||||
*/
|
||||
SQMOD_NODISCARD String ToString() const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to convert an instance of this type to a JSON string.
|
||||
*/
|
||||
void ToJSON(CtxJSON & ctx) const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Set all components to the specified scalar value.
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "Base/DynArg.hpp"
|
||||
#include "Core/Buffer.hpp"
|
||||
#include "Core/Utility.hpp"
|
||||
#include "Library/JSON.hpp"
|
||||
#include "Library/Numeric/Random.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -344,6 +345,19 @@ String Vector4::ToString() const
|
||||
return fmt::format("{},{},{},{}", x, y, z, w);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Vector4::ToJSON(CtxJSON & ctx) const
|
||||
{
|
||||
if (ctx.mObjectOverArray)
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "{{x:{},y:{},z:{},w:{}}},", x, y, z, w);
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::format_to(std::back_inserter(ctx.mOutput), "[{},{},{},{}],", x, y, z, w);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Vector4::SetScalar(Value ns)
|
||||
{
|
||||
@@ -526,6 +540,7 @@ void Register_Vector4(HSQUIRRELVM vm)
|
||||
.SquirrelFunc(_SC("cmp"), &SqDynArgFwd< SqDynArgCmpFn< Vector4 >, SQFloat, SQInteger, bool, std::nullptr_t, Vector4 >)
|
||||
.SquirrelFunc(_SC("_typename"), &Typename::Fn)
|
||||
.Func(_SC("_tostring"), &Vector4::ToString)
|
||||
.Func(_SC("_tojson"), &Vector4::ToJSON)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_add"), &SqDynArgFwd< SqDynArgAddFn< Vector4 >, SQFloat, SQInteger, bool, std::nullptr_t, Vector4 >)
|
||||
.SquirrelFunc(_SC("_sub"), &SqDynArgFwd< SqDynArgSubFn< Vector4 >, SQFloat, SQInteger, bool, std::nullptr_t, Vector4 >)
|
||||
|
||||
@@ -295,6 +295,11 @@ struct Vector4
|
||||
*/
|
||||
SQMOD_NODISCARD String ToString() const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Used by the script engine to convert an instance of this type to a JSON string.
|
||||
*/
|
||||
void ToJSON(CtxJSON & ctx) const;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Set all components to the specified scalar value.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# Create the Squirrel module
|
||||
add_library(SqModule MODULE SqBase.hpp Main.cpp
|
||||
# SDK
|
||||
SDK/sqmod.h
|
||||
# VCMP
|
||||
VCMP/vcmp.h
|
||||
VCMP/vcmp20.h
|
||||
@@ -80,6 +82,7 @@ add_library(SqModule MODULE SqBase.hpp Main.cpp
|
||||
Library/Numeric.cpp Library/Numeric.hpp
|
||||
Library/Numeric/Math.cpp Library/Numeric/Math.hpp
|
||||
Library/Numeric/Random.cpp Library/Numeric/Random.hpp
|
||||
Library/RegEx.cpp Library/RegEx.hpp
|
||||
Library/String.cpp Library/String.hpp
|
||||
Library/System.cpp Library/System.hpp
|
||||
Library/System/Dir.cpp Library/System/Dir.hpp
|
||||
@@ -89,6 +92,7 @@ add_library(SqModule MODULE SqBase.hpp Main.cpp
|
||||
Library/Utils.cpp Library/Utils.hpp
|
||||
Library/Utils/Announce.cpp Library/Utils/Announce.hpp
|
||||
Library/Utils/String.cpp Library/Utils/String.hpp
|
||||
Library/Utils/Template.cpp Library/Utils/Template.hpp
|
||||
Library/Utils/Vector.cpp Library/Utils/Vector.hpp
|
||||
Library/XML.cpp Library/XML.hpp
|
||||
Library/ZMQ.cpp Library/ZMQ.hpp
|
||||
@@ -106,15 +110,17 @@ add_library(SqModule MODULE SqBase.hpp Main.cpp
|
||||
PocoLib/Crypto.cpp PocoLib/Crypto.hpp
|
||||
PocoLib/Data.cpp PocoLib/Data.hpp
|
||||
PocoLib/Net.cpp PocoLib/Net.hpp
|
||||
PocoLib/RegEx.cpp PocoLib/RegEx.hpp
|
||||
PocoLib/Register.cpp PocoLib/Register.hpp
|
||||
PocoLib/Time.cpp PocoLib/Time.hpp
|
||||
PocoLib/Util.cpp PocoLib/Util.hpp
|
||||
#
|
||||
#
|
||||
Core.cpp Core.hpp
|
||||
Logger.cpp Logger.hpp
|
||||
Register.cpp
|
||||
Exports.cpp
|
||||
)
|
||||
# The module requires C++ 17
|
||||
set_property(TARGET SqModule PROPERTY CXX_STANDARD 17)
|
||||
# Various definitions required by the plug-in
|
||||
target_compile_definitions(SqModule PRIVATE SCRAT_USE_EXCEPTIONS=1)
|
||||
# SDK targeting
|
||||
@@ -132,28 +138,7 @@ if(WIN32 OR MINGW)
|
||||
target_link_libraries(SqModule wsock32 ws2_32 shlwapi)
|
||||
endif()
|
||||
# Link to base libraries
|
||||
target_link_libraries(SqModule Squirrel fmt::fmt SimpleINI TinyDir xxHash ConcurrentQueue SAJSON CPR UTF8Lib PUGIXML CivetWeb maxminddb libzmq-static)
|
||||
# Enable built-in Discord support
|
||||
if(ENABLE_DISCORD)
|
||||
target_link_libraries(SqModule DPP)
|
||||
target_compile_definitions(SqModule PRIVATE VCMP_ENABLE_DISCORD=1)
|
||||
target_sources(SqModule PRIVATE
|
||||
Library/DPP.cpp Library/DPP.hpp
|
||||
Library/DPP/Channel.cpp Library/DPP/Channel.hpp
|
||||
Library/DPP/Client.cpp Library/DPP/Client.hpp
|
||||
Library/DPP/Cluster.cpp Library/DPP/Cluster.hpp
|
||||
Library/DPP/Command.cpp Library/DPP/Command.hpp
|
||||
Library/DPP/Constants.cpp Library/DPP/Constants.hpp
|
||||
Library/DPP/Events.cpp Library/DPP/Events.hpp
|
||||
Library/DPP/Guild.cpp Library/DPP/Guild.hpp
|
||||
Library/DPP/Integration.cpp Library/DPP/Integration.hpp
|
||||
Library/DPP/Message.cpp Library/DPP/Message.hpp
|
||||
Library/DPP/Other.cpp Library/DPP/Other.hpp
|
||||
Library/DPP/Role.cpp Library/DPP/Role.hpp
|
||||
Library/DPP/User.cpp Library/DPP/User.hpp
|
||||
Library/DPP/Utilities.cpp Library/DPP/Utilities.hpp
|
||||
)
|
||||
endif()
|
||||
target_link_libraries(SqModule RPMalloc Squirrel fmt::fmt SimpleINI TinyDir xxHash ConcurrentQueue SAJSON CPR UTF8Lib PUGIXML CivetWeb inja maxminddb libzmq-static)
|
||||
# Link to POCO libraries
|
||||
target_link_libraries(SqModule Poco::Foundation Poco::Crypto Poco::Data Poco::Net)
|
||||
# Does POCO have SQLite support?
|
||||
@@ -192,6 +177,31 @@ if(POSTGRESQL_FOUND)
|
||||
# Inform the plug-in that it can make use of this library
|
||||
target_compile_definitions(SqModule PRIVATE SQMOD_POCO_HAS_POSTGRESQL=1)
|
||||
endif()
|
||||
# Is Discord support enabled?
|
||||
if(ENABLE_DISCORD)
|
||||
target_link_libraries(SqModule dpp)
|
||||
target_sources(SqModule PRIVATE
|
||||
Library/Discord.cpp Library/Discord.hpp
|
||||
Library/Discord/Application.hpp Library/Discord/Application.cpp
|
||||
Library/Discord/Automod.hpp Library/Discord/Automod.cpp
|
||||
Library/Discord/Channel.hpp Library/Discord/Channel.cpp
|
||||
Library/Discord/Client.hpp Library/Discord/Client.cpp
|
||||
Library/Discord/Cluster.hpp Library/Discord/Cluster.cpp
|
||||
Library/Discord/Command.hpp Library/Discord/Command.cpp
|
||||
Library/Discord/Constants.hpp Library/Discord/Constants.cpp
|
||||
Library/Discord/Events.hpp Library/Discord/Events.cpp
|
||||
Library/Discord/Guild.hpp Library/Discord/Guild.cpp
|
||||
Library/Discord/Integration.hpp Library/Discord/Integration.cpp
|
||||
Library/Discord/Message.hpp Library/Discord/Message.cpp
|
||||
Library/Discord/Misc.hpp Library/Discord/Misc.cpp
|
||||
Library/Discord/Presence.hpp Library/Discord/Presence.cpp
|
||||
Library/Discord/Role.hpp Library/Discord/Role.cpp
|
||||
Library/Discord/User.hpp Library/Discord/User.cpp
|
||||
Library/Discord/Utilities.hpp Library/Discord/Utilities.cpp
|
||||
)
|
||||
# Inform the plug-in that discord is enabled
|
||||
target_compile_definitions(SqModule PRIVATE SQMOD_DISCORD=1)
|
||||
endif()
|
||||
# Determine if build mode
|
||||
if(${CMAKE_BUILD_TYPE} MATCHES "(Release)+")
|
||||
target_compile_definitions(SqModule PRIVATE NDEBUG=1)
|
||||
@@ -222,10 +232,26 @@ else(WIN32)
|
||||
endif(WIN32)
|
||||
# Include current directory in the search path
|
||||
target_include_directories(SqModule PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
target_include_directories(SqModule PRIVATE ${CMAKE_CURRENT_LIST_DIR}/SDK)
|
||||
target_include_directories(SqModule PRIVATE ${CMAKE_CURRENT_LIST_DIR}/VCMP)
|
||||
target_include_directories(SqModule PRIVATE ${CMAKE_CURRENT_LIST_DIR}/Sqrat)
|
||||
# Include PCRE directory in the header search path
|
||||
if (POCO_UNBUNDLED)
|
||||
find_package(PCRE REQUIRED)
|
||||
target_link_libraries(SqModule PRIVATE Pcre::Pcre)
|
||||
else()
|
||||
# Get the foundation source folder path
|
||||
get_target_property(POCO_FOUNDATION_SOURCE_DIR Foundation SOURCE_DIR)
|
||||
target_include_directories(SqModule PRIVATE "${POCO_FOUNDATION_SOURCE_DIR}/src")
|
||||
endif()
|
||||
# Copy module into the plug-ins folder
|
||||
add_custom_command(TARGET SqModule POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:SqModule> "${PROJECT_SOURCE_DIR}/bin/plugins")
|
||||
# Copy DPP into the bin folder
|
||||
if (ENABLE_DISCORD)
|
||||
if (WIN32 OR MINGW)
|
||||
add_custom_command(TARGET SqModule POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:dpp> "${PROJECT_SOURCE_DIR}/bin")
|
||||
endif()
|
||||
endif()
|
||||
# Copy several dependent DLLs on windows to make distribution easier (used mainly by people that distribute builds)
|
||||
if(WIN32 AND MINGW AND COPY_DEPENDENCIES)
|
||||
get_filename_component(MINGW_BIN_PATH ${CMAKE_C_COMPILER} DIRECTORY REALPATH)
|
||||
@@ -234,12 +260,12 @@ if(WIN32 AND MINGW AND COPY_DEPENDENCIES)
|
||||
endif()
|
||||
# Make sure the deps folder exists
|
||||
file(MAKE_DIRECTORY "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
# Copy dependencies into the plug-ins folder (only so it can be distributed with the DLL)
|
||||
# Copy dependencies into the deps folder (only so it can be distributed with the DLL)
|
||||
file(COPY "${MINGW_BIN_PATH}/zlib1.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libpq.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libzstd.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libpsl-5.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libffi-7.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libffi-8.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libcurl-4.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libssh2-1.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libidn2-0.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
@@ -257,17 +283,17 @@ if(WIN32 AND MINGW AND COPY_DEPENDENCIES)
|
||||
file(COPY "${MINGW_BIN_PATH}/libp11-kit-0.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libbrotlidec.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libbrotlicommon.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libunistring-2.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libunistring-5.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libnghttp2-14.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libwinpthread-1.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libstdc++-6.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT FORCE_32BIT_BIN)
|
||||
file(COPY "${MINGW_BIN_PATH}/libgcc_s_seh-1.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libssl-1_1-x64.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libcrypto-1_1-x64.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libssl-3-x64.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libcrypto-3-x64.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
else()
|
||||
file(COPY "${MINGW_BIN_PATH}/libssl-1_1.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libcrypto-1_1.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libssl-3.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
file(COPY "${MINGW_BIN_PATH}/libcrypto-3.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
endif()
|
||||
if(POCO_UNBUNDLED)
|
||||
file(COPY "${MINGW_BIN_PATH}/libexpat-1.dll" DESTINATION "${PROJECT_SOURCE_DIR}/bin/deps")
|
||||
|
||||
137
module/Core.cpp
137
module/Core.cpp
@@ -49,8 +49,8 @@ extern void TerminateRoutines();
|
||||
extern void TerminateCommands();
|
||||
extern void TerminateSignals();
|
||||
extern void TerminateNet();
|
||||
#ifdef VCMP_ENABLE_DISCORD
|
||||
extern void TerminateDPP();
|
||||
#ifdef SQMOD_DISCORD
|
||||
extern void TerminateDiscord();
|
||||
#endif
|
||||
extern void TerminatePocoNet();
|
||||
extern void TerminatePocoData();
|
||||
@@ -164,6 +164,7 @@ Core::Core() noexcept
|
||||
, m_Scripts()
|
||||
, m_PendingScripts()
|
||||
, m_Options()
|
||||
, m_ExtCommands{nullptr, nullptr, nullptr, nullptr}
|
||||
, m_Blips()
|
||||
, m_Checkpoints()
|
||||
, m_KeyBinds()
|
||||
@@ -444,9 +445,9 @@ bool Core::Execute()
|
||||
m_LockPostLoadSignal = false;
|
||||
m_LockUnloadSignal = false;
|
||||
|
||||
//cLogDbg(m_Verbosity >= 1, "Signaling outside plug-ins to register their API");
|
||||
cLogDbg(m_Verbosity >= 1, "Signaling outside plug-ins that the API is being registered");
|
||||
// Tell modules to do their monkey business
|
||||
//_Func->SendPluginCommand(0xDEADBABE, "");
|
||||
_Func->SendPluginCommand(SQMOD_LOAD_CMD, SQMOD_HOST_NAME);
|
||||
|
||||
// Load pending scripts while we're in the bounds of the allowed recursiveness
|
||||
for (unsigned levels = 0; !m_PendingScripts.empty() && (levels < 8); ++levels)
|
||||
@@ -514,9 +515,9 @@ void Core::Terminate(bool shutdown)
|
||||
// Clear the callbacks
|
||||
ResetSignalPair(mOnUnload);
|
||||
|
||||
//cLogDbg(m_Verbosity >= 1, "Signaling outside plug-ins to release their resources");
|
||||
cLogDbg(m_Verbosity >= 1, "Signaling outside plug-ins to release their resources");
|
||||
// Tell modules to do their monkey business
|
||||
//_Func->SendPluginCommand(0xDEADC0DE, "");
|
||||
_Func->SendPluginCommand(SQMOD_TERMINATE_CMD, SQMOD_HOST_NAME);
|
||||
}
|
||||
|
||||
cLogDbg(m_Verbosity >= 1, "Clearing the entity containers");
|
||||
@@ -552,14 +553,14 @@ void Core::Terminate(bool shutdown)
|
||||
// Release announcers
|
||||
AnnounceTerminate();
|
||||
cLogDbg(m_Verbosity >= 1, "Announcer terminated");
|
||||
// Release DPP
|
||||
#ifdef VCMP_ENABLE_DISCORD
|
||||
TerminateDPP();
|
||||
cLogDbg(m_Verbosity >= 1, "Discord terminated");
|
||||
#endif
|
||||
// Release network
|
||||
TerminateNet();
|
||||
cLogDbg(m_Verbosity >= 1, "Network terminated");
|
||||
// Release DPP
|
||||
#ifdef SQMOD_DISCORD
|
||||
TerminateDiscord();
|
||||
cLogDbg(m_Verbosity >= 1, "Discord terminated");
|
||||
#endif
|
||||
// Release Poco statement results
|
||||
TerminatePocoNet();
|
||||
TerminatePocoData();
|
||||
@@ -604,9 +605,9 @@ void Core::Terminate(bool shutdown)
|
||||
HSQUIRRELVM sq_vm = m_VM;
|
||||
m_VM = nullptr;
|
||||
|
||||
//cLogDbg(m_Verbosity >= 1, "Signaling outside plug-ins the virtual machine is closing");
|
||||
cLogDbg(m_Verbosity >= 1, "Signaling outside plug-ins the virtual machine is closing");
|
||||
// Tell modules to do their monkey business
|
||||
//_Func->SendPluginCommand(0xBAAAAAAD, "");
|
||||
_Func->SendPluginCommand(SQMOD_CLOSING_CMD, SQMOD_HOST_NAME);
|
||||
// Release any callbacks from the logger
|
||||
Logger::Get().Release();
|
||||
cLogDbg(m_Verbosity >= 2, "Closing Virtual Machine");
|
||||
@@ -637,9 +638,9 @@ void Core::Terminate(bool shutdown)
|
||||
// Destroy the VM context, if any
|
||||
delete ctx;
|
||||
|
||||
//cLogDbg(m_Verbosity >= 1, "Signaling outside plug-ins to release the virtual machine");
|
||||
cLogDbg(m_Verbosity >= 1, "Signaling outside plug-ins the virtual machine was closed");
|
||||
// Tell modules to do their monkey business
|
||||
//_Func->SendPluginCommand(0xDEADBEAF, "");
|
||||
_Func->SendPluginCommand(SQMOD_RELEASED_CMD, SQMOD_HOST_NAME);
|
||||
}
|
||||
|
||||
OutputMessage("Squirrel plug-in was successfully terminated");
|
||||
@@ -912,6 +913,81 @@ String Core::FetchCodeLine(const SQChar * src, SQInteger line, bool trim)
|
||||
return script->FetchLine(line, trim);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
int32_t Core::RegisterExtCommand(ExtPluginCommand_t fn)
|
||||
{
|
||||
ExtPluginCommand_t * slot = nullptr;
|
||||
// Find a free slot or matching function pointer in the pool
|
||||
for (size_t i = 0; i < m_ExtCommands.max_size(); ++i)
|
||||
{
|
||||
// Is this slot available and are we still looking for a slot?
|
||||
if (m_ExtCommands[i] == nullptr && slot == nullptr)
|
||||
{
|
||||
slot = &m_ExtCommands[i]; // Found a slot
|
||||
}
|
||||
// We keep looking for duplicates even if we found the slot
|
||||
else if (m_ExtCommands[i] == fn)
|
||||
{
|
||||
return 0; // Already registered
|
||||
}
|
||||
}
|
||||
// Do we have a free slot?
|
||||
if (slot != nullptr)
|
||||
{
|
||||
*slot = fn; // Use this slot
|
||||
return 1; // Successfully registered
|
||||
}
|
||||
// No space in the pool
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
int32_t Core::UnregisterExtCommand(ExtPluginCommand_t fn)
|
||||
{
|
||||
// Find the matching function pointer
|
||||
for (size_t i = 0; i < m_ExtCommands.max_size(); ++i)
|
||||
{
|
||||
// Is this the same pointer?
|
||||
if (m_ExtCommands[i] != nullptr && m_ExtCommands[i] == fn)
|
||||
{
|
||||
// Forget about it
|
||||
m_ExtCommands[i] = nullptr;
|
||||
return 1; // Successfully unregistered
|
||||
}
|
||||
}
|
||||
// No space
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
int32_t Core::SendExtCommand(int32_t target, int32_t req, int32_t tag, const uint8_t * data, size_t size)
|
||||
{
|
||||
int32_t count = 0;
|
||||
// Send the command to all registered function pointers
|
||||
for (size_t i = 0; i < m_ExtCommands.max_size(); ++i)
|
||||
{
|
||||
if (m_ExtCommands[i] != nullptr)
|
||||
{
|
||||
const int32_t r = m_ExtCommands[i](target, req, tag, data, size);
|
||||
// Command processed
|
||||
++count;
|
||||
// Command failed?
|
||||
if (r < 0)
|
||||
{
|
||||
LogErr("External command failed (%i): target(%i), req(%i), tag(%i), data(%p), size (%zu)",
|
||||
r, target, req, tag, data, size);
|
||||
}
|
||||
// Command consumed?
|
||||
else if (r > 0)
|
||||
{
|
||||
break; // This function pointer requested exclusive access over this command
|
||||
}
|
||||
}
|
||||
}
|
||||
// Return how many function pointers received this command
|
||||
return count;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
bool Core::DoScripts(Scripts::iterator itr, Scripts::iterator end)
|
||||
{
|
||||
@@ -2379,6 +2455,8 @@ void Core::InitEvents()
|
||||
InitSignalPair(mOnServerOption, m_Events, "ServerOption");
|
||||
InitSignalPair(mOnScriptReload, m_Events, "ScriptReload");
|
||||
InitSignalPair(mOnScriptLoaded, m_Events, "ScriptLoaded");
|
||||
InitSignalPair(mOnExtCommandReply, m_Events, "ExtCommandReply");
|
||||
InitSignalPair(mOnExtCommandEvent, m_Events, "ExtCommandEvent");
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Core::DropEvents()
|
||||
@@ -2524,6 +2602,8 @@ void Core::DropEvents()
|
||||
ResetSignalPair(mOnServerOption);
|
||||
ResetSignalPair(mOnScriptReload);
|
||||
ResetSignalPair(mOnScriptLoaded);
|
||||
ResetSignalPair(mOnExtCommandReply);
|
||||
ResetSignalPair(mOnExtCommandEvent);
|
||||
m_Events.Release();
|
||||
}
|
||||
|
||||
@@ -2869,6 +2949,31 @@ static LightObj & SqGetClientDataBuffer()
|
||||
return Core::Get().GetClientDataBuffer();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static SQInteger SqSendExtCommand(int32_t target, int32_t req, int32_t tag, SqBuffer & buffer)
|
||||
{
|
||||
// Default to an empty/null buffer
|
||||
const uint8_t * data = nullptr;
|
||||
size_t size = 0;
|
||||
// Does the buffer actually point to anything?
|
||||
if (buffer.GetRef())
|
||||
{
|
||||
data = buffer.GetRef()->Begin< uint8_t >();
|
||||
size = buffer.GetRef()->PositionAs< size_t >();
|
||||
}
|
||||
// Forward the request
|
||||
return Core::Get().SendExtCommand(target, req, tag, data, size);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static SQInteger SqSendExtCommandStr(int32_t target, int32_t req, int32_t tag, StackStrF & str)
|
||||
{
|
||||
// Forward the request
|
||||
return Core::Get().SendExtCommand(target, req, tag,
|
||||
reinterpret_cast< const uint8_t * >(str.mPtr),
|
||||
str.mLen <= 0 ? 0 : static_cast< size_t >(str.mLen));
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
void Register_Core(HSQUIRRELVM vm)
|
||||
{
|
||||
@@ -2918,6 +3023,8 @@ void Register_Core(HSQUIRRELVM vm)
|
||||
.Func(_SC("DestroyPickup"), &SqDelPickup)
|
||||
.Func(_SC("DestroyVehicle"), &SqDelVehicle)
|
||||
.Func(_SC("ClientDataBuffer"), &SqGetClientDataBuffer)
|
||||
.Func(_SC("SendExtCommand"), &SqSendExtCommand)
|
||||
.FmtFunc(_SC("SendExtCommandStr"), &SqSendExtCommandStr)
|
||||
.Func(_SC("OnPreLoad"), &SqGetPreLoadEvent)
|
||||
.Func(_SC("OnPostLoad"), &SqGetPostLoadEvent)
|
||||
.Func(_SC("OnUnload"), &SqGetUnloadEvent)
|
||||
|
||||
110
module/Core.hpp
110
module/Core.hpp
@@ -9,6 +9,9 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <unordered_map>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "SDK/sqmod.h"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
@@ -56,6 +59,8 @@ public:
|
||||
typedef std::vector< ScriptSrc > Scripts; // List of loaded scripts.
|
||||
// --------------------------------------------------------------------------------------------
|
||||
typedef std::unordered_map< String, String > Options; // List of custom options.
|
||||
// --------------------------------------------------------------------------------------------
|
||||
typedef std::array< ExtPluginCommand_t, 4 > ExtCommands; // 4 external command parsers should be enough.
|
||||
|
||||
private:
|
||||
|
||||
@@ -68,6 +73,7 @@ private:
|
||||
Scripts m_Scripts; // Loaded scripts objects.
|
||||
Scripts m_PendingScripts; // Pending scripts objects.
|
||||
Options m_Options; // Custom configuration options.
|
||||
ExtCommands m_ExtCommands; // External command parsers pointers.
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
Blips m_Blips; // Blips pool.
|
||||
@@ -399,6 +405,23 @@ public:
|
||||
*/
|
||||
SQMOD_NODISCARD String FetchCodeLine(const SQChar * src, SQInteger line, bool trim = true);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Register a pointer to a function used to processes commands from script.
|
||||
* Returns -1 it failed (no free slot), 0 if it was already registered and 1 if it succeeded.
|
||||
*/
|
||||
int32_t RegisterExtCommand(ExtPluginCommand_t fn);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Remove a pointer to a function used to processes commands from script.
|
||||
* Returns -1 it failed (no free slot) and 1 if it succeeded.
|
||||
*/
|
||||
int32_t UnregisterExtCommand(ExtPluginCommand_t fn);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Send a command to all functions currently registered to receive them.
|
||||
*/
|
||||
int32_t SendExtCommand(int32_t target, int32_t req, int32_t tag, const uint8_t * data, size_t size);
|
||||
|
||||
protected:
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
@@ -710,6 +733,16 @@ public:
|
||||
*/
|
||||
void EmitClientScriptData(int32_t player_id, const uint8_t * data, size_t size);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Send a response to the script that may have resulted from a previous command.
|
||||
*/
|
||||
void EmitExtCommandReply(int32_t sender, int32_t tag, const uint8_t * data, size_t size);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Forward an event to the script from an external plug-in.
|
||||
*/
|
||||
void EmitExtCommandEvent(int32_t sender, int32_t tag, const uint8_t * data, size_t size);
|
||||
|
||||
public:
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
@@ -864,6 +897,8 @@ public:
|
||||
SignalPair mOnServerOption{};
|
||||
SignalPair mOnScriptReload{};
|
||||
SignalPair mOnScriptLoaded{};
|
||||
SignalPair mOnExtCommandReply{};
|
||||
SignalPair mOnExtCommandEvent{};
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@@ -993,28 +1028,93 @@ template < class F > inline void ForeachActivePickup(F f) { ForeachActiveEntity(
|
||||
template < class F > inline void ForeachActivePlayer(F f) { ForeachActiveEntity(Core::Get().GetPlayers(), std::forward< F >(f)); }
|
||||
template < class F > inline void ForeachActiveVehicle(F f) { ForeachActiveEntity(Core::Get().GetVehicles(), std::forward< F >(f)); }
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Process the identifier of each player slot.
|
||||
*/
|
||||
template < class F > inline void ForeachPlayerSlot(F f) {
|
||||
for (int32_t i = 0, n = static_cast< int32_t >(_Func->GetMaxPlayers()); i < n; ++i) {
|
||||
f(i);
|
||||
}
|
||||
}
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Process the identifier of each player slot and count processed players.
|
||||
*/
|
||||
template < class F > SQMOD_NODISCARD inline int32_t ForeachPlayerSlotCount(F f) {
|
||||
int32_t c = 0;
|
||||
for (int32_t i = 0, n = static_cast< int32_t >(_Func->GetMaxPlayers()); i < n; ++i) {
|
||||
if (f(i)) ++c;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Process the identifier of each player slot until a certain criteria is met.
|
||||
*/
|
||||
template < class F > SQMOD_NODISCARD inline int32_t ForeachPlayerSlotUntil(F f) {
|
||||
for (int32_t i = 0, n = static_cast< int32_t >(_Func->GetMaxPlayers()); i < n; ++i) {
|
||||
if (f(i)) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Process the identifier of each connected player.
|
||||
*/
|
||||
template < class F > inline void ForeachConnectedPlayer(F f) {
|
||||
for (int32_t i = 0, n = _Func->GetMaxPlayers(); i < n; ++i) f(i);
|
||||
for (int32_t i = 0, n = static_cast< int32_t >(_Func->GetMaxPlayers()); i < n; ++i) {
|
||||
if (_Func->IsPlayerConnected(i) != 0) f(i);
|
||||
}
|
||||
}
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Process the identifier of each connected player and count processed players.
|
||||
*/
|
||||
template < class F > SQMOD_NODISCARD inline int32_t ForeachConnectedPlayerCount(F f) {
|
||||
int32_t c = 0;
|
||||
for (int32_t i = 0, n = _Func->GetMaxPlayers(); i < n; ++i)
|
||||
if (f(i)) ++c;
|
||||
for (int32_t i = 0, n = static_cast< int32_t >(_Func->GetMaxPlayers()); i < n; ++i) {
|
||||
if (_Func->IsPlayerConnected(i) != 0 && f(i)) ++c;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Process the identifier of each connected player until a certain criteria is met.
|
||||
*/
|
||||
template < class F > SQMOD_NODISCARD inline int32_t ForeachConnectedPlayerUntil(F f) {
|
||||
for (int32_t i = 0, n = _Func->GetMaxPlayers(); i < n; ++i)
|
||||
if (f(i)) return i;
|
||||
for (int32_t i = 0, n = static_cast< int32_t >(_Func->GetMaxPlayers()); i < n; ++i) {
|
||||
if (_Func->IsPlayerConnected(i) != 0 && f(i)) return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Used to select entity instances based on type.
|
||||
*/
|
||||
template < class > struct EntityInstSelect;
|
||||
// Specialization for blips.
|
||||
template < > struct EntityInstSelect< CBlip > {
|
||||
static BlipInst & Get(int32_t id) { return Core::Get().GetBlip(id); }
|
||||
};
|
||||
// Specialization for checkpoints.
|
||||
template < > struct EntityInstSelect< CCheckpoint > {
|
||||
static CheckpointInst & Get(int32_t id) { return Core::Get().GetCheckpoint(id); }
|
||||
};
|
||||
// Specialization for keybinds.
|
||||
template < > struct EntityInstSelect< CKeyBind > {
|
||||
static KeyBindInst & Get(int32_t id) { return Core::Get().GetKeyBind(id); }
|
||||
};
|
||||
// Specialization for objects.
|
||||
template < > struct EntityInstSelect< CObject > {
|
||||
static ObjectInst & Get(int32_t id) { return Core::Get().GetObj(id); }
|
||||
};
|
||||
// Specialization for pickups.
|
||||
template < > struct EntityInstSelect< CPickup > {
|
||||
static PickupInst & Get(int32_t id) { return Core::Get().GetPickup(id); }
|
||||
};
|
||||
// Specialization for players.
|
||||
template < > struct EntityInstSelect< CPlayer > {
|
||||
static PlayerInst & Get(int32_t id) { return Core::Get().GetPlayer(id); }
|
||||
};
|
||||
// Specialization for vehicles.
|
||||
template < > struct EntityInstSelect< CVehicle > {
|
||||
static VehicleInst & Get(int32_t id) { return Core::Get().GetVehicle(id); }
|
||||
};
|
||||
|
||||
} // Namespace:: SqMod
|
||||
|
||||
@@ -161,7 +161,7 @@ bool Area::IsInside(float x, float y) const
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
AreaManager::AreaManager(size_t sz) noexcept
|
||||
: m_Queue(), m_ProcList(), m_Grid{}
|
||||
: m_Queue(), m_ProcList(), m_Grid{}, m_Cells{}
|
||||
{
|
||||
// Negative half grid size (left)
|
||||
int l = (-GRIDH * CELLD);
|
||||
@@ -171,21 +171,30 @@ AreaManager::AreaManager(size_t sz) noexcept
|
||||
int r = (l + CELLD);
|
||||
// Positive half grid size (top)
|
||||
int t = abs(l);
|
||||
// Row/Column of the grid
|
||||
int row = 0, col = 0;
|
||||
// Initialize the grid cells
|
||||
for (auto & a : m_Grid)
|
||||
{
|
||||
// Reset the column
|
||||
col = 0;
|
||||
// Process row
|
||||
for (auto & c : a)
|
||||
{
|
||||
auto & cx = m_Cells[row][col];
|
||||
// Grab a reference to the cell
|
||||
// Configure the range of the cell
|
||||
c.mL = static_cast< float >(l);
|
||||
c.mB = static_cast< float >(b);
|
||||
c.mR = static_cast< float >(r);
|
||||
c.mT = static_cast< float >(t);
|
||||
c.mL = cx.mL = static_cast< float >(l);
|
||||
c.mB = cx.mB = static_cast< float >(b);
|
||||
c.mR = cx.mR = static_cast< float >(r);
|
||||
c.mT = cx.mT = static_cast< float >(t);
|
||||
// Reserve area memory if requested
|
||||
c.mAreas.reserve(sz);
|
||||
// Reset the locks on this area
|
||||
c.mLocks = 0;
|
||||
// Set the row and column
|
||||
c.mRow = row;
|
||||
c.mCol = col++;
|
||||
// Advance the left side
|
||||
l = r;
|
||||
// Advance the right side
|
||||
@@ -203,6 +212,8 @@ AreaManager::AreaManager(size_t sz) noexcept
|
||||
t -= CELLD;
|
||||
}
|
||||
}
|
||||
// Advance row
|
||||
++row;
|
||||
}
|
||||
// Reserve some space in the queue
|
||||
m_Queue.reserve(128);
|
||||
@@ -340,6 +351,21 @@ void AreaManager::RemoveArea(Area & a)
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Vector2i AreaManager::LocateCell(float x, float y)
|
||||
{
|
||||
for (int r = 0; r < GRIDN; ++r)
|
||||
{
|
||||
for (int c = 0; c < GRIDN; ++c)
|
||||
{
|
||||
auto & bb = m_Cells[r][c];
|
||||
// Check whether point is inside cell
|
||||
if (bb.mL <= x && bb.mR >= x && bb.mB <= y && bb.mT >= y)
|
||||
{
|
||||
return {r, c}; // Is inside
|
||||
}
|
||||
}
|
||||
}
|
||||
// Point is out of bounds
|
||||
return {NOCELL, NOCELL};
|
||||
/*
|
||||
// Transform the world coordinates into a cell coordinates
|
||||
// and cast to integral after rounding the value
|
||||
int xc = static_cast< int >(std::round(x / CELLD));
|
||||
@@ -364,6 +390,7 @@ Vector2i AreaManager::LocateCell(float x, float y)
|
||||
}
|
||||
// Return the identified cell row and column
|
||||
return {GRIDH+xc, GRIDH-yc};
|
||||
*/
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
@@ -469,6 +496,7 @@ void Register_Areas(HSQUIRRELVM vm)
|
||||
.Func(_SC("TestEx"), &Area::TestEx)
|
||||
.Func(_SC("Manage"), &Area::Manage)
|
||||
.Func(_SC("Unmanage"), &Area::Unmanage)
|
||||
.CbFunc(_SC("EachCell"), &Area::EachCell)
|
||||
// Static Functions
|
||||
.StaticFunc(_SC("GlobalTest"), &Areas_TestPoint)
|
||||
.StaticFunc(_SC("GlobalTestEx"), &Areas_TestPointEx)
|
||||
|
||||
@@ -29,15 +29,25 @@ struct AreaCell
|
||||
Areas mAreas; // Areas that intersect with the cell.
|
||||
// --------------------------------------------------------------------------------------------
|
||||
int mLocks; // The amount of locks on the cell.
|
||||
int mRow; // Row location in the grid.
|
||||
int mCol; // Column location in the grid.
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Default constructor.
|
||||
*/
|
||||
AreaCell()
|
||||
: mL(0), mB(0), mR(0), mT(0), mAreas(0), mLocks(0)
|
||||
: mL(0), mB(0), mR(0), mT(0), mAreas(0), mLocks(0), mRow(0), mCol(0)
|
||||
{
|
||||
//...
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Show information (mainly for debug purposes).
|
||||
*/
|
||||
String Dump()
|
||||
{
|
||||
return fmt::format("({} : {} | {} : {}) {} : {}", mL, mB, mR, mT, mRow, mCol);
|
||||
}
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@@ -454,6 +464,17 @@ struct Area
|
||||
*/
|
||||
bool Unmanage();
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Iterate all managed cells through a functor.
|
||||
*/
|
||||
void EachCell(Function & fn) const
|
||||
{
|
||||
for (const auto & e : mCells)
|
||||
{
|
||||
fn.Execute(static_cast< SQInteger >(e->mRow), static_cast< SQInteger >(e->mCol));
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
@@ -610,7 +631,10 @@ private:
|
||||
ProcList m_ProcList; // Actions ready to be completed.
|
||||
// --------------------------------------------------------------------------------------------
|
||||
AreaCell m_Grid[GRIDN][GRIDN]; // A grid of area lists.
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
struct {
|
||||
float mL, mB, mR, mT;
|
||||
} m_Cells[GRIDN][GRIDN];
|
||||
public:
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
@@ -664,7 +688,7 @@ public:
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Clear all cell lists and release any script references.
|
||||
*/
|
||||
static Vector2i LocateCell(float x, float y);
|
||||
Vector2i LocateCell(float x, float y);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Test a point to see whether it intersects with any areas
|
||||
@@ -679,7 +703,7 @@ public:
|
||||
return; // Not our problem
|
||||
}
|
||||
// Retrieve a reference to the identified cell
|
||||
AreaCell & c = m_Grid[cc.y][cc.x];
|
||||
AreaCell & c = m_Grid[cc.x][cc.y];
|
||||
// Is this cell empty?
|
||||
if (c.mAreas.empty())
|
||||
{
|
||||
|
||||
@@ -285,13 +285,13 @@ public:
|
||||
// Make sure that the buffer can host at least one element of this type
|
||||
if (m_Cap < sizeof(T))
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host an element of size ({})"),
|
||||
m_Cap, sizeof(T));
|
||||
}
|
||||
// Make sure that the specified element is withing buffer range
|
||||
else if (n > (m_Cap - sizeof(T)))
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Element of size (%d) at index (%u) is out of buffer capacity (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Element of size ({}) at index ({}) is out of buffer capacity ({})"),
|
||||
sizeof(T), n, m_Cap);
|
||||
}
|
||||
// Return the requested element
|
||||
@@ -306,13 +306,13 @@ public:
|
||||
// Make sure that the buffer can host at least one element of this type
|
||||
if (m_Cap < sizeof(T))
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host an element of size ({})"),
|
||||
m_Cap, sizeof(T));
|
||||
}
|
||||
// Make sure that the specified element is withing buffer range
|
||||
else if (n > (m_Cap - sizeof(T)))
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Element of size (%d) at index (%u) is out of buffer capacity (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Element of size ({}) at index ({}) is out of buffer capacity ({})"),
|
||||
sizeof(T), n, m_Cap);
|
||||
}
|
||||
// Return the requested element
|
||||
@@ -359,7 +359,7 @@ public:
|
||||
// Make sure that the buffer can host at least one element of this type
|
||||
if (m_Cap < sizeof(T))
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host an element of size ({})"),
|
||||
m_Cap, sizeof(T));
|
||||
}
|
||||
// Return the requested element
|
||||
@@ -374,7 +374,7 @@ public:
|
||||
// Make sure that the buffer can host at least one element of this type
|
||||
if (m_Cap < sizeof(T))
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host an element of size ({})"),
|
||||
m_Cap, sizeof(T));
|
||||
}
|
||||
// Return the requested element
|
||||
@@ -389,7 +389,7 @@ public:
|
||||
// Make sure that the buffer can host at least two elements of this type
|
||||
if (m_Cap < (sizeof(T) * 2))
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host two elements of size (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host two elements of size ({})"),
|
||||
m_Cap, sizeof(T));
|
||||
}
|
||||
// Return the requested element
|
||||
@@ -404,7 +404,7 @@ public:
|
||||
// Make sure that the buffer can host at least two elements of this type
|
||||
if (m_Cap < (sizeof(T) * 2))
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host two elements of size (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host two elements of size ({})"),
|
||||
m_Cap, sizeof(T));
|
||||
}
|
||||
// Return the requested element
|
||||
@@ -419,7 +419,7 @@ public:
|
||||
// Make sure that the buffer can host at least one element of this type
|
||||
if (m_Cap < sizeof(T))
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host an element of size ({})"),
|
||||
m_Cap, sizeof(T));
|
||||
}
|
||||
// Return the requested element
|
||||
@@ -434,7 +434,7 @@ public:
|
||||
// Make sure that the buffer can host at least one element of this type
|
||||
if (m_Cap < sizeof(T))
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host an element of size ({})"),
|
||||
m_Cap, sizeof(T));
|
||||
}
|
||||
// Return the requested element
|
||||
@@ -449,7 +449,7 @@ public:
|
||||
// Make sure that the buffer can host at least two elements of this type
|
||||
if (m_Cap < (sizeof(T) * 2))
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host two elements of size (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host two elements of size ({})"),
|
||||
m_Cap, sizeof(T));
|
||||
}
|
||||
// Return the requested element
|
||||
@@ -464,7 +464,7 @@ public:
|
||||
// Make sure that the buffer can host at least two elements of this type
|
||||
if (m_Cap < (sizeof(T) * 2))
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host two elements of size (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host two elements of size ({})"),
|
||||
m_Cap, sizeof(T));
|
||||
}
|
||||
// Return the requested element
|
||||
@@ -540,7 +540,7 @@ public:
|
||||
// Make sure that at least one element of this type exists after the cursor
|
||||
if ((m_Cur + sizeof(T)) > m_Cap)
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Element of size (%u) starting at (%u) exceeds buffer capacity (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Element of size ({}) starting at ({}) exceeds buffer capacity ({})"),
|
||||
sizeof(T), m_Cur, m_Cap);
|
||||
}
|
||||
// Return the requested element
|
||||
@@ -555,7 +555,7 @@ public:
|
||||
// Make sure that at least one element of this type exists after the cursor
|
||||
if ((m_Cur + sizeof(T)) > m_Cap)
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Element of size (%u) starting at (%u) exceeds buffer capacity (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Element of size ({}) starting at ({}) exceeds buffer capacity ({})"),
|
||||
sizeof(T), m_Cur, m_Cap);
|
||||
}
|
||||
// Return the requested element
|
||||
@@ -570,7 +570,7 @@ public:
|
||||
// The cursor must have at least one element of this type behind
|
||||
if (m_Cur < sizeof(T))
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Cannot read an element of size (%u) before the cursor at (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Cannot read an element of size ({}) before the cursor at ({})"),
|
||||
sizeof(T), m_Cur);
|
||||
}
|
||||
// Return the requested element
|
||||
@@ -585,7 +585,7 @@ public:
|
||||
// The cursor must have at least one element of this type behind
|
||||
if (m_Cur < sizeof(T))
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Cannot read an element of size (%u) before the cursor at (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Cannot read an element of size ({}) before the cursor at ({})"),
|
||||
sizeof(T), m_Cur);
|
||||
}
|
||||
// Return the requested element
|
||||
@@ -600,13 +600,13 @@ public:
|
||||
// Make sure that the buffer can host at least one element of this type
|
||||
if (m_Cap < sizeof(T))
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host an element of size ({})"),
|
||||
m_Cap, sizeof(T));
|
||||
}
|
||||
// There must be buffer left for at least two elements of this type after the cursor
|
||||
else if ((m_Cur + (sizeof(T) * 2)) > m_Cap)
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Element of size (%u) starting at (%u) exceeds buffer capacity (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Element of size ({}) starting at ({}) exceeds buffer capacity ({})"),
|
||||
sizeof(T), m_Cur + sizeof(T), m_Cap);
|
||||
}
|
||||
// Return the requested element
|
||||
@@ -621,13 +621,13 @@ public:
|
||||
// Make sure that the buffer can host at least one element of this type
|
||||
if (m_Cap < sizeof(T))
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of (%u) is unable to host an element of size (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Buffer capacity of ({}) is unable to host an element of size ({})"),
|
||||
m_Cap, sizeof(T));
|
||||
}
|
||||
// There must be buffer left for at least two elements of this type after the cursor
|
||||
else if ((m_Cur + (sizeof(T) * 2)) > m_Cap)
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Element of size (%u) starting at (%u) exceeds buffer capacity (%u)"),
|
||||
ThrowMemExcept(fmt::runtime("Element of size ({}) starting at ({}) exceeds buffer capacity ({})"),
|
||||
sizeof(T), m_Cur + sizeof(T), m_Cap);
|
||||
}
|
||||
// Return the requested element
|
||||
@@ -708,7 +708,7 @@ public:
|
||||
// See if the requested capacity doesn't exceed the limit
|
||||
if (n > Max< T >())
|
||||
{
|
||||
ThrowMemExcept(fmt::runtime("Requested buffer of (%u) elements exceeds the (%u) limit"), n, Max< T >());
|
||||
ThrowMemExcept(fmt::runtime("Requested buffer of ({}) elements exceeds the ({}) limit"), n, Max< T >());
|
||||
}
|
||||
// Is there an existing buffer?
|
||||
else if (n && !m_Cap)
|
||||
|
||||
@@ -248,6 +248,14 @@ String SqTypeName(HSQUIRRELVM vm, SQInteger idx)
|
||||
return String(val.mPtr, static_cast< size_t >(val.mLen));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
String SqTypeName(HSQUIRRELVM vm, LightObj & obj)
|
||||
{
|
||||
const StackGuard sg(vm);
|
||||
sq_pushobject(vm, obj);
|
||||
return SqTypeName(vm, -1);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
LightObj BufferToStrObj(const Buffer & b)
|
||||
{
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include <sqratTable.h>
|
||||
#include <sqratUtil.h>
|
||||
#include <fmt/core.h>
|
||||
#include <rpmalloc.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
@@ -173,7 +174,7 @@ void OutputError(const char * msg, ...);
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Generate a formatted string and throw it as a Sqrat exception.
|
||||
*/
|
||||
template < class... Args > void SqThrowF(Args &&... args)
|
||||
template < class... Args > inline void SqThrowF(Args &&... args)
|
||||
{
|
||||
throw Sqrat::Exception(fmt::format(std::forward< Args >(args)...));
|
||||
}
|
||||
@@ -181,7 +182,7 @@ template < class... Args > void SqThrowF(Args &&... args)
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Generate a formatted string and throw it as a squirrel exception.
|
||||
*/
|
||||
template < class... Args > SQRESULT SqThrowErrorF(HSQUIRRELVM vm, Args &&... args)
|
||||
template < class... Args > inline SQRESULT SqThrowErrorF(HSQUIRRELVM vm, Args &&... args)
|
||||
{
|
||||
String msg;
|
||||
try
|
||||
@@ -241,6 +242,11 @@ SQMOD_NODISCARD const SQChar * SqTypeName(SQObjectType type);
|
||||
*/
|
||||
SQMOD_NODISCARD String SqTypeName(HSQUIRRELVM vm, SQInteger idx);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Retrieve the string representation of a certain type from a script object.
|
||||
*/
|
||||
SQMOD_NODISCARD String SqTypeName(HSQUIRRELVM vm, LightObj & obj);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Create a script string instance from a buffer.
|
||||
*/
|
||||
@@ -266,4 +272,93 @@ SQMOD_NODISCARD SQFloat PopStackFloat(HSQUIRRELVM vm, SQInteger idx);
|
||||
*/
|
||||
SQMOD_NODISCARD bool SToB(const SQChar * str);
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* RAII allocator initializer.
|
||||
*/
|
||||
struct RPMallocInit
|
||||
{
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Default constructor.
|
||||
*/
|
||||
RPMallocInit()
|
||||
{
|
||||
if (rpmalloc_initialize() != 0)
|
||||
{
|
||||
OutputError("Failed to initialize memory allocator");
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor (disabled).
|
||||
*/
|
||||
RPMallocInit(const RPMallocInit &) = delete;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor (disabled).
|
||||
*/
|
||||
RPMallocInit(RPMallocInit &&) noexcept = delete;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*/
|
||||
~RPMallocInit()
|
||||
{
|
||||
if (rpmalloc_is_thread_initialized()) rpmalloc_finalize();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy assignment operator (disabled).
|
||||
*/
|
||||
RPMallocInit & operator = (const RPMallocInit &) = delete;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy assignment operator (disabled).
|
||||
*/
|
||||
RPMallocInit & operator = (RPMallocInit &&) noexcept = delete;
|
||||
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* RAII allocator thread initializer.
|
||||
*/
|
||||
struct RPMallocThreadInit
|
||||
{
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Default constructor.
|
||||
*/
|
||||
RPMallocThreadInit()
|
||||
{
|
||||
rpmalloc_thread_initialize();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor (disabled).
|
||||
*/
|
||||
RPMallocThreadInit(const RPMallocThreadInit &) = delete;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor (disabled).
|
||||
*/
|
||||
RPMallocThreadInit(RPMallocThreadInit &&) noexcept = delete;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*/
|
||||
~RPMallocThreadInit()
|
||||
{
|
||||
if (rpmalloc_is_thread_initialized()) rpmalloc_thread_finalize(1);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy assignment operator (disabled).
|
||||
*/
|
||||
RPMallocThreadInit & operator = (const RPMallocThreadInit &) = delete;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy assignment operator (disabled).
|
||||
*/
|
||||
RPMallocThreadInit & operator = (RPMallocThreadInit &&) noexcept = delete;
|
||||
|
||||
};
|
||||
|
||||
} // Namespace:: SqMod
|
||||
|
||||
@@ -347,7 +347,7 @@ void Core::EmitIncomingConnection(char * player_name, size_t name_buffer_size, c
|
||||
// Release any stored buffer information
|
||||
m_IncomingNameBuffer = nullptr;
|
||||
m_IncomingNameCapacity = 0;
|
||||
// We catched the exception so we can release the assigned buffer
|
||||
// We caught the exception so we can release the assigned buffer
|
||||
throw; // re-throw it
|
||||
}
|
||||
// Release any stored buffer information
|
||||
@@ -392,7 +392,8 @@ void Core::EmitPlayerRequestSpawn(int32_t player_id)
|
||||
#ifdef VCMP_ENABLE_OFFICIAL
|
||||
if (IsOfficial())
|
||||
{
|
||||
ExecuteLegacyEvent(m_VM, _SC("onPlayerRequestSpawn"), _player.mLgObj);
|
||||
LightObj r = EvaluateLegacyEvent(m_VM, _SC("onPlayerRequestSpawn"), _player.mLgObj);
|
||||
SetState(r.IsNull() ? 1 : r.Cast< int32_t >());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -2245,6 +2246,44 @@ void Core::EmitClientScriptData(int32_t player_id, const uint8_t * data, size_t
|
||||
m_ClientData.Release();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Core::EmitExtCommandReply(int32_t sender, int32_t tag, const uint8_t * data, size_t size)
|
||||
{
|
||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ExtCommandReply(%i, %i, %p, %zu)", sender, tag, data, size)
|
||||
// Don't even bother if there's no one listening
|
||||
if (!(mOnExtCommandReply.first->IsEmpty()))
|
||||
{
|
||||
// Allocate a buffer with the received size
|
||||
Buffer b(static_cast< Buffer::SzType >(size));
|
||||
// Replicate the data to the allocated buffer
|
||||
b.Write(0, reinterpret_cast< Buffer::ConstPtr >(data), static_cast< Buffer::SzType >(size));
|
||||
// Prepare an object for the obtained buffer
|
||||
LightObj obj(SqTypeIdentity< SqBuffer >{}, m_VM, std::move(b));
|
||||
// Forward the event call
|
||||
(*mOnExtCommandReply.first)(sender, tag, obj, size);
|
||||
}
|
||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ExtCommandReply")
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Core::EmitExtCommandEvent(int32_t sender, int32_t tag, const uint8_t * data, size_t size)
|
||||
{
|
||||
SQMOD_CO_EV_TRACEBACK("[TRACE<] Core::ExtCommandEvent(%i, %i, %p, %zu)", sender, tag, data, size)
|
||||
// Don't even bother if there's no one listening
|
||||
if (!(mOnExtCommandEvent.first->IsEmpty()))
|
||||
{
|
||||
// Allocate a buffer with the received size
|
||||
Buffer b(static_cast< Buffer::SzType >(size));
|
||||
// Replicate the data to the allocated buffer
|
||||
b.Write(0, reinterpret_cast< Buffer::ConstPtr >(data), static_cast< Buffer::SzType >(size));
|
||||
// Prepare an object for the obtained buffer
|
||||
LightObj obj(SqTypeIdentity< SqBuffer >{}, m_VM, std::move(b));
|
||||
// Forward the event call
|
||||
(*mOnExtCommandEvent.first)(sender, tag, obj, size);
|
||||
}
|
||||
SQMOD_CO_EV_TRACEBACK("[TRACE>] Core::ExtCommandEvent")
|
||||
}
|
||||
|
||||
#undef NULL_SQOBJ_ // don't need this anymore
|
||||
|
||||
} // Namespace:: SqMod
|
||||
|
||||
@@ -549,6 +549,8 @@ void Register_Routine(HSQUIRRELVM vm)
|
||||
.Prop(_SC("Inactive"), &Routine::GetInactive)
|
||||
.Prop(_SC("Persistent"), &Routine::GetPersistent, &Routine::SetPersistent)
|
||||
.Prop(_SC("Yields"), &Routine::GetYields, &Routine::SetYields)
|
||||
.Prop(_SC("Elapsed"), &Routine::GetElapsed)
|
||||
.Prop(_SC("Remaining"), &Routine::GetRemaining)
|
||||
.Prop(_SC("Terminated"), &Routine::GetTerminated)
|
||||
.Prop(_SC("Arguments"), &Routine::GetArguments)
|
||||
// Member Methods
|
||||
|
||||
@@ -408,7 +408,6 @@ public:
|
||||
}
|
||||
// Unable to find such routine
|
||||
STHROWF("Unable to fetch a routine with tag ({}). No such routine", tag.mPtr);
|
||||
SQ_UNREACHABLE
|
||||
// Should not reach this point but if it did, we have to return something
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
@@ -418,6 +417,7 @@ public:
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
SQ_UNREACHABLE
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
@@ -804,6 +804,32 @@ public:
|
||||
return (m_Slot == SQMOD_MAX_ROUTINES);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the time elapsed since the routine was created or invoked.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetElapsed() const
|
||||
{
|
||||
if (m_Slot >= SQMOD_MAX_ROUTINES)
|
||||
{
|
||||
STHROWF("This instance does not reference a valid routine");
|
||||
}
|
||||
// We know it's valid so let's return it
|
||||
return s_Instances[m_Slot].mInterval - s_Intervals[m_Slot];
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the time remaining until the routine is invoked.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetRemaining() const
|
||||
{
|
||||
if (m_Slot >= SQMOD_MAX_ROUTINES)
|
||||
{
|
||||
STHROWF("This instance does not reference a valid routine");
|
||||
}
|
||||
// We know it's valid so let's return it
|
||||
return s_Intervals[m_Slot];
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the number of arguments to be forwarded.
|
||||
*/
|
||||
|
||||
@@ -1723,6 +1723,7 @@ void Register_Signal(HSQUIRRELVM vm)
|
||||
.SquirrelFunc(_SC("Eliminate"), &Signal::SqEliminate)
|
||||
.SquirrelFunc(_SC("EliminateThis"), &Signal::SqEliminateThis)
|
||||
.SquirrelFunc(_SC("EliminateFunc"), &Signal::SqEliminateFunc)
|
||||
.SquirrelFunc(_SC("Broadcast"), &Signal::SqEmit)
|
||||
.SquirrelFunc(_SC("Emit"), &Signal::SqEmit)
|
||||
.SquirrelFunc(_SC("Query"), &Signal::SqQuery)
|
||||
.SquirrelFunc(_SC("Consume"), &Signal::SqConsume)
|
||||
|
||||
@@ -328,17 +328,40 @@ SQInteger Tasks::Find(int32_t id, int32_t type, SQInteger & pos, HSQUIRRELVM vm)
|
||||
{
|
||||
// Grab the top of the stack
|
||||
const SQInteger top = sq_gettop(vm);
|
||||
// Was there a callback specified?
|
||||
// Was there a callback or tag specified?
|
||||
if (top <= 1)
|
||||
{
|
||||
return sq_throwerror(vm, "Missing task callback");
|
||||
return sq_throwerror(vm, "Missing task callback or tag");
|
||||
}
|
||||
|
||||
SQRESULT res = SQ_OK;
|
||||
// Grab the hash of the callback object
|
||||
const SQHash chash = sq_gethash(vm, 2);
|
||||
// Fetch the task identifier type
|
||||
const SQObjectType ot = sq_gettype(vm, 2);
|
||||
// Are we looking for a task with a specific tag?
|
||||
if (ot == OT_STRING)
|
||||
{
|
||||
// Attempt to retrieve the value from the stack as a string
|
||||
StackStrF tag(vm, 2);
|
||||
// Have we failed to retrieve the string?
|
||||
if (SQ_FAILED(tag.Proc(true)))
|
||||
{
|
||||
return tag.mRes; // Propagate the error!
|
||||
}
|
||||
// Attempt to find the requested task
|
||||
for (const auto & t : s_Tasks)
|
||||
{
|
||||
if (t.mEntity == id && t.mType == type && t.mTag.compare(0, String::npos, tag.mPtr) == 0)
|
||||
{
|
||||
pos = static_cast< SQInteger >(&t - s_Tasks); // Store the index of this element
|
||||
}
|
||||
}
|
||||
}
|
||||
// Validate the callback type
|
||||
else if (ot != OT_CLOSURE && ot != OT_NATIVECLOSURE)
|
||||
{
|
||||
return sq_throwerror(vm, "Invalid callback type");
|
||||
}
|
||||
// Should we include the iterations in the criteria?
|
||||
if (top > 3)
|
||||
else if (top > 3)
|
||||
{
|
||||
SQInteger intrv = 0;
|
||||
// Grab the interval from the stack
|
||||
@@ -348,6 +371,8 @@ SQInteger Tasks::Find(int32_t id, int32_t type, SQInteger & pos, HSQUIRRELVM vm)
|
||||
{
|
||||
return res; // Propagate the error
|
||||
}
|
||||
// Grab the hash of the callback object
|
||||
const SQHash chash = sq_gethash(vm, 2);
|
||||
// Attempt to find the requested task
|
||||
for (const auto & t : s_Tasks)
|
||||
{
|
||||
@@ -375,6 +400,8 @@ SQInteger Tasks::Find(int32_t id, int32_t type, SQInteger & pos, HSQUIRRELVM vm)
|
||||
{
|
||||
return res; // Propagate the error
|
||||
}
|
||||
// Grab the hash of the callback object
|
||||
const SQHash chash = sq_gethash(vm, 2);
|
||||
// Cast iterations to the right type
|
||||
const Iterator itr = ConvTo< Iterator >::From(sqitr);
|
||||
// Attempt to find the requested task
|
||||
@@ -388,6 +415,8 @@ SQInteger Tasks::Find(int32_t id, int32_t type, SQInteger & pos, HSQUIRRELVM vm)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Grab the hash of the callback object
|
||||
const SQHash chash = sq_gethash(vm, 2);
|
||||
// Attempt to find the requested task
|
||||
for (const auto & t : s_Tasks)
|
||||
{
|
||||
@@ -416,7 +445,7 @@ SQInteger Tasks::Remove(int32_t id, int32_t type, HSQUIRRELVM vm)
|
||||
// Did we find anything?
|
||||
else if (pos < 0)
|
||||
{
|
||||
return sq_throwerror(vm, "Unable to locate such task");
|
||||
sq_pushbool(vm, SQFalse); // Unable to locate such task
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -424,9 +453,11 @@ SQInteger Tasks::Remove(int32_t id, int32_t type, HSQUIRRELVM vm)
|
||||
s_Tasks[pos].Terminate();
|
||||
// Reset the timer
|
||||
s_Intervals[pos] = 0;
|
||||
// A task was successfully removed
|
||||
sq_pushbool(vm, SQTrue);
|
||||
}
|
||||
// Specify that we don't return anything
|
||||
return 0;
|
||||
// Specify that we return a value
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -37,9 +37,9 @@ private:
|
||||
LightObj mData; // A reference to the arbitrary data associated with this instance.
|
||||
Iterator mIterations; // Number of iterations before self destruct.
|
||||
Interval mInterval; // Interval between task invocations.
|
||||
int16_t mEntity; // The identifier of the entity to which is belongs.
|
||||
uint8_t mType; // The type of the entity to which is belongs.
|
||||
uint8_t mArgc; // The number of arguments that the task must forward.
|
||||
int16_t mEntity; // The identifier of the entity to which is belongs.
|
||||
uint8_t mType; // The type of the entity to which is belongs.
|
||||
uint8_t mArgc; // The number of arguments that the task must forward.
|
||||
Argument mArgv[8]; // The arguments that the task must forward.
|
||||
|
||||
/* ----------------------------------------------------------------------------------------
|
||||
|
||||
@@ -103,7 +103,7 @@ void ThreadPool::Terminate(bool SQ_UNUSED_ARG(shutdown))
|
||||
// Is the item valid?
|
||||
if (item)
|
||||
{
|
||||
item->OnCompleted(); // Allow the item to finish itself
|
||||
[[maybe_unused]] auto _ = item->OnCompleted(true); // Allow the item to finish itself
|
||||
}
|
||||
// Item processed
|
||||
item.reset();
|
||||
@@ -125,7 +125,15 @@ void ThreadPool::Process()
|
||||
// Is the item valid?
|
||||
if (item)
|
||||
{
|
||||
item->OnCompleted(); // Allow the item to finish itself
|
||||
try {
|
||||
// Allow the item to finish itself
|
||||
if (item->OnCompleted(false))
|
||||
{
|
||||
Enqueue(std::move(item)); // Queue again
|
||||
}
|
||||
} catch (const std::exception & e) {
|
||||
LogErr("Exception occured in %s completion stage [%s] for [%s]", item->TypeName(), e.what(), item->IdentifiableInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,6 +146,8 @@ void ThreadPool::WorkerProc()
|
||||
bool retry = false;
|
||||
// Pointer to the dequeued item
|
||||
Item item;
|
||||
// Initialize third-party allocator for this thread
|
||||
auto rpmallocinit = std::make_unique< RPMallocThreadInit >();
|
||||
// Constantly process items from the queue
|
||||
while (true)
|
||||
{
|
||||
@@ -147,7 +157,11 @@ void ThreadPool::WorkerProc()
|
||||
// Is there an item that requested to try again?
|
||||
if (item)
|
||||
{
|
||||
item->OnAborted(true); // NOLINT(bugprone-use-after-move) There's an `if` condition above idiot!
|
||||
try {
|
||||
item->OnAborted(true); // NOLINT(bugprone-use-after-move) There's an `if` condition above idiot!
|
||||
} catch (const std::exception & e) {
|
||||
LogErr("Exception occured in %s cancelation stage [%s] for [%s]", item->TypeName(), e.what(), item->IdentifiableInfo());
|
||||
}
|
||||
}
|
||||
// Exit the loop
|
||||
break;
|
||||
@@ -173,15 +187,30 @@ void ThreadPool::WorkerProc()
|
||||
// Is there an item to be processed?
|
||||
if (item)
|
||||
{
|
||||
item->OnAborted(false); // It should mark itself as aborted somehow!
|
||||
try {
|
||||
item->OnAborted(false); // It should mark itself as aborted somehow!
|
||||
} catch (const std::exception & e) {
|
||||
LogErr("Exception occured in %s forced cancelation stage [%s] for [%s]", item->TypeName(), e.what(), item->IdentifiableInfo());
|
||||
}
|
||||
}
|
||||
// Exit the loop
|
||||
break;
|
||||
}
|
||||
bool r;
|
||||
// Attempt preparation
|
||||
try {
|
||||
r = item->OnPrepare();
|
||||
} catch (const std::exception & e) {
|
||||
LogErr("Exception occured in %s preparation stage [%s] for [%s]", item->TypeName(), e.what(), item->IdentifiableInfo());
|
||||
}
|
||||
// Perform the task
|
||||
if (item->OnPrepare())
|
||||
if (r)
|
||||
{
|
||||
retry = item->OnProcess();
|
||||
try {
|
||||
retry = item->OnProcess();
|
||||
} catch (const std::exception & e) {
|
||||
LogErr("Exception occured in %s processing stage [%s] for [%s]", item->TypeName(), e.what(), item->IdentifiableInfo());
|
||||
}
|
||||
}
|
||||
// The task was performed
|
||||
if (!retry)
|
||||
|
||||
@@ -55,6 +55,16 @@ struct ThreadPoolItem
|
||||
*/
|
||||
ThreadPoolItem & operator = (ThreadPoolItem && o) = delete;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Provide a name to what type of task this is. Mainly for debugging purposes.
|
||||
*/
|
||||
SQMOD_NODISCARD virtual const char * TypeName() noexcept { return "worker item"; }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Provide unique information that may help identify the task. Mainly for debugging purposes.
|
||||
*/
|
||||
SQMOD_NODISCARD virtual const char * IdentifiableInfo() noexcept { return ""; }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Invoked in worker thread by the thread pool after obtaining the task from the queue.
|
||||
* Must return true to indicate that the task can be performed. False indicates failure.
|
||||
@@ -69,8 +79,10 @@ struct ThreadPoolItem
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Invoked in main thread by the thread pool after the task was completed.
|
||||
* If it returns true then it will be put back into the queue to be processed again.
|
||||
* If the boolean parameter is true then the thread-pool is in the process of shutting down.
|
||||
*/
|
||||
virtual void OnCompleted() { }
|
||||
SQMOD_NODISCARD virtual bool OnCompleted(bool SQ_UNUSED_ARG(stop)) { return false; }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Called in worker by the thread pool to let the task know that it will be aborted.
|
||||
@@ -98,13 +110,13 @@ private:
|
||||
* Destructor.
|
||||
*/
|
||||
~ThreadPool();
|
||||
|
||||
public:
|
||||
// --------------------------------------------------------------------------------------------
|
||||
using Item = std::unique_ptr< ThreadPoolItem >; // Owning pointer of an item.
|
||||
private:
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
using Pool = std::vector< std::thread >; // Worker container.
|
||||
using Item = std::unique_ptr< ThreadPoolItem >; // Owning pointer of an item.
|
||||
// --------------------------------------------------------------------------------------------
|
||||
using Finished = moodycamel::ConcurrentQueue< Item >; // Finished items.
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
@@ -171,9 +183,25 @@ public:
|
||||
void Process();
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Queue an item to be processed.
|
||||
* Queue an item to be processed. Will take ownership of the given pointer!
|
||||
*/
|
||||
void Enqueue(ThreadPoolItem * item)
|
||||
{
|
||||
Enqueue(Item{item});
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Queue an item to be processed. Will take ownership of the given pointer!
|
||||
*/
|
||||
template < class T > void CastEnqueue(std::unique_ptr< T > && item)
|
||||
{
|
||||
Enqueue(Item{std::forward< std::unique_ptr< T > >(item)});
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Queue an item to be processed. Will take ownership of the given pointer!
|
||||
*/
|
||||
void Enqueue(Item && item)
|
||||
{
|
||||
// Only queue valid items
|
||||
if (!item || !m_Running) return;
|
||||
@@ -183,7 +211,7 @@ public:
|
||||
// Acquire a lock on the mutex
|
||||
std::unique_lock< std::mutex > lock(m_Mutex);
|
||||
// Push the item in the queue
|
||||
m_Queue.push(Item(item));
|
||||
m_Queue.push(std::forward< Item >(item));
|
||||
// Release the mutex before notifying
|
||||
lock.unlock();
|
||||
// Notify one thread that there's work
|
||||
@@ -191,16 +219,32 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
bool r;
|
||||
// Attempt preparation
|
||||
try {
|
||||
r = item->OnPrepare();
|
||||
} catch (const std::exception & e) {
|
||||
LogErr("Exception occured in %s preparation stage [%s] for [%s]", item->TypeName(), e.what(), item->IdentifiableInfo());
|
||||
}
|
||||
// Perform the task in-place
|
||||
if (item->OnPrepare())
|
||||
if (r)
|
||||
{
|
||||
if (item->OnProcess())
|
||||
try {
|
||||
r = item->OnProcess();
|
||||
} catch (const std::exception & e) {
|
||||
LogErr("Exception occured in %s processing stage [%s] for [%s]", item->TypeName(), e.what(), item->IdentifiableInfo());
|
||||
}
|
||||
if (r)
|
||||
{
|
||||
item->OnAborted(true); // Not accepted in single thread
|
||||
try {
|
||||
item->OnAborted(true); // Not accepted in single thread
|
||||
} catch (const std::exception & e) {
|
||||
LogErr("Exception occured in %s cancelation stage [%s] for [%s]", item->TypeName(), e.what(), item->IdentifiableInfo());
|
||||
}
|
||||
}
|
||||
}
|
||||
// Item was finished in main thread
|
||||
item->OnCompleted();
|
||||
// Task is completed in processing stage
|
||||
m_Finished.enqueue(std::forward< Item >(item));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,7 +255,6 @@ public:
|
||||
{
|
||||
return m_Threads.size();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // Namespace:: SqMod
|
||||
|
||||
@@ -251,6 +251,20 @@ template < class Key, class T, class Pred = std::equal_to< Key > > struct VecMap
|
||||
return m_Storage.back().second;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieves a reference to the front of the container.
|
||||
* Available for internal use only.
|
||||
*/
|
||||
reference front() { return m_Storage.front(); }
|
||||
const_reference front() const { return m_Storage.front(); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieves a reference to the back of the container.
|
||||
* Available for internal use only.
|
||||
*/
|
||||
reference back() { return m_Storage.back(); }
|
||||
const_reference back() const { return m_Storage.back(); }
|
||||
|
||||
private:
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -468,6 +468,16 @@ void CCheckpoint::SetColorA(int32_t a) const
|
||||
// Perform the requested operation
|
||||
_Func->SetCheckPointColour(m_ID, r, g, b, a);
|
||||
}
|
||||
#ifdef VCMP_ENABLE_OFFICIAL
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
LightObj & CCheckpoint::GetLegacyObject() const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Return the requested information
|
||||
return Core::Get().GetCheckpoint(m_ID).mLgObj;
|
||||
}
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static LightObj & Checkpoint_CreateEx1a(int32_t world, bool sphere, float x, float y, float z,
|
||||
@@ -517,6 +527,9 @@ void Register_CCheckpoint(HSQUIRRELVM vm)
|
||||
.Prop(_SC("Tag"), &CCheckpoint::GetTag, &CCheckpoint::SetTag)
|
||||
.Prop(_SC("Data"), &CCheckpoint::GetData, &CCheckpoint::SetData)
|
||||
.Prop(_SC("Active"), &CCheckpoint::IsActive)
|
||||
#ifdef VCMP_ENABLE_OFFICIAL
|
||||
.Prop(_SC("Legacy"), &CCheckpoint::GetLegacyObject)
|
||||
#endif
|
||||
// Core Methods
|
||||
.FmtFunc(_SC("SetTag"), &CCheckpoint::ApplyTag)
|
||||
.Func(_SC("CustomEvent"), &CCheckpoint::CustomEvent)
|
||||
|
||||
@@ -320,6 +320,12 @@ public:
|
||||
* Modify the alpha transparency of the managed checkpoint entity.
|
||||
*/
|
||||
void SetColorA(int32_t a) const;
|
||||
#ifdef VCMP_ENABLE_OFFICIAL
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve legacy object instance for this entity.
|
||||
*/
|
||||
LightObj & GetLegacyObject() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // Namespace:: SqMod
|
||||
|
||||
@@ -833,6 +833,16 @@ void CObject::RotateByEulerZ(float z) const
|
||||
// Perform the requested operation
|
||||
_Func->RotateObjectByEuler(m_ID, 0.0f, 0.0f, z, mRotateByEulerDuration);
|
||||
}
|
||||
#ifdef VCMP_ENABLE_OFFICIAL
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
LightObj & CObject::GetLegacyObject() const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Return the requested information
|
||||
return Core::Get().GetObj(m_ID).mLgObj;
|
||||
}
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static LightObj & Object_CreateEx1a(int32_t model, int32_t world, float x, float y, float z,
|
||||
@@ -883,6 +893,9 @@ void Register_CObject(HSQUIRRELVM vm)
|
||||
.Prop(_SC("Tag"), &CObject::GetTag, &CObject::SetTag)
|
||||
.Prop(_SC("Data"), &CObject::GetData, &CObject::SetData)
|
||||
.Prop(_SC("Active"), &CObject::IsActive)
|
||||
#ifdef VCMP_ENABLE_OFFICIAL
|
||||
.Prop(_SC("Legacy"), &CObject::GetLegacyObject)
|
||||
#endif
|
||||
// Core Methods
|
||||
.FmtFunc(_SC("SetTag"), &CObject::ApplyTag)
|
||||
.Func(_SC("CustomEvent"), &CObject::CustomEvent)
|
||||
|
||||
@@ -499,6 +499,12 @@ public:
|
||||
* Modify the rotation on the z axis of the managed object entity.
|
||||
*/
|
||||
void RotateByEulerZ(float z) const;
|
||||
#ifdef VCMP_ENABLE_OFFICIAL
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve legacy object instance for this entity.
|
||||
*/
|
||||
LightObj & GetLegacyObject() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // Namespace:: SqMod
|
||||
|
||||
@@ -449,6 +449,16 @@ void CPickup::SetPositionZ(float z) const
|
||||
// Perform the requested operation
|
||||
_Func->SetPickupPosition(m_ID, z, y, z);
|
||||
}
|
||||
#ifdef VCMP_ENABLE_OFFICIAL
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
LightObj & CPickup::GetLegacyObject() const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Return the requested information
|
||||
return Core::Get().GetPickup(m_ID).mLgObj;
|
||||
}
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static LightObj & Pickup_CreateEx1a(int32_t model, int32_t world, int32_t quantity,
|
||||
@@ -496,6 +506,9 @@ void Register_CPickup(HSQUIRRELVM vm)
|
||||
.Prop(_SC("Tag"), &CPickup::GetTag, &CPickup::SetTag)
|
||||
.Prop(_SC("Data"), &CPickup::GetData, &CPickup::SetData)
|
||||
.Prop(_SC("Active"), &CPickup::IsActive)
|
||||
#ifdef VCMP_ENABLE_OFFICIAL
|
||||
.Prop(_SC("Legacy"), &CPickup::GetLegacyObject)
|
||||
#endif
|
||||
// Core Methods
|
||||
.FmtFunc(_SC("SetTag"), &CPickup::ApplyTag)
|
||||
.Func(_SC("CustomEvent"), &CPickup::CustomEvent)
|
||||
|
||||
@@ -298,6 +298,12 @@ public:
|
||||
* Modify the position on the z axis of the managed pickup entity.
|
||||
*/
|
||||
void SetPositionZ(float z) const;
|
||||
#ifdef VCMP_ENABLE_OFFICIAL
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve legacy object instance for this entity.
|
||||
*/
|
||||
LightObj & GetLegacyObject() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // Namespace:: SqMod
|
||||
|
||||
@@ -2593,7 +2593,16 @@ SQInteger CPlayer::AnnounceEx(HSQUIRRELVM vm)
|
||||
// This function does not return a value
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef VCMP_ENABLE_OFFICIAL
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
LightObj & CPlayer::GetLegacyObject() const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Return the requested information
|
||||
return Core::Get().GetPlayer(m_ID).mLgObj;
|
||||
}
|
||||
#endif
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQInteger Player_FindAuto(HSQUIRRELVM vm)
|
||||
{
|
||||
@@ -2793,6 +2802,9 @@ void Register_CPlayer(HSQUIRRELVM vm)
|
||||
.Prop(_SC("Tag"), &CPlayer::GetTag, &CPlayer::SetTag)
|
||||
.Prop(_SC("Data"), &CPlayer::GetData, &CPlayer::SetData)
|
||||
.Prop(_SC("Active"), &CPlayer::IsActive)
|
||||
#ifdef VCMP_ENABLE_OFFICIAL
|
||||
.Prop(_SC("Legacy"), &CPlayer::GetLegacyObject)
|
||||
#endif
|
||||
// Core Methods
|
||||
.FmtFunc(_SC("SetTag"), &CPlayer::ApplyTag)
|
||||
.Func(_SC("CustomEvent"), &CPlayer::CustomEvent)
|
||||
|
||||
@@ -1101,6 +1101,12 @@ public:
|
||||
* Send a formatted announcement message to the managed player entity.
|
||||
*/
|
||||
static SQInteger AnnounceEx(HSQUIRRELVM vm);
|
||||
#ifdef VCMP_ENABLE_OFFICIAL
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve legacy object instance for this entity.
|
||||
*/
|
||||
LightObj & GetLegacyObject() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // Namespace:: SqMod
|
||||
|
||||
@@ -2015,6 +2015,16 @@ void CVehicle::SetRelativeTurnSpeedZ(float z) const
|
||||
// Perform the requested operation
|
||||
_Func->SetVehicleTurnSpeed(m_ID, z, y, z, static_cast< uint8_t >(false), static_cast< uint8_t >(true));
|
||||
}
|
||||
#ifdef VCMP_ENABLE_OFFICIAL
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
LightObj & CVehicle::GetLegacyObject() const
|
||||
{
|
||||
// Validate the managed identifier
|
||||
Validate();
|
||||
// Return the requested information
|
||||
return Core::Get().GetVehicle(m_ID).mLgObj;
|
||||
}
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static LightObj & Vehicle_CreateEx1a(int32_t model, int32_t world, float x, float y, float z, float angle,
|
||||
@@ -2061,6 +2071,9 @@ void Register_CVehicle(HSQUIRRELVM vm)
|
||||
.Prop(_SC("ID"), &CVehicle::GetID)
|
||||
.Prop(_SC("Tag"), &CVehicle::GetTag, &CVehicle::SetTag)
|
||||
.Prop(_SC("Data"), &CVehicle::GetData, &CVehicle::SetData)
|
||||
#ifdef VCMP_ENABLE_OFFICIAL
|
||||
.Prop(_SC("Legacy"), &CVehicle::GetLegacyObject)
|
||||
#endif
|
||||
.Prop(_SC("Active"), &CVehicle::IsActive)
|
||||
// Core Methods
|
||||
.FmtFunc(_SC("SetTag"), &CVehicle::ApplyTag)
|
||||
|
||||
@@ -942,6 +942,12 @@ public:
|
||||
* Modify the relative turn velocity on the z axis of the managed vehicle entity.
|
||||
*/
|
||||
void SetRelativeTurnSpeedZ(float z) const;
|
||||
#ifdef VCMP_ENABLE_OFFICIAL
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve legacy object instance for this entity.
|
||||
*/
|
||||
LightObj & GetLegacyObject() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // Namespace:: SqMod
|
||||
|
||||
73
module/Exports.cpp
Normal file
73
module/Exports.cpp
Normal file
@@ -0,0 +1,73 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <cstring>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <sqmod.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static int32_t RegisterCommandFn(ExtPluginCommand_t fn)
|
||||
{
|
||||
return Core::Get().RegisterExtCommand(fn);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static int32_t UnregisterCommandFn(ExtPluginCommand_t fn)
|
||||
{
|
||||
return Core::Get().UnregisterExtCommand(fn);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static int32_t SendCommandFn(int32_t target, int32_t req, int32_t tag, const uint8_t * data, size_t size)
|
||||
{
|
||||
return Core::Get().SendExtCommand(target, req, tag, data, size);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static int32_t SendCommandReplyFn(int32_t sender, int32_t tag, const uint8_t * data, size_t size)
|
||||
{
|
||||
// Mark the initialization as successful by default
|
||||
const CoreState cs(SQMOD_SUCCESS);
|
||||
// Forward the call to the script callbacks
|
||||
Core::Get().EmitExtCommandReply(sender, tag, data, size);
|
||||
// Return the last known plug-in state
|
||||
return Core::Get().GetState();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static int32_t SendCommandEventFn(int32_t sender, int32_t tag, const uint8_t * data, size_t size)
|
||||
{
|
||||
// Mark the initialization as successful by default
|
||||
const CoreState cs(SQMOD_SUCCESS);
|
||||
// Forward the call to the script callbacks
|
||||
Core::Get().EmitExtCommandEvent(sender, tag, data, size);
|
||||
// Return the last known plug-in state
|
||||
return Core::Get().GetState();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const SQ_MOD_EXPORTS g_SqModExports{
|
||||
sizeof(SQ_MOD_EXPORTS),
|
||||
&RegisterCommandFn,
|
||||
&UnregisterCommandFn,
|
||||
&SendCommandFn,
|
||||
&SendCommandReplyFn,
|
||||
&SendCommandEventFn
|
||||
};
|
||||
|
||||
// The server needs a pointer to a pointer, and a persistent one
|
||||
static const SQ_MOD_EXPORTS * g_SqModExportsPtr = &g_SqModExports;
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void InitExports()
|
||||
{
|
||||
// Tell the server about the pointer to the exports structure
|
||||
_Func->ExportFunctions(_Info->pluginId, reinterpret_cast< const void ** >(&g_SqModExportsPtr), sizeof(HSQ_MOD_EXPORTS));
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -47,9 +47,11 @@ struct CpBaseAction : public ThreadPoolItem
|
||||
~CpBaseAction() override = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Task completed callback.
|
||||
* Invoked in main thread by the thread pool after the task was completed.
|
||||
* If it returns true then it will be put back into the queue to be processed again.
|
||||
* If the boolean parameter is trye then the thread-pool is in the process of shutting down.
|
||||
*/
|
||||
void OnCompleted() override
|
||||
SQMOD_NODISCARD bool OnCompleted(bool SQ_UNUSED_ARG(stop)) override
|
||||
{
|
||||
// Is there a callback?
|
||||
if (!mCallback.IsNull())
|
||||
@@ -58,6 +60,8 @@ struct CpBaseAction : public ThreadPoolItem
|
||||
}
|
||||
// Unlock the session
|
||||
mInstance->mPending = nullptr;
|
||||
// Don't re-queue
|
||||
return false;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/DPP.hpp"
|
||||
#include "Library/DPP/Cluster.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <sqratConst.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void TerminateDPP()
|
||||
{
|
||||
// Go over all clusters and try to terminate them
|
||||
for (DpCluster * inst = DpCluster::sHead; inst && inst->mNext != DpCluster::sHead; inst = inst->mNext)
|
||||
{
|
||||
inst->Terminate(); // Terminate() the cluster
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void ProcessDPP()
|
||||
{
|
||||
// Go over all clusters and allow them to process data
|
||||
for (DpCluster * inst = DpCluster::sHead; inst && inst->mNext != DpCluster::sHead; inst = inst->mNext)
|
||||
{
|
||||
inst->Process();
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
extern void Register_DPP_Channel(HSQUIRRELVM vm, Table & ns);
|
||||
extern void Register_DPP_Client(HSQUIRRELVM vm, Table & ns);
|
||||
extern void Register_DPP_Cluster(HSQUIRRELVM vm, Table & ns);
|
||||
extern void Register_DPP_Command(HSQUIRRELVM vm, Table & ns);
|
||||
extern void Register_DPP_Constants(HSQUIRRELVM vm, Table & ns);
|
||||
extern void Register_DPP_Events(HSQUIRRELVM vm, Table & ns);
|
||||
extern void Register_DPP_Guild(HSQUIRRELVM vm, Table & ns);
|
||||
extern void Register_DPP_Integration(HSQUIRRELVM vm, Table & ns);
|
||||
extern void Register_DPP_Message(HSQUIRRELVM vm, Table & ns);
|
||||
extern void Register_DPP_Other(HSQUIRRELVM vm, Table & ns);
|
||||
extern void Register_DPP_Role(HSQUIRRELVM vm, Table & ns);
|
||||
extern void Register_DPP_User(HSQUIRRELVM vm, Table & ns);
|
||||
|
||||
// ================================================================================================
|
||||
void Register_DPP(HSQUIRRELVM vm)
|
||||
{
|
||||
Table ns(vm);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
Register_DPP_Constants(vm, ns);
|
||||
Register_DPP_Client(vm, ns);
|
||||
Register_DPP_Integration(vm, ns);
|
||||
Register_DPP_Command(vm, ns);
|
||||
Register_DPP_Message(vm, ns);
|
||||
Register_DPP_Channel(vm, ns);
|
||||
Register_DPP_Other(vm, ns);
|
||||
Register_DPP_Role(vm, ns);
|
||||
Register_DPP_User(vm, ns);
|
||||
Register_DPP_Guild(vm, ns);
|
||||
{
|
||||
Table ens(vm);
|
||||
Register_DPP_Events(vm, ens);
|
||||
ns.Bind(_SC("Events"), ens);
|
||||
}
|
||||
Register_DPP_Cluster(vm, ns);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Func(_SC("HasVoice"), dpp::utility::has_voice);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
RootTable(vm).Bind(_SC("SqDiscord"), ns);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -1,16 +0,0 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/DPP/Channel.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Register_DPP_Channel(HSQUIRRELVM vm, Table & ns)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -1,757 +0,0 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/DPP/Cluster.hpp"
|
||||
#include "Library/DPP/Events.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMOD_DECL_TYPENAME(SqDppCluster, _SC("SqDppCluster"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Register_DPP_Cluster(HSQUIRRELVM vm, Table & ns)
|
||||
{
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Cluster"),
|
||||
Class< DpCluster, NoCopy< DpCluster > >(vm, SqDppCluster::Str)
|
||||
// Constructors
|
||||
.Ctor< StackStrF & >()
|
||||
.Ctor< StackStrF &, SQInteger >()
|
||||
.Ctor< StackStrF &, SQInteger, SQInteger >()
|
||||
.Ctor< StackStrF &, SQInteger, SQInteger, SQInteger >()
|
||||
.Ctor< StackStrF &, SQInteger, SQInteger, SQInteger, SQInteger >()
|
||||
.Ctor< StackStrF &, SQInteger, SQInteger, SQInteger, SQInteger, bool >()
|
||||
.Ctor< StackStrF &, SQInteger, SQInteger, SQInteger, SQInteger, bool, const DpCachePolicy & >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppCluster::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("On"), &DpCluster::GetEvents)
|
||||
.Prop(_SC("UpTime"), &DpCluster::UpTime)
|
||||
// Member Methods
|
||||
.Func(_SC("Start"), &DpCluster::Start)
|
||||
.Func(_SC("Log"), &DpCluster::Log)
|
||||
.Func(_SC("GetDmChannel"), &DpCluster::GetDmChannel)
|
||||
.Func(_SC("SetDmChannel"), &DpCluster::SetDmChannel)
|
||||
.Func(_SC("SetPresence"), &DpCluster::SetPresence)
|
||||
.Func(_SC("EnableEvent"), &DpCluster::EnableEvent)
|
||||
.Func(_SC("DisableEvent"), &DpCluster::DisableEvent)
|
||||
);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMOD_NODISCARD LightObj EventToScriptObject(uint8_t type, uintptr_t data);
|
||||
void EventInvokeCleanup(uint8_t type, uintptr_t data);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::Process(bool force)
|
||||
{
|
||||
// Is there a valid connection?
|
||||
if (!mC && !force)
|
||||
{
|
||||
return; // No point in going forward
|
||||
}
|
||||
DpInternalEvent event;
|
||||
// Retrieve each event individually and process it
|
||||
for (size_t count = mQueue.size_approx(), n = 0; n <= count; ++n)
|
||||
{
|
||||
// Try to get an event from the queue
|
||||
if (mQueue.try_dequeue(event))
|
||||
{
|
||||
// Fetch the type of event
|
||||
const auto type = event.GetType();
|
||||
// Fetch the event itself
|
||||
const auto data = event.GetData();
|
||||
// Is this a valid event and is anyone listening to it?
|
||||
if (event.mData == 0 || mEvents[type].first == nullptr || mEvents[type].first->IsEmpty())
|
||||
{
|
||||
continue; // Move on
|
||||
}
|
||||
// Transform the event instance into a script object
|
||||
LightObj obj = EventToScriptObject(type, data);
|
||||
// Allow the script to take ownership of the event instance now
|
||||
event.Reset();
|
||||
// Forward the call to the associated signal
|
||||
(*mEvents[type].first)(obj);
|
||||
// Allow the event instance to clean itself
|
||||
EventInvokeCleanup(type, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================================================================
|
||||
* Event handlers.
|
||||
*/
|
||||
void DpCluster::OnVoiceStateUpdate(const dpp::voice_state_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::VoiceStateUpdate, new DpVoiceStateUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnLog(const dpp::log_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::Log, new DpLogEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnGuildJoinRequestDelete(const dpp::guild_join_request_delete_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::GuildJoinRequestDelete, new DpGuildJoinRequestDeleteEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnInteractionCreate(const dpp::interaction_create_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::InteractionCreate, new DpInteractionCreateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnButtonClick(const dpp::button_click_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::ButtonClick, new DpButtonClickEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnSelectClick(const dpp::select_click_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::SelectClick, new DpSelectClickEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnGuildDelete(const dpp::guild_delete_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::GuildDelete, new DpGuildDeleteEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnChannelDelete(const dpp::channel_delete_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::ChannelDelete, new DpChannelDeleteEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnChannelUpdate(const dpp::channel_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::ChannelUpdate, new DpChannelUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnReady(const dpp::ready_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::Ready, new DpReadyEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnMessageDelete(const dpp::message_delete_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::MessageDelete, new DpMessageDeleteEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnApplicationCommandDelete(const dpp::application_command_delete_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::ApplicationCommandDelete, new DpApplicationCommandDeleteEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnGuildMemberRemove(const dpp::guild_member_remove_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::GuildMemberRemove, new DpGuildMemberRemoveEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnApplicationCommandCreate(const dpp::application_command_create_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::ApplicationCommandCreate, new DpApplicationCommandCreateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnResumed(const dpp::resumed_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::Resumed, new DpResumedEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnGuildRoleCreate(const dpp::guild_role_create_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::GuildRoleCreate, new DpGuildRoleCreateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnTypingStart(const dpp::typing_start_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::TypingStart, new DpTypingStartEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnMessageReactionAdd(const dpp::message_reaction_add_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::MessageReactionAdd, new DpMessageReactionAddEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnGuildMembersChunk(const dpp::guild_members_chunk_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::GuildMembersChunk, new DpGuildMembersChunkEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnMessageReactionRemove(const dpp::message_reaction_remove_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::MessageReactionRemove, new DpMessageReactionRemoveEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnGuildCreate(const dpp::guild_create_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::GuildCreate, new DpGuildCreateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnChannelCreate(const dpp::channel_create_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::ChannelCreate, new DpChannelCreateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnMessageReactionRemoveEmoji(const dpp::message_reaction_remove_emoji_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::MessageReactionRemoveEmoji, new DpMessageReactionRemoveEmojiEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnMessageDeleteBulk(const dpp::message_delete_bulk_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::MessageDeleteBulk, new DpMessageDeleteBulkEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnGuildRoleUpdate(const dpp::guild_role_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::GuildRoleUpdate, new DpGuildRoleUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnGuildRoleDelete(const dpp::guild_role_delete_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::GuildRoleDelete, new DpGuildRoleDeleteEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnChannelPinsUpdate(const dpp::channel_pins_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::ChannelPinsUpdate, new DpChannelPinsUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnMessageReactionRemoveAll(const dpp::message_reaction_remove_all_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::MessageReactionRemoveAll, new DpMessageReactionRemoveAllEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnVoiceServerUpdate(const dpp::voice_server_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::VoiceServerUpdate, new DpVoiceServerUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnGuildEmojisUpdate(const dpp::guild_emojis_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::GuildEmojisUpdate, new DpGuildEmojisUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnGuildStickersUpdate(const dpp::guild_stickers_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::GuildStickersUpdate, new DpGuildStickersUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnPresenceUpdate(const dpp::presence_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::PresenceUpdate, new DpPresenceUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnWebhooksUpdate(const dpp::webhooks_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::WebhooksUpdate, new DpWebhooksUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnGuildMemberAdd(const dpp::guild_member_add_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::GuildMemberAdd, new DpGuildMemberAddEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnInviteDelete(const dpp::invite_delete_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::InviteDelete, new DpInviteDeleteEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnGuildUpdate(const dpp::guild_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::GuildUpdate, new DpGuildUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnGuildIntegrationsUpdate(const dpp::guild_integrations_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::GuildIntegrationsUpdate, new DpGuildIntegrationsUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnGuildMemberUpdate(const dpp::guild_member_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::GuildMemberUpdate, new DpGuildMemberUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnApplicationCommandUpdate(const dpp::application_command_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::ApplicationCommandUpdate, new DpApplicationCommandUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnInviteCreate(const dpp::invite_create_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::InviteCreate, new DpInviteCreateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnMessageUpdate(const dpp::message_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::MessageUpdate, new DpMessageUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnUserUpdate(const dpp::user_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::UserUpdate, new DpUserUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnMessageCreate(const dpp::message_create_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::MessageCreate, new DpMessageCreateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnGuildBanAdd(const dpp::guild_ban_add_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::GuildBanAdd, new DpGuildBanAddEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnGuildBanRemove(const dpp::guild_ban_remove_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::GuildBanRemove, new DpGuildBanRemoveEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnIntegrationCreate(const dpp::integration_create_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::IntegrationCreate, new DpIntegrationCreateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnIntegrationUpdate(const dpp::integration_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::IntegrationUpdate, new DpIntegrationUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnIntegrationDelete(const dpp::integration_delete_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::IntegrationDelete, new DpIntegrationDeleteEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnThreadCreate(const dpp::thread_create_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::ThreadCreate, new DpThreadCreateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnThreadUpdate(const dpp::thread_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::ThreadUpdate, new DpThreadUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnThreadDelete(const dpp::thread_delete_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::ThreadDelete, new DpThreadDeleteEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnThreadListSync(const dpp::thread_list_sync_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::ThreadListSync, new DpThreadListSyncEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnThreadMemberUpdate(const dpp::thread_member_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::ThreadMemberUpdate, new DpThreadMemberUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnThreadMembersUpdate(const dpp::thread_members_update_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::ThreadMembersUpdate, new DpThreadMembersUpdateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnVoiceBufferSend(const dpp::voice_buffer_send_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::VoiceBufferSend, new DpVoiceBufferSendEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnVoiceUserTalking(const dpp::voice_user_talking_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::VoiceUserTalking, new DpVoiceUserTalkingEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnVoiceReady(const dpp::voice_ready_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::VoiceReady, new DpVoiceReadyEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnVoiceReceive(const dpp::voice_receive_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::VoiceReceive, new DpVoiceReceiveEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnVoiceTrackMarker(const dpp::voice_track_marker_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::VoiceTrackMarker, new DpVoiceTrackMarkerEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnStageInstanceCreate(const dpp::stage_instance_create_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::StageInstanceCreate, new DpStageInstanceCreateEvent(ev)));
|
||||
}
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnStageInstanceDelete(const dpp::stage_instance_delete_t & ev)
|
||||
{
|
||||
mQueue.enqueue(DpInternalEvent(DpEventID::StageInstanceDelete, new DpStageInstanceDeleteEvent(ev)));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
DpCluster & DpCluster::EnableEvent(SQInteger id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case DpEventID::VoiceStateUpdate: mC->on_voice_state_update([this](auto && e) { OnVoiceStateUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::Log: mC->on_log([this](auto && e) { OnLog(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::GuildJoinRequestDelete: mC->on_guild_join_request_delete([this](auto && e) { OnGuildJoinRequestDelete(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::InteractionCreate: mC->on_interaction_create([this](auto && e) { OnInteractionCreate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::ButtonClick: mC->on_button_click([this](auto && e) { OnButtonClick(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::SelectClick: mC->on_select_click([this](auto && e) { OnSelectClick(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::GuildDelete: mC->on_guild_delete([this](auto && e) { OnGuildDelete(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::ChannelDelete: mC->on_channel_delete([this](auto && e) { OnChannelDelete(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::ChannelUpdate: mC->on_channel_update([this](auto && e) { OnChannelUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::Ready: mC->on_ready([this](auto && e) { OnReady(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::MessageDelete: mC->on_message_delete([this](auto && e) { OnMessageDelete(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::ApplicationCommandDelete: mC->on_application_command_delete([this](auto && e) { OnApplicationCommandDelete(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::GuildMemberRemove: mC->on_guild_member_remove([this](auto && e) { OnGuildMemberRemove(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::ApplicationCommandCreate: mC->on_application_command_create([this](auto && e) { OnApplicationCommandCreate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::Resumed: mC->on_resumed([this](auto && e) { OnResumed(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::GuildRoleCreate: mC->on_guild_role_create([this](auto && e) { OnGuildRoleCreate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::TypingStart: mC->on_typing_start([this](auto && e) { OnTypingStart(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::MessageReactionAdd: mC->on_message_reaction_add([this](auto && e) { OnMessageReactionAdd(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::GuildMembersChunk: mC->on_guild_members_chunk([this](auto && e) { OnGuildMembersChunk(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::MessageReactionRemove: mC->on_message_reaction_remove([this](auto && e) { OnMessageReactionRemove(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::GuildCreate: mC->on_guild_create([this](auto && e) { OnGuildCreate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::ChannelCreate: mC->on_channel_create([this](auto && e) { OnChannelCreate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::MessageReactionRemoveEmoji: mC->on_message_reaction_remove_emoji([this](auto && e) { OnMessageReactionRemoveEmoji(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::MessageDeleteBulk: mC->on_message_delete_bulk([this](auto && e) { OnMessageDeleteBulk(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::GuildRoleUpdate: mC->on_guild_role_update([this](auto && e) { OnGuildRoleUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::GuildRoleDelete: mC->on_guild_role_delete([this](auto && e) { OnGuildRoleDelete(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::ChannelPinsUpdate: mC->on_channel_pins_update([this](auto && e) { OnChannelPinsUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::MessageReactionRemoveAll: mC->on_message_reaction_remove_all([this](auto && e) { OnMessageReactionRemoveAll(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::VoiceServerUpdate: mC->on_voice_server_update([this](auto && e) { OnVoiceServerUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::GuildEmojisUpdate: mC->on_guild_emojis_update([this](auto && e) { OnGuildEmojisUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::GuildStickersUpdate: mC->on_guild_stickers_update([this](auto && e) { OnGuildStickersUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::PresenceUpdate: mC->on_presence_update([this](auto && e) { OnPresenceUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::WebhooksUpdate: mC->on_webhooks_update([this](auto && e) { OnWebhooksUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::GuildMemberAdd: mC->on_guild_member_add([this](auto && e) { OnGuildMemberAdd(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::InviteDelete: mC->on_invite_delete([this](auto && e) { OnInviteDelete(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::GuildUpdate: mC->on_guild_update([this](auto && e) { OnGuildUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::GuildIntegrationsUpdate: mC->on_guild_integrations_update([this](auto && e) { OnGuildIntegrationsUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::GuildMemberUpdate: mC->on_guild_member_update([this](auto && e) { OnGuildMemberUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::ApplicationCommandUpdate: mC->on_application_command_update([this](auto && e) { OnApplicationCommandUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::InviteCreate: mC->on_invite_create([this](auto && e) { OnInviteCreate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::MessageUpdate: mC->on_message_update([this](auto && e) { OnMessageUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::UserUpdate: mC->on_user_update([this](auto && e) { OnUserUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::MessageCreate: mC->on_message_create([this](auto && e) { OnMessageCreate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::GuildBanAdd: mC->on_guild_ban_add([this](auto && e) { OnGuildBanAdd(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::GuildBanRemove: mC->on_guild_ban_remove([this](auto && e) { OnGuildBanRemove(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::IntegrationCreate: mC->on_integration_create([this](auto && e) { OnIntegrationCreate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::IntegrationUpdate: mC->on_integration_update([this](auto && e) { OnIntegrationUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::IntegrationDelete: mC->on_integration_delete([this](auto && e) { OnIntegrationDelete(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::ThreadCreate: mC->on_thread_create([this](auto && e) { OnThreadCreate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::ThreadUpdate: mC->on_thread_update([this](auto && e) { OnThreadUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::ThreadDelete: mC->on_thread_delete([this](auto && e) { OnThreadDelete(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::ThreadListSync: mC->on_thread_list_sync([this](auto && e) { OnThreadListSync(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::ThreadMemberUpdate: mC->on_thread_member_update([this](auto && e) { OnThreadMemberUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::ThreadMembersUpdate: mC->on_thread_members_update([this](auto && e) { OnThreadMembersUpdate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::VoiceBufferSend: mC->on_voice_buffer_send([this](auto && e) { OnVoiceBufferSend(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::VoiceUserTalking: mC->on_voice_user_talking([this](auto && e) { OnVoiceUserTalking(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::VoiceReady: mC->on_voice_ready([this](auto && e) { OnVoiceReady(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::VoiceReceive: mC->on_voice_receive([this](auto && e) { OnVoiceReceive(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::VoiceTrackMarker: mC->on_voice_track_marker([this](auto && e) { OnVoiceTrackMarker(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::StageInstanceCreate: mC->on_stage_instance_create([this](auto && e) { OnStageInstanceCreate(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::StageInstanceDelete: mC->on_stage_instance_delete([this](auto && e) { OnStageInstanceDelete(std::forward< decltype(e) >(e)); }); break;
|
||||
case DpEventID::Max: // Fall through
|
||||
default: STHROWF("Invalid discord event identifier {}", id);
|
||||
}
|
||||
// Allow chaining
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
DpCluster & DpCluster::DisableEvent(SQInteger id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case DpEventID::VoiceStateUpdate: mC->on_voice_state_update(std::function<void(const dpp::voice_state_update_t&)>{}); break;
|
||||
case DpEventID::Log: mC->on_log(std::function<void(const dpp::log_t&)>{}); break;
|
||||
case DpEventID::GuildJoinRequestDelete: mC->on_guild_join_request_delete(std::function<void(const dpp::guild_join_request_delete_t&)>{}); break;
|
||||
case DpEventID::InteractionCreate: mC->on_interaction_create(std::function<void(const dpp::interaction_create_t&)>{}); break;
|
||||
case DpEventID::ButtonClick: mC->on_button_click(std::function<void(const dpp::button_click_t&)>{}); break;
|
||||
case DpEventID::SelectClick: mC->on_select_click(std::function<void(const dpp::select_click_t&)>{}); break;
|
||||
case DpEventID::GuildDelete: mC->on_guild_delete(std::function<void(const dpp::guild_delete_t&)>{}); break;
|
||||
case DpEventID::ChannelDelete: mC->on_channel_delete(std::function<void(const dpp::channel_delete_t&)>{}); break;
|
||||
case DpEventID::ChannelUpdate: mC->on_channel_update(std::function<void(const dpp::channel_update_t&)>{}); break;
|
||||
case DpEventID::Ready: mC->on_ready(std::function<void(const dpp::ready_t&)>{}); break;
|
||||
case DpEventID::MessageDelete: mC->on_message_delete(std::function<void(const dpp::message_delete_t&)>{}); break;
|
||||
case DpEventID::ApplicationCommandDelete: mC->on_application_command_delete(std::function<void(const dpp::application_command_delete_t&)>{}); break;
|
||||
case DpEventID::GuildMemberRemove: mC->on_guild_member_remove(std::function<void(const dpp::guild_member_remove_t&)>{}); break;
|
||||
case DpEventID::ApplicationCommandCreate: mC->on_application_command_create(std::function<void(const dpp::application_command_create_t&)>{}); break;
|
||||
case DpEventID::Resumed: mC->on_resumed(std::function<void(const dpp::resumed_t&)>{}); break;
|
||||
case DpEventID::GuildRoleCreate: mC->on_guild_role_create(std::function<void(const dpp::guild_role_create_t&)>{}); break;
|
||||
case DpEventID::TypingStart: mC->on_typing_start(std::function<void(const dpp::typing_start_t&)>{}); break;
|
||||
case DpEventID::MessageReactionAdd: mC->on_message_reaction_add(std::function<void(const dpp::message_reaction_add_t&)>{}); break;
|
||||
case DpEventID::GuildMembersChunk: mC->on_guild_members_chunk(std::function<void(const dpp::guild_members_chunk_t&)>{}); break;
|
||||
case DpEventID::MessageReactionRemove: mC->on_message_reaction_remove(std::function<void(const dpp::message_reaction_remove_t&)>{}); break;
|
||||
case DpEventID::GuildCreate: mC->on_guild_create(std::function<void(const dpp::guild_create_t&)>{}); break;
|
||||
case DpEventID::ChannelCreate: mC->on_channel_create(std::function<void(const dpp::channel_create_t&)>{}); break;
|
||||
case DpEventID::MessageReactionRemoveEmoji: mC->on_message_reaction_remove_emoji(std::function<void(const dpp::message_reaction_remove_emoji_t&)>{}); break;
|
||||
case DpEventID::MessageDeleteBulk: mC->on_message_delete_bulk(std::function<void(const dpp::message_delete_bulk_t&)>{}); break;
|
||||
case DpEventID::GuildRoleUpdate: mC->on_guild_role_update(std::function<void(const dpp::guild_role_update_t&)>{}); break;
|
||||
case DpEventID::GuildRoleDelete: mC->on_guild_role_delete(std::function<void(const dpp::guild_role_delete_t&)>{}); break;
|
||||
case DpEventID::ChannelPinsUpdate: mC->on_channel_pins_update(std::function<void(const dpp::channel_pins_update_t&)>{}); break;
|
||||
case DpEventID::MessageReactionRemoveAll: mC->on_message_reaction_remove_all(std::function<void(const dpp::message_reaction_remove_all_t&)>{}); break;
|
||||
case DpEventID::VoiceServerUpdate: mC->on_voice_server_update(std::function<void(const dpp::voice_server_update_t&)>{}); break;
|
||||
case DpEventID::GuildEmojisUpdate: mC->on_guild_emojis_update(std::function<void(const dpp::guild_emojis_update_t&)>{}); break;
|
||||
case DpEventID::GuildStickersUpdate: mC->on_guild_stickers_update(std::function<void(const dpp::guild_stickers_update_t&)>{}); break;
|
||||
case DpEventID::PresenceUpdate: mC->on_presence_update(std::function<void(const dpp::presence_update_t&)>{}); break;
|
||||
case DpEventID::WebhooksUpdate: mC->on_webhooks_update(std::function<void(const dpp::webhooks_update_t&)>{}); break;
|
||||
case DpEventID::GuildMemberAdd: mC->on_guild_member_add(std::function<void(const dpp::guild_member_add_t&)>{}); break;
|
||||
case DpEventID::InviteDelete: mC->on_invite_delete(std::function<void(const dpp::invite_delete_t&)>{}); break;
|
||||
case DpEventID::GuildUpdate: mC->on_guild_update(std::function<void(const dpp::guild_update_t&)>{}); break;
|
||||
case DpEventID::GuildIntegrationsUpdate: mC->on_guild_integrations_update(std::function<void(const dpp::guild_integrations_update_t&)>{}); break;
|
||||
case DpEventID::GuildMemberUpdate: mC->on_guild_member_update(std::function<void(const dpp::guild_member_update_t&)>{}); break;
|
||||
case DpEventID::ApplicationCommandUpdate: mC->on_application_command_update(std::function<void(const dpp::application_command_update_t&)>{}); break;
|
||||
case DpEventID::InviteCreate: mC->on_invite_create(std::function<void(const dpp::invite_create_t&)>{}); break;
|
||||
case DpEventID::MessageUpdate: mC->on_message_update(std::function<void(const dpp::message_update_t&)>{}); break;
|
||||
case DpEventID::UserUpdate: mC->on_user_update(std::function<void(const dpp::user_update_t&)>{}); break;
|
||||
case DpEventID::MessageCreate: mC->on_message_create(std::function<void(const dpp::message_create_t&)>{}); break;
|
||||
case DpEventID::GuildBanAdd: mC->on_guild_ban_add(std::function<void(const dpp::guild_ban_add_t&)>{}); break;
|
||||
case DpEventID::GuildBanRemove: mC->on_guild_ban_remove(std::function<void(const dpp::guild_ban_remove_t&)>{}); break;
|
||||
case DpEventID::IntegrationCreate: mC->on_integration_create(std::function<void(const dpp::integration_create_t&)>{}); break;
|
||||
case DpEventID::IntegrationUpdate: mC->on_integration_update(std::function<void(const dpp::integration_update_t&)>{}); break;
|
||||
case DpEventID::IntegrationDelete: mC->on_integration_delete(std::function<void(const dpp::integration_delete_t&)>{}); break;
|
||||
case DpEventID::ThreadCreate: mC->on_thread_create(std::function<void(const dpp::thread_create_t&)>{}); break;
|
||||
case DpEventID::ThreadUpdate: mC->on_thread_update(std::function<void(const dpp::thread_update_t&)>{}); break;
|
||||
case DpEventID::ThreadDelete: mC->on_thread_delete(std::function<void(const dpp::thread_delete_t&)>{}); break;
|
||||
case DpEventID::ThreadListSync: mC->on_thread_list_sync(std::function<void(const dpp::thread_list_sync_t&)>{}); break;
|
||||
case DpEventID::ThreadMemberUpdate: mC->on_thread_member_update(std::function<void(const dpp::thread_member_update_t&)>{}); break;
|
||||
case DpEventID::ThreadMembersUpdate: mC->on_thread_members_update(std::function<void(const dpp::thread_members_update_t&)>{}); break;
|
||||
case DpEventID::VoiceBufferSend: mC->on_voice_buffer_send(std::function<void(const dpp::voice_buffer_send_t&)>{}); break;
|
||||
case DpEventID::VoiceUserTalking: mC->on_voice_user_talking(std::function<void(const dpp::voice_user_talking_t&)>{}); break;
|
||||
case DpEventID::VoiceReady: mC->on_voice_ready(std::function<void(const dpp::voice_ready_t&)>{}); break;
|
||||
case DpEventID::VoiceReceive: mC->on_voice_receive(std::function<void(const dpp::voice_receive_t&)>{}); break;
|
||||
case DpEventID::VoiceTrackMarker: mC->on_voice_track_marker(std::function<void(const dpp::voice_track_marker_t&)>{}); break;
|
||||
case DpEventID::StageInstanceCreate: mC->on_stage_instance_create(std::function<void(const dpp::stage_instance_create_t&)>{}); break;
|
||||
case DpEventID::StageInstanceDelete: mC->on_stage_instance_delete(std::function<void(const dpp::stage_instance_delete_t&)>{}); break;
|
||||
case DpEventID::Max: // Fall through
|
||||
default: STHROWF("Invalid discord event identifier {}", id);
|
||||
}
|
||||
// Allow chaining
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpInternalEvent::Release()
|
||||
{
|
||||
// Make sure we actually manage something
|
||||
if (mData == 0) return;
|
||||
// Fetch the type of data
|
||||
const auto type = GetType();
|
||||
// Fetch the data itself
|
||||
const auto data = GetData();
|
||||
// Identify data type
|
||||
switch (type)
|
||||
{
|
||||
case DpEventID::VoiceStateUpdate: delete reinterpret_cast< DpVoiceStateUpdateEvent * >(data); break;
|
||||
case DpEventID::Log: delete reinterpret_cast< DpLogEvent * >(data); break;
|
||||
case DpEventID::GuildJoinRequestDelete: delete reinterpret_cast< DpGuildJoinRequestDeleteEvent * >(data); break;
|
||||
case DpEventID::InteractionCreate: delete reinterpret_cast< DpInteractionCreateEvent * >(data); break;
|
||||
case DpEventID::ButtonClick: delete reinterpret_cast< DpButtonClickEvent * >(data); break;
|
||||
case DpEventID::SelectClick: delete reinterpret_cast< DpSelectClickEvent * >(data); break;
|
||||
case DpEventID::GuildDelete: delete reinterpret_cast< DpGuildDeleteEvent * >(data); break;
|
||||
case DpEventID::ChannelDelete: delete reinterpret_cast< DpChannelDeleteEvent * >(data); break;
|
||||
case DpEventID::ChannelUpdate: delete reinterpret_cast< DpChannelUpdateEvent * >(data); break;
|
||||
case DpEventID::Ready: delete reinterpret_cast< DpReadyEvent * >(data); break;
|
||||
case DpEventID::MessageDelete: delete reinterpret_cast< DpMessageDeleteEvent * >(data); break;
|
||||
case DpEventID::ApplicationCommandDelete: delete reinterpret_cast< DpApplicationCommandDeleteEvent * >(data); break;
|
||||
case DpEventID::GuildMemberRemove: delete reinterpret_cast< DpGuildMemberRemoveEvent * >(data); break;
|
||||
case DpEventID::ApplicationCommandCreate: delete reinterpret_cast< DpApplicationCommandCreateEvent * >(data); break;
|
||||
case DpEventID::Resumed: delete reinterpret_cast< DpResumedEvent * >(data); break;
|
||||
case DpEventID::GuildRoleCreate: delete reinterpret_cast< DpGuildRoleCreateEvent * >(data); break;
|
||||
case DpEventID::TypingStart: delete reinterpret_cast< DpTypingStartEvent * >(data); break;
|
||||
case DpEventID::MessageReactionAdd: delete reinterpret_cast< DpMessageReactionAddEvent * >(data); break;
|
||||
case DpEventID::GuildMembersChunk: delete reinterpret_cast< DpGuildMembersChunkEvent * >(data); break;
|
||||
case DpEventID::MessageReactionRemove: delete reinterpret_cast< DpMessageReactionRemoveEvent * >(data); break;
|
||||
case DpEventID::GuildCreate: delete reinterpret_cast< DpGuildCreateEvent * >(data); break;
|
||||
case DpEventID::ChannelCreate: delete reinterpret_cast< DpChannelCreateEvent * >(data); break;
|
||||
case DpEventID::MessageReactionRemoveEmoji: delete reinterpret_cast< DpMessageReactionRemoveEmojiEvent * >(data); break;
|
||||
case DpEventID::MessageDeleteBulk: delete reinterpret_cast< DpMessageDeleteBulkEvent * >(data); break;
|
||||
case DpEventID::GuildRoleUpdate: delete reinterpret_cast< DpGuildRoleUpdateEvent * >(data); break;
|
||||
case DpEventID::GuildRoleDelete: delete reinterpret_cast< DpGuildRoleDeleteEvent * >(data); break;
|
||||
case DpEventID::ChannelPinsUpdate: delete reinterpret_cast< DpChannelPinsUpdateEvent * >(data); break;
|
||||
case DpEventID::MessageReactionRemoveAll: delete reinterpret_cast< DpMessageReactionRemoveAllEvent * >(data); break;
|
||||
case DpEventID::VoiceServerUpdate: delete reinterpret_cast< DpVoiceServerUpdateEvent * >(data); break;
|
||||
case DpEventID::GuildEmojisUpdate: delete reinterpret_cast< DpGuildEmojisUpdateEvent * >(data); break;
|
||||
case DpEventID::GuildStickersUpdate: delete reinterpret_cast< DpGuildStickersUpdateEvent * >(data); break;
|
||||
case DpEventID::PresenceUpdate: delete reinterpret_cast< DpPresenceUpdateEvent * >(data); break;
|
||||
case DpEventID::WebhooksUpdate: delete reinterpret_cast< DpWebhooksUpdateEvent * >(data); break;
|
||||
case DpEventID::GuildMemberAdd: delete reinterpret_cast< DpGuildMemberAddEvent * >(data); break;
|
||||
case DpEventID::InviteDelete: delete reinterpret_cast< DpInviteDeleteEvent * >(data); break;
|
||||
case DpEventID::GuildUpdate: delete reinterpret_cast< DpGuildUpdateEvent * >(data); break;
|
||||
case DpEventID::GuildIntegrationsUpdate: delete reinterpret_cast< DpGuildIntegrationsUpdateEvent * >(data); break;
|
||||
case DpEventID::GuildMemberUpdate: delete reinterpret_cast< DpGuildMemberUpdateEvent * >(data); break;
|
||||
case DpEventID::ApplicationCommandUpdate: delete reinterpret_cast< DpApplicationCommandUpdateEvent * >(data); break;
|
||||
case DpEventID::InviteCreate: delete reinterpret_cast< DpInviteCreateEvent * >(data); break;
|
||||
case DpEventID::MessageUpdate: delete reinterpret_cast< DpMessageUpdateEvent * >(data); break;
|
||||
case DpEventID::UserUpdate: delete reinterpret_cast< DpUserUpdateEvent * >(data); break;
|
||||
case DpEventID::MessageCreate: delete reinterpret_cast< DpMessageCreateEvent * >(data); break;
|
||||
case DpEventID::GuildBanAdd: delete reinterpret_cast< DpGuildBanAddEvent * >(data); break;
|
||||
case DpEventID::GuildBanRemove: delete reinterpret_cast< DpGuildBanRemoveEvent * >(data); break;
|
||||
case DpEventID::IntegrationCreate: delete reinterpret_cast< DpIntegrationCreateEvent * >(data); break;
|
||||
case DpEventID::IntegrationUpdate: delete reinterpret_cast< DpIntegrationUpdateEvent * >(data); break;
|
||||
case DpEventID::IntegrationDelete: delete reinterpret_cast< DpIntegrationDeleteEvent * >(data); break;
|
||||
case DpEventID::ThreadCreate: delete reinterpret_cast< DpThreadCreateEvent * >(data); break;
|
||||
case DpEventID::ThreadUpdate: delete reinterpret_cast< DpThreadUpdateEvent * >(data); break;
|
||||
case DpEventID::ThreadDelete: delete reinterpret_cast< DpThreadDeleteEvent * >(data); break;
|
||||
case DpEventID::ThreadListSync: delete reinterpret_cast< DpThreadListSyncEvent * >(data); break;
|
||||
case DpEventID::ThreadMemberUpdate: delete reinterpret_cast< DpThreadMemberUpdateEvent * >(data); break;
|
||||
case DpEventID::ThreadMembersUpdate: delete reinterpret_cast< DpThreadMembersUpdateEvent * >(data); break;
|
||||
case DpEventID::VoiceBufferSend: delete reinterpret_cast< DpVoiceBufferSendEvent * >(data); break;
|
||||
case DpEventID::VoiceUserTalking: delete reinterpret_cast< DpVoiceUserTalkingEvent * >(data); break;
|
||||
case DpEventID::VoiceReady: delete reinterpret_cast< DpVoiceReadyEvent * >(data); break;
|
||||
case DpEventID::VoiceReceive: delete reinterpret_cast< DpVoiceReceiveEvent * >(data); break;
|
||||
case DpEventID::VoiceTrackMarker: delete reinterpret_cast< DpVoiceTrackMarkerEvent * >(data); break;
|
||||
case DpEventID::StageInstanceCreate: delete reinterpret_cast< DpStageInstanceCreateEvent * >(data); break;
|
||||
case DpEventID::StageInstanceDelete: delete reinterpret_cast< DpStageInstanceDeleteEvent * >(data); break;
|
||||
case DpEventID::Max: // Fall through
|
||||
default: LogFtl("Unrecognized discord event instance type"); assert(0); break;
|
||||
}
|
||||
// Forget about it
|
||||
Reset();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMOD_NODISCARD LightObj EventToScriptObject(uint8_t type, uintptr_t data)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DpEventID::VoiceStateUpdate: return LightObj(reinterpret_cast< DpVoiceStateUpdateEvent * >(data));
|
||||
case DpEventID::Log: return LightObj(reinterpret_cast< DpLogEvent * >(data));
|
||||
case DpEventID::GuildJoinRequestDelete: return LightObj(reinterpret_cast< DpGuildJoinRequestDeleteEvent * >(data));
|
||||
case DpEventID::InteractionCreate: return LightObj(reinterpret_cast< DpInteractionCreateEvent * >(data));
|
||||
case DpEventID::ButtonClick: return LightObj(reinterpret_cast< DpButtonClickEvent * >(data));
|
||||
case DpEventID::SelectClick: return LightObj(reinterpret_cast< DpSelectClickEvent * >(data));
|
||||
case DpEventID::GuildDelete: return LightObj(reinterpret_cast< DpGuildDeleteEvent * >(data));
|
||||
case DpEventID::ChannelDelete: return LightObj(reinterpret_cast< DpChannelDeleteEvent * >(data));
|
||||
case DpEventID::ChannelUpdate: return LightObj(reinterpret_cast< DpChannelUpdateEvent * >(data));
|
||||
case DpEventID::Ready: return LightObj(reinterpret_cast< DpReadyEvent * >(data));
|
||||
case DpEventID::MessageDelete: return LightObj(reinterpret_cast< DpMessageDeleteEvent * >(data));
|
||||
case DpEventID::ApplicationCommandDelete: return LightObj(reinterpret_cast< DpApplicationCommandDeleteEvent * >(data));
|
||||
case DpEventID::GuildMemberRemove: return LightObj(reinterpret_cast< DpGuildMemberRemoveEvent * >(data));
|
||||
case DpEventID::ApplicationCommandCreate: return LightObj(reinterpret_cast< DpApplicationCommandCreateEvent * >(data));
|
||||
case DpEventID::Resumed: return LightObj(reinterpret_cast< DpResumedEvent * >(data));
|
||||
case DpEventID::GuildRoleCreate: return LightObj(reinterpret_cast< DpGuildRoleCreateEvent * >(data));
|
||||
case DpEventID::TypingStart: return LightObj(reinterpret_cast< DpTypingStartEvent * >(data));
|
||||
case DpEventID::MessageReactionAdd: return LightObj(reinterpret_cast< DpMessageReactionAddEvent * >(data));
|
||||
case DpEventID::GuildMembersChunk: return LightObj(reinterpret_cast< DpGuildMembersChunkEvent * >(data));
|
||||
case DpEventID::MessageReactionRemove: return LightObj(reinterpret_cast< DpMessageReactionRemoveEvent * >(data));
|
||||
case DpEventID::GuildCreate: return LightObj(reinterpret_cast< DpGuildCreateEvent * >(data));
|
||||
case DpEventID::ChannelCreate: return LightObj(reinterpret_cast< DpChannelCreateEvent * >(data));
|
||||
case DpEventID::MessageReactionRemoveEmoji: return LightObj(reinterpret_cast< DpMessageReactionRemoveEmojiEvent * >(data));
|
||||
case DpEventID::MessageDeleteBulk: return LightObj(reinterpret_cast< DpMessageDeleteBulkEvent * >(data));
|
||||
case DpEventID::GuildRoleUpdate: return LightObj(reinterpret_cast< DpGuildRoleUpdateEvent * >(data));
|
||||
case DpEventID::GuildRoleDelete: return LightObj(reinterpret_cast< DpGuildRoleDeleteEvent * >(data));
|
||||
case DpEventID::ChannelPinsUpdate: return LightObj(reinterpret_cast< DpChannelPinsUpdateEvent * >(data));
|
||||
case DpEventID::MessageReactionRemoveAll: return LightObj(reinterpret_cast< DpMessageReactionRemoveAllEvent * >(data));
|
||||
case DpEventID::VoiceServerUpdate: return LightObj(reinterpret_cast< DpVoiceServerUpdateEvent * >(data));
|
||||
case DpEventID::GuildEmojisUpdate: return LightObj(reinterpret_cast< DpGuildEmojisUpdateEvent * >(data));
|
||||
case DpEventID::GuildStickersUpdate: return LightObj(reinterpret_cast< DpGuildStickersUpdateEvent * >(data));
|
||||
case DpEventID::PresenceUpdate: return LightObj(reinterpret_cast< DpPresenceUpdateEvent * >(data));
|
||||
case DpEventID::WebhooksUpdate: return LightObj(reinterpret_cast< DpWebhooksUpdateEvent * >(data));
|
||||
case DpEventID::GuildMemberAdd: return LightObj(reinterpret_cast< DpGuildMemberAddEvent * >(data));
|
||||
case DpEventID::InviteDelete: return LightObj(reinterpret_cast< DpInviteDeleteEvent * >(data));
|
||||
case DpEventID::GuildUpdate: return LightObj(reinterpret_cast< DpGuildUpdateEvent * >(data));
|
||||
case DpEventID::GuildIntegrationsUpdate: return LightObj(reinterpret_cast< DpGuildIntegrationsUpdateEvent * >(data));
|
||||
case DpEventID::GuildMemberUpdate: return LightObj(reinterpret_cast< DpGuildMemberUpdateEvent * >(data));
|
||||
case DpEventID::ApplicationCommandUpdate: return LightObj(reinterpret_cast< DpApplicationCommandUpdateEvent * >(data));
|
||||
case DpEventID::InviteCreate: return LightObj(reinterpret_cast< DpInviteCreateEvent * >(data));
|
||||
case DpEventID::MessageUpdate: return LightObj(reinterpret_cast< DpMessageUpdateEvent * >(data));
|
||||
case DpEventID::UserUpdate: return LightObj(reinterpret_cast< DpUserUpdateEvent * >(data));
|
||||
case DpEventID::MessageCreate: return LightObj(reinterpret_cast< DpMessageCreateEvent * >(data));
|
||||
case DpEventID::GuildBanAdd: return LightObj(reinterpret_cast< DpGuildBanAddEvent * >(data));
|
||||
case DpEventID::GuildBanRemove: return LightObj(reinterpret_cast< DpGuildBanRemoveEvent * >(data));
|
||||
case DpEventID::IntegrationCreate: return LightObj(reinterpret_cast< DpIntegrationCreateEvent * >(data));
|
||||
case DpEventID::IntegrationUpdate: return LightObj(reinterpret_cast< DpIntegrationUpdateEvent * >(data));
|
||||
case DpEventID::IntegrationDelete: return LightObj(reinterpret_cast< DpIntegrationDeleteEvent * >(data));
|
||||
case DpEventID::ThreadCreate: return LightObj(reinterpret_cast< DpThreadCreateEvent * >(data));
|
||||
case DpEventID::ThreadUpdate: return LightObj(reinterpret_cast< DpThreadUpdateEvent * >(data));
|
||||
case DpEventID::ThreadDelete: return LightObj(reinterpret_cast< DpThreadDeleteEvent * >(data));
|
||||
case DpEventID::ThreadListSync: return LightObj(reinterpret_cast< DpThreadListSyncEvent * >(data));
|
||||
case DpEventID::ThreadMemberUpdate: return LightObj(reinterpret_cast< DpThreadMemberUpdateEvent * >(data));
|
||||
case DpEventID::ThreadMembersUpdate: return LightObj(reinterpret_cast< DpThreadMembersUpdateEvent * >(data));
|
||||
case DpEventID::VoiceBufferSend: return LightObj(reinterpret_cast< DpVoiceBufferSendEvent * >(data));
|
||||
case DpEventID::VoiceUserTalking: return LightObj(reinterpret_cast< DpVoiceUserTalkingEvent * >(data));
|
||||
case DpEventID::VoiceReady: return LightObj(reinterpret_cast< DpVoiceReadyEvent * >(data));
|
||||
case DpEventID::VoiceReceive: return LightObj(reinterpret_cast< DpVoiceReceiveEvent * >(data));
|
||||
case DpEventID::VoiceTrackMarker: return LightObj(reinterpret_cast< DpVoiceTrackMarkerEvent * >(data));
|
||||
case DpEventID::StageInstanceCreate: return LightObj(reinterpret_cast< DpStageInstanceCreateEvent * >(data));
|
||||
case DpEventID::StageInstanceDelete: return LightObj(reinterpret_cast< DpStageInstanceDeleteEvent * >(data));
|
||||
case DpEventID::Max: // Fall through
|
||||
default: assert(0); return LightObj{};
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void EventInvokeCleanup(uint8_t type, uintptr_t data)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DpEventID::VoiceStateUpdate: reinterpret_cast< DpVoiceStateUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::Log: reinterpret_cast< DpLogEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::GuildJoinRequestDelete: reinterpret_cast< DpGuildJoinRequestDeleteEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::InteractionCreate: reinterpret_cast< DpInteractionCreateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::ButtonClick: reinterpret_cast< DpButtonClickEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::SelectClick: reinterpret_cast< DpSelectClickEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::GuildDelete: reinterpret_cast< DpGuildDeleteEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::ChannelDelete: reinterpret_cast< DpChannelDeleteEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::ChannelUpdate: reinterpret_cast< DpChannelUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::Ready: reinterpret_cast< DpReadyEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::MessageDelete: reinterpret_cast< DpMessageDeleteEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::ApplicationCommandDelete: reinterpret_cast< DpApplicationCommandDeleteEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::GuildMemberRemove: reinterpret_cast< DpGuildMemberRemoveEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::ApplicationCommandCreate: reinterpret_cast< DpApplicationCommandCreateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::Resumed: reinterpret_cast< DpResumedEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::GuildRoleCreate: reinterpret_cast< DpGuildRoleCreateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::TypingStart: reinterpret_cast< DpTypingStartEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::MessageReactionAdd: reinterpret_cast< DpMessageReactionAddEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::GuildMembersChunk: reinterpret_cast< DpGuildMembersChunkEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::MessageReactionRemove: reinterpret_cast< DpMessageReactionRemoveEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::GuildCreate: reinterpret_cast< DpGuildCreateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::ChannelCreate: reinterpret_cast< DpChannelCreateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::MessageReactionRemoveEmoji: reinterpret_cast< DpMessageReactionRemoveEmojiEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::MessageDeleteBulk: reinterpret_cast< DpMessageDeleteBulkEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::GuildRoleUpdate: reinterpret_cast< DpGuildRoleUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::GuildRoleDelete: reinterpret_cast< DpGuildRoleDeleteEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::ChannelPinsUpdate: reinterpret_cast< DpChannelPinsUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::MessageReactionRemoveAll: reinterpret_cast< DpMessageReactionRemoveAllEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::VoiceServerUpdate: reinterpret_cast< DpVoiceServerUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::GuildEmojisUpdate: reinterpret_cast< DpGuildEmojisUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::GuildStickersUpdate: reinterpret_cast< DpGuildStickersUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::PresenceUpdate: reinterpret_cast< DpPresenceUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::WebhooksUpdate: reinterpret_cast< DpWebhooksUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::GuildMemberAdd: reinterpret_cast< DpGuildMemberAddEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::InviteDelete: reinterpret_cast< DpInviteDeleteEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::GuildUpdate: reinterpret_cast< DpGuildUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::GuildIntegrationsUpdate: reinterpret_cast< DpGuildIntegrationsUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::GuildMemberUpdate: reinterpret_cast< DpGuildMemberUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::ApplicationCommandUpdate: reinterpret_cast< DpApplicationCommandUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::InviteCreate: reinterpret_cast< DpInviteCreateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::MessageUpdate: reinterpret_cast< DpMessageUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::UserUpdate: reinterpret_cast< DpUserUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::MessageCreate: reinterpret_cast< DpMessageCreateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::GuildBanAdd: reinterpret_cast< DpGuildBanAddEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::GuildBanRemove: reinterpret_cast< DpGuildBanRemoveEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::IntegrationCreate: reinterpret_cast< DpIntegrationCreateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::IntegrationUpdate: reinterpret_cast< DpIntegrationUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::IntegrationDelete: reinterpret_cast< DpIntegrationDeleteEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::ThreadCreate: reinterpret_cast< DpThreadCreateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::ThreadUpdate: reinterpret_cast< DpThreadUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::ThreadDelete: reinterpret_cast< DpThreadDeleteEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::ThreadListSync: reinterpret_cast< DpThreadListSyncEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::ThreadMemberUpdate: reinterpret_cast< DpThreadMemberUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::ThreadMembersUpdate: reinterpret_cast< DpThreadMembersUpdateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::VoiceBufferSend: reinterpret_cast< DpVoiceBufferSendEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::VoiceUserTalking: reinterpret_cast< DpVoiceUserTalkingEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::VoiceReady: reinterpret_cast< DpVoiceReadyEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::VoiceReceive: reinterpret_cast< DpVoiceReceiveEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::VoiceTrackMarker: reinterpret_cast< DpVoiceTrackMarkerEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::StageInstanceCreate: reinterpret_cast< DpStageInstanceCreateEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::StageInstanceDelete: reinterpret_cast< DpStageInstanceDeleteEvent * >(data)->Cleanup(); break;
|
||||
case DpEventID::Max: // Fall through
|
||||
default: assert(0); return;
|
||||
}
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -1,16 +0,0 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/DPP/Command.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Register_DPP_Command(HSQUIRRELVM vm, Table & ns)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -1,427 +0,0 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/DPP/Constants.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <sqratConst.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const std::array< const char *, static_cast< size_t >(DpEventID::Max) > DpEventID::NAME{
|
||||
"VoiceStateUpdate",
|
||||
"Log",
|
||||
"GuildJoinRequestDelete",
|
||||
"InteractionCreate",
|
||||
"ButtonClick",
|
||||
"SelectClick",
|
||||
"GuildDelete",
|
||||
"ChannelDelete",
|
||||
"ChannelUpdate",
|
||||
"Ready",
|
||||
"MessageDelete",
|
||||
"ApplicationCommandDelete",
|
||||
"GuildMemberRemove",
|
||||
"ApplicationCommandCreate",
|
||||
"Resumed",
|
||||
"GuildRoleCreate",
|
||||
"TypingStart",
|
||||
"MessageReactionAdd",
|
||||
"GuildMembersChunk",
|
||||
"MessageReactionRemove",
|
||||
"GuildCreate",
|
||||
"ChannelCreate",
|
||||
"MessageReactionRemoveEmoji",
|
||||
"MessageDeleteBulk",
|
||||
"GuildRoleUpdate",
|
||||
"GuildRoleDelete",
|
||||
"ChannelPinsUpdate",
|
||||
"MessageReactionRemoveAll",
|
||||
"VoiceServerUpdate",
|
||||
"GuildEmojisUpdate",
|
||||
"GuildStickersUpdate",
|
||||
"PresenceUpdate",
|
||||
"WebhooksUpdate",
|
||||
"GuildMemberAdd",
|
||||
"InviteDelete",
|
||||
"GuildUpdate",
|
||||
"GuildIntegrationsUpdate",
|
||||
"GuildMemberUpdate",
|
||||
"ApplicationCommandUpdate",
|
||||
"InviteCreate",
|
||||
"MessageUpdate",
|
||||
"UserUpdate",
|
||||
"MessageCreate",
|
||||
"GuildBanAdd",
|
||||
"GuildBanRemove",
|
||||
"IntegrationCreate",
|
||||
"IntegrationUpdate",
|
||||
"IntegrationDelete",
|
||||
"ThreadCreate",
|
||||
"ThreadUpdate",
|
||||
"ThreadDelete",
|
||||
"ThreadListSync",
|
||||
"ThreadMemberUpdate",
|
||||
"ThreadMembersUpdate",
|
||||
"VoiceBufferSend",
|
||||
"VoiceUserTalking",
|
||||
"VoiceReady",
|
||||
"VoiceReceive",
|
||||
"VoiceTrackMarker",
|
||||
"StageInstanceCreate",
|
||||
"StageInstanceDelete"
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpLogLevelEnum[] = {
|
||||
{_SC("Trace"), static_cast< SQInteger >(dpp::ll_trace)},
|
||||
{_SC("Debug"), static_cast< SQInteger >(dpp::ll_debug)},
|
||||
{_SC("Info"), static_cast< SQInteger >(dpp::ll_info)},
|
||||
{_SC("Warning"), static_cast< SQInteger >(dpp::ll_warning)},
|
||||
{_SC("Error"), static_cast< SQInteger >(dpp::ll_error)},
|
||||
{_SC("Critical"), static_cast< SQInteger >(dpp::ll_critical)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpImageTypeEnum[] = {
|
||||
{_SC("PNG"), static_cast< SQInteger >(dpp::i_png)},
|
||||
{_SC("JPG"), static_cast< SQInteger >(dpp::i_jpg)},
|
||||
{_SC("GIF"), static_cast< SQInteger >(dpp::i_gif)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpCachePolicyEnum[] = {
|
||||
{_SC("Aggressive"), static_cast< SQInteger >(dpp::cp_aggressive)},
|
||||
{_SC("Lazy"), static_cast< SQInteger >(dpp::cp_lazy)},
|
||||
{_SC("None"), static_cast< SQInteger >(dpp::cp_none)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpClusterIntentsEnum[] = {
|
||||
{_SC("Guilds"), static_cast< SQInteger >(dpp::i_guilds)},
|
||||
{_SC("GuildMembers"), static_cast< SQInteger >(dpp::i_guild_members)},
|
||||
{_SC("GuildBans"), static_cast< SQInteger >(dpp::i_guild_bans)},
|
||||
{_SC("GuildEmojis"), static_cast< SQInteger >(dpp::i_guild_emojis)},
|
||||
{_SC("GuildIntegrations"), static_cast< SQInteger >(dpp::i_guild_integrations)},
|
||||
{_SC("GuildWebhooks"), static_cast< SQInteger >(dpp::i_guild_webhooks)},
|
||||
{_SC("GuildInvites"), static_cast< SQInteger >(dpp::i_guild_invites)},
|
||||
{_SC("GuildVoiceStates"), static_cast< SQInteger >(dpp::i_guild_voice_states)},
|
||||
{_SC("GuildPresences"), static_cast< SQInteger >(dpp::i_guild_presences)},
|
||||
{_SC("GuildMessages"), static_cast< SQInteger >(dpp::i_guild_messages)},
|
||||
{_SC("GuildMessageReactions"), static_cast< SQInteger >(dpp::i_guild_message_reactions)},
|
||||
{_SC("GuildMessageTyping"), static_cast< SQInteger >(dpp::i_guild_message_typing)},
|
||||
{_SC("DirectMessages"), static_cast< SQInteger >(dpp::i_direct_messages)},
|
||||
{_SC("DirectMessageReactions"), static_cast< SQInteger >(dpp::i_direct_message_reactions)},
|
||||
{_SC("DirectMessageTyping"), static_cast< SQInteger >(dpp::i_direct_message_typing)},
|
||||
{_SC("Default"), static_cast< SQInteger >(dpp::i_default_intents)},
|
||||
{_SC("Privileged"), static_cast< SQInteger >(dpp::i_privileged_intents)},
|
||||
{_SC("All"), static_cast< SQInteger >(dpp::i_all_intents)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpPresenceFlagsEnum[] = {
|
||||
{_SC("DesktopOnline"), static_cast< SQInteger >(dpp::p_desktop_online)},
|
||||
{_SC("DesktopDND"), static_cast< SQInteger >(dpp::p_desktop_dnd)},
|
||||
{_SC("DesktopIdle"), static_cast< SQInteger >(dpp::p_desktop_idle)},
|
||||
{_SC("WebWnline"), static_cast< SQInteger >(dpp::p_web_online)},
|
||||
{_SC("WebDND"), static_cast< SQInteger >(dpp::p_web_dnd)},
|
||||
{_SC("WebIdle"), static_cast< SQInteger >(dpp::p_web_idle)},
|
||||
{_SC("MobileOnline"), static_cast< SQInteger >(dpp::p_mobile_online)},
|
||||
{_SC("MobileDND"), static_cast< SQInteger >(dpp::p_mobile_dnd)},
|
||||
{_SC("MobileIdle"), static_cast< SQInteger >(dpp::p_mobile_idle)},
|
||||
{_SC("StatusOnline"), static_cast< SQInteger >(dpp::p_status_online)},
|
||||
{_SC("StatusDND"), static_cast< SQInteger >(dpp::p_status_dnd)},
|
||||
{_SC("StatusIdle"), static_cast< SQInteger >(dpp::p_status_idle)},
|
||||
// Helper bit-shift flags
|
||||
{_SC("BitShiftDesktop"), static_cast< SQInteger >(PF_SHIFT_DESKTOP)},
|
||||
{_SC("BitShiftWeb"), static_cast< SQInteger >(PF_SHIFT_WEB)},
|
||||
{_SC("BitShiftMobile"), static_cast< SQInteger >(PF_SHIFT_MOBILE)},
|
||||
{_SC("BitShiftMain"), static_cast< SQInteger >(PF_SHIFT_MAIN)},
|
||||
{_SC("BitStatusMask"), static_cast< SQInteger >(PF_STATUS_MASK)},
|
||||
{_SC("BitClearDesktop"), static_cast< SQInteger >(PF_CLEAR_DESKTOP)},
|
||||
{_SC("BitClearWeb"), static_cast< SQInteger >(PF_CLEAR_WEB)},
|
||||
{_SC("BitClearMobile"), static_cast< SQInteger >(PF_CLEAR_MOBILE)},
|
||||
{_SC("BitClearStatus"), static_cast< SQInteger >(PF_CLEAR_STATUS)},
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpPresenceStatusEnum[] = {
|
||||
{_SC("Offline"), static_cast< SQInteger >(dpp::ps_offline)},
|
||||
{_SC("Online"), static_cast< SQInteger >(dpp::ps_online)},
|
||||
{_SC("DND"), static_cast< SQInteger >(dpp::ps_dnd)},
|
||||
{_SC("Idle"), static_cast< SQInteger >(dpp::ps_idle)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpDesktopStatusBitsEnum[] = {
|
||||
{_SC("ShiftDesktop"), static_cast< SQInteger >(PF_SHIFT_DESKTOP)},
|
||||
{_SC("ShiftWeb"), static_cast< SQInteger >(PF_SHIFT_WEB)},
|
||||
{_SC("ShiftMobile"), static_cast< SQInteger >(PF_SHIFT_MOBILE)},
|
||||
{_SC("ShiftMain"), static_cast< SQInteger >(PF_SHIFT_MAIN)},
|
||||
{_SC("StatusMask"), static_cast< SQInteger >(PF_STATUS_MASK)},
|
||||
{_SC("ClearDesktop"), static_cast< SQInteger >(PF_CLEAR_DESKTOP)},
|
||||
{_SC("ClearWeb"), static_cast< SQInteger >(PF_CLEAR_WEB)},
|
||||
{_SC("ClearMobile"), static_cast< SQInteger >(PF_CLEAR_MOBILE)},
|
||||
{_SC("ClearStatus"), static_cast< SQInteger >(PF_CLEAR_STATUS)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpActivityTypeEnum[] = {
|
||||
{_SC("Game"), static_cast< SQInteger >(dpp::at_game)},
|
||||
{_SC("Streaming"), static_cast< SQInteger >(dpp::at_streaming)},
|
||||
{_SC("Listening"), static_cast< SQInteger >(dpp::at_listening)},
|
||||
{_SC("Custom"), static_cast< SQInteger >(dpp::at_custom)},
|
||||
{_SC("Competing"), static_cast< SQInteger >(dpp::at_competing)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpActivityFlagsEnum[] = {
|
||||
{_SC("Instance"), static_cast< SQInteger >(dpp::af_instance)},
|
||||
{_SC("Join"), static_cast< SQInteger >(dpp::af_join)},
|
||||
{_SC("Spectate"), static_cast< SQInteger >(dpp::af_spectate)},
|
||||
{_SC("JoinRequest"), static_cast< SQInteger >(dpp::af_join_request)},
|
||||
{_SC("Sync"), static_cast< SQInteger >(dpp::af_sync)},
|
||||
{_SC("Play"), static_cast< SQInteger >(dpp::af_play)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpVoiceStateFlagsEnum[] = {
|
||||
{_SC("Deaf"), static_cast< SQInteger >(dpp::vs_deaf)},
|
||||
{_SC("Mute"), static_cast< SQInteger >(dpp::vs_mute)},
|
||||
{_SC("SelfMute"), static_cast< SQInteger >(dpp::vs_self_mute)},
|
||||
{_SC("SelfDeaf"), static_cast< SQInteger >(dpp::vs_self_deaf)},
|
||||
{_SC("SelfStream"), static_cast< SQInteger >(dpp::vs_self_stream)},
|
||||
{_SC("SelfVideo"), static_cast< SQInteger >(dpp::vs_self_video)},
|
||||
{_SC("Suppress"), static_cast< SQInteger >(dpp::vs_suppress)},
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpRoleFlagsEnum[] = {
|
||||
{_SC("Hoist"), static_cast< SQInteger >(dpp::r_hoist)},
|
||||
{_SC("Managed"), static_cast< SQInteger >(dpp::r_managed)},
|
||||
{_SC("Mentionable"), static_cast< SQInteger >(dpp::r_mentionable)},
|
||||
{_SC("PremiumSubscriber"), static_cast< SQInteger >(dpp::r_premium_subscriber)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpRolePermissionsEnum[] = {
|
||||
{_SC("CreateInstantInvite"), static_cast< SQInteger >(dpp::p_create_instant_invite)},
|
||||
{_SC("KickMembers"), static_cast< SQInteger >(dpp::p_kick_members)},
|
||||
{_SC("BanMembers"), static_cast< SQInteger >(dpp::p_ban_members)},
|
||||
{_SC("Administrator"), static_cast< SQInteger >(dpp::p_administrator)},
|
||||
{_SC("ManageChannels"), static_cast< SQInteger >(dpp::p_manage_channels)},
|
||||
{_SC("ManageGuild"), static_cast< SQInteger >(dpp::p_manage_guild)},
|
||||
{_SC("AddReactions"), static_cast< SQInteger >(dpp::p_add_reactions)},
|
||||
{_SC("ViewAuditLog"), static_cast< SQInteger >(dpp::p_view_audit_log)},
|
||||
{_SC("PrioritySpeaker"), static_cast< SQInteger >(dpp::p_priority_speaker)},
|
||||
{_SC("Stream"), static_cast< SQInteger >(dpp::p_stream)},
|
||||
{_SC("ViewChannel"), static_cast< SQInteger >(dpp::p_view_channel)},
|
||||
{_SC("SendMessages"), static_cast< SQInteger >(dpp::p_send_messages)},
|
||||
{_SC("SendTtsMessages"), static_cast< SQInteger >(dpp::p_send_tts_messages)},
|
||||
{_SC("ManageMessages"), static_cast< SQInteger >(dpp::p_manage_messages)},
|
||||
{_SC("EmbedLinks"), static_cast< SQInteger >(dpp::p_embed_links)},
|
||||
{_SC("AttachFiles"), static_cast< SQInteger >(dpp::p_attach_files)},
|
||||
{_SC("ReadMessageHistory"), static_cast< SQInteger >(dpp::p_read_message_history)},
|
||||
{_SC("MentionEveryone"), static_cast< SQInteger >(dpp::p_mention_everyone)},
|
||||
{_SC("UseExternalEmojis"), static_cast< SQInteger >(dpp::p_use_external_emojis)},
|
||||
{_SC("ViewGuildInsights"), static_cast< SQInteger >(dpp::p_view_guild_insights)},
|
||||
{_SC("Connect"), static_cast< SQInteger >(dpp::p_connect)},
|
||||
{_SC("Speak"), static_cast< SQInteger >(dpp::p_speak)},
|
||||
{_SC("MuteMembers"), static_cast< SQInteger >(dpp::p_mute_members)},
|
||||
{_SC("DeafenMembers"), static_cast< SQInteger >(dpp::p_deafen_members)},
|
||||
{_SC("MoveMembers"), static_cast< SQInteger >(dpp::p_move_members)},
|
||||
{_SC("UseVAD"), static_cast< SQInteger >(dpp::p_use_vad)},
|
||||
{_SC("ChangeNickname"), static_cast< SQInteger >(dpp::p_change_nickname)},
|
||||
{_SC("ManageNicknames"), static_cast< SQInteger >(dpp::p_manage_nicknames)},
|
||||
{_SC("ManageRoles"), static_cast< SQInteger >(dpp::p_manage_roles)},
|
||||
{_SC("ManageWebHooks"), static_cast< SQInteger >(dpp::p_manage_webhooks)},
|
||||
{_SC("ManageEmojis"), static_cast< SQInteger >(dpp::p_manage_emojis)},
|
||||
{_SC("UseSlashCommands"), static_cast< SQInteger >(dpp::p_use_slash_commands)},
|
||||
{_SC("RequestToSpeak"), static_cast< SQInteger >(dpp::p_request_to_speak)},
|
||||
{_SC("ManageThreads"), static_cast< SQInteger >(dpp::p_manage_threads)},
|
||||
{_SC("UsePublicThreads"), static_cast< SQInteger >(dpp::p_use_public_threads)},
|
||||
{_SC("UsePrivateThreads"), static_cast< SQInteger >(dpp::p_use_private_threads)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpUserFlagsEnum[] = {
|
||||
{_SC("Bot"), static_cast< SQInteger >(dpp::u_bot)},
|
||||
{_SC("System"), static_cast< SQInteger >(dpp::u_system)},
|
||||
{_SC("MfaEnabled"), static_cast< SQInteger >(dpp::u_mfa_enabled)},
|
||||
{_SC("Verified"), static_cast< SQInteger >(dpp::u_verified)},
|
||||
{_SC("NitroFull"), static_cast< SQInteger >(dpp::u_nitro_full)},
|
||||
{_SC("NitroClassic"), static_cast< SQInteger >(dpp::u_nitro_classic)},
|
||||
{_SC("DiscordEmployee"), static_cast< SQInteger >(dpp::u_discord_employee)},
|
||||
{_SC("PartneredOwner"), static_cast< SQInteger >(dpp::u_partnered_owner)},
|
||||
{_SC("HypesquadEvents"), static_cast< SQInteger >(dpp::u_hypesquad_events)},
|
||||
{_SC("Bughunter1"), static_cast< SQInteger >(dpp::u_bughunter_1)},
|
||||
{_SC("HouseBravery"), static_cast< SQInteger >(dpp::u_house_bravery)},
|
||||
{_SC("HouseBrilliance"), static_cast< SQInteger >(dpp::u_house_brilliance)},
|
||||
{_SC("HouseBalanace"), static_cast< SQInteger >(dpp::u_house_balanace)},
|
||||
{_SC("EarlySupporter"), static_cast< SQInteger >(dpp::u_early_supporter)},
|
||||
{_SC("TeamUser"), static_cast< SQInteger >(dpp::u_team_user)},
|
||||
{_SC("Bughunter2"), static_cast< SQInteger >(dpp::u_bughunter_2)},
|
||||
{_SC("VerifiedBot"), static_cast< SQInteger >(dpp::u_verified_bot)},
|
||||
{_SC("VerifiedBotDev"), static_cast< SQInteger >(dpp::u_verified_bot_dev)},
|
||||
{_SC("AnimatedIcon"), static_cast< SQInteger >(dpp::u_animated_icon)},
|
||||
{_SC("CertifiedModerator"), static_cast< SQInteger >(dpp::u_certified_moderator)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpRegionEnum[] = {
|
||||
{_SC("Brazil"), static_cast< SQInteger >(dpp::r_brazil)},
|
||||
{_SC("CentralEurope"), static_cast< SQInteger >(dpp::r_central_europe)},
|
||||
{_SC("HongKong"), static_cast< SQInteger >(dpp::r_hong_kong)},
|
||||
{_SC("India"), static_cast< SQInteger >(dpp::r_india)},
|
||||
{_SC("Japan"), static_cast< SQInteger >(dpp::r_japan)},
|
||||
{_SC("Russia"), static_cast< SQInteger >(dpp::r_russia)},
|
||||
{_SC("Singapore"), static_cast< SQInteger >(dpp::r_singapore)},
|
||||
{_SC("SouthAfrica"), static_cast< SQInteger >(dpp::r_south_africa)},
|
||||
{_SC("Sydney"), static_cast< SQInteger >(dpp::r_sydney)},
|
||||
{_SC("UsCentral"), static_cast< SQInteger >(dpp::r_us_central)},
|
||||
{_SC("UsEast"), static_cast< SQInteger >(dpp::r_us_east)},
|
||||
{_SC("UsSouth"), static_cast< SQInteger >(dpp::r_us_south)},
|
||||
{_SC("UsWest"), static_cast< SQInteger >(dpp::r_us_west)},
|
||||
{_SC("WesternEurope"), static_cast< SQInteger >(dpp::r_western_europe)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpGuildFlagsEnum[] = {
|
||||
{_SC("Large"), static_cast< SQInteger >(dpp::g_large)},
|
||||
{_SC("Unavailable"), static_cast< SQInteger >(dpp::g_unavailable)},
|
||||
{_SC("WidgetEnabled"), static_cast< SQInteger >(dpp::g_widget_enabled)},
|
||||
{_SC("InviteSplash"), static_cast< SQInteger >(dpp::g_invite_splash)},
|
||||
{_SC("VipRegions"), static_cast< SQInteger >(dpp::g_vip_regions)},
|
||||
{_SC("VanityURL"), static_cast< SQInteger >(dpp::g_vanity_url)},
|
||||
{_SC("Verified"), static_cast< SQInteger >(dpp::g_verified)},
|
||||
{_SC("Partnered"), static_cast< SQInteger >(dpp::g_partnered)},
|
||||
{_SC("Community"), static_cast< SQInteger >(dpp::g_community)},
|
||||
{_SC("Commerce"), static_cast< SQInteger >(dpp::g_commerce)},
|
||||
{_SC("News"), static_cast< SQInteger >(dpp::g_news)},
|
||||
{_SC("Discoverable"), static_cast< SQInteger >(dpp::g_discoverable)},
|
||||
{_SC("Featureable"), static_cast< SQInteger >(dpp::g_featureable)},
|
||||
{_SC("AnimatedIcon"), static_cast< SQInteger >(dpp::g_animated_icon)},
|
||||
{_SC("Banner"), static_cast< SQInteger >(dpp::g_banner)},
|
||||
{_SC("WelcomeScreenEnabled"), static_cast< SQInteger >(dpp::g_welcome_screen_enabled)},
|
||||
{_SC("MemberVerificationGate"), static_cast< SQInteger >(dpp::g_member_verification_gate)},
|
||||
{_SC("PreviewEnabled"), static_cast< SQInteger >(dpp::g_preview_enabled)},
|
||||
{_SC("NoJoinNotifications"), static_cast< SQInteger >(dpp::g_no_join_notifications)},
|
||||
{_SC("NoBoostNotifications"), static_cast< SQInteger >(dpp::g_no_boost_notifications)},
|
||||
{_SC("HasAnimatedIcon"), static_cast< SQInteger >(dpp::g_has_animated_icon)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpGuildMemberFlagsEnum[] = {
|
||||
{_SC("Deaf"), static_cast< SQInteger >(dpp::gm_deaf)},
|
||||
{_SC("Mute"), static_cast< SQInteger >(dpp::gm_mute)},
|
||||
{_SC("Pending"), static_cast< SQInteger >(dpp::gm_pending)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpComponentTypeEnum[] = {
|
||||
{_SC("ActionRow"), static_cast< SQInteger >(dpp::cot_action_row)},
|
||||
{_SC("Button"), static_cast< SQInteger >(dpp::cot_button)},
|
||||
{_SC("SelectMenu"), static_cast< SQInteger >(dpp::cot_selectmenu)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpComponentStyleEnum[] = {
|
||||
{_SC("Primary"), static_cast< SQInteger >(dpp::cos_primary)},
|
||||
{_SC("Secondary"), static_cast< SQInteger >(dpp::cos_secondary)},
|
||||
{_SC("Success"), static_cast< SQInteger >(dpp::cos_success)},
|
||||
{_SC("Danger"), static_cast< SQInteger >(dpp::cos_danger)},
|
||||
{_SC("Link"), static_cast< SQInteger >(dpp::cos_link)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpStickerTypeEnum[] = {
|
||||
{_SC("Standard"), static_cast< SQInteger >(dpp::st_standard)},
|
||||
{_SC("Guild"), static_cast< SQInteger >(dpp::st_guild)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpStickerFormatEnum[] = {
|
||||
{_SC("PNG"), static_cast< SQInteger >(dpp::sf_png)},
|
||||
{_SC("APNG"), static_cast< SQInteger >(dpp::sf_apng)},
|
||||
{_SC("Lottie"), static_cast< SQInteger >(dpp::sf_lottie)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpMessageFlagsEnum[] = {
|
||||
{_SC("Crossposted"), static_cast< SQInteger >(dpp::m_crossposted)},
|
||||
{_SC("IsCrosspost"), static_cast< SQInteger >(dpp::m_is_crosspost)},
|
||||
{_SC("SuppressEmbeds"), static_cast< SQInteger >(dpp::m_suppress_embeds)},
|
||||
{_SC("SourceMessageDeleted"), static_cast< SQInteger >(dpp::m_source_message_deleted)},
|
||||
{_SC("Urgent"), static_cast< SQInteger >(dpp::m_urgent)},
|
||||
{_SC("Ephemeral"), static_cast< SQInteger >(dpp::m_ephemeral)},
|
||||
{_SC("Loading"), static_cast< SQInteger >(dpp::m_loading)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpMessageTypeEnum[] = {
|
||||
{_SC("Default"), static_cast< SQInteger >(dpp::mt_default)},
|
||||
{_SC("RecipientAdd"), static_cast< SQInteger >(dpp::mt_recipient_add)},
|
||||
{_SC("RecipientRemove"), static_cast< SQInteger >(dpp::mt_recipient_remove)},
|
||||
{_SC("Call"), static_cast< SQInteger >(dpp::mt_call)},
|
||||
{_SC("ChannelNameChange"), static_cast< SQInteger >(dpp::mt_channel_name_change)},
|
||||
{_SC("ChannelIconChange"), static_cast< SQInteger >(dpp::mt_channel_icon_change)},
|
||||
{_SC("ChannelPinnedMessage"), static_cast< SQInteger >(dpp::mt_channel_pinned_message)},
|
||||
{_SC("GuildMemberJoin"), static_cast< SQInteger >(dpp::mt_guild_member_join)},
|
||||
{_SC("UserPremiumGuildSubscription"), static_cast< SQInteger >(dpp::mt_user_premium_guild_subscription)},
|
||||
{_SC("UserPremiumGuildSubscriptionTier1"), static_cast< SQInteger >(dpp::mt_user_premium_guild_subscription_tier_1)},
|
||||
{_SC("UserPremiumGuildSubscriptionTier2"), static_cast< SQInteger >(dpp::mt_user_premium_guild_subscription_tier_2)},
|
||||
{_SC("UserPremiumGuildSubscriptionTier3"), static_cast< SQInteger >(dpp::mt_user_premium_guild_subscription_tier_3)},
|
||||
{_SC("ChannelFollowAdd"), static_cast< SQInteger >(dpp::mt_channel_follow_add)},
|
||||
{_SC("GuildDiscoveryDisqualified"), static_cast< SQInteger >(dpp::mt_guild_discovery_disqualified)},
|
||||
{_SC("GuildDiscoveryRequalified"), static_cast< SQInteger >(dpp::mt_guild_discovery_requalified)},
|
||||
{_SC("GuildDiscoveryGracePeriodInitialWarning"), static_cast< SQInteger >(dpp::mt_guild_discovery_grace_period_initial_warning)},
|
||||
{_SC("GuildDiscoveryGracePeriodFinalWarning"), static_cast< SQInteger >(dpp::mt_guild_discovery_grace_period_final_warning)},
|
||||
{_SC("ThreadCreated"), static_cast< SQInteger >(dpp::mt_thread_created)},
|
||||
{_SC("Reply"), static_cast< SQInteger >(dpp::mt_reply)},
|
||||
{_SC("ApplicationCommand"), static_cast< SQInteger >(dpp::mt_application_command)},
|
||||
{_SC("ThreadStarterMessage"), static_cast< SQInteger >(dpp::mt_thread_starter_message)},
|
||||
{_SC("GuildInviteReminder"), static_cast< SQInteger >(dpp::mt_guild_invite_reminder)}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElements g_EnumList[] = {
|
||||
{_SC("SqDiscordLogLevel"), g_DpLogLevelEnum},
|
||||
{_SC("SqDiscordImageType"), g_DpImageTypeEnum},
|
||||
{_SC("SqDiscordCachePolicy"), g_DpCachePolicyEnum},
|
||||
{_SC("SqDiscordClusterIntents"), g_DpClusterIntentsEnum},
|
||||
{_SC("SqDiscordPresenceFlags"), g_DpPresenceFlagsEnum},
|
||||
{_SC("SqDiscordPresenceStatus"), g_DpPresenceStatusEnum},
|
||||
{_SC("SqDiscordDesktopStatusBits"), g_DpDesktopStatusBitsEnum},
|
||||
{_SC("SqDiscordActivityType"), g_DpActivityTypeEnum},
|
||||
{_SC("SqDiscordActivityFlags"), g_DpActivityFlagsEnum},
|
||||
{_SC("SqDiscordVoiceStateFlags"), g_DpVoiceStateFlagsEnum},
|
||||
{_SC("SqDiscordRoleFlags"), g_DpRoleFlagsEnum},
|
||||
{_SC("SqDiscordRolePermissions"), g_DpRolePermissionsEnum},
|
||||
{_SC("SqDiscordUserFlags"), g_DpUserFlagsEnum},
|
||||
{_SC("SqDiscordRegion"), g_DpRegionEnum},
|
||||
{_SC("SqDiscordGuildFlags"), g_DpGuildFlagsEnum},
|
||||
{_SC("SqDiscordGuildMemberFlags"), g_DpGuildMemberFlagsEnum},
|
||||
{_SC("SqDiscordComponentType"), g_DpComponentTypeEnum},
|
||||
{_SC("SqDiscordComponentStyle"), g_DpComponentStyleEnum},
|
||||
{_SC("SqDiscordStickerType"), g_DpStickerTypeEnum},
|
||||
{_SC("SqDiscordStickerFormat"), g_DpStickerFormatEnum},
|
||||
{_SC("SqDiscordMessageFlags"), g_DpMessageFlagsEnum},
|
||||
{_SC("SqDiscordMessageType"), g_DpMessageTypeEnum}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Register_DPP_Constants(HSQUIRRELVM vm, Table & ns)
|
||||
{
|
||||
RegisterEnumerations(vm, g_EnumList);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
Enumeration e(vm);
|
||||
// Bind all events using their associated name
|
||||
for (SQInteger i = 0; i < static_cast< SQInteger >(DpEventID::Max); ++i)
|
||||
{
|
||||
e.Const(DpEventID::NAME[i], i);
|
||||
}
|
||||
// Expose the constants
|
||||
ConstTable(vm).Enum(_SC("SqDiscordEvent"), e);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -1,91 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core/Utility.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Unique ID for each event.
|
||||
*/
|
||||
struct DpEventID
|
||||
{
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* ID enumeration.
|
||||
*/
|
||||
enum Type
|
||||
{
|
||||
VoiceStateUpdate=0,
|
||||
Log,
|
||||
GuildJoinRequestDelete,
|
||||
InteractionCreate,
|
||||
ButtonClick,
|
||||
SelectClick,
|
||||
GuildDelete,
|
||||
ChannelDelete,
|
||||
ChannelUpdate,
|
||||
Ready,
|
||||
MessageDelete,
|
||||
ApplicationCommandDelete,
|
||||
GuildMemberRemove,
|
||||
ApplicationCommandCreate,
|
||||
Resumed,
|
||||
GuildRoleCreate,
|
||||
TypingStart,
|
||||
MessageReactionAdd,
|
||||
GuildMembersChunk,
|
||||
MessageReactionRemove,
|
||||
GuildCreate,
|
||||
ChannelCreate,
|
||||
MessageReactionRemoveEmoji,
|
||||
MessageDeleteBulk,
|
||||
GuildRoleUpdate,
|
||||
GuildRoleDelete,
|
||||
ChannelPinsUpdate,
|
||||
MessageReactionRemoveAll,
|
||||
VoiceServerUpdate,
|
||||
GuildEmojisUpdate,
|
||||
GuildStickersUpdate,
|
||||
PresenceUpdate,
|
||||
WebhooksUpdate,
|
||||
GuildMemberAdd,
|
||||
InviteDelete,
|
||||
GuildUpdate,
|
||||
GuildIntegrationsUpdate,
|
||||
GuildMemberUpdate,
|
||||
ApplicationCommandUpdate,
|
||||
InviteCreate,
|
||||
MessageUpdate,
|
||||
UserUpdate,
|
||||
MessageCreate,
|
||||
GuildBanAdd,
|
||||
GuildBanRemove,
|
||||
IntegrationCreate,
|
||||
IntegrationUpdate,
|
||||
IntegrationDelete,
|
||||
ThreadCreate,
|
||||
ThreadUpdate,
|
||||
ThreadDelete,
|
||||
ThreadListSync,
|
||||
ThreadMemberUpdate,
|
||||
ThreadMembersUpdate,
|
||||
VoiceBufferSend,
|
||||
VoiceUserTalking,
|
||||
VoiceReady,
|
||||
VoiceReceive,
|
||||
VoiceTrackMarker,
|
||||
StageInstanceCreate,
|
||||
StageInstanceDelete,
|
||||
Max
|
||||
};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* String identification for each event ID.
|
||||
*/
|
||||
static const std::array< const char *, static_cast< size_t >(Max) > NAME;
|
||||
};
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -1,630 +0,0 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/DPP/Events.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMOD_DECL_TYPENAME(SqDppVoiceStateUpdateEvent, _SC("SqDppVoiceStateUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppLogEvent, _SC("SqDppLogEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppGuildJoinRequestDeleteEvent, _SC("SqDppGuildJoinRequestDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppInteractionCreateEvent, _SC("SqDppInteractionCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppButtonClickEvent, _SC("SqDppButtonClickEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppSelectClickEvent, _SC("SqDppSelectClickEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppGuildDeleteEvent, _SC("SqDppGuildDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppChannelDeleteEvent, _SC("SqDppChannelDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppChannelUpdateEvent, _SC("SqDppChannelUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppReadyEvent, _SC("SqDppReadyEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppMessageDeleteEvent, _SC("SqDppMessageDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppApplicationCommandDeleteEvent, _SC("SqDppApplicationCommandDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppGuildMemberRemoveEvent, _SC("SqDppGuildMemberRemoveEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppApplicationCommandCreateEvent, _SC("SqDppApplicationCommandCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppResumedEvent, _SC("SqDppResumedEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppGuildRoleCreateEvent, _SC("SqDppGuildRoleCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppTypingStartEvent, _SC("SqDppTypingStartEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppMessageReactionAddEvent, _SC("SqDppMessageReactionAddEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppGuildMembersChunkEvent, _SC("SqDppGuildMembersChunkEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppMessageReactionRemoveEvent, _SC("SqDppMessageReactionRemoveEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppGuildCreateEvent, _SC("SqDppGuildCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppChannelCreateEvent, _SC("SqDppChannelCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppMessageReactionRemoveEmojiEvent, _SC("SqDppMessageReactionRemoveEmojiEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppMessageDeleteBulkEvent, _SC("SqDppMessageDeleteBulkEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppGuildRoleUpdateEvent, _SC("SqDppGuildRoleUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppGuildRoleDeleteEvent, _SC("SqDppGuildRoleDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppChannelPinsUpdateEvent, _SC("SqDppChannelPinsUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppMessageReactionRemoveAllEvent, _SC("SqDppMessageReactionRemoveAllEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppVoiceServerUpdateEvent, _SC("SqDppVoiceServerUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppGuildEmojisUpdateEvent, _SC("SqDppGuildEmojisUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppGuildStickersUpdateEvent, _SC("SqDppGuildStickersUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppPresenceUpdateEvent, _SC("SqDppPresenceUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppWebhooksUpdateEvent, _SC("SqDppWebhooksUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppGuildMemberAddEvent, _SC("SqDppGuildMemberAddEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppInviteDeleteEvent, _SC("SqDppInviteDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppGuildUpdateEvent, _SC("SqDppGuildUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppGuildIntegrationsUpdateEvent, _SC("SqDppGuildIntegrationsUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppGuildMemberUpdateEvent, _SC("SqDppGuildMemberUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppApplicationCommandUpdateEvent, _SC("SqDppApplicationCommandUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppInviteCreateEvent, _SC("SqDppInviteCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppMessageUpdateEvent, _SC("SqDppMessageUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppUserUpdateEvent, _SC("SqDppUserUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppMessageCreateEvent, _SC("SqDppMessageCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppGuildBanAddEvent, _SC("SqDppGuildBanAddEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppGuildBanRemoveEvent, _SC("SqDppGuildBanRemoveEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppIntegrationCreateEvent, _SC("SqDppIntegrationCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppIntegrationUpdateEvent, _SC("SqDppIntegrationUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppIntegrationDeleteEvent, _SC("SqDppIntegrationDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppThreadCreateEvent, _SC("SqDppThreadCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppThreadUpdateEvent, _SC("SqDppThreadUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppThreadDeleteEvent, _SC("SqDppThreadDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppThreadListSyncEvent, _SC("SqDppThreadListSyncEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppThreadMemberUpdateEvent, _SC("SqDppThreadMemberUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppThreadMembersUpdateEvent, _SC("SqDppThreadMembersUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppVoiceBufferSendEvent, _SC("SqDppVoiceBufferSendEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppVoiceUserTalkingEvent, _SC("SqDppVoiceUserTalkingEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppVoiceReadyEvent, _SC("SqDppVoiceReadyEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppVoiceReceiveEvent, _SC("SqDppVoiceReceiveEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppVoiceTrackMarkerEvent, _SC("SqDppVoiceTrackMarkerEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppStageInstanceCreateEvent, _SC("SqDppStageInstanceCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppStageInstanceDeleteEvent, _SC("SqDppStageInstanceDeleteEvent"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Register_DPP_Events(HSQUIRRELVM vm, Table & ns)
|
||||
{
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceStateUpdate"),
|
||||
Class< DpVoiceStateUpdateEvent, NoConstructor< DpVoiceStateUpdateEvent > >(vm, SqDppVoiceStateUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppVoiceStateUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpVoiceStateUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("State"), &DpVoiceStateUpdateEvent::GetState)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Log"),
|
||||
Class< DpLogEvent, NoConstructor< DpLogEvent > >(vm, SqDppLogEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppLogEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpLogEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpLogEvent::GetRawEvent)
|
||||
.Prop(_SC("Severity"), &DpLogEvent::GetSeverity)
|
||||
.Prop(_SC("Message"), &DpLogEvent::GetMessage)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildJoinRequestDelete"),
|
||||
Class< DpGuildJoinRequestDeleteEvent, NoConstructor< DpGuildJoinRequestDeleteEvent > >(vm, SqDppGuildJoinRequestDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuildJoinRequestDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildJoinRequestDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpGuildJoinRequestDeleteEvent::GetRawEvent)
|
||||
.Prop(_SC("GuildID"), &DpGuildJoinRequestDeleteEvent::GetGuildID)
|
||||
.Prop(_SC("UserID"), &DpGuildJoinRequestDeleteEvent::GetUserID)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("InteractionCreate"),
|
||||
Class< DpInteractionCreateEvent, NoConstructor< DpInteractionCreateEvent > >(vm, SqDppInteractionCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppInteractionCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpInteractionCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpInteractionCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ButtonClick"),
|
||||
Class< DpButtonClickEvent, NoConstructor< DpButtonClickEvent > >(vm, SqDppButtonClickEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppButtonClickEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpButtonClickEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpButtonClickEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("SelectClick"),
|
||||
Class< DpSelectClickEvent, NoConstructor< DpSelectClickEvent > >(vm, SqDppSelectClickEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppSelectClickEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpSelectClickEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpSelectClickEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildDelete"),
|
||||
Class< DpGuildDeleteEvent, NoConstructor< DpGuildDeleteEvent > >(vm, SqDppGuildDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuildDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpGuildDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ChannelDelete"),
|
||||
Class< DpChannelDeleteEvent, NoConstructor< DpChannelDeleteEvent > >(vm, SqDppChannelDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppChannelDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpChannelDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpChannelDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ChannelUpdate"),
|
||||
Class< DpChannelUpdateEvent, NoConstructor< DpChannelUpdateEvent > >(vm, SqDppChannelUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppChannelUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpChannelUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpChannelUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Ready"),
|
||||
Class< DpReadyEvent, NoConstructor< DpReadyEvent > >(vm, SqDppReadyEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppReadyEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpReadyEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpReadyEvent::GetRawEvent)
|
||||
.Prop(_SC("SessionID"), &DpReadyEvent::GetSessionID)
|
||||
.Prop(_SC("ShardID"), &DpReadyEvent::GetShardID)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("MessageDelete"),
|
||||
Class< DpMessageDeleteEvent, NoConstructor< DpMessageDeleteEvent > >(vm, SqDppMessageDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppMessageDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpMessageDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpMessageDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ApplicationCommandDelete"),
|
||||
Class< DpApplicationCommandDeleteEvent, NoConstructor< DpApplicationCommandDeleteEvent > >(vm, SqDppApplicationCommandDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppApplicationCommandDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpApplicationCommandDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpApplicationCommandDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildMemberRemove"),
|
||||
Class< DpGuildMemberRemoveEvent, NoConstructor< DpGuildMemberRemoveEvent > >(vm, SqDppGuildMemberRemoveEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuildMemberRemoveEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildMemberRemoveEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpGuildMemberRemoveEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ApplicationCommandCreate"),
|
||||
Class< DpApplicationCommandCreateEvent, NoConstructor< DpApplicationCommandCreateEvent > >(vm, SqDppApplicationCommandCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppApplicationCommandCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpApplicationCommandCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpApplicationCommandCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Resumed"),
|
||||
Class< DpResumedEvent, NoConstructor< DpResumedEvent > >(vm, SqDppResumedEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppResumedEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpResumedEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpResumedEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildRoleCreate"),
|
||||
Class< DpGuildRoleCreateEvent, NoConstructor< DpGuildRoleCreateEvent > >(vm, SqDppGuildRoleCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuildRoleCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildRoleCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpGuildRoleCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("TypingStart"),
|
||||
Class< DpTypingStartEvent, NoConstructor< DpTypingStartEvent > >(vm, SqDppTypingStartEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppTypingStartEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpTypingStartEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpTypingStartEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("MessageReactionAdd"),
|
||||
Class< DpMessageReactionAddEvent, NoConstructor< DpMessageReactionAddEvent > >(vm, SqDppMessageReactionAddEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppMessageReactionAddEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpMessageReactionAddEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpMessageReactionAddEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildMembersChunk"),
|
||||
Class< DpGuildMembersChunkEvent, NoConstructor< DpGuildMembersChunkEvent > >(vm, SqDppGuildMembersChunkEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuildMembersChunkEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildMembersChunkEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpGuildMembersChunkEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("MessageReactionRemove"),
|
||||
Class< DpMessageReactionRemoveEvent, NoConstructor< DpMessageReactionRemoveEvent > >(vm, SqDppMessageReactionRemoveEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppMessageReactionRemoveEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpMessageReactionRemoveEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpMessageReactionRemoveEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildCreate"),
|
||||
Class< DpGuildCreateEvent, NoConstructor< DpGuildCreateEvent > >(vm, SqDppGuildCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuildCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpGuildCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ChannelCreate"),
|
||||
Class< DpChannelCreateEvent, NoConstructor< DpChannelCreateEvent > >(vm, SqDppChannelCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppChannelCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpChannelCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpChannelCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("MessageReactionRemoveEmoji"),
|
||||
Class< DpMessageReactionRemoveEmojiEvent, NoConstructor< DpMessageReactionRemoveEmojiEvent > >(vm, SqDppMessageReactionRemoveEmojiEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppMessageReactionRemoveEmojiEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpMessageReactionRemoveEmojiEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpMessageReactionRemoveEmojiEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("MessageDeleteBulk"),
|
||||
Class< DpMessageDeleteBulkEvent, NoConstructor< DpMessageDeleteBulkEvent > >(vm, SqDppMessageDeleteBulkEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppMessageDeleteBulkEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpMessageDeleteBulkEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpMessageDeleteBulkEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildRoleUpdate"),
|
||||
Class< DpGuildRoleUpdateEvent, NoConstructor< DpGuildRoleUpdateEvent > >(vm, SqDppGuildRoleUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuildRoleUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildRoleUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpGuildRoleUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildRoleDelete"),
|
||||
Class< DpGuildRoleDeleteEvent, NoConstructor< DpGuildRoleDeleteEvent > >(vm, SqDppGuildRoleDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuildRoleDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildRoleDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpGuildRoleDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ChannelPinsUpdate"),
|
||||
Class< DpChannelPinsUpdateEvent, NoConstructor< DpChannelPinsUpdateEvent > >(vm, SqDppChannelPinsUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppChannelPinsUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpChannelPinsUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpChannelPinsUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("MessageReactionRemoveAll"),
|
||||
Class< DpMessageReactionRemoveAllEvent, NoConstructor< DpMessageReactionRemoveAllEvent > >(vm, SqDppMessageReactionRemoveAllEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppMessageReactionRemoveAllEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpMessageReactionRemoveAllEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpMessageReactionRemoveAllEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceServerUpdate"),
|
||||
Class< DpVoiceServerUpdateEvent, NoConstructor< DpVoiceServerUpdateEvent > >(vm, SqDppVoiceServerUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppVoiceServerUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpVoiceServerUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpVoiceServerUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildEmojisUpdate"),
|
||||
Class< DpGuildEmojisUpdateEvent, NoConstructor< DpGuildEmojisUpdateEvent > >(vm, SqDppGuildEmojisUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuildEmojisUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildEmojisUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpGuildEmojisUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildStickersUpdate"),
|
||||
Class< DpGuildStickersUpdateEvent, NoConstructor< DpGuildStickersUpdateEvent > >(vm, SqDppGuildStickersUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuildStickersUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildStickersUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpGuildStickersUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("PresenceUpdate"),
|
||||
Class< DpPresenceUpdateEvent, NoConstructor< DpPresenceUpdateEvent > >(vm, SqDppPresenceUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppPresenceUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpPresenceUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpPresenceUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("WebhooksUpdate"),
|
||||
Class< DpWebhooksUpdateEvent, NoConstructor< DpWebhooksUpdateEvent > >(vm, SqDppWebhooksUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppWebhooksUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpWebhooksUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpWebhooksUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildMemberAdd"),
|
||||
Class< DpGuildMemberAddEvent, NoConstructor< DpGuildMemberAddEvent > >(vm, SqDppGuildMemberAddEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuildMemberAddEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildMemberAddEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpGuildMemberAddEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("InviteDelete"),
|
||||
Class< DpInviteDeleteEvent, NoConstructor< DpInviteDeleteEvent > >(vm, SqDppInviteDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppInviteDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpInviteDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpInviteDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildUpdate"),
|
||||
Class< DpGuildUpdateEvent, NoConstructor< DpGuildUpdateEvent > >(vm, SqDppGuildUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuildUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpGuildUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildIntegrationsUpdate"),
|
||||
Class< DpGuildIntegrationsUpdateEvent, NoConstructor< DpGuildIntegrationsUpdateEvent > >(vm, SqDppGuildIntegrationsUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuildIntegrationsUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildIntegrationsUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpGuildIntegrationsUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildMemberUpdate"),
|
||||
Class< DpGuildMemberUpdateEvent, NoConstructor< DpGuildMemberUpdateEvent > >(vm, SqDppGuildMemberUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuildMemberUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildMemberUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpGuildMemberUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ApplicationCommandUpdate"),
|
||||
Class< DpApplicationCommandUpdateEvent, NoConstructor< DpApplicationCommandUpdateEvent > >(vm, SqDppApplicationCommandUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppApplicationCommandUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpApplicationCommandUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpApplicationCommandUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("InviteCreate"),
|
||||
Class< DpInviteCreateEvent, NoConstructor< DpInviteCreateEvent > >(vm, SqDppInviteCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppInviteCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpInviteCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpInviteCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("MessageUpdate"),
|
||||
Class< DpMessageUpdateEvent, NoConstructor< DpMessageUpdateEvent > >(vm, SqDppMessageUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppMessageUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpMessageUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpMessageUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("UserUpdate"),
|
||||
Class< DpUserUpdateEvent, NoConstructor< DpUserUpdateEvent > >(vm, SqDppUserUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppUserUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpUserUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpUserUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("MessageCreate"),
|
||||
Class< DpMessageCreateEvent, NoConstructor< DpMessageCreateEvent > >(vm, SqDppMessageCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppMessageCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpMessageCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpMessageCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildBanAdd"),
|
||||
Class< DpGuildBanAddEvent, NoConstructor< DpGuildBanAddEvent > >(vm, SqDppGuildBanAddEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuildBanAddEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildBanAddEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpGuildBanAddEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildBanRemove"),
|
||||
Class< DpGuildBanRemoveEvent, NoConstructor< DpGuildBanRemoveEvent > >(vm, SqDppGuildBanRemoveEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuildBanRemoveEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildBanRemoveEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpGuildBanRemoveEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("IntegrationCreate"),
|
||||
Class< DpIntegrationCreateEvent, NoConstructor< DpIntegrationCreateEvent > >(vm, SqDppIntegrationCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppIntegrationCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpIntegrationCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpIntegrationCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("IntegrationUpdate"),
|
||||
Class< DpIntegrationUpdateEvent, NoConstructor< DpIntegrationUpdateEvent > >(vm, SqDppIntegrationUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppIntegrationUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpIntegrationUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpIntegrationUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("IntegrationDelete"),
|
||||
Class< DpIntegrationDeleteEvent, NoConstructor< DpIntegrationDeleteEvent > >(vm, SqDppIntegrationDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppIntegrationDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpIntegrationDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpIntegrationDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ThreadCreate"),
|
||||
Class< DpThreadCreateEvent, NoConstructor< DpThreadCreateEvent > >(vm, SqDppThreadCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppThreadCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpThreadCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpThreadCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ThreadUpdate"),
|
||||
Class< DpThreadUpdateEvent, NoConstructor< DpThreadUpdateEvent > >(vm, SqDppThreadUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppThreadUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpThreadUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpThreadUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ThreadDelete"),
|
||||
Class< DpThreadDeleteEvent, NoConstructor< DpThreadDeleteEvent > >(vm, SqDppThreadDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppThreadDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpThreadDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpThreadDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ThreadListSync"),
|
||||
Class< DpThreadListSyncEvent, NoConstructor< DpThreadListSyncEvent > >(vm, SqDppThreadListSyncEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppThreadListSyncEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpThreadListSyncEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpThreadListSyncEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ThreadMemberUpdate"),
|
||||
Class< DpThreadMemberUpdateEvent, NoConstructor< DpThreadMemberUpdateEvent > >(vm, SqDppThreadMemberUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppThreadMemberUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpThreadMemberUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpThreadMemberUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ThreadMembersUpdate"),
|
||||
Class< DpThreadMembersUpdateEvent, NoConstructor< DpThreadMembersUpdateEvent > >(vm, SqDppThreadMembersUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppThreadMembersUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpThreadMembersUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpThreadMembersUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceBufferSend"),
|
||||
Class< DpVoiceBufferSendEvent, NoConstructor< DpVoiceBufferSendEvent > >(vm, SqDppVoiceBufferSendEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppVoiceBufferSendEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpVoiceBufferSendEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpVoiceBufferSendEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceUserTalking"),
|
||||
Class< DpVoiceUserTalkingEvent, NoConstructor< DpVoiceUserTalkingEvent > >(vm, SqDppVoiceUserTalkingEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppVoiceUserTalkingEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpVoiceUserTalkingEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpVoiceUserTalkingEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceReady"),
|
||||
Class< DpVoiceReadyEvent, NoConstructor< DpVoiceReadyEvent > >(vm, SqDppVoiceReadyEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppVoiceReadyEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpVoiceReadyEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpVoiceReadyEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceReceive"),
|
||||
Class< DpVoiceReceiveEvent, NoConstructor< DpVoiceReceiveEvent > >(vm, SqDppVoiceReceiveEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppVoiceReceiveEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpVoiceReceiveEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpVoiceReceiveEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceTrackMarker"),
|
||||
Class< DpVoiceTrackMarkerEvent, NoConstructor< DpVoiceTrackMarkerEvent > >(vm, SqDppVoiceTrackMarkerEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppVoiceTrackMarkerEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpVoiceTrackMarkerEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpVoiceTrackMarkerEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("StageInstanceCreate"),
|
||||
Class< DpStageInstanceCreateEvent, NoConstructor< DpStageInstanceCreateEvent > >(vm, SqDppStageInstanceCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppStageInstanceCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpStageInstanceCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpStageInstanceCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("StageInstanceDelete"),
|
||||
Class< DpStageInstanceDeleteEvent, NoConstructor< DpStageInstanceDeleteEvent > >(vm, SqDppStageInstanceDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppStageInstanceDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpStageInstanceDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("RawEvent"), &DpStageInstanceDeleteEvent::GetRawEvent)
|
||||
);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -1,146 +0,0 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/DPP/Guild.hpp"
|
||||
#include "Library/DPP/Other.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMOD_DECL_TYPENAME(SqDppGuildMember, _SC("SqDppGuildMember"))
|
||||
SQMOD_DECL_TYPENAME(SqDppGuild, _SC("SqDppGuild"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Table DpGuild::GetMembers() const
|
||||
{
|
||||
Table t(SqVM(), static_cast< SQInteger >(Valid().members.size()));
|
||||
// Attempt to convert the [members] associative container into a script table
|
||||
const auto r = t.InsertFromMapWith(mPtr->members, [](HSQUIRRELVM vm, auto id, auto & m) -> SQRESULT {
|
||||
// The [id] is a dpp::snowflake which is basically a uint64_t so let's leave that as is
|
||||
sq_pushinteger(vm, static_cast< SQInteger >(id));
|
||||
// Wrap the dpp::guild_member type into a DpGuildMember instance
|
||||
ClassType< DpGuildMember >::PushInstance(vm, new DpGuildMember(m));
|
||||
// The elements are now on the stack and can be inserted in the table
|
||||
return SQ_OK;
|
||||
});
|
||||
// Did anything fail?
|
||||
if (SQ_FAILED(r))
|
||||
{
|
||||
STHROWF("Unable to convert [members] container");
|
||||
}
|
||||
// Return the resulted table
|
||||
return t;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
Table DpGuild::GetVoiceMembers() const
|
||||
{
|
||||
Table t(SqVM(), static_cast< SQInteger >(Valid().voice_members.size()));
|
||||
// Attempt to convert the [voice_members] associative container into a script table
|
||||
const auto r = t.InsertFromMapWith(mPtr->voice_members, [](HSQUIRRELVM vm, auto id, auto & m) -> SQRESULT {
|
||||
// The [id] is a dpp::snowflake which is basically a uint64_t so let's leave that as is
|
||||
sq_pushinteger(vm, static_cast< SQInteger >(id));
|
||||
// Wrap the dpp::guild_member type into a DpGuildMember instance
|
||||
ClassType< DpVoiceState >::PushInstance(vm, new DpVoiceState(m));
|
||||
// The elements are now on the stack and can be inserted in the table
|
||||
return SQ_OK;
|
||||
});
|
||||
// Did anything fail?
|
||||
if (SQ_FAILED(r))
|
||||
{
|
||||
STHROWF("Unable to convert [voice_members] container");
|
||||
}
|
||||
// Return the resulted table
|
||||
return t;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Register_DPP_Guild(HSQUIRRELVM vm, Table & ns)
|
||||
{
|
||||
ns.Bind(_SC("GuildMember"),
|
||||
Class< DpGuildMember, NoConstructor< DpGuildMember > >(vm, SqDppGuildMember::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuildMember::Fn)
|
||||
.Func(_SC("_tojson"), &DpGuildMember::BuildJSON)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpGuildMember::IsValid)
|
||||
.Prop(_SC("JSON"), &DpGuildMember::BuildJSON)
|
||||
.Prop(_SC("Nickname"), &DpGuildMember::GetNickname)
|
||||
.Prop(_SC("GuildID"), &DpGuildMember::GetGuildID)
|
||||
.Prop(_SC("UserID"), &DpGuildMember::GetUserID)
|
||||
.Prop(_SC("JoinedAt"), &DpGuildMember::GetJoinedAt)
|
||||
.Prop(_SC("PremiumSince"), &DpGuildMember::GetPremiumSince)
|
||||
.Prop(_SC("Flags"), &DpGuildMember::GetFlags)
|
||||
.Prop(_SC("IsDeaf"), &DpGuildMember::IsDeaf)
|
||||
.Prop(_SC("IsMuted"), &DpGuildMember::IsMuted)
|
||||
.Prop(_SC("IsPending"), &DpGuildMember::IsPending)
|
||||
// Member Methods
|
||||
.Func(_SC("GetRoles"), &DpGuildMember::GetRoles)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Guild"),
|
||||
Class< DpGuild, NoConstructor< DpGuild > >(vm, SqDppGuild::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppGuild::Fn)
|
||||
.Func(_SC("_tojson"), &DpGuild::BuildJSON)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpGuild::IsValid)
|
||||
.Prop(_SC("JSON"), &DpGuild::BuildJSON)
|
||||
.Prop(_SC("ShardID"), &DpGuild::GetShardID)
|
||||
.Prop(_SC("Flags"), &DpGuild::GetFlags)
|
||||
.Prop(_SC("Name"), &DpGuild::GetName)
|
||||
.Prop(_SC("Description"), &DpGuild::GetDescription)
|
||||
.Prop(_SC("VanityUrlCode"), &DpGuild::GetVanityUrlCode)
|
||||
.Prop(_SC("Icon"), &DpGuild::GetIcon)
|
||||
.Prop(_SC("Splash"), &DpGuild::GetSplash)
|
||||
.Prop(_SC("DiscoverySplash"), &DpGuild::GetDiscoverySplash)
|
||||
.Prop(_SC("OwnerID"), &DpGuild::GetOwnerID)
|
||||
.Prop(_SC("VoiceRegion"), &DpGuild::GetVoiceRegion)
|
||||
.Prop(_SC("AfkChannelID"), &DpGuild::GetAfkChannelID)
|
||||
.Prop(_SC("AfkTimeout"), &DpGuild::GetAfkTimeout)
|
||||
.Prop(_SC("WidgetChannelID"), &DpGuild::GetWidgetChannelID)
|
||||
.Prop(_SC("VerificationLevel"), &DpGuild::GetVerificationLevel)
|
||||
.Prop(_SC("DefaultMessageNotifications"), &DpGuild::GetDefaultMessageNotifications)
|
||||
.Prop(_SC("ExplicitContentFilter"), &DpGuild::GetExplicitContentFilter)
|
||||
.Prop(_SC("MfaLevel"), &DpGuild::GetMfaLevel)
|
||||
.Prop(_SC("ApplicationID"), &DpGuild::GetApplicationID)
|
||||
.Prop(_SC("SystemChannelID"), &DpGuild::GetSystemChannelID)
|
||||
.Prop(_SC("RulesChannelID"), &DpGuild::GetRulesChannelID)
|
||||
.Prop(_SC("MemberCount"), &DpGuild::GetMemberCount)
|
||||
.Prop(_SC("Banner"), &DpGuild::GetBanner)
|
||||
.Prop(_SC("PremiumTier"), &DpGuild::GetPremiumTier)
|
||||
.Prop(_SC("PremiumSubscriptionCount"), &DpGuild::GetPremiumSubscriptionCount)
|
||||
.Prop(_SC("PublicUpdatesChannelID"), &DpGuild::GetPublicUpdatesChannelID)
|
||||
.Prop(_SC("MaxVideoChannelUsers"), &DpGuild::GetMaxVideoChannelUsers)
|
||||
.Prop(_SC("IsLarge"), &DpGuild::IsLarge)
|
||||
.Prop(_SC("IsUnavailable"), &DpGuild::IsUnavailable)
|
||||
.Prop(_SC("WidgetEnabled"), &DpGuild::WidgetEnabled)
|
||||
.Prop(_SC("HasInviteSplash"), &DpGuild::HasInviteSplash)
|
||||
.Prop(_SC("HasVipRegions"), &DpGuild::HasVipRegions)
|
||||
.Prop(_SC("HasVanityURL"), &DpGuild::HasVanityURL)
|
||||
.Prop(_SC("IsVerified"), &DpGuild::IsVerified)
|
||||
.Prop(_SC("IsPartnered"), &DpGuild::IsPartnered)
|
||||
.Prop(_SC("IsCommunity"), &DpGuild::IsCommunity)
|
||||
.Prop(_SC("HasCommerce"), &DpGuild::HasCommerce)
|
||||
.Prop(_SC("HasNews"), &DpGuild::HasNews)
|
||||
.Prop(_SC("IsDiscoverable"), &DpGuild::IsDiscoverable)
|
||||
.Prop(_SC("IsFeatureable"), &DpGuild::IsFeatureable)
|
||||
.Prop(_SC("HasAnimatedIcon"), &DpGuild::HasAnimatedIcon)
|
||||
.Prop(_SC("BasBanner"), &DpGuild::BasBanner)
|
||||
.Prop(_SC("WelcomeScreenEnabled"), &DpGuild::WelcomeScreenEnabled)
|
||||
.Prop(_SC("HasMemberVerificationGate"), &DpGuild::HasMemberVerificationGate)
|
||||
.Prop(_SC("IsPreviewEnabled"), &DpGuild::IsPreviewEnabled)
|
||||
.Prop(_SC("HasAnimatedIconHash"), &DpGuild::HasAnimatedIconHash)
|
||||
// Member Methods
|
||||
.Func(_SC("BuildJSON"), &DpGuild::BuildJSON_)
|
||||
.Func(_SC("GetRoles"), &DpGuild::GetRoles)
|
||||
.Func(_SC("GetChannels"), &DpGuild::GetChannels)
|
||||
.Func(_SC("GetThreads"), &DpGuild::GetThreads)
|
||||
.Func(_SC("GetMembers"), &DpGuild::GetMembers)
|
||||
.Func(_SC("GetVoiceMembers"), &DpGuild::GetVoiceMembers)
|
||||
.Func(_SC("GetEmojis"), &DpGuild::GetEmojis)
|
||||
.Func(_SC("RehashMembers"), &DpGuild::RehashMembers)
|
||||
.Func(_SC("ConnectMemberVoice"), &DpGuild::ConnectMemberVoice)
|
||||
);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -1,16 +0,0 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/DPP/Integration.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Register_DPP_Integration(HSQUIRRELVM vm, Table & ns)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -1,242 +0,0 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/DPP/Message.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMOD_DECL_TYPENAME(SqDppSelectOption, _SC("SqDppSelectOption"))
|
||||
SQMOD_DECL_TYPENAME(SqDppSelectOptions, _SC("SqDppSelectOptions"))
|
||||
SQMOD_DECL_TYPENAME(SqDppComponent, _SC("SqDppComponent"))
|
||||
SQMOD_DECL_TYPENAME(SqDppComponents, _SC("SqDppComponents"))
|
||||
SQMOD_DECL_TYPENAME(SqDppEmbedFooter, _SC("SqDppEmbedFooter"))
|
||||
SQMOD_DECL_TYPENAME(SqDppEmbedImage, _SC("SqDppEmbedImage"))
|
||||
SQMOD_DECL_TYPENAME(SqDppEmbedProvider, _SC("SqDppEmbedProvider"))
|
||||
SQMOD_DECL_TYPENAME(SqDppEmbedAuthor, _SC("SqDppEmbedAuthor"))
|
||||
SQMOD_DECL_TYPENAME(SqDppEmbedField, _SC("SqDppEmbedField"))
|
||||
SQMOD_DECL_TYPENAME(SqDppEmbed, _SC("SqDppEmbed"))
|
||||
SQMOD_DECL_TYPENAME(SqDppReaction, _SC("SqDppReaction"))
|
||||
SQMOD_DECL_TYPENAME(SqDppAttachment, _SC("SqDppAttachment"))
|
||||
SQMOD_DECL_TYPENAME(SqDppSticker, _SC("SqDppSticker"))
|
||||
SQMOD_DECL_TYPENAME(SqDppStickerPack, _SC("SqDppStickerPack"))
|
||||
SQMOD_DECL_TYPENAME(SqDppMessage, _SC("SqDppMessage"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Register_DPP_Message(HSQUIRRELVM vm, Table & ns)
|
||||
{
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("SelectOption"),
|
||||
Class< DpSelectOption, NoCopy< DpSelectOption > >(vm, SqDppSelectOption::Str)
|
||||
.Ctor()
|
||||
.Ctor< StackStrF &, StackStrF &, StackStrF & >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppSelectOption::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpSelectOption::IsValid)
|
||||
.Prop(_SC("Label"), &DpSelectOption::GetLabel, &DpSelectOption::SetLabel)
|
||||
.Prop(_SC("Value"), &DpSelectOption::GetValue, &DpSelectOption::SetValue)
|
||||
.Prop(_SC("Description"), &DpSelectOption::GetDescription, &DpSelectOption::SetDescription)
|
||||
.Prop(_SC("IsDefault"), &DpSelectOption::IsDefault, &DpSelectOption::SetDefault)
|
||||
.Prop(_SC("IsAnimated"), &DpSelectOption::IsAnimated, &DpSelectOption::SetAnimated)
|
||||
.Prop(_SC("EmojiName"), &DpSelectOption::GetEmojiName, &DpSelectOption::SetEmojiName)
|
||||
.Prop(_SC("EmojiID"), &DpSelectOption::GetEmojiID, &DpSelectOption::SetEmojiID)
|
||||
// Member Methods
|
||||
.FmtFunc(_SC("SetLabel"), &DpSelectOption::ApplyLabel)
|
||||
.FmtFunc(_SC("SetValue"), &DpSelectOption::ApplyValue)
|
||||
.FmtFunc(_SC("SetDescription"), &DpSelectOption::ApplyDescription)
|
||||
.FmtFunc(_SC("SetEmoji"), &DpSelectOption::SetEmoji)
|
||||
.FmtFunc(_SC("SetDefault"), &DpSelectOption::SetDefault)
|
||||
.FmtFunc(_SC("SetAnimated"), &DpSelectOption::SetAnimated)
|
||||
.FmtFunc(_SC("SetEmojiName"), &DpSelectOption::ApplyEmojiName)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
Register_DPP_VectorProxy< dpp::select_option, DpSelectOption, SqDppSelectOptions >(vm, ns, _SC("SelectOptions"));
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Component"),
|
||||
Class< DpComponent, NoConstructor< DpComponent > >(vm, SqDppComponent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppComponent::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpComponent::IsValid)
|
||||
.Prop(_SC("JSON"), &DpComponent::BuildJSON)
|
||||
.Prop(_SC("Type"), &DpComponent::GetType, &DpComponent::SetType)
|
||||
.Prop(_SC("Label"), &DpComponent::GetLabel, &DpComponent::SetLabel)
|
||||
.Prop(_SC("Style"), &DpComponent::GetStyle, &DpComponent::SetStyle)
|
||||
.Prop(_SC("CustomID"), &DpComponent::GetCustomID, &DpComponent::SetCustomID)
|
||||
.Prop(_SC("URL"), &DpComponent::GetURL, &DpComponent::SetURL)
|
||||
.Prop(_SC("Placeholder"), &DpComponent::GetPlaceholder, &DpComponent::SetPlaceholder)
|
||||
.Prop(_SC("MinValues"), &DpComponent::GetMinValues, &DpComponent::SetMinValues)
|
||||
.Prop(_SC("MaxValues"), &DpComponent::GetMaxValues, &DpComponent::SetMaxValues)
|
||||
.Prop(_SC("Disabled"), &DpComponent::IsDisabled, &DpComponent::SetDisabled)
|
||||
.Prop(_SC("IsAnimated"), &DpComponent::IsAnimated, &DpComponent::SetAnimated)
|
||||
.Prop(_SC("EmojiName"), &DpComponent::GetEmojiName, &DpComponent::SetEmojiName)
|
||||
.Prop(_SC("EmojiID"), &DpComponent::GetEmojiID, &DpComponent::SetEmojiID)
|
||||
// Member Methods
|
||||
.FmtFunc(_SC("SetLabel"), &DpComponent::ApplyLabel)
|
||||
.FmtFunc(_SC("SetCustomID"), &DpComponent::ApplyCustomID)
|
||||
.FmtFunc(_SC("SetURL"), &DpComponent::ApplyURL)
|
||||
.FmtFunc(_SC("SetPlaceholder"), &DpComponent::ApplyPlaceholder)
|
||||
.FmtFunc(_SC("SetDisabled"), &DpComponent::SetDisabled)
|
||||
.FmtFunc(_SC("SetAnimated"), &DpComponent::SetAnimated)
|
||||
.FmtFunc(_SC("SetEmojiName"), &DpComponent::ApplyEmojiName)
|
||||
.FmtFunc(_SC("GetComponents"), &DpComponent::GetComponents)
|
||||
.FmtFunc(_SC("GetOptions"), &DpComponent::GetOptions)
|
||||
.FmtFunc(_SC("AddComponent"), &DpComponent::AddComponent)
|
||||
.FmtFunc(_SC("AddOption"), &DpComponent::AddSelectOption)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
Register_DPP_VectorProxy< dpp::component, DpComponent, SqDppComponent >(vm, ns, _SC("Components"));
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("EmbedFooter"),
|
||||
Class< DpEmbedFooter, NoConstructor< DpEmbedFooter > >(vm, SqDppEmbedFooter::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppEmbedFooter::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpEmbedFooter::IsValid)
|
||||
.Prop(_SC("Text"), &DpEmbedFooter::GetText, &DpEmbedFooter::SetText)
|
||||
.Prop(_SC("Icon"), &DpEmbedFooter::GetIconURL, &DpEmbedFooter::SetIconURL)
|
||||
.Prop(_SC("Proxy"), &DpEmbedFooter::GetProxyURL, &DpEmbedFooter::SetProxyURL)
|
||||
// Member Methods
|
||||
.FmtFunc(_SC("SetText"), &DpEmbedFooter::ApplyText)
|
||||
.FmtFunc(_SC("SetIcon"), &DpEmbedFooter::ApplyIconURL)
|
||||
.FmtFunc(_SC("SetProxy"), &DpEmbedFooter::ApplyProxyURL)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("EmbedImage"),
|
||||
Class< DpEmbedImage, NoConstructor< DpEmbedImage > >(vm, SqDppEmbedImage::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppEmbedImage::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpEmbedImage::IsValid)
|
||||
.Prop(_SC("URL"), &DpEmbedImage::GetURL, &DpEmbedImage::SetURL)
|
||||
.Prop(_SC("Proxy"), &DpEmbedImage::GetProxyURL, &DpEmbedImage::SetProxyURL)
|
||||
.Prop(_SC("Height"), &DpEmbedImage::GetHeight, &DpEmbedImage::SetHeight)
|
||||
.Prop(_SC("Width"), &DpEmbedImage::GetWidth, &DpEmbedImage::SetWidth)
|
||||
// Member Methods
|
||||
.FmtFunc(_SC("SetURL"), &DpEmbedImage::ApplyURL)
|
||||
.FmtFunc(_SC("SetProxy"), &DpEmbedImage::ApplyProxyURL)
|
||||
.FmtFunc(_SC("SetHeight"), &DpEmbedImage::ApplyHeight)
|
||||
.FmtFunc(_SC("SetWidth"), &DpEmbedImage::ApplyWidth)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("EmbedProvider"),
|
||||
Class< DpEmbedProvider, NoConstructor< DpEmbedProvider > >(vm, SqDppEmbedProvider::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppEmbedProvider::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpEmbedProvider::IsValid)
|
||||
.Prop(_SC("Name"), &DpEmbedProvider::GetName, &DpEmbedProvider::SetName)
|
||||
.Prop(_SC("URL"), &DpEmbedProvider::GetURL, &DpEmbedProvider::SetURL)
|
||||
// Member Methods
|
||||
.FmtFunc(_SC("SetName"), &DpEmbedProvider::ApplyName)
|
||||
.FmtFunc(_SC("SetURL"), &DpEmbedProvider::ApplyURL)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("EmbedAuthor"),
|
||||
Class< DpEmbedAuthor, NoConstructor< DpEmbedAuthor > >(vm, SqDppEmbedAuthor::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppEmbedAuthor::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpEmbedAuthor::IsValid)
|
||||
.Prop(_SC("Name"), &DpEmbedAuthor::GetName, &DpEmbedAuthor::SetName)
|
||||
.Prop(_SC("URL"), &DpEmbedAuthor::GetURL, &DpEmbedAuthor::SetURL)
|
||||
.Prop(_SC("Icon"), &DpEmbedAuthor::GetIconURL, &DpEmbedAuthor::SetIconURL)
|
||||
.Prop(_SC("ProxyIcon"), &DpEmbedAuthor::GetProxyIconURL, &DpEmbedAuthor::SetProxyIconURL)
|
||||
// Member Methods
|
||||
.FmtFunc(_SC("SetName"), &DpEmbedAuthor::ApplyName)
|
||||
.FmtFunc(_SC("SetURL"), &DpEmbedAuthor::ApplyURL)
|
||||
.FmtFunc(_SC("SetIcon"), &DpEmbedAuthor::ApplyIconURL)
|
||||
.FmtFunc(_SC("SetProxyIcon"), &DpEmbedAuthor::ApplyProxyIconURL)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("EmbedField"),
|
||||
Class< DpEmbedField, NoConstructor< DpEmbedField > >(vm, SqDppEmbedField::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppEmbedField::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpEmbedField::IsValid)
|
||||
.Prop(_SC("Name"), &DpEmbedField::GetName, &DpEmbedField::SetName)
|
||||
.Prop(_SC("Value"), &DpEmbedField::GetValue, &DpEmbedField::SetValue)
|
||||
.Prop(_SC("Inline"), &DpEmbedField::IsInline, &DpEmbedField::SetInline)
|
||||
// Member Methods
|
||||
.FmtFunc(_SC("SetName"), &DpEmbedField::ApplyName)
|
||||
.FmtFunc(_SC("SetValue"), &DpEmbedField::ApplyValue)
|
||||
.FmtFunc(_SC("SetInline"), &DpEmbedField::SetInline)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Embed"),
|
||||
Class< DpEmbed, NoConstructor< DpEmbed > >(vm, SqDppEmbed::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppEmbed::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpEmbed::IsValid)
|
||||
.Prop(_SC("Title"), &DpEmbed::GetTitle, &DpEmbed::SetTitle)
|
||||
.Prop(_SC("Type"), &DpEmbed::GetType, &DpEmbed::SetType)
|
||||
.Prop(_SC("Description"), &DpEmbed::GetDescription, &DpEmbed::SetDescription)
|
||||
.Prop(_SC("URL"), &DpEmbed::GetURL, &DpEmbed::SetURL)
|
||||
.Prop(_SC("TimeStamp"), &DpEmbed::GetTimeStamp, &DpEmbed::SetTimeStamp)
|
||||
.Prop(_SC("Color"), &DpEmbed::GetColor, &DpEmbed::SetColor)
|
||||
.Prop(_SC("Footer"), &DpEmbed::GetFooter, &DpEmbed::SetFooter)
|
||||
.Prop(_SC("Image"), &DpEmbed::GetImage, &DpEmbed::SetImage)
|
||||
.Prop(_SC("Thumbnail"), &DpEmbed::GetThumbnail, &DpEmbed::SetThumbnail)
|
||||
.Prop(_SC("Video"), &DpEmbed::GetVideo, &DpEmbed::SetVideo)
|
||||
.Prop(_SC("Provider"), &DpEmbed::GetProvider, &DpEmbed::SetProvider)
|
||||
.Prop(_SC("Author"), &DpEmbed::GetAuthor, &DpEmbed::SetAuthor)
|
||||
.Prop(_SC("Fields"), &DpEmbed::GetFields)
|
||||
// Member Methods
|
||||
.FmtFunc(_SC("SetTitle"), &DpEmbed::ApplyTitle)
|
||||
.FmtFunc(_SC("SetType"), &DpEmbed::ApplyType)
|
||||
.FmtFunc(_SC("SetDescription"), &DpEmbed::ApplyDescription)
|
||||
.FmtFunc(_SC("SetURL"), &DpEmbed::ApplyURL)
|
||||
.FmtFunc(_SC("SetTimeStamp"), &DpEmbed::ApplyTimeStamp)
|
||||
.FmtFunc(_SC("SetFooter"), &DpEmbed::ApplyFooter)
|
||||
.FmtFunc(_SC("SetImage"), &DpEmbed::ApplyImage)
|
||||
.FmtFunc(_SC("SetThumbnail"), &DpEmbed::ApplyThumbnail)
|
||||
.FmtFunc(_SC("SetVideo"), &DpEmbed::ApplyVideo)
|
||||
.FmtFunc(_SC("SetProvider"), &DpEmbed::ApplyProvider)
|
||||
.FmtFunc(_SC("SetAuthor"), &DpEmbed::ApplyAuthor)
|
||||
.FmtFunc(_SC("AddField"), &DpEmbed::AddField)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Reaction"),
|
||||
Class< DpReaction, NoConstructor< DpReaction > >(vm, SqDppReaction::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppReaction::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpReaction::IsValid)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Attachment"),
|
||||
Class< DpAttachment, NoConstructor< DpAttachment > >(vm, SqDppAttachment::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppAttachment::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpAttachment::IsValid)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Sticker"),
|
||||
Class< DpSticker, NoConstructor< DpSticker > >(vm, SqDppSticker::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppSticker::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpSticker::IsValid)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("StickerPack"),
|
||||
Class< DpStickerPack, NoConstructor< DpStickerPack > >(vm, SqDppStickerPack::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppStickerPack::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpStickerPack::IsValid)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Message"),
|
||||
Class< DpMessage, NoConstructor< DpMessage > >(vm, SqDppMessage::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppMessage::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpMessage::IsValid)
|
||||
);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,74 +0,0 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/DPP/Role.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMOD_DECL_TYPENAME(SqDppRole, _SC("SqDppRole"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Register_DPP_Role(HSQUIRRELVM vm, Table & ns)
|
||||
{
|
||||
ns.Bind(_SC("Role"),
|
||||
Class< DpRole, NoConstructor< DpRole > >(vm, SqDppRole::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppRole::Fn)
|
||||
.Func(_SC("_tojson"), &DpRole::BuildJSON)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpRole::IsValid)
|
||||
.Prop(_SC("JSON"), &DpRole::BuildJSON)
|
||||
.Prop(_SC("Name"), &DpRole::GetName)
|
||||
.Prop(_SC("GuildID"), &DpRole::GetGuildID)
|
||||
.Prop(_SC("Color"), &DpRole::GetColour)
|
||||
.Prop(_SC("Colour"), &DpRole::GetColour)
|
||||
.Prop(_SC("Position"), &DpRole::GetPosition)
|
||||
.Prop(_SC("Permissions"), &DpRole::GetPermissions)
|
||||
.Prop(_SC("Flags"), &DpRole::GetFlags)
|
||||
.Prop(_SC("IntegrationID"), &DpRole::GetIntegrationID)
|
||||
.Prop(_SC("BotID"), &DpRole::GetBotID)
|
||||
.Prop(_SC("IsHoisted"), &DpRole::IsHoisted)
|
||||
.Prop(_SC("IsMentionable"), &DpRole::IsMentionable)
|
||||
.Prop(_SC("IsManaged"), &DpRole::IsManaged)
|
||||
.Prop(_SC("CanCreateInstantInvite"), &DpRole::CanCreateInstantInvite)
|
||||
.Prop(_SC("CanKickMembers"), &DpRole::CanKickMembers)
|
||||
.Prop(_SC("CanBanMembers"), &DpRole::CanBanMembers)
|
||||
.Prop(_SC("IsAdministrator"), &DpRole::IsAdministrator)
|
||||
.Prop(_SC("CanManageChannels"), &DpRole::CanManageChannels)
|
||||
.Prop(_SC("CanManageGuild"), &DpRole::CanManageGuild)
|
||||
.Prop(_SC("CanAddReactions"), &DpRole::CanAddReactions)
|
||||
.Prop(_SC("CanViewAuditLog"), &DpRole::CanViewAuditLog)
|
||||
.Prop(_SC("IsPrioritySpeaker"), &DpRole::IsPrioritySpeaker)
|
||||
.Prop(_SC("CanStream"), &DpRole::CanStream)
|
||||
.Prop(_SC("CanViewChannel"), &DpRole::CanViewChannel)
|
||||
.Prop(_SC("CanSendMessages"), &DpRole::CanSendMessages)
|
||||
.Prop(_SC("CanSendTtsMessages"), &DpRole::CanSendTtsMessages)
|
||||
.Prop(_SC("CanManageMessages"), &DpRole::CanManageMessages)
|
||||
.Prop(_SC("CanEmbedLinks"), &DpRole::CanEmbedLinks)
|
||||
.Prop(_SC("CanAttachFiles"), &DpRole::CanAttachFiles)
|
||||
.Prop(_SC("CanReadMessageHistory"), &DpRole::CanReadMessageHistory)
|
||||
.Prop(_SC("CanMentionEveryone"), &DpRole::CanMentionEveryone)
|
||||
.Prop(_SC("CanUseExternalEmojis"), &DpRole::CanUseExternalEmojis)
|
||||
.Prop(_SC("CanViewGuildInsights"), &DpRole::CanViewGuildInsights)
|
||||
.Prop(_SC("CanConnect"), &DpRole::CanConnect)
|
||||
.Prop(_SC("CanSpeak"), &DpRole::CanSpeak)
|
||||
.Prop(_SC("CanMuteMembers"), &DpRole::CanMuteMembers)
|
||||
.Prop(_SC("CanDeafenMembers"), &DpRole::CanDeafenMembers)
|
||||
.Prop(_SC("CanMoveMembers"), &DpRole::CanMoveMembers)
|
||||
.Prop(_SC("CanUseVAT"), &DpRole::CanUseVAT)
|
||||
.Prop(_SC("CanChangeNickname"), &DpRole::CanChangeNickname)
|
||||
.Prop(_SC("CanManageNicknames"), &DpRole::CanManageNicknames)
|
||||
.Prop(_SC("CanManageRoles"), &DpRole::CanManageRoles)
|
||||
.Prop(_SC("CanManageWebhooks"), &DpRole::CanManageWebhooks)
|
||||
.Prop(_SC("CanManageEmojis"), &DpRole::CanManageEmojis)
|
||||
.Prop(_SC("CanUseSlashCommands"), &DpRole::CanUseSlashCommands)
|
||||
.Prop(_SC("HasRequestToSpeak"), &DpRole::HasRequestToSpeak)
|
||||
.Prop(_SC("CanManageThreads"), &DpRole::CanManageThreads)
|
||||
.Prop(_SC("HasUsePublicThreads"), &DpRole::HasUsePublicThreads)
|
||||
.Prop(_SC("HasUsePrivateThreads"), &DpRole::HasUsePrivateThreads)
|
||||
// Member Methods
|
||||
.Func(_SC("BuildJSON"), &DpRole::BuildJSON_)
|
||||
);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -1,301 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core/Utility.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <chrono>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Represents a role within a DpGuild.
|
||||
*/
|
||||
struct DpRole
|
||||
{
|
||||
using Ptr = std::unique_ptr< dpp::role >;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Referenced role instance.
|
||||
*/
|
||||
Ptr mPtr{nullptr};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Whether the referenced pointer is owned.
|
||||
*/
|
||||
bool mOwned{false};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Default constructor.
|
||||
*/
|
||||
DpRole() noexcept = default;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
explicit DpRole(Ptr::pointer ptr, bool owned = false) noexcept
|
||||
: mPtr(ptr), mOwned(owned)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
explicit DpRole(const Ptr::element_type & o) noexcept
|
||||
: DpRole(new Ptr::element_type(o), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
explicit DpRole(Ptr::element_type && o) noexcept
|
||||
: DpRole(new Ptr::element_type(std::forward< Ptr::element_type >(o)), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor (disabled).
|
||||
*/
|
||||
DpRole(const DpRole & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
DpRole(DpRole && o) noexcept = default;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*/
|
||||
~DpRole() noexcept { Cleanup(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy assignment operator (disabled).
|
||||
*/
|
||||
DpRole & operator = (const DpRole & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move assignment operator.
|
||||
*/
|
||||
DpRole & operator = (DpRole && o) noexcept
|
||||
{
|
||||
if (this != &o) {
|
||||
Cleanup();
|
||||
// Transfer members values
|
||||
mPtr = std::move(o.mPtr);
|
||||
mOwned = o.mOwned;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Release any referenced resources and default to an empty/invalid state.
|
||||
*/
|
||||
void Cleanup()
|
||||
{
|
||||
// Do we own this to try delete it?
|
||||
if (!mOwned && mPtr) {
|
||||
// Not our job, simply forget about it
|
||||
[[maybe_unused]] auto p = mPtr.release();
|
||||
} else mPtr.reset(); // We own this so delete the instance
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle.
|
||||
*/
|
||||
void Validate() const { if (!mPtr) STHROWF("Invalid discord role handle"); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle and retrieve a const reference to it.
|
||||
*/
|
||||
SQMOD_NODISCARD Ptr::element_type & Valid() const { Validate(); return *mPtr; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether a valid instance is managed.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsValid() const { return static_cast< bool >(mPtr); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve role name.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetName() const { return Valid().name; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the role guild id.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetGuildID() const { return Valid().guild_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the role colour.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetColour() const { return static_cast< SQInteger >(Valid().colour); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the role position.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetPosition() const { return static_cast< SQInteger >(Valid().position); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the role permissions bitmask values from SqDiscordRolePermissions.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetPermissions() const { return static_cast< SQInteger >(Valid().permissions); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the role flags from SqDiscordRoleFlags.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetFlags() const { return static_cast< SQInteger >(Valid().flags); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the role integration id if any (e.g. role is a bot's role created when it was invited).
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetIntegrationID() const { return Valid().integration_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the role bot id if any (e.g. role is a bot's role created when it was invited).
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetBotID() const { return Valid().bot_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Build a JSON string from this object.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string BuildJSON() const { return Valid().build_json(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Build a JSON string from this object. If [with_id] is True then ID is to be included in the JSON.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string BuildJSON_(bool with_id) const { return Valid().build_json(with_id); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role is hoisted.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsHoisted() const { return Valid().is_hoisted(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role is mentionable.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsMentionable() const { return Valid().is_mentionable(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role is managed (belongs to a bot or application).
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsManaged() const { return Valid().is_managed(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has create instant invite permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanCreateInstantInvite() const { return Valid().has_create_instant_invite(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the kick members permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanKickMembers() const { return Valid().has_kick_members(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the ban members permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanBanMembers() const { return Valid().has_ban_members(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the administrator permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsAdministrator() const { return Valid().has_administrator(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the manage channels permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanManageChannels() const { return Valid().has_manage_channels(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the manage guild permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanManageGuild() const { return Valid().has_manage_guild(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the add reactions permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanAddReactions() const { return Valid().has_add_reactions(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the view audit log permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanViewAuditLog() const { return Valid().has_view_audit_log(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the priority speaker permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsPrioritySpeaker() const { return Valid().has_priority_speaker(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the stream permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanStream() const { return Valid().has_stream(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the view channel permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanViewChannel() const { return Valid().has_view_channel(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the send messages permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanSendMessages() const { return Valid().has_send_messages(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the send TTS messages permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanSendTtsMessages() const { return Valid().has_send_tts_messages(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the manage messages permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanManageMessages() const { return Valid().has_manage_messages(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the embed links permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanEmbedLinks() const { return Valid().has_embed_links(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the attach files permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanAttachFiles() const { return Valid().has_attach_files(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the read message history permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanReadMessageHistory() const { return Valid().has_read_message_history(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the mention \@everyone and \@here permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanMentionEveryone() const { return Valid().has_mention_everyone(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the use external emojis permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanUseExternalEmojis() const { return Valid().has_use_external_emojis(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the view guild insights permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanViewGuildInsights() const { return Valid().has_view_guild_insights(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the connect voice permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanConnect() const { return Valid().has_connect(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the speak permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanSpeak() const { return Valid().has_speak(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the mute members permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanMuteMembers() const { return Valid().has_mute_members(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the deafen members permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanDeafenMembers() const { return Valid().has_deafen_members(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the move members permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanMoveMembers() const { return Valid().has_move_members(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has use voice activity detection permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanUseVAT() const { return Valid().has_use_vad(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the change nickname permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanChangeNickname() const { return Valid().has_change_nickname(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the manage nicknames permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanManageNicknames() const { return Valid().has_manage_nicknames(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the manage roles permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanManageRoles() const { return Valid().has_manage_roles(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the manage webhooks permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanManageWebhooks() const { return Valid().has_manage_webhooks(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the manage emojis permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanManageEmojis() const { return Valid().has_manage_emojis(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the use slash commands permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanUseSlashCommands() const { return Valid().has_use_slash_commands(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the request to speak permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool HasRequestToSpeak() const { return Valid().has_request_to_speak(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the manage threads permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool CanManageThreads() const { return Valid().has_manage_threads(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the use public threads permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool HasUsePublicThreads() const { return Valid().has_use_public_threads(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the role has the use private threads permission.
|
||||
*/
|
||||
SQMOD_NODISCARD bool HasUsePrivateThreads() const { return Valid().has_use_private_threads(); }
|
||||
};
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -1,48 +0,0 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/DPP/User.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMOD_DECL_TYPENAME(SqDppUser, _SC("SqDppUser"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Register_DPP_User(HSQUIRRELVM vm, Table & ns)
|
||||
{
|
||||
ns.Bind(_SC("User"),
|
||||
Class< DpUser, NoConstructor< DpUser > >(vm, SqDppUser::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppUser::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpUser::IsValid)
|
||||
.Prop(_SC("Username"), &DpUser::GetUsername)
|
||||
.Prop(_SC("Discriminator"), &DpUser::GetDiscriminator)
|
||||
.Prop(_SC("Avatar"), &DpUser::GetAvatar)
|
||||
.Prop(_SC("Flags"), &DpUser::GetFlags)
|
||||
.Prop(_SC("RefCount"), &DpUser::GetRefCount)
|
||||
.Prop(_SC("AvatarURL"), &DpUser::GetAvatarURL)
|
||||
.Prop(_SC("IsBot"), &DpUser::IsBot)
|
||||
.Prop(_SC("IsSystem"), &DpUser::IsSystem)
|
||||
.Prop(_SC("IsMfaEnabled"), &DpUser::IsMfaEnabled)
|
||||
.Prop(_SC("IsVerified"), &DpUser::IsVerified)
|
||||
.Prop(_SC("HasNitroFull"), &DpUser::HasNitroFull)
|
||||
.Prop(_SC("HasNitroClassic"), &DpUser::HasNitroClassic)
|
||||
.Prop(_SC("IsDiscordEmployee"), &DpUser::IsDiscordEmployee)
|
||||
.Prop(_SC("IsPartneredOwner"), &DpUser::IsPartneredOwner)
|
||||
.Prop(_SC("HasHypesquadEvents"), &DpUser::HasHypesquadEvents)
|
||||
.Prop(_SC("IsBughunter1"), &DpUser::IsBughunter1)
|
||||
.Prop(_SC("IsHouseBravery"), &DpUser::IsHouseBravery)
|
||||
.Prop(_SC("IsHouseBrilliance"), &DpUser::IsHouseBrilliance)
|
||||
.Prop(_SC("IsHouseBalanace"), &DpUser::IsHouseBalanace)
|
||||
.Prop(_SC("IsEarlySupporter"), &DpUser::IsEarlySupporter)
|
||||
.Prop(_SC("IsTeamUser"), &DpUser::IsTeamUser)
|
||||
.Prop(_SC("IsBughunter2"), &DpUser::IsBughunter2)
|
||||
.Prop(_SC("IsVerifiedBot"), &DpUser::IsVerifiedBot)
|
||||
.Prop(_SC("IsVerifiedBotDev"), &DpUser::IsVerifiedBotDev)
|
||||
.Prop(_SC("IsCertifiedDoderator"), &DpUser::IsCertifiedDoderator)
|
||||
.Prop(_SC("HasAnimatedIcon"), &DpUser::HasAnimatedIcon)
|
||||
);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -1,206 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core/Utility.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Represents a user on discord. May or may not be a member of a DpGuild.
|
||||
*/
|
||||
struct DpUser
|
||||
{
|
||||
using Ptr = std::unique_ptr< dpp::user >;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Referenced user instance.
|
||||
*/
|
||||
Ptr mPtr{nullptr};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Whether the referenced pointer is owned.
|
||||
*/
|
||||
bool mOwned{false};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Default constructor.
|
||||
*/
|
||||
DpUser() noexcept = default;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
explicit DpUser(Ptr::pointer ptr, bool owned = false) noexcept
|
||||
: mPtr(ptr), mOwned(owned)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor.
|
||||
*/
|
||||
explicit DpUser(const Ptr::element_type & o) noexcept
|
||||
: DpUser(new Ptr::element_type(o), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
explicit DpUser(Ptr::element_type && o) noexcept
|
||||
: DpUser(new Ptr::element_type(std::forward< Ptr::element_type >(o)), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor (disabled).
|
||||
*/
|
||||
DpUser(const DpUser & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
DpUser(DpUser && o) noexcept = default;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*/
|
||||
~DpUser() noexcept { Cleanup(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy assignment operator (disabled).
|
||||
*/
|
||||
DpUser & operator = (const DpUser & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move assignment operator.
|
||||
*/
|
||||
DpUser & operator = (DpUser && o) noexcept
|
||||
{
|
||||
if (this != &o) {
|
||||
Cleanup();
|
||||
// Transfer members values
|
||||
mPtr = std::move(o.mPtr);
|
||||
mOwned = o.mOwned;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Release any referenced resources and default to an empty/invalid state.
|
||||
*/
|
||||
void Cleanup()
|
||||
{
|
||||
// Do we own this to try delete it?
|
||||
if (!mOwned && mPtr) {
|
||||
// Not our job, simply forget about it
|
||||
[[maybe_unused]] auto p = mPtr.release();
|
||||
} else mPtr.reset(); // We own this so delete the instance
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle.
|
||||
*/
|
||||
void Validate() const { if (!mPtr) STHROWF("Invalid discord user handle"); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle and retrieve a const reference to it.
|
||||
*/
|
||||
SQMOD_NODISCARD Ptr::element_type & Valid() const { Validate(); return *mPtr; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether a valid instance is managed.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsValid() const { return static_cast< bool >(mPtr); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve user discord username.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetUsername() const { return Valid().username; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve user discriminator (aka tag), 4 digits usually displayed with leading zeroes.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetDiscriminator() const { return static_cast< SQInteger >(Valid().discriminator); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve user avatar hash.
|
||||
*/
|
||||
SQMOD_NODISCARD const dpp::utility::iconhash & GetAvatar() const { return Valid().avatar; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve user flags built from a bitmask of values in dpp::user_flags.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetFlags() const { return static_cast< SQInteger >(Valid().flags); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve user feference count of how many guilds this user is in.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetRefCount() const { return static_cast< SQInteger >(Valid().refcount); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the avatar url of the user object.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string GetAvatarURL() const { return Valid().get_avatar_url(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user is a bot.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsBot() const { return Valid().is_bot(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user is a system user (Clyde).
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsSystem() const { return Valid().is_system(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user has multi-factor authentication enabled.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsMfaEnabled() const { return Valid().is_mfa_enabled(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user has verified account.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsVerified() const { return Valid().is_verified(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user has full nitro.
|
||||
*/
|
||||
SQMOD_NODISCARD bool HasNitroFull() const { return Valid().has_nitro_full(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user has nitro classic.
|
||||
*/
|
||||
SQMOD_NODISCARD bool HasNitroClassic() const { return Valid().has_nitro_classic(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user is a discord employee.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsDiscordEmployee() const { return Valid().is_discord_employee(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user owns a partnered server.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsPartneredOwner() const { return Valid().is_partnered_owner(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user has hype-squad events.
|
||||
*/
|
||||
SQMOD_NODISCARD bool HasHypesquadEvents() const { return Valid().has_hypesquad_events(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user has the bug-hunter level 1 badge.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsBughunter1() const { return Valid().is_bughunter_1(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user is in house bravery.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsHouseBravery() const { return Valid().is_house_bravery(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user is in house brilliance.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsHouseBrilliance() const { return Valid().is_house_brilliance(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user is in house balance.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsHouseBalanace() const { return Valid().is_house_balanace(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user is an early supporter.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsEarlySupporter() const { return Valid().is_early_supporter(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user is a team user.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsTeamUser() const { return Valid().is_team_user(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user has the bug-hunter level 2 badge.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsBughunter2() const { return Valid().is_bughunter_2(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user has the verified bot badge.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsVerifiedBot() const { return Valid().is_verified_bot(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user is an early verified bot developer.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsVerifiedBotDev() const { return Valid().is_verified_bot_dev(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user is a certified moderator.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsCertifiedDoderator() const { return Valid().is_certified_moderator(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user has an animated icon.
|
||||
*/
|
||||
SQMOD_NODISCARD bool HasAnimatedIcon() const { return Valid().has_animated_icon(); }
|
||||
};
|
||||
|
||||
} // Namespace:: SqMod
|
||||
51
module/Library/Discord.cpp
Normal file
51
module/Library/Discord.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/Discord.hpp"
|
||||
#include "Library/Discord/Cluster.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void TerminateDiscord()
|
||||
{
|
||||
// Go over all clusters and try to terminate them
|
||||
for (DpCluster * inst = DpCluster::sHead; inst && inst->mNext != DpCluster::sHead; inst = inst->mNext)
|
||||
{
|
||||
inst->Terminate(); // Terminate the cluster
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void ProcessDiscord()
|
||||
{
|
||||
// Go over all clusters and allow them to process data
|
||||
for (DpCluster * inst = DpCluster::sHead; inst && inst->mNext != DpCluster::sHead; inst = inst->mNext)
|
||||
{
|
||||
inst->Process();
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
extern void Register_Discord_Constants(HSQUIRRELVM vm, Table & ns);
|
||||
extern void Register_Discord_Events(HSQUIRRELVM vm, Table & ns);
|
||||
extern void Register_Discord_Misc(HSQUIRRELVM vm, Table & ns);
|
||||
extern void Register_Discord_Cluster(HSQUIRRELVM vm, Table & ns);
|
||||
|
||||
// ================================================================================================
|
||||
void Register_Discord(HSQUIRRELVM vm)
|
||||
{
|
||||
Table ns(vm);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
Register_Discord_Constants(vm, ns);
|
||||
{
|
||||
Table ens(vm);
|
||||
Register_Discord_Events(vm, ens);
|
||||
ns.Bind(_SC("Event"), ens);
|
||||
}
|
||||
Register_Discord_Misc(vm, ns);
|
||||
Register_Discord_Cluster(vm, ns);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
RootTable(vm).Bind(_SC("SqDiscord"), ns);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -1,16 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/DPP/Client.hpp"
|
||||
#include "Library/IO/Buffer.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <atomic>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <sqratFunction.h>
|
||||
#include <concurrentqueue.h>
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Register_DPP_Client(HSQUIRRELVM vm, Table & ns)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
9
module/Library/Discord/Application.cpp
Normal file
9
module/Library/Discord/Application.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/Discord/Application.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -4,9 +4,10 @@
|
||||
#include "Core/Utility.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
||||
9
module/Library/Discord/Automod.cpp
Normal file
9
module/Library/Discord/Automod.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/Discord/Automod.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -4,8 +4,7 @@
|
||||
#include "Core/Utility.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#define JSMN_HEADER
|
||||
#include <jsmn.h>
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
9
module/Library/Discord/Channel.cpp
Normal file
9
module/Library/Discord/Channel.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/Discord/Channel.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -1,12 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/DPP/Utilities.hpp"
|
||||
#include "Core/Utility.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
||||
9
module/Library/Discord/Client.cpp
Normal file
9
module/Library/Discord/Client.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/Discord/Client.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -3,17 +3,11 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core/Utility.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <chrono>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
|
||||
} // Namespace:: SqMod
|
||||
492
module/Library/Discord/Cluster.cpp
Normal file
492
module/Library/Discord/Cluster.cpp
Normal file
@@ -0,0 +1,492 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/Discord/Cluster.hpp"
|
||||
#include "Library/Discord/Events.hpp"
|
||||
#include "Logger.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMOD_DECL_TYPENAME(SqDpClusterTypename, _SC("SqDiscordCluster"))
|
||||
SQMOD_DECL_TYPENAME(SqDpClusterOptionsTypename, _SC("SqDiscordClusterOptions"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
DpCluster::DpCluster(DpClusterOptions & o)
|
||||
: Base(), mQueue(4096)
|
||||
, mC(std::make_unique< dpp::cluster >(o.mToken, o.mIntents, o.mShards, o.mClusterID, o.mMaxClusters, o.mCompressed, o.mPolicy, o.mRequestThreads, o.mRequestThreadsRaw))
|
||||
, mSqEvents(), mEvents(), mEventsHandle()
|
||||
{
|
||||
// Make sure all event handles are not valid
|
||||
mEventsHandle.fill(0);
|
||||
// Initialize event signals
|
||||
InitEvents();
|
||||
// Proxy library logging to our logger
|
||||
if (!o.mCustomLogging)
|
||||
{
|
||||
mC->on_log([](const dpp::log_t& event) {
|
||||
switch (event.severity)
|
||||
{
|
||||
case dpp::ll_trace: Logger::Get().Send(LOGL_DBG, true, event.message.c_str(), event.message.size()); break;
|
||||
case dpp::ll_debug: Logger::Get().Send(LOGL_DBG, true, event.message.c_str(), event.message.size()); break;
|
||||
case dpp::ll_info: Logger::Get().Send(LOGL_INF, true, event.message.c_str(), event.message.size()); break;
|
||||
case dpp::ll_warning: Logger::Get().Send(LOGL_WRN, true, event.message.c_str(), event.message.size()); break;
|
||||
case dpp::ll_error: Logger::Get().Send(LOGL_ERR, true, event.message.c_str(), event.message.size()); break;
|
||||
case dpp::ll_critical: Logger::Get().Send(LOGL_FTL, true, event.message.c_str(), event.message.size()); break;
|
||||
default: break;
|
||||
}
|
||||
});
|
||||
}
|
||||
// Remember this instance
|
||||
ChainInstance();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMOD_NODISCARD LightObj EventToScriptObject(uint8_t type, uintptr_t data);
|
||||
void EventInvokeCleanup(uint8_t type, uintptr_t data);
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::Process(bool force)
|
||||
{
|
||||
// Is there a valid connection?
|
||||
if (!mC && !force)
|
||||
{
|
||||
return; // No point in going forward
|
||||
}
|
||||
EventItem event;
|
||||
// Retrieve each event individually and process it
|
||||
for (size_t count = mQueue.size_approx(), n = 0; n <= count; ++n)
|
||||
{
|
||||
// Try to get an event from the queue
|
||||
if (mQueue.try_dequeue(event))
|
||||
{
|
||||
// Fetch the type of event
|
||||
const auto id = static_cast< size_t >(event->GetEventID());
|
||||
// Is this a valid event and is anyone listening to it?
|
||||
if (!(event->mFrom) || !(mEvents[id].first) || mEvents[id].first->IsEmpty())
|
||||
{
|
||||
continue; // Move on
|
||||
}
|
||||
// Transform the event instance into a script object
|
||||
LightObj obj = event->ToScriptObject();
|
||||
// Allow the script to take ownership of the event instance now
|
||||
[[maybe_unused]] auto p = event.release();
|
||||
// Don't abort everything down the line for an error caused by a discord event handler
|
||||
try {
|
||||
(*mEvents[id].first)(obj); // Forward the call to the associated signal
|
||||
} catch (const std::exception & e) {
|
||||
LogErr("Squirrel exception caught in (%s) discord event", p->GetEventName().data());
|
||||
LogSInf("Message: %s", e.what());
|
||||
}
|
||||
// Allow the event instance to clean itself (i.e. invalidate itself)
|
||||
// User should not keep this event object for later use!
|
||||
// Event data is accessible only during the event signal
|
||||
p->Cleanup();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::Terminate()
|
||||
{
|
||||
// Stop the cluster connection
|
||||
if (mC) mC->shutdown();
|
||||
// Release associated script objects
|
||||
mSqEvents.Release();
|
||||
// Release event signal objects
|
||||
DropEvents();
|
||||
// Delete the cluster instance
|
||||
mC.reset();
|
||||
}
|
||||
|
||||
// ================================================================================================
|
||||
void Register_Discord_Cluster(HSQUIRRELVM vm, Table & ns)
|
||||
{
|
||||
ns.Bind(_SC("ClusterOptions"),
|
||||
Class< DpClusterOptions >(vm, SqDpClusterOptionsTypename::Str)
|
||||
// Constructors
|
||||
.Ctor< StackStrF & >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpClusterOptionsTypename::Fn)
|
||||
);
|
||||
|
||||
ns.Bind(_SC("Cluster"),
|
||||
Class< DpCluster, NoCopy< DpCluster > >(vm, SqDpClusterTypename::Str)
|
||||
// Constructors
|
||||
.Ctor< DpClusterOptions & >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpClusterTypename::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("On"), &DpCluster::GetEvents)
|
||||
// Member Methods
|
||||
.Func(_SC("Start"), &DpCluster::Start)
|
||||
.Func(_SC("Stop"), &DpCluster::Stop)
|
||||
.Func(_SC("EnableEvent"), &DpCluster::EnableEvent)
|
||||
.Func(_SC("DisableEvent"), &DpCluster::DisableEvent)
|
||||
);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
DpCluster & DpCluster::EnableEvent(SQInteger id)
|
||||
{
|
||||
// Retrieve managed cluster instance
|
||||
auto & c = Valid("enable event on a");
|
||||
// Assigned event handle
|
||||
dpp::event_handle eh = 0;
|
||||
// Make sure the specified event handle is valid
|
||||
if (id >= 0 && id < static_cast< SQInteger >(DpEventID::Max))
|
||||
{
|
||||
eh = mEventsHandle[static_cast< size_t >(id)]; // Get the real handle
|
||||
}
|
||||
// Is this event already enabled?
|
||||
if (eh != 0)
|
||||
{
|
||||
return *this; // Job already done
|
||||
}
|
||||
// Identify event type
|
||||
switch (id)
|
||||
{
|
||||
case DpEventID::VoiceStateUpdate: eh = c.on_voice_state_update.attach([this](const dpp::voice_state_update_t & e) { OnVoiceStateUpdate(e); }); break;
|
||||
case DpEventID::VoiceClientDisconnect: eh = c.on_voice_client_disconnect.attach([this](const dpp::voice_client_disconnect_t & e) { OnVoiceClientDisconnect(e); }); break;
|
||||
case DpEventID::VoiceClientSpeaking: eh = c.on_voice_client_speaking.attach([this](const dpp::voice_client_speaking_t & e) { OnVoiceClientSpeaking(e); }); break;
|
||||
case DpEventID::Log: eh = c.on_log.attach([this](const dpp::log_t & e) { OnLog(e); }); break;
|
||||
case DpEventID::GuildJoinRequestDelete: eh = c.on_guild_join_request_delete.attach([this](const dpp::guild_join_request_delete_t & e) { OnGuildJoinRequestDelete(e); }); break;
|
||||
case DpEventID::InteractionCreate: eh = c.on_interaction_create.attach([this](const dpp::interaction_create_t & e) { OnInteractionCreate(e); }); break;
|
||||
case DpEventID::SlashCommand: eh = c.on_slashcommand.attach([this](const dpp::slashcommand_t & e) { OnSlashCommand(e); }); break;
|
||||
case DpEventID::ButtonClick: eh = c.on_button_click.attach([this](const dpp::button_click_t & e) { OnButtonClick(e); }); break;
|
||||
case DpEventID::AutoComplete: eh = c.on_autocomplete.attach([this](const dpp::autocomplete_t & e) { OnAutoComplete(e); }); break;
|
||||
case DpEventID::SelectClick: eh = c.on_select_click.attach([this](const dpp::select_click_t & e) { OnSelectClick(e); }); break;
|
||||
case DpEventID::MessageContextMenu: eh = c.on_message_context_menu.attach([this](const dpp::message_context_menu_t & e) { OnMessageContextMenu(e); }); break;
|
||||
case DpEventID::UserContextMenu: eh = c.on_user_context_menu.attach([this](const dpp::user_context_menu_t & e) { OnUserContextMenu(e); }); break;
|
||||
case DpEventID::FormSubmit: eh = c.on_form_submit.attach([this](const dpp::form_submit_t & e) { OnFormSubmit(e); }); break;
|
||||
case DpEventID::GuildDelete: eh = c.on_guild_delete.attach([this](const dpp::guild_delete_t & e) { OnGuildDelete(e); }); break;
|
||||
case DpEventID::ChannelDelete: eh = c.on_channel_delete.attach([this](const dpp::channel_delete_t & e) { OnChannelDelete(e); }); break;
|
||||
case DpEventID::ChannelUpdate: eh = c.on_channel_update.attach([this](const dpp::channel_update_t & e) { OnChannelUpdate(e); }); break;
|
||||
case DpEventID::Ready: eh = c.on_ready.attach([this](const dpp::ready_t & e) { OnReady(e); }); break;
|
||||
case DpEventID::MessageDelete: eh = c.on_message_delete.attach([this](const dpp::message_delete_t & e) { OnMessageDelete(e); }); break;
|
||||
case DpEventID::GuildMemberRemove: eh = c.on_guild_member_remove.attach([this](const dpp::guild_member_remove_t & e) { OnGuildMemberRemove(e); }); break;
|
||||
case DpEventID::Resumed: eh = c.on_resumed.attach([this](const dpp::resumed_t & e) { OnResumed(e); }); break;
|
||||
case DpEventID::GuildRoleCreate: eh = c.on_guild_role_create.attach([this](const dpp::guild_role_create_t & e) { OnGuildRoleCreate(e); }); break;
|
||||
case DpEventID::TypingStart: eh = c.on_typing_start.attach([this](const dpp::typing_start_t & e) { OnTypingStart(e); }); break;
|
||||
case DpEventID::MessageReactionAdd: eh = c.on_message_reaction_add.attach([this](const dpp::message_reaction_add_t & e) { OnMessageReactionAdd(e); }); break;
|
||||
case DpEventID::GuildMembersChunk: eh = c.on_guild_members_chunk.attach([this](const dpp::guild_members_chunk_t & e) { OnGuildMembersChunk(e); }); break;
|
||||
case DpEventID::MessageReactionRemove: eh = c.on_message_reaction_remove.attach([this](const dpp::message_reaction_remove_t & e) { OnMessageReactionRemove(e); }); break;
|
||||
case DpEventID::GuildCreate: eh = c.on_guild_create.attach([this](const dpp::guild_create_t & e) { OnGuildCreate(e); }); break;
|
||||
case DpEventID::ChannelCreate: eh = c.on_channel_create.attach([this](const dpp::channel_create_t & e) { OnChannelCreate(e); }); break;
|
||||
case DpEventID::MessageReactionRemoveEmoji: eh = c.on_message_reaction_remove_emoji.attach([this](const dpp::message_reaction_remove_emoji_t & e) { OnMessageReactionRemoveEmoji(e); }); break;
|
||||
case DpEventID::MessageDeleteDulk: eh = c.on_message_delete_bulk.attach([this](const dpp::message_delete_bulk_t & e) { OnMessageDeleteDulk(e); }); break;
|
||||
case DpEventID::GuildRoleUpdate: eh = c.on_guild_role_update.attach([this](const dpp::guild_role_update_t & e) { OnGuildRoleUpdate(e); }); break;
|
||||
case DpEventID::GuildRoleDelete: eh = c.on_guild_role_delete.attach([this](const dpp::guild_role_delete_t & e) { OnGuildRoleDelete(e); }); break;
|
||||
case DpEventID::ChannelPinsUpdate: eh = c.on_channel_pins_update.attach([this](const dpp::channel_pins_update_t & e) { OnChannelPinsUpdate(e); }); break;
|
||||
case DpEventID::MessageReactionRemoveAll: eh = c.on_message_reaction_remove_all.attach([this](const dpp::message_reaction_remove_all_t & e) { OnMessageReactionRemoveAll(e); }); break;
|
||||
case DpEventID::VoiceServerUpdate: eh = c.on_voice_server_update.attach([this](const dpp::voice_server_update_t & e) { OnVoiceServerUpdate(e); }); break;
|
||||
case DpEventID::GuildEmojisUpdate: eh = c.on_guild_emojis_update.attach([this](const dpp::guild_emojis_update_t & e) { OnGuildEmojisUpdate(e); }); break;
|
||||
case DpEventID::GuildStickersUpdate: eh = c.on_guild_stickers_update.attach([this](const dpp::guild_stickers_update_t & e) { OnGuildStickersUpdate(e); }); break;
|
||||
case DpEventID::PresenceUpdate: eh = c.on_presence_update.attach([this](const dpp::presence_update_t & e) { OnPresenceUpdate(e); }); break;
|
||||
case DpEventID::WebhooksUpdate: eh = c.on_webhooks_update.attach([this](const dpp::webhooks_update_t & e) { OnWebhooksUpdate(e); }); break;
|
||||
case DpEventID::AutomodRuleCreate: eh = c.on_automod_rule_create.attach([this](const dpp::automod_rule_create_t & e) { OnAutomodRuleCreate(e); }); break;
|
||||
case DpEventID::AutomodRuleUpdate: eh = c.on_automod_rule_update.attach([this](const dpp::automod_rule_update_t & e) { OnAutomodRuleUpdate(e); }); break;
|
||||
case DpEventID::AutomodRuleDelete: eh = c.on_automod_rule_delete.attach([this](const dpp::automod_rule_delete_t & e) { OnAutomodRuleDelete(e); }); break;
|
||||
case DpEventID::AutomodRuleExecute: eh = c.on_automod_rule_execute.attach([this](const dpp::automod_rule_execute_t & e) { OnAutomodRuleExecute(e); }); break;
|
||||
case DpEventID::GuildMemberAdd: eh = c.on_guild_member_add.attach([this](const dpp::guild_member_add_t & e) { OnGuildMemberAdd(e); }); break;
|
||||
case DpEventID::InviteDelete: eh = c.on_invite_delete.attach([this](const dpp::invite_delete_t & e) { OnInviteDelete(e); }); break;
|
||||
case DpEventID::GuildUpdate: eh = c.on_guild_update.attach([this](const dpp::guild_update_t & e) { OnGuildUpdate(e); }); break;
|
||||
case DpEventID::GuildIntegrationsUpdate: eh = c.on_guild_integrations_update.attach([this](const dpp::guild_integrations_update_t & e) { OnGuildIntegrationsUpdate(e); }); break;
|
||||
case DpEventID::GuildMemberUpdate: eh = c.on_guild_member_update.attach([this](const dpp::guild_member_update_t & e) { OnGuildMemberUpdate(e); }); break;
|
||||
case DpEventID::InviteCreate: eh = c.on_invite_create.attach([this](const dpp::invite_create_t & e) { OnInviteCreate(e); }); break;
|
||||
case DpEventID::MessageUpdate: eh = c.on_message_update.attach([this](const dpp::message_update_t & e) { OnMessageUpdate(e); }); break;
|
||||
case DpEventID::UserUpdate: eh = c.on_user_update.attach([this](const dpp::user_update_t & e) { OnUserUpdate(e); }); break;
|
||||
case DpEventID::MessageCreate: eh = c.on_message_create.attach([this](const dpp::message_create_t & e) { OnMessageCreate(e); }); break;
|
||||
case DpEventID::GuildBanAdd: eh = c.on_guild_ban_add.attach([this](const dpp::guild_ban_add_t & e) { OnGuildBanAdd(e); }); break;
|
||||
case DpEventID::GuildBanRemove: eh = c.on_guild_ban_remove.attach([this](const dpp::guild_ban_remove_t & e) { OnGuildBanRemove(e); }); break;
|
||||
case DpEventID::IntegrationCreate: eh = c.on_integration_create.attach([this](const dpp::integration_create_t & e) { OnIntegrationCreate(e); }); break;
|
||||
case DpEventID::IntegrationUpdate: eh = c.on_integration_update.attach([this](const dpp::integration_update_t & e) { OnIntegrationUpdate(e); }); break;
|
||||
case DpEventID::IntegrationDelete: eh = c.on_integration_delete.attach([this](const dpp::integration_delete_t & e) { OnIntegrationDelete(e); }); break;
|
||||
case DpEventID::ThreadCreate: eh = c.on_thread_create.attach([this](const dpp::thread_create_t & e) { OnThreadCreate(e); }); break;
|
||||
case DpEventID::ThreadUpdate: eh = c.on_thread_update.attach([this](const dpp::thread_update_t & e) { OnThreadUpdate(e); }); break;
|
||||
case DpEventID::ThreadDelete: eh = c.on_thread_delete.attach([this](const dpp::thread_delete_t & e) { OnThreadDelete(e); }); break;
|
||||
case DpEventID::ThreadListSync: eh = c.on_thread_list_sync.attach([this](const dpp::thread_list_sync_t & e) { OnThreadListSync(e); }); break;
|
||||
case DpEventID::ThreadMemberUpdate: eh = c.on_thread_member_update.attach([this](const dpp::thread_member_update_t & e) { OnThreadMemberUpdate(e); }); break;
|
||||
case DpEventID::ThreadMembersUpdate: eh = c.on_thread_members_update.attach([this](const dpp::thread_members_update_t & e) { OnThreadMembersUpdate(e); }); break;
|
||||
case DpEventID::GuildScheduledEventCreate: eh = c.on_guild_scheduled_event_create.attach([this](const dpp::guild_scheduled_event_create_t & e) { OnGuildScheduledEventCreate(e); }); break;
|
||||
case DpEventID::GuildScheduledEventUpdate: eh = c.on_guild_scheduled_event_update.attach([this](const dpp::guild_scheduled_event_update_t & e) { OnGuildScheduledEventUpdate(e); }); break;
|
||||
case DpEventID::GuildScheduledEventDelete: eh = c.on_guild_scheduled_event_delete.attach([this](const dpp::guild_scheduled_event_delete_t & e) { OnGuildScheduledEventDelete(e); }); break;
|
||||
case DpEventID::GuildScheduledEventUserAdd: eh = c.on_guild_scheduled_event_user_add.attach([this](const dpp::guild_scheduled_event_user_add_t & e) { OnGuildScheduledEventUserAdd(e); }); break;
|
||||
case DpEventID::GuildScheduledEventUserRemove: eh = c.on_guild_scheduled_event_user_remove.attach([this](const dpp::guild_scheduled_event_user_remove_t & e) { OnGuildScheduledEventUserRemove(e); }); break;
|
||||
case DpEventID::VoiceBufferSend: eh = c.on_voice_buffer_send.attach([this](const dpp::voice_buffer_send_t & e) { OnVoiceBufferSend(e); }); break;
|
||||
case DpEventID::VoiceUserTalking: eh = c.on_voice_user_talking.attach([this](const dpp::voice_user_talking_t & e) { OnVoiceUserTalking(e); }); break;
|
||||
case DpEventID::VoiceReady: eh = c.on_voice_ready.attach([this](const dpp::voice_ready_t & e) { OnVoiceReady(e); }); break;
|
||||
case DpEventID::VoiceReceive: eh = c.on_voice_receive.attach([this](const dpp::voice_receive_t & e) { OnVoiceReceive(e); }); break;
|
||||
case DpEventID::VoiceReceiveCombined: eh = c.on_voice_receive_combined.attach([this](const dpp::voice_receive_t & e) { OnVoiceReceiveCombined(e); }); break;
|
||||
case DpEventID::VoiceTrackMarker: eh = c.on_voice_track_marker.attach([this](const dpp::voice_track_marker_t & e) { OnVoiceTrackMarker(e); }); break;
|
||||
case DpEventID::StageInstanceCreate: eh = c.on_stage_instance_create.attach([this](const dpp::stage_instance_create_t & e) { OnStageInstanceCreate(e); }); break;
|
||||
case DpEventID::StageInstanceUpdate: eh = c.on_stage_instance_update.attach([this](const dpp::stage_instance_update_t & e) { OnStageInstanceUpdate(e); }); break;
|
||||
case DpEventID::StageInstanceDelete: eh = c.on_stage_instance_delete.attach([this](const dpp::stage_instance_delete_t & e) { OnStageInstanceDelete(e); }); break;
|
||||
case DpEventID::Max: // Fall through
|
||||
default: STHROWF("Invalid discord event identifier {}", id);
|
||||
}
|
||||
// Remember the designated event handle
|
||||
mEventsHandle[static_cast< size_t >(id)] = eh;
|
||||
// Allow chaining
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
DpCluster & DpCluster::DisableEvent(SQInteger id)
|
||||
{
|
||||
// Retrieve managed cluster instance
|
||||
auto & c = Valid("disable event on a");
|
||||
// Assigned event handle
|
||||
dpp::event_handle eh = 0;
|
||||
// Make sure the specified event handle is valid
|
||||
if (id >= 0 && id < static_cast< SQInteger >(DpEventID::Max))
|
||||
{
|
||||
eh = mEventsHandle[static_cast< size_t >(id)]; // Get the real handle
|
||||
}
|
||||
// Is there anything attached to event dispatched?
|
||||
if (eh == 0)
|
||||
{
|
||||
return *this; // Nothing to detach
|
||||
}
|
||||
// Identify event type
|
||||
switch (id)
|
||||
{
|
||||
case DpEventID::VoiceStateUpdate: c.on_voice_state_update.detach(eh); break;
|
||||
case DpEventID::VoiceClientDisconnect: c.on_voice_client_disconnect.detach(eh); break;
|
||||
case DpEventID::VoiceClientSpeaking: c.on_voice_client_speaking.detach(eh); break;
|
||||
case DpEventID::Log: c.on_log.detach(eh); break;
|
||||
case DpEventID::GuildJoinRequestDelete: c.on_guild_join_request_delete.detach(eh); break;
|
||||
case DpEventID::InteractionCreate: c.on_interaction_create.detach(eh); break;
|
||||
case DpEventID::SlashCommand: c.on_slashcommand.detach(eh); break;
|
||||
case DpEventID::ButtonClick: c.on_button_click.detach(eh); break;
|
||||
case DpEventID::AutoComplete: c.on_autocomplete.detach(eh); break;
|
||||
case DpEventID::SelectClick: c.on_select_click.detach(eh); break;
|
||||
case DpEventID::MessageContextMenu: c.on_message_context_menu.detach(eh); break;
|
||||
case DpEventID::UserContextMenu: c.on_user_context_menu.detach(eh); break;
|
||||
case DpEventID::FormSubmit: c.on_form_submit.detach(eh); break;
|
||||
case DpEventID::GuildDelete: c.on_guild_delete.detach(eh); break;
|
||||
case DpEventID::ChannelDelete: c.on_channel_delete.detach(eh); break;
|
||||
case DpEventID::ChannelUpdate: c.on_channel_update.detach(eh); break;
|
||||
case DpEventID::Ready: c.on_ready.detach(eh); break;
|
||||
case DpEventID::MessageDelete: c.on_message_delete.detach(eh); break;
|
||||
case DpEventID::GuildMemberRemove: c.on_guild_member_remove.detach(eh); break;
|
||||
case DpEventID::Resumed: c.on_resumed.detach(eh); break;
|
||||
case DpEventID::GuildRoleCreate: c.on_guild_role_create.detach(eh); break;
|
||||
case DpEventID::TypingStart: c.on_typing_start.detach(eh); break;
|
||||
case DpEventID::MessageReactionAdd: c.on_message_reaction_add.detach(eh); break;
|
||||
case DpEventID::GuildMembersChunk: c.on_guild_members_chunk.detach(eh); break;
|
||||
case DpEventID::MessageReactionRemove: c.on_message_reaction_remove.detach(eh); break;
|
||||
case DpEventID::GuildCreate: c.on_guild_create.detach(eh); break;
|
||||
case DpEventID::ChannelCreate: c.on_channel_create.detach(eh); break;
|
||||
case DpEventID::MessageReactionRemoveEmoji: c.on_message_reaction_remove_emoji.detach(eh); break;
|
||||
case DpEventID::MessageDeleteDulk: c.on_message_delete_bulk.detach(eh); break;
|
||||
case DpEventID::GuildRoleUpdate: c.on_guild_role_update.detach(eh); break;
|
||||
case DpEventID::GuildRoleDelete: c.on_guild_role_delete.detach(eh); break;
|
||||
case DpEventID::ChannelPinsUpdate: c.on_channel_pins_update.detach(eh); break;
|
||||
case DpEventID::MessageReactionRemoveAll: c.on_message_reaction_remove_all.detach(eh); break;
|
||||
case DpEventID::VoiceServerUpdate: c.on_voice_server_update.detach(eh); break;
|
||||
case DpEventID::GuildEmojisUpdate: c.on_guild_emojis_update.detach(eh); break;
|
||||
case DpEventID::GuildStickersUpdate: c.on_guild_stickers_update.detach(eh); break;
|
||||
case DpEventID::PresenceUpdate: c.on_presence_update.detach(eh); break;
|
||||
case DpEventID::WebhooksUpdate: c.on_webhooks_update.detach(eh); break;
|
||||
case DpEventID::AutomodRuleCreate: c.on_automod_rule_create.detach(eh); break;
|
||||
case DpEventID::AutomodRuleUpdate: c.on_automod_rule_update.detach(eh); break;
|
||||
case DpEventID::AutomodRuleDelete: c.on_automod_rule_delete.detach(eh); break;
|
||||
case DpEventID::AutomodRuleExecute: c.on_automod_rule_execute.detach(eh); break;
|
||||
case DpEventID::GuildMemberAdd: c.on_guild_member_add.detach(eh); break;
|
||||
case DpEventID::InviteDelete: c.on_invite_delete.detach(eh); break;
|
||||
case DpEventID::GuildUpdate: c.on_guild_update.detach(eh); break;
|
||||
case DpEventID::GuildIntegrationsUpdate: c.on_guild_integrations_update.detach(eh); break;
|
||||
case DpEventID::GuildMemberUpdate: c.on_guild_member_update.detach(eh); break;
|
||||
case DpEventID::InviteCreate: c.on_invite_create.detach(eh); break;
|
||||
case DpEventID::MessageUpdate: c.on_message_update.detach(eh); break;
|
||||
case DpEventID::UserUpdate: c.on_user_update.detach(eh); break;
|
||||
case DpEventID::MessageCreate: c.on_message_create.detach(eh); break;
|
||||
case DpEventID::GuildBanAdd: c.on_guild_ban_add.detach(eh); break;
|
||||
case DpEventID::GuildBanRemove: c.on_guild_ban_remove.detach(eh); break;
|
||||
case DpEventID::IntegrationCreate: c.on_integration_create.detach(eh); break;
|
||||
case DpEventID::IntegrationUpdate: c.on_integration_update.detach(eh); break;
|
||||
case DpEventID::IntegrationDelete: c.on_integration_delete.detach(eh); break;
|
||||
case DpEventID::ThreadCreate: c.on_thread_create.detach(eh); break;
|
||||
case DpEventID::ThreadUpdate: c.on_thread_update.detach(eh); break;
|
||||
case DpEventID::ThreadDelete: c.on_thread_delete.detach(eh); break;
|
||||
case DpEventID::ThreadListSync: c.on_thread_list_sync.detach(eh); break;
|
||||
case DpEventID::ThreadMemberUpdate: c.on_thread_member_update.detach(eh); break;
|
||||
case DpEventID::ThreadMembersUpdate: c.on_thread_members_update.detach(eh); break;
|
||||
case DpEventID::GuildScheduledEventCreate: c.on_guild_scheduled_event_create.detach(eh); break;
|
||||
case DpEventID::GuildScheduledEventUpdate: c.on_guild_scheduled_event_update.detach(eh); break;
|
||||
case DpEventID::GuildScheduledEventDelete: c.on_guild_scheduled_event_delete.detach(eh); break;
|
||||
case DpEventID::GuildScheduledEventUserAdd: c.on_guild_scheduled_event_user_add.detach(eh); break;
|
||||
case DpEventID::GuildScheduledEventUserRemove: c.on_guild_scheduled_event_user_remove.detach(eh); break;
|
||||
case DpEventID::VoiceBufferSend: c.on_voice_buffer_send.detach(eh); break;
|
||||
case DpEventID::VoiceUserTalking: c.on_voice_user_talking.detach(eh); break;
|
||||
case DpEventID::VoiceReady: c.on_voice_ready.detach(eh); break;
|
||||
case DpEventID::VoiceReceive: c.on_voice_receive.detach(eh); break;
|
||||
case DpEventID::VoiceReceiveCombined: c.on_voice_receive_combined.detach(eh); break;
|
||||
case DpEventID::VoiceTrackMarker: c.on_voice_track_marker.detach(eh); break;
|
||||
case DpEventID::StageInstanceCreate: c.on_stage_instance_create.detach(eh); break;
|
||||
case DpEventID::StageInstanceUpdate: c.on_stage_instance_update.detach(eh); break;
|
||||
case DpEventID::StageInstanceDelete: c.on_stage_instance_delete.detach(eh); break;
|
||||
case DpEventID::Max: // Fall through
|
||||
default: STHROWF("Invalid discord event identifier {}", id);
|
||||
}
|
||||
// Forget about this event handler
|
||||
mEventsHandle[static_cast< size_t >(id)] = 0;
|
||||
// Allow chaining
|
||||
return *this;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DpCluster::OnVoiceStateUpdate(const dpp::voice_state_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpVoiceStateUpdateEvent(ev))); }
|
||||
void DpCluster::OnVoiceClientDisconnect(const dpp::voice_client_disconnect_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpVoiceClientDisconnectEvent(ev))); }
|
||||
void DpCluster::OnVoiceClientSpeaking(const dpp::voice_client_speaking_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpVoiceClientSpeakingEvent(ev))); }
|
||||
void DpCluster::OnLog(const dpp::log_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpLogEvent(ev))); }
|
||||
void DpCluster::OnGuildJoinRequestDelete(const dpp::guild_join_request_delete_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildJoinRequestDeleteEvent(ev))); }
|
||||
void DpCluster::OnInteractionCreate(const dpp::interaction_create_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpInteractionCreateEvent(ev))); }
|
||||
void DpCluster::OnSlashCommand(const dpp::slashcommand_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpSlashCommandEvent(ev))); }
|
||||
void DpCluster::OnButtonClick(const dpp::button_click_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpButtonClickEvent(ev))); }
|
||||
void DpCluster::OnAutoComplete(const dpp::autocomplete_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpAutoCompleteEvent(ev))); }
|
||||
void DpCluster::OnSelectClick(const dpp::select_click_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpSelectClickEvent(ev))); }
|
||||
void DpCluster::OnMessageContextMenu(const dpp::message_context_menu_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpMessageContextMenuEvent(ev))); }
|
||||
void DpCluster::OnUserContextMenu(const dpp::user_context_menu_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpUserContextMenuEvent(ev))); }
|
||||
void DpCluster::OnFormSubmit(const dpp::form_submit_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpFormSubmitEvent(ev))); }
|
||||
void DpCluster::OnGuildDelete(const dpp::guild_delete_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildDeleteEvent(ev))); }
|
||||
void DpCluster::OnChannelDelete(const dpp::channel_delete_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpChannelDeleteEvent(ev))); }
|
||||
void DpCluster::OnChannelUpdate(const dpp::channel_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpChannelUpdateEvent(ev))); }
|
||||
void DpCluster::OnReady(const dpp::ready_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpReadyEvent(ev))); }
|
||||
void DpCluster::OnMessageDelete(const dpp::message_delete_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpMessageDeleteEvent(ev))); }
|
||||
void DpCluster::OnGuildMemberRemove(const dpp::guild_member_remove_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildMemberRemoveEvent(ev))); }
|
||||
void DpCluster::OnResumed(const dpp::resumed_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpResumedEvent(ev))); }
|
||||
void DpCluster::OnGuildRoleCreate(const dpp::guild_role_create_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildRoleCreateEvent(ev))); }
|
||||
void DpCluster::OnTypingStart(const dpp::typing_start_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpTypingStartEvent(ev))); }
|
||||
void DpCluster::OnMessageReactionAdd(const dpp::message_reaction_add_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpMessageReactionAddEvent(ev))); }
|
||||
void DpCluster::OnGuildMembersChunk(const dpp::guild_members_chunk_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildMembersChunkEvent(ev))); }
|
||||
void DpCluster::OnMessageReactionRemove(const dpp::message_reaction_remove_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpMessageReactionRemoveEvent(ev))); }
|
||||
void DpCluster::OnGuildCreate(const dpp::guild_create_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildCreateEvent(ev))); }
|
||||
void DpCluster::OnChannelCreate(const dpp::channel_create_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpChannelCreateEvent(ev))); }
|
||||
void DpCluster::OnMessageReactionRemoveEmoji(const dpp::message_reaction_remove_emoji_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpMessageReactionRemoveEmojiEvent(ev))); }
|
||||
void DpCluster::OnMessageDeleteDulk(const dpp::message_delete_bulk_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpMessageDeleteDulkEvent(ev))); }
|
||||
void DpCluster::OnGuildRoleUpdate(const dpp::guild_role_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildRoleUpdateEvent(ev))); }
|
||||
void DpCluster::OnGuildRoleDelete(const dpp::guild_role_delete_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildRoleDeleteEvent(ev))); }
|
||||
void DpCluster::OnChannelPinsUpdate(const dpp::channel_pins_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpChannelPinsUpdateEvent(ev))); }
|
||||
void DpCluster::OnMessageReactionRemoveAll(const dpp::message_reaction_remove_all_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpMessageReactionRemoveAllEvent(ev))); }
|
||||
void DpCluster::OnVoiceServerUpdate(const dpp::voice_server_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpVoiceServerUpdateEvent(ev))); }
|
||||
void DpCluster::OnGuildEmojisUpdate(const dpp::guild_emojis_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildEmojisUpdateEvent(ev))); }
|
||||
void DpCluster::OnGuildStickersUpdate(const dpp::guild_stickers_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildStickersUpdateEvent(ev))); }
|
||||
void DpCluster::OnPresenceUpdate(const dpp::presence_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpPresenceUpdateEvent(ev))); }
|
||||
void DpCluster::OnWebhooksUpdate(const dpp::webhooks_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpWebhooksUpdateEvent(ev))); }
|
||||
void DpCluster::OnAutomodRuleCreate(const dpp::automod_rule_create_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpAutomodRuleCreateEvent(ev))); }
|
||||
void DpCluster::OnAutomodRuleUpdate(const dpp::automod_rule_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpAutomodRuleUpdateEvent(ev))); }
|
||||
void DpCluster::OnAutomodRuleDelete(const dpp::automod_rule_delete_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpAutomodRuleDeleteEvent(ev))); }
|
||||
void DpCluster::OnAutomodRuleExecute(const dpp::automod_rule_execute_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpAutomodRuleExecuteEvent(ev))); }
|
||||
void DpCluster::OnGuildMemberAdd(const dpp::guild_member_add_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildMemberAddEvent(ev))); }
|
||||
void DpCluster::OnInviteDelete(const dpp::invite_delete_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpInviteDeleteEvent(ev))); }
|
||||
void DpCluster::OnGuildUpdate(const dpp::guild_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildUpdateEvent(ev))); }
|
||||
void DpCluster::OnGuildIntegrationsUpdate(const dpp::guild_integrations_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildIntegrationsUpdateEvent(ev))); }
|
||||
void DpCluster::OnGuildMemberUpdate(const dpp::guild_member_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildMemberUpdateEvent(ev))); }
|
||||
void DpCluster::OnInviteCreate(const dpp::invite_create_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpInviteCreateEvent(ev))); }
|
||||
void DpCluster::OnMessageUpdate(const dpp::message_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpMessageUpdateEvent(ev))); }
|
||||
void DpCluster::OnUserUpdate(const dpp::user_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpUserUpdateEvent(ev))); }
|
||||
void DpCluster::OnMessageCreate(const dpp::message_create_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpMessageCreateEvent(ev))); }
|
||||
void DpCluster::OnGuildBanAdd(const dpp::guild_ban_add_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildBanAddEvent(ev))); }
|
||||
void DpCluster::OnGuildBanRemove(const dpp::guild_ban_remove_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildBanRemoveEvent(ev))); }
|
||||
void DpCluster::OnIntegrationCreate(const dpp::integration_create_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpIntegrationCreateEvent(ev))); }
|
||||
void DpCluster::OnIntegrationUpdate(const dpp::integration_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpIntegrationUpdateEvent(ev))); }
|
||||
void DpCluster::OnIntegrationDelete(const dpp::integration_delete_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpIntegrationDeleteEvent(ev))); }
|
||||
void DpCluster::OnThreadCreate(const dpp::thread_create_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpThreadCreateEvent(ev))); }
|
||||
void DpCluster::OnThreadUpdate(const dpp::thread_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpThreadUpdateEvent(ev))); }
|
||||
void DpCluster::OnThreadDelete(const dpp::thread_delete_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpThreadDeleteEvent(ev))); }
|
||||
void DpCluster::OnThreadListSync(const dpp::thread_list_sync_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpThreadListSyncEvent(ev))); }
|
||||
void DpCluster::OnThreadMemberUpdate(const dpp::thread_member_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpThreadMemberUpdateEvent(ev))); }
|
||||
void DpCluster::OnThreadMembersUpdate(const dpp::thread_members_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpThreadMembersUpdateEvent(ev))); }
|
||||
void DpCluster::OnGuildScheduledEventCreate(const dpp::guild_scheduled_event_create_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildScheduledEventCreateEvent(ev))); }
|
||||
void DpCluster::OnGuildScheduledEventUpdate(const dpp::guild_scheduled_event_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildScheduledEventUpdateEvent(ev))); }
|
||||
void DpCluster::OnGuildScheduledEventDelete(const dpp::guild_scheduled_event_delete_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildScheduledEventDeleteEvent(ev))); }
|
||||
void DpCluster::OnGuildScheduledEventUserAdd(const dpp::guild_scheduled_event_user_add_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildScheduledEventUserAddEvent(ev))); }
|
||||
void DpCluster::OnGuildScheduledEventUserRemove(const dpp::guild_scheduled_event_user_remove_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpGuildScheduledEventUserRemoveEvent(ev))); }
|
||||
void DpCluster::OnVoiceBufferSend(const dpp::voice_buffer_send_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpVoiceBufferSendEvent(ev))); }
|
||||
void DpCluster::OnVoiceUserTalking(const dpp::voice_user_talking_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpVoiceUserTalkingEvent(ev))); }
|
||||
void DpCluster::OnVoiceReady(const dpp::voice_ready_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpVoiceReadyEvent(ev))); }
|
||||
void DpCluster::OnVoiceReceive(const dpp::voice_receive_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpVoiceReceiveEvent(ev))); }
|
||||
void DpCluster::OnVoiceReceiveCombined(const dpp::voice_receive_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpVoiceReceiveCombinedEvent(ev))); }
|
||||
void DpCluster::OnVoiceTrackMarker(const dpp::voice_track_marker_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpVoiceTrackMarkerEvent(ev))); }
|
||||
void DpCluster::OnStageInstanceCreate(const dpp::stage_instance_create_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpStageInstanceCreateEvent(ev))); }
|
||||
void DpCluster::OnStageInstanceUpdate(const dpp::stage_instance_update_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpStageInstanceUpdateEvent(ev))); }
|
||||
void DpCluster::OnStageInstanceDelete(const dpp::stage_instance_delete_t & ev)
|
||||
{ mQueue.enqueue(EventItem(new DpStageInstanceDeleteEvent(ev))); }
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -5,13 +5,14 @@
|
||||
#include "Core/Signal.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/DPP/Other.hpp"
|
||||
#include "Library/DPP/Constants.hpp"
|
||||
#include "Library/Discord/Constants.hpp"
|
||||
#include "Library/Discord/Misc.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <string_view>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <concurrentqueue.h>
|
||||
@@ -20,118 +21,79 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
struct DpEventBase;
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Internal event proxy.
|
||||
*
|
||||
*/
|
||||
struct DpInternalEvent
|
||||
struct DpClusterOptions
|
||||
{
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Event data.
|
||||
*/
|
||||
uint64_t mData{0llu};
|
||||
// The bot token to use for all HTTP commands and websocket connections.
|
||||
std::string mToken{};
|
||||
// A bitmask of dpd::intents values for all shards on this cluster. This is required to be sent for all bots with over 100 servers.
|
||||
uint32_t mIntents{dpp::i_default_intents};
|
||||
// The total number of shards on this bot. If there are multiple clusters, then (shards / clusters) actual shards will run on this cluster.
|
||||
// If you omit this value, the library will attempt to query the Discord API for the correct number of shards to start.
|
||||
uint32_t mShards{0};
|
||||
// The ID of this cluster, should be between 0 and MAXCLUSTERS-1
|
||||
uint32_t mClusterID{0};
|
||||
// The total number of clusters that are active, which may be on separate processes or even separate machines.
|
||||
uint32_t mMaxClusters{1};
|
||||
// Whether or not to use compression for shards on this cluster. Saves a ton of bandwidth at the cost of some CPU
|
||||
bool mCompressed{true};
|
||||
// Set the user caching policy for the cluster, either lazy (only cache users/members when they message the bot) or aggressive (request whole member lists on seeing new guilds too)
|
||||
dpp::cache_policy_t mPolicy{dpp::cp_aggressive, dpp::cp_aggressive, dpp::cp_aggressive};
|
||||
// The number of threads to allocate for making HTTP requests to Discord. This defaults to 12. You can increase this at runtime via the object returned from get_rest().
|
||||
uint32_t mRequestThreads{12};
|
||||
// The number of threads to allocate for making HTTP requests to sites outside of Discord. This defaults to 1. You can increase this at runtime via the object returned from get_raw_rest().
|
||||
uint32_t mRequestThreadsRaw{1};
|
||||
// Disable automatic forwarding of logged messages to internal logging. Allows to handle logging manually without risking duplicate output (at the cost of some performance, ofc).
|
||||
bool mCustomLogging{false};
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Default constructor.
|
||||
* Base constructors.
|
||||
*/
|
||||
DpInternalEvent() noexcept = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
DpInternalEvent(uint64_t type, void * data) noexcept
|
||||
: mData((type << 56u) | reinterpret_cast< uint64_t >(data))
|
||||
DpClusterOptions(StackStrF & token)
|
||||
: mToken(token.ToStr())
|
||||
{
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor (disabled).
|
||||
* Copy/Move constructors.
|
||||
*/
|
||||
DpInternalEvent(const DpInternalEvent & o) = delete;
|
||||
DpClusterOptions(const DpClusterOptions &) noexcept = default;
|
||||
DpClusterOptions(DpClusterOptions &&) noexcept = default;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
* Copy/Move assignment operators.
|
||||
*/
|
||||
DpInternalEvent(DpInternalEvent && o) noexcept
|
||||
: mData(o.mData)
|
||||
{
|
||||
o.mData = 0llu; // Take ownership
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*/
|
||||
~DpInternalEvent()
|
||||
{
|
||||
Release();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy assignment operator (disabled).
|
||||
*/
|
||||
DpInternalEvent & operator = (const DpInternalEvent & o) = delete;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move assignment operator.
|
||||
*/
|
||||
DpInternalEvent & operator = (DpInternalEvent && o) noexcept
|
||||
{
|
||||
if (mData != o.mData)
|
||||
{
|
||||
// Release current information
|
||||
Release();
|
||||
// Replicate members
|
||||
mData = o.mData;
|
||||
// Take ownership
|
||||
o.mData = 0llu;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Forget about the managed event data.
|
||||
*/
|
||||
void Reset() noexcept
|
||||
{
|
||||
mData = 0llu;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the event type.
|
||||
*/
|
||||
SQMOD_NODISCARD uint8_t GetType() const noexcept
|
||||
{
|
||||
return static_cast< uint8_t >((mData >> 56u) & 0xFFllu);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the event data.
|
||||
*/
|
||||
SQMOD_NODISCARD uintptr_t GetData() const noexcept
|
||||
{
|
||||
return static_cast< uintptr_t >((~(0xFFllu << 56u)) & mData);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Release associated event data, if any.
|
||||
*/
|
||||
void Release();
|
||||
DpClusterOptions & operator = (const DpClusterOptions &) noexcept = default;
|
||||
DpClusterOptions & operator = (DpClusterOptions &&) noexcept = default;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* The cluster class represents a group of shards and a command queue for sending and receiving
|
||||
* commands from discord via HTTP.
|
||||
* Primitive implementation of a discord client with basic functionality.
|
||||
*/
|
||||
struct DpCluster : public SqChainedInstances< DpCluster >
|
||||
{
|
||||
using Base = SqChainedInstances< DpCluster >;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Queue of events generated from other threads.
|
||||
*/
|
||||
using EventQueue = moodycamel::ConcurrentQueue< DpInternalEvent >;
|
||||
using EventItem = std::unique_ptr< DpEventBase >;
|
||||
using EventQueue = moodycamel::ConcurrentQueue< EventItem >;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Managed cluster instance.
|
||||
* Type of container for cluster signals.
|
||||
*/
|
||||
std::unique_ptr< dpp::cluster > mC{nullptr};
|
||||
using Signals = std::array< SignalPair, static_cast< size_t >(DpEventID::Max) >;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Type of container for event handles.
|
||||
*/
|
||||
using EventHandle = std::array< dpp::event_handle, static_cast< size_t >(DpEventID::Max) >;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Event queue.
|
||||
@@ -139,141 +101,103 @@ struct DpCluster : public SqChainedInstances< DpCluster >
|
||||
EventQueue mQueue{4096};
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
* Managed cluster instance.
|
||||
*/
|
||||
explicit DpCluster(StackStrF & token)
|
||||
: mC(std::make_unique< dpp::cluster >(token.ToStr()))
|
||||
, mQueue(4096)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
std::unique_ptr< dpp::cluster > mC;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
* Table containing the emitted cluster events.
|
||||
*/
|
||||
DpCluster(StackStrF & token, SQInteger intents)
|
||||
: mC(std::make_unique< dpp::cluster >(token.ToStr(), static_cast< uint32_t >(intents)))
|
||||
, mQueue(4096)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
LightObj mSqEvents{};
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
* Cluster signals.
|
||||
*/
|
||||
DpCluster(StackStrF & token, SQInteger intents, SQInteger shards)
|
||||
: mC(std::make_unique< dpp::cluster >(token.ToStr(), static_cast< uint32_t >(intents), static_cast< uint32_t >(shards)))
|
||||
, mQueue(4096)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
Signals mEvents{};
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
* Event handles for bound event event handlers so they can be stopped at any time.
|
||||
*/
|
||||
DpCluster(StackStrF & token, SQInteger intents, SQInteger shards, SQInteger cluster_id)
|
||||
: mC(std::make_unique< dpp::cluster >(token.ToStr(), static_cast< uint32_t >(intents), static_cast< uint32_t >(shards), static_cast< uint32_t >(cluster_id)))
|
||||
, mQueue(4096)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
EventHandle mEventsHandle{};
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
* Base constructors.
|
||||
*/
|
||||
DpCluster(StackStrF & token, SQInteger intents, SQInteger shards, SQInteger cluster_id, SQInteger max_clusters)
|
||||
: mC(std::make_unique< dpp::cluster >(token.ToStr(), static_cast< uint32_t >(intents), static_cast< uint32_t >(shards), static_cast< uint32_t >(cluster_id), static_cast< uint32_t >(max_clusters)))
|
||||
, mQueue(4096)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
DpCluster(DpClusterOptions & o);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
* Copy/Move constructors (disabled).
|
||||
*/
|
||||
DpCluster(StackStrF & token, SQInteger intents, SQInteger shards, SQInteger cluster_id, SQInteger max_clusters, bool compressed)
|
||||
: mC(std::make_unique< dpp::cluster >(token.ToStr(), static_cast< uint32_t >(intents), static_cast< uint32_t >(shards), static_cast< uint32_t >(cluster_id), static_cast< uint32_t >(max_clusters), compressed))
|
||||
, mQueue(4096)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
DpCluster(StackStrF & token, SQInteger intents, SQInteger shards, SQInteger cluster_id, SQInteger max_clusters, bool compressed, const DpCachePolicy & cp)
|
||||
: mC(std::make_unique< dpp::cluster >(token.ToStr(), static_cast< uint32_t >(intents), static_cast< uint32_t >(shards), static_cast< uint32_t >(cluster_id), static_cast< uint32_t >(max_clusters), compressed, cp.ToNative()))
|
||||
, mQueue(4096)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
DpCluster(const DpCluster &) noexcept = delete;
|
||||
DpCluster(DpCluster &&) noexcept = delete;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*/
|
||||
~DpCluster()
|
||||
{
|
||||
DropEvents();
|
||||
Stop();
|
||||
// Forget about this instance
|
||||
UnchainInstance();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Start the cluster, connecting all its shards. Returns once all shards are connected.
|
||||
* Copy/Move assignment operators (disabled).
|
||||
*/
|
||||
DpCluster & Start()
|
||||
DpCluster & operator = (const DpCluster &) noexcept = delete;
|
||||
DpCluster & operator = (DpCluster &&) noexcept = delete;
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check if the managed cluster instance is valid and throw an exception otherwise.
|
||||
*/
|
||||
void Validate() const
|
||||
{
|
||||
LogInf("Before start...");
|
||||
mC->start(true);
|
||||
LogInf("After start...");
|
||||
return *this;
|
||||
if (!mC)
|
||||
{
|
||||
STHROWF("Discord cluster instance is not valid anymore.");
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Log a message to whatever log the user is using.
|
||||
* Check if the managed cluster instance is valid and throw an exception otherwise.
|
||||
*/
|
||||
DpCluster & Log(SQInteger severity, StackStrF & message)
|
||||
void Validate(const char * m) const
|
||||
{
|
||||
mC->log(static_cast< dpp::loglevel >(severity), message.ToStr());
|
||||
return *this;
|
||||
if (!mC)
|
||||
{
|
||||
STHROWF("Cannot {} a cluster instance that is not valid anymore.", fmt::to_string_view(m));
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Get the dm channel for a user id.
|
||||
* Check if the managed cluster instance is valid and throw an exception otherwise.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetDmChannel(dpp::snowflake user_id) const
|
||||
{
|
||||
return mC->get_dm_channel(static_cast< dpp::snowflake >(user_id));
|
||||
}
|
||||
dpp::cluster & Valid() const { Validate(); return *mC; }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Set the dm channel id for a user id.
|
||||
* Check if the managed cluster instance is valid and throw an exception otherwise.
|
||||
*/
|
||||
DpCluster & SetDmChannel(dpp::snowflake user_id, dpp::snowflake channel_id)
|
||||
{
|
||||
mC->set_dm_channel(user_id, channel_id);
|
||||
return *this;
|
||||
}
|
||||
dpp::cluster & Valid(const char * m) const { Validate(m); return *mC; }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns the uptime of the cluster.
|
||||
* Process the cluster. This is used internally on each server frame.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::utility::uptime UpTime() const
|
||||
{
|
||||
return mC->uptime();
|
||||
}
|
||||
void Process(bool force = false);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Returns the uptime of the cluster.
|
||||
* Terminate the cluster. This is used internally when the VM is shutting down.
|
||||
*/
|
||||
DpCluster & SetPresence(const DpPresence & p)
|
||||
{
|
||||
mC->set_presence(p.Valid());
|
||||
return *this;
|
||||
}
|
||||
void Terminate();
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
LightObj mSqEvents{}; // Table containing the emitted cluster events.
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Start the cluster.
|
||||
*/
|
||||
DpCluster & Start() { Valid("start").start(dpp::st_return); return *this; }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Stop the cluster.
|
||||
*/
|
||||
void Stop() { Valid("stop").shutdown(); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the events table of this cluster.
|
||||
@@ -283,29 +207,6 @@ struct DpCluster : public SqChainedInstances< DpCluster >
|
||||
return mSqEvents;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Cluster signals.
|
||||
*/
|
||||
std::array< SignalPair, static_cast< size_t >(DpEventID::Max) > mEvents{};
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Process the cluster.
|
||||
*/
|
||||
void Process(bool force = false);
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Terminate the cluster.
|
||||
*/
|
||||
void Terminate()
|
||||
{
|
||||
// Delete the cluster instance
|
||||
mC.reset();
|
||||
// Release associated script objects
|
||||
mSqEvents.Release();
|
||||
// Release event signal objects
|
||||
DropEvents();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Enable a certain event for the cluster.
|
||||
*/
|
||||
@@ -318,16 +219,6 @@ struct DpCluster : public SqChainedInstances< DpCluster >
|
||||
|
||||
private:
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Initialize the cluster.
|
||||
*/
|
||||
void Initialize()
|
||||
{
|
||||
InitEvents();
|
||||
// Remember this instance
|
||||
ChainInstance();
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Signal initialization.
|
||||
*/
|
||||
@@ -338,8 +229,8 @@ private:
|
||||
{
|
||||
return;
|
||||
}
|
||||
// Create a new table on the stack
|
||||
sq_newtableex(SqVM(), 64);
|
||||
// Create a new table on the stack with enough space pre-allocated
|
||||
sq_newtableex(SqVM(), static_cast< SQInteger >(DpEventID::Max + 1));
|
||||
// Grab the table object from the stack
|
||||
mSqEvents = LightObj(-1, SqVM());
|
||||
// Pop the table object from the stack
|
||||
@@ -366,19 +257,24 @@ private:
|
||||
* Event handlers.
|
||||
*/
|
||||
void OnVoiceStateUpdate(const dpp::voice_state_update_t & ev);
|
||||
void OnVoiceClientDisconnect(const dpp::voice_client_disconnect_t & ev);
|
||||
void OnVoiceClientSpeaking(const dpp::voice_client_speaking_t & ev);
|
||||
void OnLog(const dpp::log_t & ev);
|
||||
void OnGuildJoinRequestDelete(const dpp::guild_join_request_delete_t & ev);
|
||||
void OnInteractionCreate(const dpp::interaction_create_t & ev);
|
||||
void OnSlashCommand(const dpp::slashcommand_t & ev);
|
||||
void OnButtonClick(const dpp::button_click_t & ev);
|
||||
void OnAutoComplete(const dpp::autocomplete_t & ev);
|
||||
void OnSelectClick(const dpp::select_click_t & ev);
|
||||
void OnMessageContextMenu(const dpp::message_context_menu_t & ev);
|
||||
void OnUserContextMenu(const dpp::user_context_menu_t & ev);
|
||||
void OnFormSubmit(const dpp::form_submit_t & ev);
|
||||
void OnGuildDelete(const dpp::guild_delete_t & ev);
|
||||
void OnChannelDelete(const dpp::channel_delete_t & ev);
|
||||
void OnChannelUpdate(const dpp::channel_update_t & ev);
|
||||
void OnReady(const dpp::ready_t & ev);
|
||||
void OnMessageDelete(const dpp::message_delete_t & ev);
|
||||
void OnApplicationCommandDelete(const dpp::application_command_delete_t & ev);
|
||||
void OnGuildMemberRemove(const dpp::guild_member_remove_t & ev);
|
||||
void OnApplicationCommandCreate(const dpp::application_command_create_t & ev);
|
||||
void OnResumed(const dpp::resumed_t & ev);
|
||||
void OnGuildRoleCreate(const dpp::guild_role_create_t & ev);
|
||||
void OnTypingStart(const dpp::typing_start_t & ev);
|
||||
@@ -388,7 +284,7 @@ private:
|
||||
void OnGuildCreate(const dpp::guild_create_t & ev);
|
||||
void OnChannelCreate(const dpp::channel_create_t & ev);
|
||||
void OnMessageReactionRemoveEmoji(const dpp::message_reaction_remove_emoji_t & ev);
|
||||
void OnMessageDeleteBulk(const dpp::message_delete_bulk_t & ev);
|
||||
void OnMessageDeleteDulk(const dpp::message_delete_bulk_t & ev);
|
||||
void OnGuildRoleUpdate(const dpp::guild_role_update_t & ev);
|
||||
void OnGuildRoleDelete(const dpp::guild_role_delete_t & ev);
|
||||
void OnChannelPinsUpdate(const dpp::channel_pins_update_t & ev);
|
||||
@@ -398,12 +294,15 @@ private:
|
||||
void OnGuildStickersUpdate(const dpp::guild_stickers_update_t & ev);
|
||||
void OnPresenceUpdate(const dpp::presence_update_t & ev);
|
||||
void OnWebhooksUpdate(const dpp::webhooks_update_t & ev);
|
||||
void OnAutomodRuleCreate(const dpp::automod_rule_create_t & ev);
|
||||
void OnAutomodRuleUpdate(const dpp::automod_rule_update_t & ev);
|
||||
void OnAutomodRuleDelete(const dpp::automod_rule_delete_t & ev);
|
||||
void OnAutomodRuleExecute(const dpp::automod_rule_execute_t & ev);
|
||||
void OnGuildMemberAdd(const dpp::guild_member_add_t & ev);
|
||||
void OnInviteDelete(const dpp::invite_delete_t & ev);
|
||||
void OnGuildUpdate(const dpp::guild_update_t & ev);
|
||||
void OnGuildIntegrationsUpdate(const dpp::guild_integrations_update_t & ev);
|
||||
void OnGuildMemberUpdate(const dpp::guild_member_update_t & ev);
|
||||
void OnApplicationCommandUpdate(const dpp::application_command_update_t & ev);
|
||||
void OnInviteCreate(const dpp::invite_create_t & ev);
|
||||
void OnMessageUpdate(const dpp::message_update_t & ev);
|
||||
void OnUserUpdate(const dpp::user_update_t & ev);
|
||||
@@ -419,12 +318,19 @@ private:
|
||||
void OnThreadListSync(const dpp::thread_list_sync_t & ev);
|
||||
void OnThreadMemberUpdate(const dpp::thread_member_update_t & ev);
|
||||
void OnThreadMembersUpdate(const dpp::thread_members_update_t & ev);
|
||||
void OnGuildScheduledEventCreate(const dpp::guild_scheduled_event_create_t & ev);
|
||||
void OnGuildScheduledEventUpdate(const dpp::guild_scheduled_event_update_t & ev);
|
||||
void OnGuildScheduledEventDelete(const dpp::guild_scheduled_event_delete_t & ev);
|
||||
void OnGuildScheduledEventUserAdd(const dpp::guild_scheduled_event_user_add_t & ev);
|
||||
void OnGuildScheduledEventUserRemove(const dpp::guild_scheduled_event_user_remove_t & ev);
|
||||
void OnVoiceBufferSend(const dpp::voice_buffer_send_t & ev);
|
||||
void OnVoiceUserTalking(const dpp::voice_user_talking_t & ev);
|
||||
void OnVoiceReady(const dpp::voice_ready_t & ev);
|
||||
void OnVoiceReceive(const dpp::voice_receive_t & ev);
|
||||
void OnVoiceReceiveCombined(const dpp::voice_receive_t & ev);
|
||||
void OnVoiceTrackMarker(const dpp::voice_track_marker_t & ev);
|
||||
void OnStageInstanceCreate(const dpp::stage_instance_create_t & ev);
|
||||
void OnStageInstanceUpdate(const dpp::stage_instance_update_t & ev);
|
||||
void OnStageInstanceDelete(const dpp::stage_instance_delete_t & ev);
|
||||
};
|
||||
|
||||
9
module/Library/Discord/Command.cpp
Normal file
9
module/Library/Discord/Command.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/Discord/Command.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -3,17 +3,11 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core/Utility.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <chrono>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
|
||||
} // Namespace:: SqMod
|
||||
282
module/Library/Discord/Constants.cpp
Normal file
282
module/Library/Discord/Constants.cpp
Normal file
@@ -0,0 +1,282 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/Discord/Constants.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <sqratConst.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
const std::array< const char *, static_cast< size_t >(DpEventID::Max) > DpEventID::NAME{
|
||||
"VoiceStateUpdate",
|
||||
"VoiceClientDisconnect",
|
||||
"VoiceClientSpeaking",
|
||||
"Log",
|
||||
"GuildJoinRequestDelete",
|
||||
"InteractionCreate",
|
||||
"SlashCommand",
|
||||
"ButtonClick",
|
||||
"AutoComplete",
|
||||
"SelectClick",
|
||||
"MessageContextMenu",
|
||||
"UserContextMenu",
|
||||
"FormSubmit",
|
||||
"GuildDelete",
|
||||
"ChannelDelete",
|
||||
"ChannelUpdate",
|
||||
"Ready",
|
||||
"MessageDelete",
|
||||
"GuildMemberRemove",
|
||||
"Resumed",
|
||||
"GuildRoleCreate",
|
||||
"TypingStart",
|
||||
"MessageReactionAdd",
|
||||
"GuildMembersChunk",
|
||||
"MessageReactionRemove",
|
||||
"GuildCreate",
|
||||
"ChannelCreate",
|
||||
"MessageReactionRemoveEmoji",
|
||||
"MessageDeleteDulk",
|
||||
"GuildRoleUpdate",
|
||||
"GuildRoleDelete",
|
||||
"ChannelPinsUpdate",
|
||||
"MessageReactionRemoveAll",
|
||||
"VoiceServerUpdate",
|
||||
"GuildEmojisUpdate",
|
||||
"GuildStickersUpdate",
|
||||
"PresenceUpdate",
|
||||
"WebhooksUpdate",
|
||||
"AutomodRuleCreate",
|
||||
"AutomodRuleUpdate",
|
||||
"AutomodRuleDelete",
|
||||
"AutomodRuleExecute",
|
||||
"GuildMemberAdd",
|
||||
"InviteDelete",
|
||||
"GuildUpdate",
|
||||
"GuildIntegrationsUpdate",
|
||||
"GuildMemberUpdate",
|
||||
"InviteCreate",
|
||||
"MessageUpdate",
|
||||
"UserUpdate",
|
||||
"MessageCreate",
|
||||
"GuildBanAdd",
|
||||
"GuildBanRemove",
|
||||
"IntegrationCreate",
|
||||
"IntegrationUpdate",
|
||||
"IntegrationDelete",
|
||||
"ThreadCreate",
|
||||
"ThreadUpdate",
|
||||
"ThreadDelete",
|
||||
"ThreadListSync",
|
||||
"ThreadMemberUpdate",
|
||||
"ThreadMembersUpdate",
|
||||
"GuildScheduledEventCreate",
|
||||
"GuildScheduledEventUpdate",
|
||||
"GuildScheduledEventDelete",
|
||||
"GuildScheduledEventUserAdd",
|
||||
"GuildScheduledEventUserRemove",
|
||||
"VoiceBufferSend",
|
||||
"VoiceUserTalking",
|
||||
"VoiceReady",
|
||||
"VoiceReceive",
|
||||
"VoiceReceiveCombined",
|
||||
"VoiceTrackMarker",
|
||||
"StageInstanceCreate",
|
||||
"StageInstanceUpdate",
|
||||
"StageInstanceDelete",
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpLogLevelEnum[] = {
|
||||
{_SC("Trace"), static_cast< SQInteger >(dpp::ll_trace)},
|
||||
{_SC("Debug"), static_cast< SQInteger >(dpp::ll_debug)},
|
||||
{_SC("Info"), static_cast< SQInteger >(dpp::ll_info)},
|
||||
{_SC("Warning"), static_cast< SQInteger >(dpp::ll_warning)},
|
||||
{_SC("Error"), static_cast< SQInteger >(dpp::ll_error)},
|
||||
{_SC("Critical"), static_cast< SQInteger >(dpp::ll_critical)},
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpVoiceStateFlagsEnum[] = {
|
||||
{_SC("Deaf"), static_cast< SQInteger >(dpp::vs_deaf)},
|
||||
{_SC("Mute"), static_cast< SQInteger >(dpp::vs_mute)},
|
||||
{_SC("SelfMute"), static_cast< SQInteger >(dpp::vs_self_mute)},
|
||||
{_SC("SelfDeaf"), static_cast< SQInteger >(dpp::vs_self_deaf)},
|
||||
{_SC("SelfStream"), static_cast< SQInteger >(dpp::vs_self_stream)},
|
||||
{_SC("SelfVideo"), static_cast< SQInteger >(dpp::vs_self_video)},
|
||||
{_SC("Suppress"), static_cast< SQInteger >(dpp::vs_suppress)},
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpEmojiFlagsEnum[] = {
|
||||
{_SC("RequireColons"), static_cast< SQInteger >(dpp::e_require_colons)},
|
||||
{_SC("Managed"), static_cast< SQInteger >(dpp::e_managed)},
|
||||
{_SC("Animated"), static_cast< SQInteger >(dpp::e_animated)},
|
||||
{_SC("Available"), static_cast< SQInteger >(dpp::e_available)},
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpPresenceFlagsEnum[] = {
|
||||
{_SC("DesktopOnline"), static_cast< SQInteger >(dpp::p_desktop_online)},
|
||||
{_SC("DesktopDND"), static_cast< SQInteger >(dpp::p_desktop_dnd)},
|
||||
{_SC("DesktopIdle"), static_cast< SQInteger >(dpp::p_desktop_idle)},
|
||||
{_SC("WebOnline"), static_cast< SQInteger >(dpp::p_web_online)},
|
||||
{_SC("WebDND"), static_cast< SQInteger >(dpp::p_web_dnd)},
|
||||
{_SC("WebIdle"), static_cast< SQInteger >(dpp::p_web_idle)},
|
||||
{_SC("MobileOnline"), static_cast< SQInteger >(dpp::p_mobile_online)},
|
||||
{_SC("MobileDND"), static_cast< SQInteger >(dpp::p_mobile_dnd)},
|
||||
{_SC("MobileIdle"), static_cast< SQInteger >(dpp::p_mobile_idle)},
|
||||
{_SC("StatusOnline"), static_cast< SQInteger >(dpp::p_status_online)},
|
||||
{_SC("StatusDND"), static_cast< SQInteger >(dpp::p_status_dnd)},
|
||||
{_SC("StatusIdle"), static_cast< SQInteger >(dpp::p_status_idle)},
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpPresenceStatusEnum[] = {
|
||||
{_SC("Offline"), static_cast< SQInteger >(dpp::ps_offline)},
|
||||
{_SC("Online"), static_cast< SQInteger >(dpp::ps_online)},
|
||||
{_SC("DND"), static_cast< SQInteger >(dpp::ps_dnd)},
|
||||
{_SC("Idle"), static_cast< SQInteger >(dpp::ps_idle)},
|
||||
// Bit shift for desktop status
|
||||
{_SC("ShiftDesktop"), static_cast< SQInteger >(PF_SHIFT_DESKTOP)},
|
||||
{_SC("ShiftWeb"), static_cast< SQInteger >(PF_SHIFT_WEB)},
|
||||
{_SC("ShiftMobile"), static_cast< SQInteger >(PF_SHIFT_MOBILE)},
|
||||
{_SC("ShiftMain"), static_cast< SQInteger >(PF_SHIFT_MAIN)},
|
||||
{_SC("StatusMask"), static_cast< SQInteger >(PF_STATUS_MASK)},
|
||||
{_SC("ClearDesktop"), static_cast< SQInteger >(PF_CLEAR_DESKTOP)},
|
||||
{_SC("ClearWeb"), static_cast< SQInteger >(PF_CLEAR_WEB)},
|
||||
{_SC("ClearMobile"), static_cast< SQInteger >(PF_CLEAR_MOBILE)},
|
||||
{_SC("ClearStatus"), static_cast< SQInteger >(PF_CLEAR_STATUS)},
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpActivityTypeEnum[] = {
|
||||
{_SC("Game"), static_cast< SQInteger >(dpp::at_game)},
|
||||
{_SC("Streaming"), static_cast< SQInteger >(dpp::at_streaming)},
|
||||
{_SC("Listening"), static_cast< SQInteger >(dpp::at_listening)},
|
||||
{_SC("Watching"), static_cast< SQInteger >(dpp::at_watching)},
|
||||
{_SC("Custom"), static_cast< SQInteger >(dpp::at_custom)},
|
||||
{_SC("Competing"), static_cast< SQInteger >(dpp::at_competing)},
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpActivityFlagsEnum[] = {
|
||||
{_SC("Instance"), static_cast< SQInteger >(dpp::af_instance)},
|
||||
{_SC("Join"), static_cast< SQInteger >(dpp::af_join)},
|
||||
{_SC("Spectate"), static_cast< SQInteger >(dpp::af_spectate)},
|
||||
{_SC("JoinRequest"), static_cast< SQInteger >(dpp::af_join_request)},
|
||||
{_SC("Sync"), static_cast< SQInteger >(dpp::af_sync)},
|
||||
{_SC("Play"), static_cast< SQInteger >(dpp::af_play)},
|
||||
{_SC("PartyPrivacyFriends"), static_cast< SQInteger >(dpp::af_party_privacy_friends)},
|
||||
{_SC("PartyPrivacyVoiceChannel"), static_cast< SQInteger >(dpp::af_party_privacy_voice_channel)},
|
||||
{_SC("Embedded"), static_cast< SQInteger >(dpp::af_embedded)},
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpRegionEnum[] = {
|
||||
{_SC("Brazil"), static_cast< SQInteger >(dpp::r_brazil)},
|
||||
{_SC("CentralEurope"), static_cast< SQInteger >(dpp::r_central_europe)},
|
||||
{_SC("HongKong"), static_cast< SQInteger >(dpp::r_hong_kong)},
|
||||
{_SC("India"), static_cast< SQInteger >(dpp::r_india)},
|
||||
{_SC("Japan"), static_cast< SQInteger >(dpp::r_japan)},
|
||||
{_SC("Russia"), static_cast< SQInteger >(dpp::r_russia)},
|
||||
{_SC("Singapore"), static_cast< SQInteger >(dpp::r_singapore)},
|
||||
{_SC("SouthAfrica"), static_cast< SQInteger >(dpp::r_south_africa)},
|
||||
{_SC("Sydney"), static_cast< SQInteger >(dpp::r_sydney)},
|
||||
{_SC("UsCentral"), static_cast< SQInteger >(dpp::r_us_central)},
|
||||
{_SC("UsEast"), static_cast< SQInteger >(dpp::r_us_east)},
|
||||
{_SC("UsSouth"), static_cast< SQInteger >(dpp::r_us_south)},
|
||||
{_SC("UsWest"), static_cast< SQInteger >(dpp::r_us_west)},
|
||||
{_SC("WesternEurope"), static_cast< SQInteger >(dpp::r_western_europe)},
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpGuildFlagsEnum[] = {
|
||||
{_SC("Large"), static_cast< SQInteger >(dpp::g_large)},
|
||||
{_SC("Unavailable"), static_cast< SQInteger >(dpp::g_unavailable)},
|
||||
{_SC("WidgetEnabled"), static_cast< SQInteger >(dpp::g_widget_enabled)},
|
||||
{_SC("InviteSplash"), static_cast< SQInteger >(dpp::g_invite_splash)},
|
||||
{_SC("VipRegions"), static_cast< SQInteger >(dpp::g_vip_regions)},
|
||||
{_SC("VanityURL"), static_cast< SQInteger >(dpp::g_vanity_url)},
|
||||
{_SC("Verified"), static_cast< SQInteger >(dpp::g_verified)},
|
||||
{_SC("Partnered"), static_cast< SQInteger >(dpp::g_partnered)},
|
||||
{_SC("Community"), static_cast< SQInteger >(dpp::g_community)},
|
||||
{_SC("RoleSubscriptionEnabled"), static_cast< SQInteger >(dpp::g_role_subscription_enabled)},
|
||||
{_SC("News"), static_cast< SQInteger >(dpp::g_news)},
|
||||
{_SC("Discoverable"), static_cast< SQInteger >(dpp::g_discoverable)},
|
||||
{_SC("Featureable"), static_cast< SQInteger >(dpp::g_featureable)},
|
||||
{_SC("AnimatedIcon"), static_cast< SQInteger >(dpp::g_animated_icon)},
|
||||
{_SC("Banner"), static_cast< SQInteger >(dpp::g_banner)},
|
||||
{_SC("WelcomeScreenEnabled"), static_cast< SQInteger >(dpp::g_welcome_screen_enabled)},
|
||||
{_SC("MemberVerificationGate"), static_cast< SQInteger >(dpp::g_member_verification_gate)},
|
||||
{_SC("PreviewEnabled"), static_cast< SQInteger >(dpp::g_preview_enabled)},
|
||||
{_SC("NoJoinNotifications"), static_cast< SQInteger >(dpp::g_no_join_notifications)},
|
||||
{_SC("NoBoostNotifications"), static_cast< SQInteger >(dpp::g_no_boost_notifications)},
|
||||
{_SC("HasAnimatedIcon"), static_cast< SQInteger >(dpp::g_has_animated_icon)},
|
||||
{_SC("HasAnimatedBanner"), static_cast< SQInteger >(dpp::g_has_animated_banner)},
|
||||
{_SC("NoSetupTips"), static_cast< SQInteger >(dpp::g_no_setup_tips)},
|
||||
{_SC("NoStickerGreeting"), static_cast< SQInteger >(dpp::g_no_sticker_greeting)},
|
||||
{_SC("MonetizationEnabled"), static_cast< SQInteger >(dpp::g_monetization_enabled)},
|
||||
{_SC("MoreStickers"), static_cast< SQInteger >(dpp::g_more_stickers)},
|
||||
{_SC("CreatorStorePageEnabled"), static_cast< SQInteger >(dpp::g_creator_store_page_enabled)},
|
||||
{_SC("RoleIcons"), static_cast< SQInteger >(dpp::g_role_icons)},
|
||||
{_SC("SevenDayThreadArchive"), static_cast< SQInteger >(dpp::g_seven_day_thread_archive)},
|
||||
{_SC("ThreeDayThreadArchive"), static_cast< SQInteger >(dpp::g_three_day_thread_archive)},
|
||||
{_SC("TicketedEvents"), static_cast< SQInteger >(dpp::g_ticketed_events)},
|
||||
{_SC("ChannelBanners"), static_cast< SQInteger >(dpp::g_channel_banners)},
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpGuildFlagsExtraEnum[] = {
|
||||
{_SC("PremiumProgressBarEnabled"), static_cast< SQInteger >(dpp::g_premium_progress_bar_enabled)},
|
||||
{_SC("AnimatedBanner"), static_cast< SQInteger >(dpp::g_animated_banner)},
|
||||
{_SC("AutoModeration"), static_cast< SQInteger >(dpp::g_auto_moderation)},
|
||||
{_SC("InvitesDisabled"), static_cast< SQInteger >(dpp::g_invites_disabled)},
|
||||
{_SC("DeveloperSupportServer"), static_cast< SQInteger >(dpp::g_developer_support_server)},
|
||||
{_SC("NoRoleSubscriptionNotifications"), static_cast< SQInteger >(dpp::g_no_role_subscription_notifications)},
|
||||
{_SC("NoRoleSubscriptionNotificationReplies"), static_cast< SQInteger >(dpp::g_no_role_subscription_notification_replies)},
|
||||
{_SC("RoleSubscriptionsAvailableForPurchase"), static_cast< SQInteger >(dpp::g_role_subscriptions_available_for_purchase)},
|
||||
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElement g_DpGuildMemberFlagsEnum[] = {
|
||||
{_SC("Deaf"), static_cast< SQInteger >(dpp::gm_deaf)},
|
||||
{_SC("Mute"), static_cast< SQInteger >(dpp::gm_mute)},
|
||||
{_SC("Pending"), static_cast< SQInteger >(dpp::gm_pending)},
|
||||
{_SC("AnimatedAvatar"), static_cast< SQInteger >(dpp::gm_animated_avatar)},
|
||||
{_SC("VoiceAction"), static_cast< SQInteger >(dpp::gm_voice_action)},
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
static const EnumElements g_EnumList[] = {
|
||||
{_SC("SqDiscordLogLevel"), g_DpLogLevelEnum},
|
||||
{_SC("SqDiscordVoiceStateFlags"), g_DpVoiceStateFlagsEnum},
|
||||
{_SC("SqDiscordEmojiFlags"), g_DpEmojiFlagsEnum},
|
||||
{_SC("SqDiscordPresenceFlags"), g_DpPresenceFlagsEnum},
|
||||
{_SC("SqDiscordPresenceStatus"), g_DpPresenceStatusEnum},
|
||||
{_SC("SqDiscordActivityType"), g_DpActivityTypeEnum},
|
||||
{_SC("SqDiscordActivityFlags"), g_DpActivityFlagsEnum},
|
||||
{_SC("SqDiscordRegion"), g_DpRegionEnum},
|
||||
{_SC("SqDiscordGuildFlags"), g_DpGuildFlagsEnum},
|
||||
{_SC("SqDiscordGuildFlagsExtra"), g_DpGuildFlagsExtraEnum},
|
||||
{_SC("SqDiscordGuildMemberFlags"), g_DpGuildMemberFlagsEnum},
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Register_Discord_Constants(HSQUIRRELVM vm, Table & ns)
|
||||
{
|
||||
RegisterEnumerations(vm, g_EnumList);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
Enumeration e(vm);
|
||||
// Bind all events using their associated name
|
||||
for (SQInteger i = 0; i < static_cast< SQInteger >(DpEventID::Max); ++i)
|
||||
{
|
||||
e.Const(DpEventID::NAME[i], i);
|
||||
}
|
||||
// Expose the constants
|
||||
ConstTable(vm).Enum(_SC("SqDiscordEvent"), e);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
655
module/Library/Discord/Constants.hpp
Normal file
655
module/Library/Discord/Constants.hpp
Normal file
@@ -0,0 +1,655 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core/Utility.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <array>
|
||||
#include <string_view>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Unique ID for each event.
|
||||
*/
|
||||
struct DpEventID
|
||||
{
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* ID enumeration.
|
||||
*/
|
||||
enum Type
|
||||
{
|
||||
VoiceStateUpdate=0,
|
||||
VoiceClientDisconnect,
|
||||
VoiceClientSpeaking,
|
||||
Log,
|
||||
GuildJoinRequestDelete,
|
||||
InteractionCreate,
|
||||
SlashCommand,
|
||||
ButtonClick,
|
||||
AutoComplete,
|
||||
SelectClick,
|
||||
MessageContextMenu,
|
||||
UserContextMenu,
|
||||
FormSubmit,
|
||||
GuildDelete,
|
||||
ChannelDelete,
|
||||
ChannelUpdate,
|
||||
Ready,
|
||||
MessageDelete,
|
||||
GuildMemberRemove,
|
||||
Resumed,
|
||||
GuildRoleCreate,
|
||||
TypingStart,
|
||||
MessageReactionAdd,
|
||||
GuildMembersChunk,
|
||||
MessageReactionRemove,
|
||||
GuildCreate,
|
||||
ChannelCreate,
|
||||
MessageReactionRemoveEmoji,
|
||||
MessageDeleteDulk,
|
||||
GuildRoleUpdate,
|
||||
GuildRoleDelete,
|
||||
ChannelPinsUpdate,
|
||||
MessageReactionRemoveAll,
|
||||
VoiceServerUpdate,
|
||||
GuildEmojisUpdate,
|
||||
GuildStickersUpdate,
|
||||
PresenceUpdate,
|
||||
WebhooksUpdate,
|
||||
AutomodRuleCreate,
|
||||
AutomodRuleUpdate,
|
||||
AutomodRuleDelete,
|
||||
AutomodRuleExecute,
|
||||
GuildMemberAdd,
|
||||
InviteDelete,
|
||||
GuildUpdate,
|
||||
GuildIntegrationsUpdate,
|
||||
GuildMemberUpdate,
|
||||
InviteCreate,
|
||||
MessageUpdate,
|
||||
UserUpdate,
|
||||
MessageCreate,
|
||||
GuildBanAdd,
|
||||
GuildBanRemove,
|
||||
IntegrationCreate,
|
||||
IntegrationUpdate,
|
||||
IntegrationDelete,
|
||||
ThreadCreate,
|
||||
ThreadUpdate,
|
||||
ThreadDelete,
|
||||
ThreadListSync,
|
||||
ThreadMemberUpdate,
|
||||
ThreadMembersUpdate,
|
||||
GuildScheduledEventCreate,
|
||||
GuildScheduledEventUpdate,
|
||||
GuildScheduledEventDelete,
|
||||
GuildScheduledEventUserAdd,
|
||||
GuildScheduledEventUserRemove,
|
||||
VoiceBufferSend,
|
||||
VoiceUserTalking,
|
||||
VoiceReady,
|
||||
VoiceReceive,
|
||||
VoiceReceiveCombined,
|
||||
VoiceTrackMarker,
|
||||
StageInstanceCreate,
|
||||
StageInstanceUpdate,
|
||||
StageInstanceDelete,
|
||||
Max
|
||||
};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* String identification for each event ID.
|
||||
*/
|
||||
static const std::array< const char *, static_cast< size_t >(Max) > NAME;
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Structures that hold compile-time type information for events.
|
||||
*/
|
||||
struct DpVoiceStateUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::voice_state_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::VoiceStateUpdate;
|
||||
static inline constexpr std::string_view Name = "VoiceStateUpdate";
|
||||
};
|
||||
struct DpVoiceClientDisconnectEventInfo
|
||||
{
|
||||
using Type = dpp::voice_client_disconnect_t;
|
||||
static inline constexpr size_t ID = DpEventID::VoiceClientDisconnect;
|
||||
static inline constexpr std::string_view Name = "VoiceClientDisconnect";
|
||||
};
|
||||
struct DpVoiceClientSpeakingEventInfo
|
||||
{
|
||||
using Type = dpp::voice_client_speaking_t;
|
||||
static inline constexpr size_t ID = DpEventID::VoiceClientSpeaking;
|
||||
static inline constexpr std::string_view Name = "VoiceClientSpeaking";
|
||||
};
|
||||
struct DpLogEventInfo
|
||||
{
|
||||
using Type = dpp::log_t;
|
||||
static inline constexpr size_t ID = DpEventID::Log;
|
||||
static inline constexpr std::string_view Name = "Log";
|
||||
};
|
||||
struct DpGuildJoinRequestDeleteEventInfo
|
||||
{
|
||||
using Type = dpp::guild_join_request_delete_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildJoinRequestDelete;
|
||||
static inline constexpr std::string_view Name = "GuildJoinRequestDelete";
|
||||
};
|
||||
struct DpInteractionCreateEventInfo
|
||||
{
|
||||
using Type = dpp::interaction_create_t;
|
||||
static inline constexpr size_t ID = DpEventID::InteractionCreate;
|
||||
static inline constexpr std::string_view Name = "InteractionCreate";
|
||||
};
|
||||
struct DpSlashCommandEventInfo
|
||||
{
|
||||
using Type = dpp::slashcommand_t;
|
||||
static inline constexpr size_t ID = DpEventID::SlashCommand;
|
||||
static inline constexpr std::string_view Name = "SlashCommand";
|
||||
};
|
||||
struct DpButtonClickEventInfo
|
||||
{
|
||||
using Type = dpp::button_click_t;
|
||||
static inline constexpr size_t ID = DpEventID::ButtonClick;
|
||||
static inline constexpr std::string_view Name = "ButtonClick";
|
||||
};
|
||||
struct DpAutoCompleteEventInfo
|
||||
{
|
||||
using Type = dpp::autocomplete_t;
|
||||
static inline constexpr size_t ID = DpEventID::AutoComplete;
|
||||
static inline constexpr std::string_view Name = "AutoComplete";
|
||||
};
|
||||
struct DpSelectClickEventInfo
|
||||
{
|
||||
using Type = dpp::select_click_t;
|
||||
static inline constexpr size_t ID = DpEventID::SelectClick;
|
||||
static inline constexpr std::string_view Name = "SelectClick";
|
||||
};
|
||||
struct DpMessageContextMenuEventInfo
|
||||
{
|
||||
using Type = dpp::message_context_menu_t;
|
||||
static inline constexpr size_t ID = DpEventID::MessageContextMenu;
|
||||
static inline constexpr std::string_view Name = "MessageContextMenu";
|
||||
};
|
||||
struct DpUserContextMenuEventInfo
|
||||
{
|
||||
using Type = dpp::user_context_menu_t;
|
||||
static inline constexpr size_t ID = DpEventID::UserContextMenu;
|
||||
static inline constexpr std::string_view Name = "UserContextMenu";
|
||||
};
|
||||
struct DpFormSubmitEventInfo
|
||||
{
|
||||
using Type = dpp::form_submit_t;
|
||||
static inline constexpr size_t ID = DpEventID::FormSubmit;
|
||||
static inline constexpr std::string_view Name = "FormSubmit";
|
||||
};
|
||||
struct DpGuildDeleteEventInfo
|
||||
{
|
||||
using Type = dpp::guild_delete_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildDelete;
|
||||
static inline constexpr std::string_view Name = "GuildDelete";
|
||||
};
|
||||
struct DpChannelDeleteEventInfo
|
||||
{
|
||||
using Type = dpp::channel_delete_t;
|
||||
static inline constexpr size_t ID = DpEventID::ChannelDelete;
|
||||
static inline constexpr std::string_view Name = "ChannelDelete";
|
||||
};
|
||||
struct DpChannelUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::channel_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::ChannelUpdate;
|
||||
static inline constexpr std::string_view Name = "ChannelUpdate";
|
||||
};
|
||||
struct DpReadyEventInfo
|
||||
{
|
||||
using Type = dpp::ready_t;
|
||||
static inline constexpr size_t ID = DpEventID::Ready;
|
||||
static inline constexpr std::string_view Name = "Ready";
|
||||
};
|
||||
struct DpMessageDeleteEventInfo
|
||||
{
|
||||
using Type = dpp::message_delete_t;
|
||||
static inline constexpr size_t ID = DpEventID::MessageDelete;
|
||||
static inline constexpr std::string_view Name = "MessageDelete";
|
||||
};
|
||||
struct DpGuildMemberRemoveEventInfo
|
||||
{
|
||||
using Type = dpp::guild_member_remove_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildMemberRemove;
|
||||
static inline constexpr std::string_view Name = "GuildMemberRemove";
|
||||
};
|
||||
struct DpResumedEventInfo
|
||||
{
|
||||
using Type = dpp::resumed_t;
|
||||
static inline constexpr size_t ID = DpEventID::Resumed;
|
||||
static inline constexpr std::string_view Name = "Resumed";
|
||||
};
|
||||
struct DpGuildRoleCreateEventInfo
|
||||
{
|
||||
using Type = dpp::guild_role_create_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildRoleCreate;
|
||||
static inline constexpr std::string_view Name = "GuildRoleCreate";
|
||||
};
|
||||
struct DpTypingStartEventInfo
|
||||
{
|
||||
using Type = dpp::typing_start_t;
|
||||
static inline constexpr size_t ID = DpEventID::TypingStart;
|
||||
static inline constexpr std::string_view Name = "TypingStart";
|
||||
};
|
||||
struct DpMessageReactionAddEventInfo
|
||||
{
|
||||
using Type = dpp::message_reaction_add_t;
|
||||
static inline constexpr size_t ID = DpEventID::MessageReactionAdd;
|
||||
static inline constexpr std::string_view Name = "MessageReactionAdd";
|
||||
};
|
||||
struct DpGuildMembersChunkEventInfo
|
||||
{
|
||||
using Type = dpp::guild_members_chunk_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildMembersChunk;
|
||||
static inline constexpr std::string_view Name = "GuildMembersChunk";
|
||||
};
|
||||
struct DpMessageReactionRemoveEventInfo
|
||||
{
|
||||
using Type = dpp::message_reaction_remove_t;
|
||||
static inline constexpr size_t ID = DpEventID::MessageReactionRemove;
|
||||
static inline constexpr std::string_view Name = "MessageReactionRemove";
|
||||
};
|
||||
struct DpGuildCreateEventInfo
|
||||
{
|
||||
using Type = dpp::guild_create_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildCreate;
|
||||
static inline constexpr std::string_view Name = "GuildCreate";
|
||||
};
|
||||
struct DpChannelCreateEventInfo
|
||||
{
|
||||
using Type = dpp::channel_create_t;
|
||||
static inline constexpr size_t ID = DpEventID::ChannelCreate;
|
||||
static inline constexpr std::string_view Name = "ChannelCreate";
|
||||
};
|
||||
struct DpMessageReactionRemoveEmojiEventInfo
|
||||
{
|
||||
using Type = dpp::message_reaction_remove_emoji_t;
|
||||
static inline constexpr size_t ID = DpEventID::MessageReactionRemoveEmoji;
|
||||
static inline constexpr std::string_view Name = "MessageReactionRemoveEmoji";
|
||||
};
|
||||
struct DpMessageDeleteDulkEventInfo
|
||||
{
|
||||
using Type = dpp::message_delete_bulk_t;
|
||||
static inline constexpr size_t ID = DpEventID::MessageDeleteDulk;
|
||||
static inline constexpr std::string_view Name = "MessageDeleteDulk";
|
||||
};
|
||||
struct DpGuildRoleUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::guild_role_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildRoleUpdate;
|
||||
static inline constexpr std::string_view Name = "GuildRoleUpdate";
|
||||
};
|
||||
struct DpGuildRoleDeleteEventInfo
|
||||
{
|
||||
using Type = dpp::guild_role_delete_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildRoleDelete;
|
||||
static inline constexpr std::string_view Name = "GuildRoleDelete";
|
||||
};
|
||||
struct DpChannelPinsUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::channel_pins_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::ChannelPinsUpdate;
|
||||
static inline constexpr std::string_view Name = "ChannelPinsUpdate";
|
||||
};
|
||||
struct DpMessageReactionRemoveAllEventInfo
|
||||
{
|
||||
using Type = dpp::message_reaction_remove_all_t;
|
||||
static inline constexpr size_t ID = DpEventID::MessageReactionRemoveAll;
|
||||
static inline constexpr std::string_view Name = "MessageReactionRemoveAll";
|
||||
};
|
||||
struct DpVoiceServerUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::voice_server_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::VoiceServerUpdate;
|
||||
static inline constexpr std::string_view Name = "VoiceServerUpdate";
|
||||
};
|
||||
struct DpGuildEmojisUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::guild_emojis_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildEmojisUpdate;
|
||||
static inline constexpr std::string_view Name = "GuildEmojisUpdate";
|
||||
};
|
||||
struct DpGuildStickersUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::guild_stickers_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildStickersUpdate;
|
||||
static inline constexpr std::string_view Name = "GuildStickersUpdate";
|
||||
};
|
||||
struct DpPresenceUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::presence_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::PresenceUpdate;
|
||||
static inline constexpr std::string_view Name = "PresenceUpdate";
|
||||
};
|
||||
struct DpWebhooksUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::webhooks_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::WebhooksUpdate;
|
||||
static inline constexpr std::string_view Name = "WebhooksUpdate";
|
||||
};
|
||||
struct DpAutomodRuleCreateEventInfo
|
||||
{
|
||||
using Type = dpp::automod_rule_create_t;
|
||||
static inline constexpr size_t ID = DpEventID::AutomodRuleCreate;
|
||||
static inline constexpr std::string_view Name = "AutomodRuleCreate";
|
||||
};
|
||||
struct DpAutomodRuleUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::automod_rule_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::AutomodRuleUpdate;
|
||||
static inline constexpr std::string_view Name = "AutomodRuleUpdate";
|
||||
};
|
||||
struct DpAutomodRuleDeleteEventInfo
|
||||
{
|
||||
using Type = dpp::automod_rule_delete_t;
|
||||
static inline constexpr size_t ID = DpEventID::AutomodRuleDelete;
|
||||
static inline constexpr std::string_view Name = "AutomodRuleDelete";
|
||||
};
|
||||
struct DpAutomodRuleExecuteEventInfo
|
||||
{
|
||||
using Type = dpp::automod_rule_execute_t;
|
||||
static inline constexpr size_t ID = DpEventID::AutomodRuleExecute;
|
||||
static inline constexpr std::string_view Name = "AutomodRuleExecute";
|
||||
};
|
||||
struct DpGuildMemberAddEventInfo
|
||||
{
|
||||
using Type = dpp::guild_member_add_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildMemberAdd;
|
||||
static inline constexpr std::string_view Name = "GuildMemberAdd";
|
||||
};
|
||||
struct DpInviteDeleteEventInfo
|
||||
{
|
||||
using Type = dpp::invite_delete_t;
|
||||
static inline constexpr size_t ID = DpEventID::InviteDelete;
|
||||
static inline constexpr std::string_view Name = "InviteDelete";
|
||||
};
|
||||
struct DpGuildUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::guild_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildUpdate;
|
||||
static inline constexpr std::string_view Name = "GuildUpdate";
|
||||
};
|
||||
struct DpGuildIntegrationsUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::guild_integrations_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildIntegrationsUpdate;
|
||||
static inline constexpr std::string_view Name = "GuildIntegrationsUpdate";
|
||||
};
|
||||
struct DpGuildMemberUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::guild_member_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildMemberUpdate;
|
||||
static inline constexpr std::string_view Name = "GuildMemberUpdate";
|
||||
};
|
||||
struct DpInviteCreateEventInfo
|
||||
{
|
||||
using Type = dpp::invite_create_t;
|
||||
static inline constexpr size_t ID = DpEventID::InviteCreate;
|
||||
static inline constexpr std::string_view Name = "InviteCreate";
|
||||
};
|
||||
struct DpMessageUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::message_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::MessageUpdate;
|
||||
static inline constexpr std::string_view Name = "MessageUpdate";
|
||||
};
|
||||
struct DpUserUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::user_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::UserUpdate;
|
||||
static inline constexpr std::string_view Name = "UserUpdate";
|
||||
};
|
||||
struct DpMessageCreateEventInfo
|
||||
{
|
||||
using Type = dpp::message_create_t;
|
||||
static inline constexpr size_t ID = DpEventID::MessageCreate;
|
||||
static inline constexpr std::string_view Name = "MessageCreate";
|
||||
};
|
||||
struct DpGuildBanAddEventInfo
|
||||
{
|
||||
using Type = dpp::guild_ban_add_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildBanAdd;
|
||||
static inline constexpr std::string_view Name = "GuildBanAdd";
|
||||
};
|
||||
struct DpGuildBanRemoveEventInfo
|
||||
{
|
||||
using Type = dpp::guild_ban_remove_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildBanRemove;
|
||||
static inline constexpr std::string_view Name = "GuildBanRemove";
|
||||
};
|
||||
struct DpIntegrationCreateEventInfo
|
||||
{
|
||||
using Type = dpp::integration_create_t;
|
||||
static inline constexpr size_t ID = DpEventID::IntegrationCreate;
|
||||
static inline constexpr std::string_view Name = "IntegrationCreate";
|
||||
};
|
||||
struct DpIntegrationUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::integration_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::IntegrationUpdate;
|
||||
static inline constexpr std::string_view Name = "IntegrationUpdate";
|
||||
};
|
||||
struct DpIntegrationDeleteEventInfo
|
||||
{
|
||||
using Type = dpp::integration_delete_t;
|
||||
static inline constexpr size_t ID = DpEventID::IntegrationDelete;
|
||||
static inline constexpr std::string_view Name = "IntegrationDelete";
|
||||
};
|
||||
struct DpThreadCreateEventInfo
|
||||
{
|
||||
using Type = dpp::thread_create_t;
|
||||
static inline constexpr size_t ID = DpEventID::ThreadCreate;
|
||||
static inline constexpr std::string_view Name = "ThreadCreate";
|
||||
};
|
||||
struct DpThreadUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::thread_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::ThreadUpdate;
|
||||
static inline constexpr std::string_view Name = "ThreadUpdate";
|
||||
};
|
||||
struct DpThreadDeleteEventInfo
|
||||
{
|
||||
using Type = dpp::thread_delete_t;
|
||||
static inline constexpr size_t ID = DpEventID::ThreadDelete;
|
||||
static inline constexpr std::string_view Name = "ThreadDelete";
|
||||
};
|
||||
struct DpThreadListSyncEventInfo
|
||||
{
|
||||
using Type = dpp::thread_list_sync_t;
|
||||
static inline constexpr size_t ID = DpEventID::ThreadListSync;
|
||||
static inline constexpr std::string_view Name = "ThreadListSync";
|
||||
};
|
||||
struct DpThreadMemberUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::thread_member_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::ThreadMemberUpdate;
|
||||
static inline constexpr std::string_view Name = "ThreadMemberUpdate";
|
||||
};
|
||||
struct DpThreadMembersUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::thread_members_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::ThreadMembersUpdate;
|
||||
static inline constexpr std::string_view Name = "ThreadMembersUpdate";
|
||||
};
|
||||
struct DpGuildScheduledEventCreateEventInfo
|
||||
{
|
||||
using Type = dpp::guild_scheduled_event_create_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildScheduledEventCreate;
|
||||
static inline constexpr std::string_view Name = "GuildScheduledEventCreate";
|
||||
};
|
||||
struct DpGuildScheduledEventUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::guild_scheduled_event_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildScheduledEventUpdate;
|
||||
static inline constexpr std::string_view Name = "GuildScheduledEventUpdate";
|
||||
};
|
||||
struct DpGuildScheduledEventDeleteEventInfo
|
||||
{
|
||||
using Type = dpp::guild_scheduled_event_delete_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildScheduledEventDelete;
|
||||
static inline constexpr std::string_view Name = "GuildScheduledEventDelete";
|
||||
};
|
||||
struct DpGuildScheduledEventUserAddEventInfo
|
||||
{
|
||||
using Type = dpp::guild_scheduled_event_user_add_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildScheduledEventUserAdd;
|
||||
static inline constexpr std::string_view Name = "GuildScheduledEventUserAdd";
|
||||
};
|
||||
struct DpGuildScheduledEventUserRemoveEventInfo
|
||||
{
|
||||
using Type = dpp::guild_scheduled_event_user_remove_t;
|
||||
static inline constexpr size_t ID = DpEventID::GuildScheduledEventUserRemove;
|
||||
static inline constexpr std::string_view Name = "GuildScheduledEventUserRemove";
|
||||
};
|
||||
struct DpVoiceBufferSendEventInfo
|
||||
{
|
||||
using Type = dpp::voice_buffer_send_t;
|
||||
static inline constexpr size_t ID = DpEventID::VoiceBufferSend;
|
||||
static inline constexpr std::string_view Name = "VoiceBufferSend";
|
||||
};
|
||||
struct DpVoiceUserTalkingEventInfo
|
||||
{
|
||||
using Type = dpp::voice_user_talking_t;
|
||||
static inline constexpr size_t ID = DpEventID::VoiceUserTalking;
|
||||
static inline constexpr std::string_view Name = "VoiceUserTalking";
|
||||
};
|
||||
struct DpVoiceReadyEventInfo
|
||||
{
|
||||
using Type = dpp::voice_ready_t;
|
||||
static inline constexpr size_t ID = DpEventID::VoiceReady;
|
||||
static inline constexpr std::string_view Name = "VoiceReady";
|
||||
};
|
||||
struct DpVoiceReceiveEventInfo
|
||||
{
|
||||
using Type = dpp::voice_receive_t;
|
||||
static inline constexpr size_t ID = DpEventID::VoiceReceive;
|
||||
static inline constexpr std::string_view Name = "VoiceReceive";
|
||||
};
|
||||
struct DpVoiceReceiveCombinedEventInfo
|
||||
{
|
||||
using Type = dpp::voice_receive_t;
|
||||
static inline constexpr size_t ID = DpEventID::VoiceReceiveCombined;
|
||||
static inline constexpr std::string_view Name = "VoiceReceiveCombined";
|
||||
};
|
||||
struct DpVoiceTrackMarkerEventInfo
|
||||
{
|
||||
using Type = dpp::voice_track_marker_t;
|
||||
static inline constexpr size_t ID = DpEventID::VoiceTrackMarker;
|
||||
static inline constexpr std::string_view Name = "VoiceTrackMarker";
|
||||
};
|
||||
struct DpStageInstanceCreateEventInfo
|
||||
{
|
||||
using Type = dpp::stage_instance_create_t;
|
||||
static inline constexpr size_t ID = DpEventID::StageInstanceCreate;
|
||||
static inline constexpr std::string_view Name = "StageInstanceCreate";
|
||||
};
|
||||
struct DpStageInstanceUpdateEventInfo
|
||||
{
|
||||
using Type = dpp::stage_instance_update_t;
|
||||
static inline constexpr size_t ID = DpEventID::StageInstanceUpdate;
|
||||
static inline constexpr std::string_view Name = "StageInstanceUpdate";
|
||||
};
|
||||
struct DpStageInstanceDeleteEventInfo
|
||||
{
|
||||
using Type = dpp::stage_instance_delete_t;
|
||||
static inline constexpr size_t ID = DpEventID::StageInstanceDelete;
|
||||
static inline constexpr std::string_view Name = "StageInstanceDelete";
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Utility used to acquire event information at compile time.
|
||||
*/
|
||||
template < int > struct EventInfoID;
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Implementation.
|
||||
*/
|
||||
template < > struct EventInfoID< DpEventID::VoiceStateUpdate > : public DpVoiceStateUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::VoiceClientDisconnect > : public DpVoiceClientDisconnectEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::VoiceClientSpeaking > : public DpVoiceClientSpeakingEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::Log > : public DpLogEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildJoinRequestDelete > : public DpGuildJoinRequestDeleteEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::InteractionCreate > : public DpInteractionCreateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::SlashCommand > : public DpSlashCommandEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::ButtonClick > : public DpButtonClickEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::AutoComplete > : public DpAutoCompleteEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::SelectClick > : public DpSelectClickEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::MessageContextMenu > : public DpMessageContextMenuEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::UserContextMenu > : public DpUserContextMenuEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::FormSubmit > : public DpFormSubmitEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildDelete > : public DpGuildDeleteEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::ChannelDelete > : public DpChannelDeleteEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::ChannelUpdate > : public DpChannelUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::Ready > : public DpReadyEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::MessageDelete > : public DpMessageDeleteEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildMemberRemove > : public DpGuildMemberRemoveEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::Resumed > : public DpResumedEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildRoleCreate > : public DpGuildRoleCreateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::TypingStart > : public DpTypingStartEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::MessageReactionAdd > : public DpMessageReactionAddEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildMembersChunk > : public DpGuildMembersChunkEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::MessageReactionRemove > : public DpMessageReactionRemoveEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildCreate > : public DpGuildCreateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::ChannelCreate > : public DpChannelCreateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::MessageReactionRemoveEmoji > : public DpMessageReactionRemoveEmojiEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::MessageDeleteDulk > : public DpMessageDeleteDulkEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildRoleUpdate > : public DpGuildRoleUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildRoleDelete > : public DpGuildRoleDeleteEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::ChannelPinsUpdate > : public DpChannelPinsUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::MessageReactionRemoveAll > : public DpMessageReactionRemoveAllEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::VoiceServerUpdate > : public DpVoiceServerUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildEmojisUpdate > : public DpGuildEmojisUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildStickersUpdate > : public DpGuildStickersUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::PresenceUpdate > : public DpPresenceUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::WebhooksUpdate > : public DpWebhooksUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::AutomodRuleCreate > : public DpAutomodRuleCreateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::AutomodRuleUpdate > : public DpAutomodRuleUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::AutomodRuleDelete > : public DpAutomodRuleDeleteEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::AutomodRuleExecute > : public DpAutomodRuleExecuteEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildMemberAdd > : public DpGuildMemberAddEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::InviteDelete > : public DpInviteDeleteEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildUpdate > : public DpGuildUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildIntegrationsUpdate > : public DpGuildIntegrationsUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildMemberUpdate > : public DpGuildMemberUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::InviteCreate > : public DpInviteCreateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::MessageUpdate > : public DpMessageUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::UserUpdate > : public DpUserUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::MessageCreate > : public DpMessageCreateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildBanAdd > : public DpGuildBanAddEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildBanRemove > : public DpGuildBanRemoveEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::IntegrationCreate > : public DpIntegrationCreateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::IntegrationUpdate > : public DpIntegrationUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::IntegrationDelete > : public DpIntegrationDeleteEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::ThreadCreate > : public DpThreadCreateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::ThreadUpdate > : public DpThreadUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::ThreadDelete > : public DpThreadDeleteEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::ThreadListSync > : public DpThreadListSyncEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::ThreadMemberUpdate > : public DpThreadMemberUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::ThreadMembersUpdate > : public DpThreadMembersUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildScheduledEventCreate > : public DpGuildScheduledEventCreateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildScheduledEventUpdate > : public DpGuildScheduledEventUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildScheduledEventDelete > : public DpGuildScheduledEventDeleteEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildScheduledEventUserAdd > : public DpGuildScheduledEventUserAddEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::GuildScheduledEventUserRemove > : public DpGuildScheduledEventUserRemoveEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::VoiceBufferSend > : public DpVoiceBufferSendEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::VoiceUserTalking > : public DpVoiceUserTalkingEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::VoiceReady > : public DpVoiceReadyEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::VoiceReceive > : public DpVoiceReceiveEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::VoiceReceiveCombined > : public DpVoiceReceiveCombinedEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::VoiceTrackMarker > : public DpVoiceTrackMarkerEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::StageInstanceCreate > : public DpStageInstanceCreateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::StageInstanceUpdate > : public DpStageInstanceUpdateEventInfo { };
|
||||
template < > struct EventInfoID< DpEventID::StageInstanceDelete > : public DpStageInstanceDeleteEventInfo { };
|
||||
|
||||
} // Namespace:: SqMod
|
||||
777
module/Library/Discord/Events.cpp
Normal file
777
module/Library/Discord/Events.cpp
Normal file
@@ -0,0 +1,777 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/Discord/Events.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMOD_DECL_TYPENAME(SqDpVoiceStateUpdateEvent, _SC("SqDiscordVoiceStateUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpVoiceClientDisconnectEvent, _SC("SqDiscordVoiceClientDisconnectEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpVoiceClientSpeakingEvent, _SC("SqDiscordVoiceClientSpeakingEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpLogEvent, _SC("SqDiscordLogEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildJoinRequestDeleteEvent, _SC("SqDiscordGuildJoinRequestDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpInteractionCreateEvent, _SC("SqDiscordInteractionCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpSlashCommandEvent, _SC("SqDiscordSlashCommandEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpButtonClickEvent, _SC("SqDiscordButtonClickEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpAutoCompleteEvent, _SC("SqDiscordAutoCompleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpSelectClickEvent, _SC("SqDiscordSelectClickEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpMessageContextMenuEvent, _SC("SqDiscordMessageContextMenuEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpUserContextMenuEvent, _SC("SqDiscordUserContextMenuEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpFormSubmitEvent, _SC("SqDiscordFormSubmitEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildDeleteEvent, _SC("SqDiscordGuildDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpChannelDeleteEvent, _SC("SqDiscordChannelDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpChannelUpdateEvent, _SC("SqDiscordChannelUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpReadyEvent, _SC("SqDiscordReadyEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpMessageDeleteEvent, _SC("SqDiscordMessageDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildMemberRemoveEvent, _SC("SqDiscordGuildMemberRemoveEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpResumedEvent, _SC("SqDiscordResumedEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildRoleCreateEvent, _SC("SqDiscordGuildRoleCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpTypingStartEvent, _SC("SqDiscordTypingStartEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpMessageReactionAddEvent, _SC("SqDiscordMessageReactionAddEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildMembersChunkEvent, _SC("SqDiscordGuildMembersChunkEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpMessageReactionRemoveEvent, _SC("SqDiscordMessageReactionRemoveEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildCreateEvent, _SC("SqDiscordGuildCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpChannelCreateEvent, _SC("SqDiscordChannelCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpMessageReactionRemoveEmojiEvent, _SC("SqDiscordMessageReactionRemoveEmojiEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpMessageDeleteDulkEvent, _SC("SqDiscordMessageDeleteDulkEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildRoleUpdateEvent, _SC("SqDiscordGuildRoleUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildRoleDeleteEvent, _SC("SqDiscordGuildRoleDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpChannelPinsUpdateEvent, _SC("SqDiscordChannelPinsUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpMessageReactionRemoveAllEvent, _SC("SqDiscordMessageReactionRemoveAllEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpVoiceServerUpdateEvent, _SC("SqDiscordVoiceServerUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildEmojisUpdateEvent, _SC("SqDiscordGuildEmojisUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildStickersUpdateEvent, _SC("SqDiscordGuildStickersUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpPresenceUpdateEvent, _SC("SqDiscordPresenceUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpWebhooksUpdateEvent, _SC("SqDiscordWebhooksUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpAutomodRuleCreateEvent, _SC("SqDiscordAutomodRuleCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpAutomodRuleUpdateEvent, _SC("SqDiscordAutomodRuleUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpAutomodRuleDeleteEvent, _SC("SqDiscordAutomodRuleDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpAutomodRuleExecuteEvent, _SC("SqDiscordAutomodRuleExecuteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildMemberAddEvent, _SC("SqDiscordGuildMemberAddEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpInviteDeleteEvent, _SC("SqDiscordInviteDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildUpdateEvent, _SC("SqDiscordGuildUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildIntegrationsUpdateEvent, _SC("SqDiscordGuildIntegrationsUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildMemberUpdateEvent, _SC("SqDiscordGuildMemberUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpInviteCreateEvent, _SC("SqDiscordInviteCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpMessageUpdateEvent, _SC("SqDiscordMessageUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpUserUpdateEvent, _SC("SqDiscordUserUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpMessageCreateEvent, _SC("SqDiscordMessageCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildBanAddEvent, _SC("SqDiscordGuildBanAddEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildBanRemoveEvent, _SC("SqDiscordGuildBanRemoveEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpIntegrationCreateEvent, _SC("SqDiscordIntegrationCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpIntegrationUpdateEvent, _SC("SqDiscordIntegrationUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpIntegrationDeleteEvent, _SC("SqDiscordIntegrationDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpThreadCreateEvent, _SC("SqDiscordThreadCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpThreadUpdateEvent, _SC("SqDiscordThreadUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpThreadDeleteEvent, _SC("SqDiscordThreadDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpThreadListSyncEvent, _SC("SqDiscordThreadListSyncEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpThreadMemberUpdateEvent, _SC("SqDiscordThreadMemberUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpThreadMembersUpdateEvent, _SC("SqDiscordThreadMembersUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildScheduledEventCreateEvent, _SC("SqDiscordGuildScheduledEventCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildScheduledEventUpdateEvent, _SC("SqDiscordGuildScheduledEventUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildScheduledEventDeleteEvent, _SC("SqDiscordGuildScheduledEventDeleteEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildScheduledEventUserAddEvent, _SC("SqDiscordGuildScheduledEventUserAddEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildScheduledEventUserRemoveEvent, _SC("SqDiscordGuildScheduledEventUserRemoveEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpVoiceBufferSendEvent, _SC("SqDiscordVoiceBufferSendEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpVoiceUserTalkingEvent, _SC("SqDiscordVoiceUserTalkingEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpVoiceReadyEvent, _SC("SqDiscordVoiceReadyEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpVoiceReceiveEvent, _SC("SqDiscordVoiceReceiveEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpVoiceReceiveCombinedEvent, _SC("SqDiscordVoiceReceiveCombinedEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpVoiceTrackMarkerEvent, _SC("SqDiscordVoiceTrackMarkerEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpStageInstanceCreateEvent, _SC("SqDiscordStageInstanceCreateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpStageInstanceUpdateEvent, _SC("SqDiscordStageInstanceUpdateEvent"))
|
||||
SQMOD_DECL_TYPENAME(SqDpStageInstanceDeleteEvent, _SC("SqDiscordStageInstanceDeleteEvent"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Register_Discord_Events(HSQUIRRELVM vm, Table & ns)
|
||||
{
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceStateUpdate"),
|
||||
Class< DpVoiceStateUpdateEvent, NoConstructor< DpVoiceStateUpdateEvent > >(vm, SqDpVoiceStateUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpVoiceStateUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpVoiceStateUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpVoiceStateUpdateEvent::GetRawEvent)
|
||||
.Prop(_SC("State"), &DpVoiceStateUpdateEvent::GetState)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceClientDisconnect"),
|
||||
Class< DpVoiceClientDisconnectEvent, NoConstructor< DpVoiceClientDisconnectEvent > >(vm, SqDpVoiceClientDisconnectEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpVoiceClientDisconnectEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpVoiceClientDisconnectEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpVoiceClientDisconnectEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceClientSpeaking"),
|
||||
Class< DpVoiceClientSpeakingEvent, NoConstructor< DpVoiceClientSpeakingEvent > >(vm, SqDpVoiceClientSpeakingEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpVoiceClientSpeakingEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpVoiceClientSpeakingEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpVoiceClientSpeakingEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Log"),
|
||||
Class< DpLogEvent, NoConstructor< DpLogEvent > >(vm, SqDpLogEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpLogEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpLogEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpLogEvent::GetRawEvent)
|
||||
.Prop(_SC("Severity"), &DpLogEvent::GetSeverity)
|
||||
.Prop(_SC("Message"), &DpLogEvent::GetMessage)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildJoinRequestDelete"),
|
||||
Class< DpGuildJoinRequestDeleteEvent, NoConstructor< DpGuildJoinRequestDeleteEvent > >(vm, SqDpGuildJoinRequestDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildJoinRequestDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildJoinRequestDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildJoinRequestDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("InteractionCreate"),
|
||||
Class< DpInteractionCreateEvent, NoConstructor< DpInteractionCreateEvent > >(vm, SqDpInteractionCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpInteractionCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpInteractionCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpInteractionCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("SlashCommand"),
|
||||
Class< DpSlashCommandEvent, NoConstructor< DpSlashCommandEvent > >(vm, SqDpSlashCommandEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpSlashCommandEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpSlashCommandEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpSlashCommandEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ButtonClick"),
|
||||
Class< DpButtonClickEvent, NoConstructor< DpButtonClickEvent > >(vm, SqDpButtonClickEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpButtonClickEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpButtonClickEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpButtonClickEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("AutoComplete"),
|
||||
Class< DpAutoCompleteEvent, NoConstructor< DpAutoCompleteEvent > >(vm, SqDpAutoCompleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpAutoCompleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpAutoCompleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpAutoCompleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("SelectClick"),
|
||||
Class< DpSelectClickEvent, NoConstructor< DpSelectClickEvent > >(vm, SqDpSelectClickEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpSelectClickEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpSelectClickEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpSelectClickEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("MessageContextMenu"),
|
||||
Class< DpMessageContextMenuEvent, NoConstructor< DpMessageContextMenuEvent > >(vm, SqDpMessageContextMenuEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpMessageContextMenuEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpMessageContextMenuEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpMessageContextMenuEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("UserContextMenu"),
|
||||
Class< DpUserContextMenuEvent, NoConstructor< DpUserContextMenuEvent > >(vm, SqDpUserContextMenuEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpUserContextMenuEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpUserContextMenuEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpUserContextMenuEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("FormSubmit"),
|
||||
Class< DpFormSubmitEvent, NoConstructor< DpFormSubmitEvent > >(vm, SqDpFormSubmitEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpFormSubmitEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpFormSubmitEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpFormSubmitEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildDelete"),
|
||||
Class< DpGuildDeleteEvent, NoConstructor< DpGuildDeleteEvent > >(vm, SqDpGuildDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ChannelDelete"),
|
||||
Class< DpChannelDeleteEvent, NoConstructor< DpChannelDeleteEvent > >(vm, SqDpChannelDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpChannelDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpChannelDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpChannelDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ChannelUpdate"),
|
||||
Class< DpChannelUpdateEvent, NoConstructor< DpChannelUpdateEvent > >(vm, SqDpChannelUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpChannelUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpChannelUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpChannelUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Ready"),
|
||||
Class< DpReadyEvent, NoConstructor< DpReadyEvent > >(vm, SqDpReadyEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpReadyEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpReadyEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpReadyEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("MessageDelete"),
|
||||
Class< DpMessageDeleteEvent, NoConstructor< DpMessageDeleteEvent > >(vm, SqDpMessageDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpMessageDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpMessageDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpMessageDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildMemberRemove"),
|
||||
Class< DpGuildMemberRemoveEvent, NoConstructor< DpGuildMemberRemoveEvent > >(vm, SqDpGuildMemberRemoveEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildMemberRemoveEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildMemberRemoveEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildMemberRemoveEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Resumed"),
|
||||
Class< DpResumedEvent, NoConstructor< DpResumedEvent > >(vm, SqDpResumedEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpResumedEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpResumedEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpResumedEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildRoleCreate"),
|
||||
Class< DpGuildRoleCreateEvent, NoConstructor< DpGuildRoleCreateEvent > >(vm, SqDpGuildRoleCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildRoleCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildRoleCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildRoleCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("TypingStart"),
|
||||
Class< DpTypingStartEvent, NoConstructor< DpTypingStartEvent > >(vm, SqDpTypingStartEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpTypingStartEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpTypingStartEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpTypingStartEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("MessageReactionAdd"),
|
||||
Class< DpMessageReactionAddEvent, NoConstructor< DpMessageReactionAddEvent > >(vm, SqDpMessageReactionAddEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpMessageReactionAddEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpMessageReactionAddEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpMessageReactionAddEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildMembersChunk"),
|
||||
Class< DpGuildMembersChunkEvent, NoConstructor< DpGuildMembersChunkEvent > >(vm, SqDpGuildMembersChunkEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildMembersChunkEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildMembersChunkEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildMembersChunkEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("MessageReactionRemove"),
|
||||
Class< DpMessageReactionRemoveEvent, NoConstructor< DpMessageReactionRemoveEvent > >(vm, SqDpMessageReactionRemoveEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpMessageReactionRemoveEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpMessageReactionRemoveEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpMessageReactionRemoveEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildCreate"),
|
||||
Class< DpGuildCreateEvent, NoConstructor< DpGuildCreateEvent > >(vm, SqDpGuildCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ChannelCreate"),
|
||||
Class< DpChannelCreateEvent, NoConstructor< DpChannelCreateEvent > >(vm, SqDpChannelCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpChannelCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpChannelCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpChannelCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("MessageReactionRemoveEmoji"),
|
||||
Class< DpMessageReactionRemoveEmojiEvent, NoConstructor< DpMessageReactionRemoveEmojiEvent > >(vm, SqDpMessageReactionRemoveEmojiEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpMessageReactionRemoveEmojiEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpMessageReactionRemoveEmojiEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpMessageReactionRemoveEmojiEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("MessageDeleteDulk"),
|
||||
Class< DpMessageDeleteDulkEvent, NoConstructor< DpMessageDeleteDulkEvent > >(vm, SqDpMessageDeleteDulkEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpMessageDeleteDulkEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpMessageDeleteDulkEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpMessageDeleteDulkEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildRoleUpdate"),
|
||||
Class< DpGuildRoleUpdateEvent, NoConstructor< DpGuildRoleUpdateEvent > >(vm, SqDpGuildRoleUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildRoleUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildRoleUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildRoleUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildRoleDelete"),
|
||||
Class< DpGuildRoleDeleteEvent, NoConstructor< DpGuildRoleDeleteEvent > >(vm, SqDpGuildRoleDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildRoleDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildRoleDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildRoleDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ChannelPinsUpdate"),
|
||||
Class< DpChannelPinsUpdateEvent, NoConstructor< DpChannelPinsUpdateEvent > >(vm, SqDpChannelPinsUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpChannelPinsUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpChannelPinsUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpChannelPinsUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("MessageReactionRemoveAll"),
|
||||
Class< DpMessageReactionRemoveAllEvent, NoConstructor< DpMessageReactionRemoveAllEvent > >(vm, SqDpMessageReactionRemoveAllEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpMessageReactionRemoveAllEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpMessageReactionRemoveAllEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpMessageReactionRemoveAllEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceServerUpdate"),
|
||||
Class< DpVoiceServerUpdateEvent, NoConstructor< DpVoiceServerUpdateEvent > >(vm, SqDpVoiceServerUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpVoiceServerUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpVoiceServerUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpVoiceServerUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildEmojisUpdate"),
|
||||
Class< DpGuildEmojisUpdateEvent, NoConstructor< DpGuildEmojisUpdateEvent > >(vm, SqDpGuildEmojisUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildEmojisUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildEmojisUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildEmojisUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildStickersUpdate"),
|
||||
Class< DpGuildStickersUpdateEvent, NoConstructor< DpGuildStickersUpdateEvent > >(vm, SqDpGuildStickersUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildStickersUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildStickersUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildStickersUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("PresenceUpdate"),
|
||||
Class< DpPresenceUpdateEvent, NoConstructor< DpPresenceUpdateEvent > >(vm, SqDpPresenceUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpPresenceUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpPresenceUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpPresenceUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("WebhooksUpdate"),
|
||||
Class< DpWebhooksUpdateEvent, NoConstructor< DpWebhooksUpdateEvent > >(vm, SqDpWebhooksUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpWebhooksUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpWebhooksUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpWebhooksUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("AutomodRuleCreate"),
|
||||
Class< DpAutomodRuleCreateEvent, NoConstructor< DpAutomodRuleCreateEvent > >(vm, SqDpAutomodRuleCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpAutomodRuleCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpAutomodRuleCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpAutomodRuleCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("AutomodRuleUpdate"),
|
||||
Class< DpAutomodRuleUpdateEvent, NoConstructor< DpAutomodRuleUpdateEvent > >(vm, SqDpAutomodRuleUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpAutomodRuleUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpAutomodRuleUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpAutomodRuleUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("AutomodRuleDelete"),
|
||||
Class< DpAutomodRuleDeleteEvent, NoConstructor< DpAutomodRuleDeleteEvent > >(vm, SqDpAutomodRuleDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpAutomodRuleDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpAutomodRuleDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpAutomodRuleDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("AutomodRuleExecute"),
|
||||
Class< DpAutomodRuleExecuteEvent, NoConstructor< DpAutomodRuleExecuteEvent > >(vm, SqDpAutomodRuleExecuteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpAutomodRuleExecuteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpAutomodRuleExecuteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpAutomodRuleExecuteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildMemberAdd"),
|
||||
Class< DpGuildMemberAddEvent, NoConstructor< DpGuildMemberAddEvent > >(vm, SqDpGuildMemberAddEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildMemberAddEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildMemberAddEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildMemberAddEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("InviteDelete"),
|
||||
Class< DpInviteDeleteEvent, NoConstructor< DpInviteDeleteEvent > >(vm, SqDpInviteDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpInviteDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpInviteDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpInviteDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildUpdate"),
|
||||
Class< DpGuildUpdateEvent, NoConstructor< DpGuildUpdateEvent > >(vm, SqDpGuildUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildIntegrationsUpdate"),
|
||||
Class< DpGuildIntegrationsUpdateEvent, NoConstructor< DpGuildIntegrationsUpdateEvent > >(vm, SqDpGuildIntegrationsUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildIntegrationsUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildIntegrationsUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildIntegrationsUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildMemberUpdate"),
|
||||
Class< DpGuildMemberUpdateEvent, NoConstructor< DpGuildMemberUpdateEvent > >(vm, SqDpGuildMemberUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildMemberUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildMemberUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildMemberUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("InviteCreate"),
|
||||
Class< DpInviteCreateEvent, NoConstructor< DpInviteCreateEvent > >(vm, SqDpInviteCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpInviteCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpInviteCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpInviteCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("MessageUpdate"),
|
||||
Class< DpMessageUpdateEvent, NoConstructor< DpMessageUpdateEvent > >(vm, SqDpMessageUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpMessageUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpMessageUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpMessageUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("UserUpdate"),
|
||||
Class< DpUserUpdateEvent, NoConstructor< DpUserUpdateEvent > >(vm, SqDpUserUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpUserUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpUserUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpUserUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("MessageCreate"),
|
||||
Class< DpMessageCreateEvent, NoConstructor< DpMessageCreateEvent > >(vm, SqDpMessageCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpMessageCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpMessageCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpMessageCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildBanAdd"),
|
||||
Class< DpGuildBanAddEvent, NoConstructor< DpGuildBanAddEvent > >(vm, SqDpGuildBanAddEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildBanAddEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildBanAddEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildBanAddEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildBanRemove"),
|
||||
Class< DpGuildBanRemoveEvent, NoConstructor< DpGuildBanRemoveEvent > >(vm, SqDpGuildBanRemoveEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildBanRemoveEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildBanRemoveEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildBanRemoveEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("IntegrationCreate"),
|
||||
Class< DpIntegrationCreateEvent, NoConstructor< DpIntegrationCreateEvent > >(vm, SqDpIntegrationCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpIntegrationCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpIntegrationCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpIntegrationCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("IntegrationUpdate"),
|
||||
Class< DpIntegrationUpdateEvent, NoConstructor< DpIntegrationUpdateEvent > >(vm, SqDpIntegrationUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpIntegrationUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpIntegrationUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpIntegrationUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("IntegrationDelete"),
|
||||
Class< DpIntegrationDeleteEvent, NoConstructor< DpIntegrationDeleteEvent > >(vm, SqDpIntegrationDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpIntegrationDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpIntegrationDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpIntegrationDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ThreadCreate"),
|
||||
Class< DpThreadCreateEvent, NoConstructor< DpThreadCreateEvent > >(vm, SqDpThreadCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpThreadCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpThreadCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpThreadCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ThreadUpdate"),
|
||||
Class< DpThreadUpdateEvent, NoConstructor< DpThreadUpdateEvent > >(vm, SqDpThreadUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpThreadUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpThreadUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpThreadUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ThreadDelete"),
|
||||
Class< DpThreadDeleteEvent, NoConstructor< DpThreadDeleteEvent > >(vm, SqDpThreadDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpThreadDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpThreadDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpThreadDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ThreadListSync"),
|
||||
Class< DpThreadListSyncEvent, NoConstructor< DpThreadListSyncEvent > >(vm, SqDpThreadListSyncEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpThreadListSyncEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpThreadListSyncEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpThreadListSyncEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ThreadMemberUpdate"),
|
||||
Class< DpThreadMemberUpdateEvent, NoConstructor< DpThreadMemberUpdateEvent > >(vm, SqDpThreadMemberUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpThreadMemberUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpThreadMemberUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpThreadMemberUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ThreadMembersUpdate"),
|
||||
Class< DpThreadMembersUpdateEvent, NoConstructor< DpThreadMembersUpdateEvent > >(vm, SqDpThreadMembersUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpThreadMembersUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpThreadMembersUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpThreadMembersUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildScheduledEventCreate"),
|
||||
Class< DpGuildScheduledEventCreateEvent, NoConstructor< DpGuildScheduledEventCreateEvent > >(vm, SqDpGuildScheduledEventCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildScheduledEventCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildScheduledEventCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildScheduledEventCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildScheduledEventUpdate"),
|
||||
Class< DpGuildScheduledEventUpdateEvent, NoConstructor< DpGuildScheduledEventUpdateEvent > >(vm, SqDpGuildScheduledEventUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildScheduledEventUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildScheduledEventUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildScheduledEventUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildScheduledEventDelete"),
|
||||
Class< DpGuildScheduledEventDeleteEvent, NoConstructor< DpGuildScheduledEventDeleteEvent > >(vm, SqDpGuildScheduledEventDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildScheduledEventDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildScheduledEventDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildScheduledEventDeleteEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildScheduledEventUserAdd"),
|
||||
Class< DpGuildScheduledEventUserAddEvent, NoConstructor< DpGuildScheduledEventUserAddEvent > >(vm, SqDpGuildScheduledEventUserAddEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildScheduledEventUserAddEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildScheduledEventUserAddEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildScheduledEventUserAddEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("GuildScheduledEventUserRemove"),
|
||||
Class< DpGuildScheduledEventUserRemoveEvent, NoConstructor< DpGuildScheduledEventUserRemoveEvent > >(vm, SqDpGuildScheduledEventUserRemoveEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildScheduledEventUserRemoveEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpGuildScheduledEventUserRemoveEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpGuildScheduledEventUserRemoveEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceBufferSend"),
|
||||
Class< DpVoiceBufferSendEvent, NoConstructor< DpVoiceBufferSendEvent > >(vm, SqDpVoiceBufferSendEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpVoiceBufferSendEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpVoiceBufferSendEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpVoiceBufferSendEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceUserTalking"),
|
||||
Class< DpVoiceUserTalkingEvent, NoConstructor< DpVoiceUserTalkingEvent > >(vm, SqDpVoiceUserTalkingEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpVoiceUserTalkingEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpVoiceUserTalkingEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpVoiceUserTalkingEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceReady"),
|
||||
Class< DpVoiceReadyEvent, NoConstructor< DpVoiceReadyEvent > >(vm, SqDpVoiceReadyEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpVoiceReadyEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpVoiceReadyEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpVoiceReadyEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceReceive"),
|
||||
Class< DpVoiceReceiveEvent, NoConstructor< DpVoiceReceiveEvent > >(vm, SqDpVoiceReceiveEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpVoiceReceiveEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpVoiceReceiveEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpVoiceReceiveEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceReceive"),
|
||||
Class< DpVoiceReceiveCombinedEvent, NoConstructor< DpVoiceReceiveCombinedEvent > >(vm, SqDpVoiceReceiveCombinedEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpVoiceReceiveCombinedEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpVoiceReceiveCombinedEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpVoiceReceiveCombinedEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceTrackMarker"),
|
||||
Class< DpVoiceTrackMarkerEvent, NoConstructor< DpVoiceTrackMarkerEvent > >(vm, SqDpVoiceTrackMarkerEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpVoiceTrackMarkerEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpVoiceTrackMarkerEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpVoiceTrackMarkerEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("StageInstanceCreate"),
|
||||
Class< DpStageInstanceCreateEvent, NoConstructor< DpStageInstanceCreateEvent > >(vm, SqDpStageInstanceCreateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpStageInstanceCreateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpStageInstanceCreateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpStageInstanceCreateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("StageInstanceUpdate"),
|
||||
Class< DpStageInstanceUpdateEvent, NoConstructor< DpStageInstanceUpdateEvent > >(vm, SqDpStageInstanceUpdateEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpStageInstanceUpdateEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpStageInstanceUpdateEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpStageInstanceUpdateEvent::GetRawEvent)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("StageInstanceDelete"),
|
||||
Class< DpStageInstanceDeleteEvent, NoConstructor< DpStageInstanceDeleteEvent > >(vm, SqDpStageInstanceDeleteEvent::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpStageInstanceDeleteEvent::Fn)
|
||||
.Func(_SC("_tostring"), &DpStageInstanceDeleteEvent::GetRawEvent)
|
||||
// Member Properties
|
||||
.Prop(_SC("Raw"), &DpStageInstanceDeleteEvent::GetRawEvent)
|
||||
);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
File diff suppressed because it is too large
Load Diff
65
module/Library/Discord/Guild.cpp
Normal file
65
module/Library/Discord/Guild.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/Discord/Guild.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMOD_DECL_TYPENAME(SqDpGuildMember, _SC("SqDiscordGuildMember"))
|
||||
SQMOD_DECL_TYPENAME(SqDpGuild, _SC("SqDiscordGuild"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Register_Discord_Guild(HSQUIRRELVM vm, Table & ns)
|
||||
{
|
||||
ns.Bind(_SC("GuildMember"),
|
||||
Class< DpGuildMember, NoConstructor< DpGuildMember > >(vm, SqDpGuildMember::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuildMember::Fn)
|
||||
.Func(_SC("_cmp"), &DpGuildMember::SqCmp)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpGuildMember::IsValid)
|
||||
.Prop(_SC("JSON"), &DpGuildMember::BuildJSON)
|
||||
.Prop(_SC("Nickname"), &DpGuildMember::GetNickname, &DpGuildMember::SetNickname)
|
||||
.Prop(_SC("Roles"), &DpGuildMember::GetRoles)
|
||||
.Prop(_SC("RolesCount"), &DpGuildMember::RolesCount)
|
||||
.Prop(_SC("GuildID"), &DpGuildMember::GetGuildID, &DpGuildMember::SetGuildID)
|
||||
.Prop(_SC("UserID"), &DpGuildMember::GetUserID, &DpGuildMember::SetUserID)
|
||||
.Prop(_SC("Avatar"), &DpGuildMember::GetAvatar, &DpGuildMember::SetAvatar)
|
||||
.Prop(_SC("CommunicationDisabledUntil"), &DpGuildMember::GetCommunicationDisabledUntil, &DpGuildMember::SetCommunicationDisabledUntil)
|
||||
.Prop(_SC("JoinedAt"), &DpGuildMember::GetJoinedAt)
|
||||
.Prop(_SC("PremiumSince"), &DpGuildMember::GetPremiumSince)
|
||||
.Prop(_SC("Flags"), &DpGuildMember::GetFlags, &DpGuildMember::SetFlags)
|
||||
.Prop(_SC("CommunicationDisabled"), &DpGuildMember::IsCommunicationDisabled)
|
||||
.Prop(_SC("Deaf"), &DpGuildMember::GetDeaf, &DpGuildMember::SetDeaf)
|
||||
.Prop(_SC("Muted"), &DpGuildMember::GetMuted, &DpGuildMember::SetMuted)
|
||||
.Prop(_SC("IsPending"), &DpGuildMember::IsPending)
|
||||
.Prop(_SC("HasAnimatedGuildAvatar"), &DpGuildMember::HasAnimatedGuildAvatar)
|
||||
.Prop(_SC("Mention"), &DpGuildMember::GetMention)
|
||||
// Member Methods
|
||||
.Func(_SC("BuildJSON"), &DpGuildMember::BuildJSON_)
|
||||
.Func(_SC("GetNickname"), &DpGuildMember::ApplyNickname)
|
||||
.Func(_SC("AddRole"), &DpGuildMember::AddRole)
|
||||
.Func(_SC("EachRole"), &DpGuildMember::EachRole)
|
||||
.Func(_SC("ClearRoles"), &DpGuildMember::ClearRoles)
|
||||
.Func(_SC("FilterRoles"), &DpGuildMember::FilterRoles)
|
||||
.Func(_SC("GetFlags"), &DpGuildMember::ApplyFlags)
|
||||
.Func(_SC("GetAvatarURL"), &DpGuildMember::GetAvatarURL)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Guild"),
|
||||
Class< DpGuild, NoConstructor< DpGuild > >(vm, SqDpGuild::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpGuild::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpGuild::IsValid)
|
||||
.Prop(_SC("JSON"), &DpGuild::BuildJSON)
|
||||
.Prop(_SC("Name"), &DpGuild::GetName, &DpGuild::SetName)
|
||||
.Prop(_SC("Description"), &DpGuild::GetDescription, &DpGuild::SetDescription)
|
||||
// Member Methods
|
||||
.Func(_SC("BuildJSON"), &DpGuild::BuildJSON_)
|
||||
.Func(_SC("GetName"), &DpGuild::ApplyName)
|
||||
.Func(_SC("GetDescription"), &DpGuild::ApplyDescription)
|
||||
);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -4,10 +4,10 @@
|
||||
#include "Core/Utility.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <chrono>
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <dpp/dpp.h>
|
||||
#include <chrono>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
@@ -102,17 +102,36 @@ struct DpGuildMember
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsValid() const { return static_cast< bool >(mPtr); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the gickname, or empty string if they don't have a nickname on this guild.
|
||||
* Build json representation of the object.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string BuildJSON() const { return Valid().build_json(); }
|
||||
SQMOD_NODISCARD std::string BuildJSON_(bool with_id) const { return Valid().build_json(with_id); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check if this member is equal to another member object.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger SqCmp(const DpGuildMember & o) const
|
||||
{
|
||||
if (Valid() == o.Valid()) {
|
||||
return 0;
|
||||
// Nonsense...
|
||||
} else if (Valid().user_id > o.Valid().user_id) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the nickname, or empty string if they don't have a nickname on this guild.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetNickname() const { return Valid().nickname; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the guild id.
|
||||
* Modify the nickname.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetGuildID() const { return Valid().guild_id; }
|
||||
void SetNickname(StackStrF & name) const { Valid().set_nickname(name.ToStr()); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the user id.
|
||||
* Modify the nickname.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetUserID() const { return Valid().user_id; }
|
||||
DpGuildMember & ApplyNickname(StackStrF & name) { SetNickname(name); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the list of roles this user has on this guild.
|
||||
*/
|
||||
@@ -121,8 +140,97 @@ struct DpGuildMember
|
||||
return Array(SqVM()).Reserve(static_cast< SQInteger >(Valid().roles.size()))
|
||||
.AppendFromVector(Valid().roles);
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the date and time since the user joined the guild.
|
||||
* Retrieve the number of roles.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger RolesCount() const { return static_cast< SQInteger >(Valid().roles.size()); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Add a new role.
|
||||
*/
|
||||
DpGuildMember & AddRole(dpp::snowflake role) { Valid().roles.push_back(role); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Iterate all roles.
|
||||
*/
|
||||
DpGuildMember & EachRole(Function & fn)
|
||||
{
|
||||
for (const auto & a : Valid().roles)
|
||||
{
|
||||
fn.Execute(a);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the number of roles.
|
||||
*/
|
||||
DpGuildMember & ClearRoles(dpp::snowflake role) { Valid().roles.clear(); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Filter roles.
|
||||
*/
|
||||
DpGuildMember & FilterRoles(Function & fn)
|
||||
{
|
||||
std::vector< dpp::snowflake > list;
|
||||
// Reserve memory in advance
|
||||
list.reserve(Valid().roles.size());
|
||||
// Process each role individually
|
||||
for (const auto & role : Valid().roles)
|
||||
{
|
||||
auto ret = fn.Eval(role);
|
||||
// (null || true) == keep & false == skip
|
||||
if (!ret.IsNull() || !ret.template Cast< bool >())
|
||||
{
|
||||
list.push_back(role); // Keep this role
|
||||
}
|
||||
}
|
||||
// Use filtered roles
|
||||
Valid().roles.swap(list);
|
||||
// Allow chaining
|
||||
return *this;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the guild id.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetGuildID() const { return Valid().guild_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the guild id.
|
||||
*/
|
||||
void SetGuildID(dpp::snowflake id) { Valid().guild_id = id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the user id.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetUserID() const { return Valid().user_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the guild id.
|
||||
*/
|
||||
void SetUserID(dpp::snowflake id) { Valid().guild_id = id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the user avatar (per-server avatar is a nitro only feature).
|
||||
*/
|
||||
SQMOD_NODISCARD const dpp::utility::iconhash & GetAvatar() const { return Valid().avatar; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the user avatar (per-server avatar is a nitro only feature).
|
||||
*/
|
||||
void SetAvatar(const dpp::utility::iconhash & a) const { Valid().avatar = a; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the date and time when the time out will be removed; until then, they cannot interact with the guild.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetCommunicationDisabledUntil() const
|
||||
{
|
||||
return std::chrono::time_point_cast< std::chrono::seconds >(
|
||||
std::chrono::system_clock::from_time_t(Valid().communication_disabled_until)
|
||||
).time_since_epoch().count();
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Assign a timestamp until communication is disabled.
|
||||
*/
|
||||
void SetCommunicationDisabledUntil(SQInteger ts) const
|
||||
{
|
||||
Valid().set_communication_disabled_until(
|
||||
std::chrono::system_clock::to_time_t(std::chrono::time_point< std::chrono::system_clock >(std::chrono::seconds(ts)))
|
||||
);
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the date and time the user joined the guild.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetJoinedAt() const
|
||||
{
|
||||
@@ -131,7 +239,7 @@ struct DpGuildMember
|
||||
).time_since_epoch().count();
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the date and time since the user has boosted the guild guild.
|
||||
* Retrieve the date and time since the user is boosting.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetPremiumSince() const
|
||||
{
|
||||
@@ -140,25 +248,54 @@ struct DpGuildMember
|
||||
).time_since_epoch().count();
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the set of flags built from the bitmask defined by dpp::guild_member_flags.
|
||||
* Retrieve the guild flags. Built from the bitmask defined by SqDiscordGuildMemberFlags.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetFlags() const { return static_cast< SQInteger >(Valid().flags); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Build JSON string for the member object.
|
||||
* Modify the guild flags.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string BuildJSON() const { return Valid().build_json(); }
|
||||
void SetFlags(SQInteger f) const { Valid().flags = static_cast< uint8_t >(f); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the guild flags.
|
||||
*/
|
||||
DpGuildMember & ApplyFlags(SQInteger f) { SetFlags(f); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user is in time-out (communication disabled).
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsCommunicationDisabled() const { return Valid().is_communication_disabled(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user is deafened.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsDeaf() const { return Valid().is_deaf(); }
|
||||
SQMOD_NODISCARD bool GetDeaf() const { return Valid().is_deaf(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user is deafened.
|
||||
*/
|
||||
void SetDeaf(bool is_deafened) const { Valid().set_deaf(is_deafened); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user is muted.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsMuted() const { return Valid().is_muted(); }
|
||||
SQMOD_NODISCARD bool GetMuted() const { return Valid().is_muted(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user is muted.
|
||||
*/
|
||||
void SetMuted(bool is_muted) const { Valid().set_mute(is_muted); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the user is pending verification by membership screening.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsPending() const { return Valid().is_pending(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the the user's per-guild custom avatar is animated.
|
||||
*/
|
||||
SQMOD_NODISCARD bool HasAnimatedGuildAvatar() const { return Valid().has_animated_guild_avatar(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether the the user's per-guild custom avatar is animated.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string GetAvatarURL(SQInteger size, SQInteger format, bool animated) const
|
||||
{ return Valid().get_avatar_url(static_cast< uint16_t >(size), static_cast< dpp::image_type >(format), animated); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve a ping/mention for the user by nickname.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string GetMention() const { return Valid().get_mention(); }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@@ -251,228 +388,34 @@ struct DpGuild
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsValid() const { return static_cast< bool >(mPtr); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the shard ID of the guild.
|
||||
* Build json representation of the object.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetShardID() const { return static_cast< SQInteger >(Valid().shard_id); }
|
||||
SQMOD_NODISCARD std::string BuildJSON() const { return Valid().build_json(); }
|
||||
SQMOD_NODISCARD std::string BuildJSON_(bool with_id) const { return Valid().build_json(with_id); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the flags bitmask as defined by values within dpp::guild_flags.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetFlags() const { return static_cast< SQInteger >(Valid().flags); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the guild name.
|
||||
* Retrieve the guild name. Min length: 2, Max length: 100 (not including leading/trailing spaces)
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetName() const { return Valid().name; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the server description for communities.
|
||||
* Modify the guild name. Min length: 2, Max length: 100 (not including leading/trailing spaces)
|
||||
*/
|
||||
void SetName(StackStrF & name) const { Valid().set_name(name.ToStr()); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the guild name. Min length: 2, Max length: 100 (not including leading/trailing spaces)
|
||||
*/
|
||||
DpGuild & ApplyName(StackStrF & name) { SetName(name); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the server description.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetDescription() const { return Valid().description; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the vanity url code for verified or partnered servers and boost level 3.
|
||||
* Modify the server description.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetVanityUrlCode() const { return Valid().vanity_url_code; }
|
||||
void SetDescription(StackStrF & description) const { Valid().description = description.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the guild icon hash.
|
||||
* Modify the server description.
|
||||
*/
|
||||
SQMOD_NODISCARD const dpp::utility::iconhash & GetIcon() const { return Valid().icon; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the guild splash hash.
|
||||
*/
|
||||
SQMOD_NODISCARD const dpp::utility::iconhash & GetSplash() const { return Valid().splash; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the guild discovery splash hash.
|
||||
*/
|
||||
SQMOD_NODISCARD const dpp::utility::iconhash & GetDiscoverySplash() const { return Valid().discovery_splash; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the snowflake id of guild owner.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetOwnerID() const { return Valid().owner_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the guild voice region.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetVoiceRegion() const { return static_cast< SQInteger >(Valid().voice_region); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the snowflake ID of AFK voice channel or 0.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetAfkChannelID() const { return Valid().afk_channel_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the voice AFK timeout before moving users to AFK channel.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetAfkTimeout() const { return static_cast< SQInteger >(Valid().afk_timeout); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the snowflake ID of widget channel, or 0.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetWidgetChannelID() const { return Valid().widget_channel_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the verification level of server.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetVerificationLevel() const { return static_cast< SQInteger >(Valid().verification_level); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the setting for how notifications are to be delivered to users.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetDefaultMessageNotifications() const { return static_cast< SQInteger >(Valid().default_message_notifications); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether or not explicit content filtering is enable and what setting it is.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetExplicitContentFilter() const { return static_cast< SQInteger >(Valid().explicit_content_filter); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether multi factor authentication is required for moderators or not.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetMfaLevel() const { return static_cast< SQInteger >(Valid().mfa_level); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the ID of creating application, if any, or 0.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetApplicationID() const { return Valid().application_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the ID of system channel where discord update messages are sent.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetSystemChannelID() const { return Valid().system_channel_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the ID of rules channel for communities.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetRulesChannelID() const { return Valid().rules_channel_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the approximate member count. May be sent as zero.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetMemberCount() const { return static_cast< SQInteger >(Valid().member_count); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the server banner hash.
|
||||
*/
|
||||
SQMOD_NODISCARD const dpp::utility::iconhash & GetBanner() const { return Valid().banner; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the boost level.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetPremiumTier() const { return static_cast< SQInteger >(Valid().premium_tier); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the number of boosters.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetPremiumSubscriptionCount() const { return static_cast< SQInteger >(Valid().premium_subscription_count); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve public updates channel ID or 0.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetPublicUpdatesChannelID() const { return Valid().public_updates_channel_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the maximum users in a video channel, or 0.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetMaxVideoChannelUsers() const { return static_cast< SQInteger >(Valid().max_video_channel_users); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve a roles defined on this server.
|
||||
*/
|
||||
SQMOD_NODISCARD Array GetRoles() const { return Array(SqVM()).Reserve(static_cast< SQInteger >(Valid().roles.size())).AppendFromVector(Valid().roles); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve a list of channels on this server.
|
||||
*/
|
||||
SQMOD_NODISCARD Array GetChannels() const { return Array(SqVM()).Reserve(static_cast< SQInteger >(Valid().channels.size())).AppendFromVector(Valid().channels); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve a list of threads on this server.
|
||||
*/
|
||||
SQMOD_NODISCARD Array GetThreads() const { return Array(SqVM()).Reserve(static_cast< SQInteger >(Valid().threads.size())).AppendFromVector(Valid().threads); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve a list of guild members. Note that when you first receive the guild create event,
|
||||
* this may be empty or near empty. This depends upon your dpp::intents and the size of your bot.
|
||||
* It will be filled by guild member chunk requests.
|
||||
*/
|
||||
SQMOD_NODISCARD Table GetMembers() const;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve a list of members in voice channels in the guild.
|
||||
*/
|
||||
SQMOD_NODISCARD Table GetVoiceMembers() const;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve a list of emojis.
|
||||
*/
|
||||
SQMOD_NODISCARD Array GetEmojis() const { return Array(SqVM()).Reserve(static_cast< SQInteger >(Valid().emojis.size())).AppendFromVector(Valid().emojis); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Build a JSON string from this object.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string BuildJSON() const { return Valid().build_json(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Build a JSON string from this object. If [with_id] is True then ID is to be included in the JSON.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string BuildJSON_(bool with_id) const { return Valid().build_json(with_id); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Rehash members map.
|
||||
*/
|
||||
SQMOD_NODISCARD DpGuild & RehashMembers() { Valid().rehash_members(); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Connect to a voice channel another guild member is in.
|
||||
* Returns true if the user specified is in a voice channel, false if they aren't.
|
||||
*/
|
||||
SQMOD_NODISCARD bool ConnectMemberVoice(SQInteger user_id) const { return Valid().connect_member_voice(user_id); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Is a large server (>250 users).
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsLarge() const { return Valid().is_large(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Is unavailable due to outage (most other fields will be blank or outdated).
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsUnavailable() const { return Valid().is_unavailable(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Widget is enabled for this server.
|
||||
*/
|
||||
SQMOD_NODISCARD bool WidgetEnabled() const { return Valid().widget_enabled(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Guild has an invite splash.
|
||||
*/
|
||||
SQMOD_NODISCARD bool HasInviteSplash() const { return Valid().has_invite_splash(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Guild has VIP regions.
|
||||
*/
|
||||
SQMOD_NODISCARD bool HasVipRegions() const { return Valid().has_vip_regions(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Guild can have a vanity URL.
|
||||
*/
|
||||
SQMOD_NODISCARD bool HasVanityURL() const { return Valid().has_vanity_url(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Guild is a verified server.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsVerified() const { return Valid().is_verified(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Guild is a discord partner server.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsPartnered() const { return Valid().is_partnered(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Guild has enabled community.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsCommunity() const { return Valid().is_community(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Guild has enabled commerce channels.
|
||||
*/
|
||||
SQMOD_NODISCARD bool HasCommerce() const { return Valid().has_commerce(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Guild has news channel.
|
||||
*/
|
||||
SQMOD_NODISCARD bool HasNews() const { return Valid().has_news(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Guild is discoverable.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsDiscoverable() const { return Valid().is_discoverable(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Guild is featureable.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsFeatureable() const { return Valid().is_featureable(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Guild is allowed an animated icon.
|
||||
*/
|
||||
SQMOD_NODISCARD bool HasAnimatedIcon() const { return Valid().has_animated_icon(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Guild has a banner image.
|
||||
*/
|
||||
SQMOD_NODISCARD bool BasBanner() const { return Valid().has_banner(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Guild has enabled welcome screen.
|
||||
*/
|
||||
SQMOD_NODISCARD bool WelcomeScreenEnabled() const { return Valid().is_welcome_screen_enabled(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Guild has enabled membership screening.
|
||||
*/
|
||||
SQMOD_NODISCARD bool HasMemberVerificationGate() const { return Valid().has_member_verification_gate(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Guild has preview enabled.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsPreviewEnabled() const { return Valid().is_preview_enabled(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Server icon is actually an animated gif.
|
||||
*/
|
||||
SQMOD_NODISCARD bool HasAnimatedIconHash() const { return Valid().has_animated_icon_hash(); }
|
||||
DpGuild & ApplyDescription(StackStrF & description) { SetDescription(description); return *this; }
|
||||
};
|
||||
|
||||
} // Namespace:: SqMod
|
||||
9
module/Library/Discord/Integration.cpp
Normal file
9
module/Library/Discord/Integration.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/Discord/Integration.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -3,17 +3,11 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core/Utility.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <chrono>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
|
||||
} // Namespace:: SqMod
|
||||
9
module/Library/Discord/Message.cpp
Normal file
9
module/Library/Discord/Message.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/Discord/Message.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -3,17 +3,11 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core/Utility.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <chrono>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
*
|
||||
*/
|
||||
|
||||
} // Namespace:: SqMod
|
||||
@@ -1,27 +1,27 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/DPP/Other.hpp"
|
||||
#include "Library/Discord/Misc.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMOD_DECL_TYPENAME(SqDppCachePolicy, _SC("SqDppCachePolicy"))
|
||||
SQMOD_DECL_TYPENAME(SqDppIconHash, _SC("SqDppIconHash"))
|
||||
SQMOD_DECL_TYPENAME(SqDppUptime, _SC("SqDppUptime"))
|
||||
SQMOD_DECL_TYPENAME(SqDppActivity, _SC("SqDppActivity"))
|
||||
SQMOD_DECL_TYPENAME(SqDppPresence, _SC("SqDppPresence"))
|
||||
SQMOD_DECL_TYPENAME(SqDppVoiceState, _SC("SqDppVoiceState"))
|
||||
SQMOD_DECL_TYPENAME(SqDpCachePolicy, _SC("SqDiscordCachePolicy"))
|
||||
SQMOD_DECL_TYPENAME(SqDpUptime, _SC("SqDiscordUptime"))
|
||||
SQMOD_DECL_TYPENAME(SqDpIconHash, _SC("SqDiscordIconHash"))
|
||||
SQMOD_DECL_TYPENAME(SqDpVoiceState, _SC("SqDiscordVoiceState"))
|
||||
SQMOD_DECL_TYPENAME(SqDpEmoji, _SC("SqDiscordEmoji"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Register_DPP_Other(HSQUIRRELVM vm, Table & ns)
|
||||
void Register_Discord_Misc(HSQUIRRELVM vm, Table & ns)
|
||||
{
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Uptime"),
|
||||
Class< dpp::utility::uptime >(vm, SqDppUptime::Str)
|
||||
Class< dpp::utility::uptime >(vm, SqDpUptime::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
.Ctor< double >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppUptime::Fn)
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpUptime::Fn)
|
||||
.Func(_SC("_tostring"), &dpp::utility::uptime::to_string)
|
||||
// Member Variables
|
||||
.Var(_SC("Days"), &dpp::utility::uptime::days)
|
||||
@@ -34,12 +34,13 @@ void Register_DPP_Other(HSQUIRRELVM vm, Table & ns)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("IconHash"),
|
||||
Class< dpp::utility::iconhash >(vm, SqDppIconHash::Str)
|
||||
Class< dpp::utility::iconhash >(vm, SqDpIconHash::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
.Ctor< const std::string & >()
|
||||
.Ctor< uint64_t, uint64_t >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppIconHash::Fn)
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpIconHash::Fn)
|
||||
.Func(_SC("_tostring"), &dpp::utility::iconhash::to_string)
|
||||
// Member Variables
|
||||
.Var(_SC("High"), &dpp::utility::iconhash::first)
|
||||
@@ -49,77 +50,24 @@ void Register_DPP_Other(HSQUIRRELVM vm, Table & ns)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("CachePolicy"),
|
||||
Class< DpCachePolicy >(vm, SqDppCachePolicy::Str)
|
||||
Class< DpCachePolicy >(vm, SqDpCachePolicy::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
.Ctor< SQInteger >()
|
||||
.Ctor< SQInteger, SQInteger >()
|
||||
.Ctor< SQInteger, SQInteger, SQInteger >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppCachePolicy::Fn)
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpCachePolicy::Fn)
|
||||
// Member Variables
|
||||
.Var(_SC("UserPolicy"), &DpCachePolicy::mUserPolicy)
|
||||
.Var(_SC("EmojiPolicy"), &DpCachePolicy::mEmojiPolicy)
|
||||
.Var(_SC("RolePolicy"), &DpCachePolicy::mRolePolicy)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Activity"),
|
||||
Class< DpActivity, NoCopy< DpActivity > >(vm, SqDppActivity::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
.Ctor< SQInteger, StackStrF &, StackStrF &, StackStrF & >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppActivity::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Name"), &DpActivity::GetName, &DpActivity::SetName)
|
||||
.Prop(_SC("State"), &DpActivity::GetState, &DpActivity::SetState)
|
||||
.Prop(_SC("URL"), &DpActivity::GetURL, &DpActivity::SetURL)
|
||||
.Prop(_SC("Type"), &DpActivity::GetType, &DpActivity::SetType)
|
||||
.Prop(_SC("CreatedAt"), &DpActivity::GetCreatedAt, &DpActivity::SetCreatedAt)
|
||||
.Prop(_SC("Start"), &DpActivity::GetStart, &DpActivity::SetStart)
|
||||
.Prop(_SC("End"), &DpActivity::GetEnd, &DpActivity::SetEnd)
|
||||
// Member Methods
|
||||
.Func(_SC("SetName"), &DpActivity::ApplyName)
|
||||
.Func(_SC("SetState"), &DpActivity::ApplyState)
|
||||
.Func(_SC("SetURL"), &DpActivity::ApplyURL)
|
||||
.Func(_SC("SetType"), &DpActivity::ApplyType)
|
||||
.Func(_SC("SetCreatedAt"), &DpActivity::ApplyCreatedAt)
|
||||
.Func(_SC("SetStart"), &DpActivity::ApplyStart)
|
||||
.Func(_SC("SetEnd"), &DpActivity::ApplyEnd)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Presence"),
|
||||
Class< DpPresence, NoCopy< DpPresence > >(vm, SqDppPresence::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppPresence::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpPresence::IsValid)
|
||||
.Prop(_SC("UserID"), &DpPresence::GetUserID, &DpPresence::SetUserID)
|
||||
.Prop(_SC("GuildID"), &DpPresence::GetGuildID, &DpPresence::SetGuildID)
|
||||
.Prop(_SC("Flags"), &DpPresence::GetFlags, &DpPresence::SetFlags)
|
||||
.Prop(_SC("ActivityCount"), &DpPresence::ActivityCount)
|
||||
.Prop(_SC("DesktopStatus"), &DpPresence::GetDesktopStatus)
|
||||
.Prop(_SC("WebStatus"), &DpPresence::GetWebStatus)
|
||||
.Prop(_SC("MobileStatus"), &DpPresence::GetMobileStatus)
|
||||
.Prop(_SC("Status"), &DpPresence::GetStatus)
|
||||
// Member Methods
|
||||
.Func(_SC("SetUserID"), &DpPresence::ApplyUserID)
|
||||
.Func(_SC("SetGuildID"), &DpPresence::ApplyGuildID)
|
||||
.Func(_SC("SetFlags"), &DpPresence::ApplyFlags)
|
||||
.Func(_SC("AddActivity"), &DpPresence::AddActivity)
|
||||
.Func(_SC("EachActivity"), &DpPresence::EachActivity)
|
||||
.Func(_SC("ClearActivities"), &DpPresence::ClearActivities)
|
||||
.Func(_SC("FilterActivities"), &DpPresence::FilterActivities)
|
||||
.Func(_SC("BuildJSON"), &DpPresence::BuildJSON)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("VoiceState"),
|
||||
Class< DpVoiceState, NoConstructor< DpVoiceState > >(vm, SqDppVoiceState::Str)
|
||||
Class< DpVoiceState, NoConstructor< DpVoiceState > >(vm, SqDpVoiceState::Str)
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDppVoiceState::Fn)
|
||||
.Func(_SC("_tojson"), &DpVoiceState::BuildJSON)
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpVoiceState::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpVoiceState::IsValid)
|
||||
.Prop(_SC("JSON"), &DpVoiceState::BuildJSON)
|
||||
@@ -128,6 +76,7 @@ void Register_DPP_Other(HSQUIRRELVM vm, Table & ns)
|
||||
.Prop(_SC("UserID"), &DpVoiceState::GetUserID)
|
||||
.Prop(_SC("SessionID"), &DpVoiceState::GetSessionID)
|
||||
.Prop(_SC("Flags"), &DpVoiceState::GetFlags, &DpVoiceState::SetFlags)
|
||||
.Prop(_SC("RequestToSpeak"), &DpVoiceState::GetRequestToSpeak)
|
||||
.Prop(_SC("IsDeaf"), &DpVoiceState::IsDeaf)
|
||||
.Prop(_SC("IsMute"), &DpVoiceState::IsMute)
|
||||
.Prop(_SC("IsSelfMute"), &DpVoiceState::IsSelfMute)
|
||||
@@ -135,6 +84,33 @@ void Register_DPP_Other(HSQUIRRELVM vm, Table & ns)
|
||||
.Prop(_SC("SelfStream"), &DpVoiceState::SelfStream)
|
||||
.Prop(_SC("SelfVideo"), &DpVoiceState::SelfVideo)
|
||||
.Prop(_SC("IsSuppressed"), &DpVoiceState::IsSuppressed)
|
||||
// Member Methods
|
||||
.Func(_SC("BuildJSON"), &DpVoiceState::BuildJSON_)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Emoji"),
|
||||
Class< DpEmoji, NoCopy< DpEmoji > >(vm, SqDpEmoji::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
.Ctor< StackStrF &, dpp::snowflake, SQInteger >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpEmoji::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpEmoji::IsValid)
|
||||
.Prop(_SC("JSON"), &DpEmoji::BuildJSON)
|
||||
.Prop(_SC("Name"), &DpEmoji::GetName, &DpEmoji::SetName)
|
||||
.Prop(_SC("ImageData"), &DpEmoji::GetImageData)
|
||||
.Prop(_SC("RequiresColons"), &DpEmoji::GetRequiresColons)
|
||||
.Prop(_SC("IsManaged"), &DpEmoji::GetIsManaged)
|
||||
.Prop(_SC("IsAnimated"), &DpEmoji::GetIsAnimated)
|
||||
.Prop(_SC("IsAvailable"), &DpEmoji::GetIsAvailable)
|
||||
.Prop(_SC("Format"), &DpEmoji::Format)
|
||||
.Prop(_SC("Mention"), &DpEmoji::GetMention)
|
||||
// Member Methods
|
||||
.Func(_SC("SetName"), &DpEmoji::ApplyName)
|
||||
.Func(_SC("GetMention"), &DpEmoji::GetMention_)
|
||||
.Func(_SC("BuildJSON"), &DpEmoji::BuildJSON_)
|
||||
.Func(_SC("LoadImage"), &DpEmoji::LoadImage)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core/Utility.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <chrono>
|
||||
#include "Library/Discord/Utilities.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <chrono>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
@@ -59,400 +59,6 @@ struct DpCachePolicy
|
||||
}
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* An activity is a representation of what a user is doing. It might be a game, or a website, or a movie. Whatever.
|
||||
*/
|
||||
struct DpActivity
|
||||
{
|
||||
using Ptr = std::unique_ptr< dpp::activity >;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Referenced activity instance.
|
||||
*/
|
||||
Ptr mPtr{nullptr};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Whether the referenced pointer is owned.
|
||||
*/
|
||||
bool mOwned{false};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Default constructor.
|
||||
*/
|
||||
DpActivity() noexcept
|
||||
: DpActivity(new Ptr::element_type(), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
explicit DpActivity(Ptr::pointer ptr, bool owned = false) noexcept
|
||||
: mPtr(ptr), mOwned(owned)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor.
|
||||
*/
|
||||
explicit DpActivity(const Ptr::element_type & o) noexcept
|
||||
: DpActivity(new Ptr::element_type(o), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
explicit DpActivity(Ptr::element_type && o) noexcept
|
||||
: DpActivity(new Ptr::element_type(std::forward< Ptr::element_type >(o)), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
DpActivity(SQInteger type, StackStrF & name, StackStrF & state, StackStrF & url)
|
||||
: DpActivity(new Ptr::element_type(static_cast< dpp::activity_type >(type), name.ToStr(), state.ToStr(), url.ToStr()), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor (disabled).
|
||||
*/
|
||||
DpActivity(const DpActivity & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
DpActivity(DpActivity && o) noexcept = default;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*/
|
||||
~DpActivity() noexcept { Cleanup(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy assignment operator (disabled).
|
||||
*/
|
||||
DpActivity & operator = (const DpActivity & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move assignment operator.
|
||||
*/
|
||||
DpActivity & operator = (DpActivity && o) noexcept
|
||||
{
|
||||
if (this != &o) {
|
||||
Cleanup();
|
||||
// Transfer members values
|
||||
mPtr = std::move(o.mPtr);
|
||||
mOwned = o.mOwned;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Release any referenced resources and default to an empty/invalid state.
|
||||
*/
|
||||
void Cleanup()
|
||||
{
|
||||
// Do we own this to try delete it?
|
||||
if (!mOwned && mPtr) {
|
||||
// Not our job, simply forget about it
|
||||
[[maybe_unused]] auto p = mPtr.release();
|
||||
} else mPtr.reset(); // We own this so delete the instance
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle.
|
||||
*/
|
||||
void Validate() const { if (!mPtr) STHROWF("Invalid discord activity handle"); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle and retrieve a const reference to it.
|
||||
*/
|
||||
SQMOD_NODISCARD Ptr::element_type & Valid() const { Validate(); return *mPtr; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether a valid instance is managed.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsValid() const { return static_cast< bool >(mPtr); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the name of the activity.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetName() const { return Valid().name; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the name of the activity.
|
||||
*/
|
||||
void SetName(StackStrF & name) const { Valid().name = name.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the name of the activity.
|
||||
*/
|
||||
DpActivity & ApplyName(StackStrF & name) { SetName(name); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the state of the activity.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetState() const { return Valid().state; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the state of the activity.
|
||||
*/
|
||||
void SetState(StackStrF & state) const { Valid().state = state.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the state of the activity.
|
||||
*/
|
||||
DpActivity & ApplyState(StackStrF & state) { SetState(state); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the url of the activity.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetURL() const { return Valid().url; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the url of the activity.
|
||||
*/
|
||||
void SetURL(StackStrF & url) const { Valid().url = url.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the url of the activity.
|
||||
*/
|
||||
DpActivity & ApplyURL(StackStrF & url) { SetURL(url); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the type of the activity.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetType() const { return static_cast< SQInteger >(Valid().type); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the type of the activity.
|
||||
*/
|
||||
void SetType(SQInteger s) const { Valid().type = static_cast< dpp::activity_type >(s); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the type of the activity.
|
||||
*/
|
||||
DpActivity & ApplyType(SQInteger s) { SetType(s); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve when the activity was created.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetCreatedAt() const
|
||||
{
|
||||
return static_cast< SQInteger >(std::chrono::duration_cast< std::chrono::seconds >(std::chrono::system_clock::from_time_t(Valid().created_at).time_since_epoch()).count());
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify when the activity was created.
|
||||
*/
|
||||
void SetCreatedAt(SQInteger s) const
|
||||
{
|
||||
Valid().created_at = std::chrono::system_clock::to_time_t(std::chrono::time_point< std::chrono::system_clock >{std::chrono::seconds{s}});
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify when the activity was created.
|
||||
*/
|
||||
DpActivity & ApplyCreatedAt(SQInteger s) { SetCreatedAt(s); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve when the activity was started.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetStart() const
|
||||
{
|
||||
return static_cast< SQInteger >(std::chrono::duration_cast< std::chrono::seconds >(std::chrono::system_clock::from_time_t(Valid().start).time_since_epoch()).count());
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify when the activity was started.
|
||||
*/
|
||||
void SetStart(SQInteger s) const
|
||||
{
|
||||
Valid().start = std::chrono::system_clock::to_time_t(std::chrono::time_point< std::chrono::system_clock >{std::chrono::seconds{s}});
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify when the activity was started.
|
||||
*/
|
||||
DpActivity & ApplyStart(SQInteger s) { SetStart(s); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve when the activity was stopped.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetEnd() const
|
||||
{
|
||||
return static_cast< SQInteger >(std::chrono::duration_cast< std::chrono::seconds >(std::chrono::system_clock::from_time_t(Valid().end).time_since_epoch()).count());
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify when the activity was stopped.
|
||||
*/
|
||||
void SetEnd(SQInteger s) const
|
||||
{
|
||||
Valid().end = std::chrono::system_clock::to_time_t(std::chrono::time_point< std::chrono::system_clock >{std::chrono::seconds{s}});
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify when the activity was stopped.
|
||||
*/
|
||||
DpActivity & ApplyEnd(SQInteger s) { SetEnd(s); return *this; }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Represents user presence, e.g. what game they are playing and if they are online.
|
||||
*/
|
||||
struct DpPresence
|
||||
{
|
||||
using Ptr = std::unique_ptr< dpp::presence >;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Referenced presence instance.
|
||||
*/
|
||||
Ptr mPtr{nullptr};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Whether the referenced pointer is owned.
|
||||
*/
|
||||
bool mOwned{false};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Default constructor.
|
||||
*/
|
||||
DpPresence() noexcept
|
||||
: DpPresence(new Ptr::element_type(), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
explicit DpPresence(Ptr::pointer ptr, bool owned = false) noexcept
|
||||
: mPtr(ptr), mOwned(owned)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor.
|
||||
*/
|
||||
explicit DpPresence(const Ptr::element_type & o) noexcept
|
||||
: DpPresence(new Ptr::element_type(o), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
explicit DpPresence(Ptr::element_type && o) noexcept
|
||||
: DpPresence(new Ptr::element_type(std::forward< Ptr::element_type >(o)), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor (disabled).
|
||||
*/
|
||||
DpPresence(const DpPresence & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
DpPresence(DpPresence && o) noexcept = default;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*/
|
||||
~DpPresence() noexcept { Cleanup(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy assignment operator (disabled).
|
||||
*/
|
||||
DpPresence & operator = (const DpPresence & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move assignment operator.
|
||||
*/
|
||||
DpPresence & operator = (DpPresence && o) noexcept
|
||||
{
|
||||
if (this != &o) {
|
||||
Cleanup();
|
||||
// Transfer members values
|
||||
mPtr = std::move(o.mPtr);
|
||||
mOwned = o.mOwned;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Release any referenced resources and default to an empty/invalid state.
|
||||
*/
|
||||
void Cleanup()
|
||||
{
|
||||
// Do we own this to try delete it?
|
||||
if (!mOwned && mPtr) {
|
||||
// Not our job, simply forget about it
|
||||
[[maybe_unused]] auto p = mPtr.release();
|
||||
} else mPtr.reset(); // We own this so delete the instance
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle.
|
||||
*/
|
||||
void Validate() const { if (!mPtr) STHROWF("Invalid discord presence handle"); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle and retrieve a const reference to it.
|
||||
*/
|
||||
SQMOD_NODISCARD Ptr::element_type & Valid() const { Validate(); return *mPtr; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether a valid instance is managed.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsValid() const { return static_cast< bool >(mPtr); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the user that the presence applies to.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetUserID() const { return Valid().user_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the user that the presence applies to.
|
||||
*/
|
||||
void SetUserID(dpp::snowflake id) const { Valid().user_id = id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the user that the presence applies to.
|
||||
*/
|
||||
DpPresence & ApplyUserID(dpp::snowflake id) { SetUserID(id); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the guild that the presence applies to.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetGuildID() const { return Valid().guild_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the guild that the presence applies to.
|
||||
*/
|
||||
void SetGuildID(dpp::snowflake id) const { Valid().guild_id = id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the guild that the presence applies to.
|
||||
*/
|
||||
DpPresence & ApplyGuildID(dpp::snowflake id) { SetGuildID(id); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the presence bit-mask.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetFlags() const { return static_cast< SQInteger >(Valid().flags); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the presence bit-mask.
|
||||
*/
|
||||
void SetFlags(SQInteger f) const { Valid().flags = static_cast< uint8_t >(f); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the presence bit-mask.
|
||||
*/
|
||||
DpPresence & ApplyFlags(SQInteger f) { SetFlags(f); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the number of activities.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger ActivityCount() const { return static_cast< SQInteger >(Valid().activities.size()); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Add a new activity.
|
||||
*/
|
||||
DpPresence & AddActivity(const DpActivity & a) { Valid().activities.push_back(a.Valid()); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Iterate all activities.
|
||||
*/
|
||||
DpPresence & EachActivity(Function & fn)
|
||||
{
|
||||
for (const auto & a : Valid().activities)
|
||||
{
|
||||
fn.Execute(a);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the number of activities.
|
||||
*/
|
||||
DpPresence & ClearActivities(const DpActivity & a) { Valid().activities.clear(); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Filter activities.
|
||||
*/
|
||||
DpPresence & FilterActivities(Function & fn)
|
||||
{
|
||||
std::vector< dpp::activity > list;
|
||||
// Reserve memory in advance
|
||||
list.reserve(Valid().activities.size());
|
||||
// Process each activity individually
|
||||
for (const auto & a : Valid().activities)
|
||||
{
|
||||
auto ret = fn.Eval(a);
|
||||
// (null || true) == keep & false == skip
|
||||
if (!ret.IsNull() || !ret.template Cast< bool >())
|
||||
{
|
||||
list.push_back(a); // Keep this activity
|
||||
}
|
||||
}
|
||||
// Use filtered activities
|
||||
Valid().activities.swap(list);
|
||||
// Allow chaining
|
||||
return *this;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Build JSON string from this object.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string BuildJSON() const { return Valid().build_json(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the users status on desktop.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetDesktopStatus() const { return static_cast< SQInteger >(Valid().desktop_status()); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the user's status on web.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetWebStatus() const { return static_cast< SQInteger >(Valid().web_status()); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the user's status on mobile.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetMobileStatus() const { return static_cast< SQInteger >(Valid().mobile_status()); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the user's status as shown to other users.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetStatus() const { return static_cast< SQInteger >(Valid().status()); }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Represents the voice state of a user on a guild.
|
||||
* These are stored in the DpGuild object, and accessible there, or via DpChannel::GetVoiceMembers.
|
||||
@@ -547,61 +153,241 @@ struct DpVoiceState
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetGuildID() const { return Valid().guild_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the guild id this voice state is for (optional).
|
||||
* Retrieve the channel id this user is connected to (may be empty).
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetChannelID() const { return Valid().channel_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the guild id this voice state is for (optional).
|
||||
* Retrieve the user id this voice state is for.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetUserID() const { return Valid().user_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the guild id this voice state is for (optional).
|
||||
* Retrieve the session id for this voice state.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetSessionID() const { return Valid().session_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the guild id this voice state is for (optional).
|
||||
* Retrieve the voice state flags (see SqDiscordVoiceStateFlags).
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetFlags() const { return Valid().flags; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the guild id this voice state is for (optional).
|
||||
* Modify the voice state flags (see SqDiscordVoiceStateFlags).
|
||||
*/
|
||||
void SetFlags(SQInteger flags) const { Valid().flags = flags; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the guild id this voice state is for (optional).
|
||||
* Retrieve the time at which the user requested to speak, or 0.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetRequestToSpeak() const {
|
||||
return static_cast< SQInteger >(std::chrono::duration_cast< std::chrono::seconds >(
|
||||
std::chrono::system_clock::from_time_t(Valid().request_to_speak).time_since_epoch()
|
||||
).count());
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Build json representation of the object.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string BuildJSON() const { return Valid().build_json(); }
|
||||
SQMOD_NODISCARD std::string BuildJSON_(bool with_id) const { return Valid().build_json(with_id); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check if user is deafened.
|
||||
* Check if the user is deafened by the server.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsDeaf() const { return Valid().is_deaf(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check if user is muted.
|
||||
* Check if the user is muted by the server.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsMute() const { return Valid().is_mute(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check if user muted themselves.
|
||||
* Check if the user muted themselves.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsSelfMute() const { return Valid().is_self_mute(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check if user deafened themselves.
|
||||
* Check if the user deafened themselves.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsSelfDeaf() const { return Valid().is_self_deaf(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check if user is streamig.
|
||||
* Check if the user is streaming using "Go Live".
|
||||
*/
|
||||
SQMOD_NODISCARD bool SelfStream() const { return Valid().self_stream(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check if user is in video.
|
||||
* Check if the user's camera is enabled.
|
||||
*/
|
||||
SQMOD_NODISCARD bool SelfVideo() const { return Valid().self_video(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check if user is surpressed.
|
||||
* Check if user is suppressed. "HELP HELP I'M BEING SUPPRESSED!"
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsSuppressed() const { return Valid().is_suppressed(); }
|
||||
};
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
*
|
||||
* Represents the voice state of a user on a guild.
|
||||
*/
|
||||
struct DpEmoji
|
||||
{
|
||||
using Ptr = std::unique_ptr< dpp::emoji >;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Referenced voice state instance.
|
||||
*/
|
||||
Ptr mPtr{nullptr};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Whether the referenced pointer is owned.
|
||||
*/
|
||||
bool mOwned{false};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Default constructor.
|
||||
*/
|
||||
DpEmoji() noexcept = default;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
explicit DpEmoji(Ptr::pointer ptr, bool owned = false) noexcept
|
||||
: mPtr(ptr), mOwned(owned)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
explicit DpEmoji(const Ptr::element_type & o) noexcept
|
||||
: DpEmoji(new Ptr::element_type(o), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
explicit DpEmoji(Ptr::element_type && o) noexcept
|
||||
: DpEmoji(new Ptr::element_type(std::forward< Ptr::element_type >(o)), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
DpEmoji(StackStrF & name, dpp::snowflake id, SQInteger flags)
|
||||
: DpEmoji(new Ptr::element_type(name.ToStr(), id, static_cast< uint8_t >(flags)), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor (disabled).
|
||||
*/
|
||||
DpEmoji(const DpEmoji & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
DpEmoji(DpEmoji && o) noexcept = default;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*/
|
||||
~DpEmoji() noexcept { Cleanup(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy assignment operator (disabled).
|
||||
*/
|
||||
DpEmoji & operator = (const DpEmoji & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move assignment operator.
|
||||
*/
|
||||
DpEmoji & operator = (DpEmoji && o) noexcept
|
||||
{
|
||||
if (this != &o) {
|
||||
Cleanup();
|
||||
// Transfer members values
|
||||
mPtr = std::move(o.mPtr);
|
||||
mOwned = o.mOwned;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Release any referenced resources and default to an empty/invalid state.
|
||||
*/
|
||||
void Cleanup()
|
||||
{
|
||||
// Do we own this to try delete it?
|
||||
if (!mOwned && mPtr) {
|
||||
// Not our job, simply forget about it
|
||||
[[maybe_unused]] auto p = mPtr.release();
|
||||
} else mPtr.reset(); // We own this so delete the instance
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle.
|
||||
*/
|
||||
void Validate() const { if (!mPtr) STHROWF("Invalid discord voice state handle"); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle and retrieve a const reference to it.
|
||||
*/
|
||||
SQMOD_NODISCARD Ptr::element_type & Valid() const { Validate(); return *mPtr; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether a valid instance is managed.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsValid() const { return static_cast< bool >(mPtr); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the name of the emoji.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetName() const { return Valid().name; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the name of the emoji.
|
||||
*/
|
||||
void SetName(StackStrF & name) const { Valid().name = name.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the name of the emoji.
|
||||
*/
|
||||
DpEmoji & ApplyName(StackStrF & name) { SetName(name); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the user who uploaded the emoji.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetUserID() const { return Valid().user_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the user who uploaded the emoji.
|
||||
*/
|
||||
void SetUserID(dpp::snowflake id) const { Valid().user_id = id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the user who uploaded the emoji.
|
||||
*/
|
||||
DpEmoji & ApplyUserID(dpp::snowflake id) { SetUserID(id); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the flags for the emoji from SqDiscordEmojiFlags.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetFlags() const { return Valid().flags; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the flags for the emoji from SqDiscordEmojiFlags.
|
||||
*/
|
||||
void SetFlags(SQInteger flags) const { Valid().flags = static_cast< uint8_t >(flags); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the flags for the emoji from SqDiscordEmojiFlags.
|
||||
*/
|
||||
DpEmoji & ApplyFlags(SQInteger flags) { SetFlags(flags); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the image data for the emoji if uploading.
|
||||
*/
|
||||
SQMOD_NODISCARD LightObj GetImageData() const { return !Valid().image_data ? LightObj{} : LightObj(*Valid().image_data); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Create a mentionable emoji.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string GetMention_(StackStrF & name, dpp::snowflake id, bool is_animated = false) const
|
||||
{ return Valid().get_mention(name.ToStr(), id, is_animated); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Build json representation of the object.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string BuildJSON() const { return Valid().build_json(); }
|
||||
SQMOD_NODISCARD std::string BuildJSON_(bool with_id) const { return Valid().build_json(with_id); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve whether the Emoji requires colons.
|
||||
*/
|
||||
SQMOD_NODISCARD bool GetRequiresColons() const { return Valid().requires_colons(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve whether the Emoji is managed.
|
||||
*/
|
||||
SQMOD_NODISCARD bool GetIsManaged() const { return Valid().is_managed(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve whether the Emoji is animated.
|
||||
*/
|
||||
SQMOD_NODISCARD bool GetIsAnimated() const { return Valid().is_animated(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve whether the Emoji is available.
|
||||
*/
|
||||
SQMOD_NODISCARD bool GetIsAvailable() const { return Valid().is_available(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Load an image into the object as base64.
|
||||
*/
|
||||
DpEmoji & LoadImage(StackStrF & data, SQInteger type) { Valid().load_image(data.ToStr(), static_cast< dpp::image_type >(type)); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Format to name if unicode, name:id if has id or a:name:id if animated.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string Format() const { return Valid().format(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the mention/ping for the emoji.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string GetMention() const { return Valid().get_mention(); }
|
||||
};
|
||||
|
||||
} // Namespace:: SqMod
|
||||
143
module/Library/Discord/Presence.cpp
Normal file
143
module/Library/Discord/Presence.cpp
Normal file
@@ -0,0 +1,143 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/Discord/Presence.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
SQMOD_DECL_TYPENAME(SqDpActivityButton, _SC("SqDiscordActivityButton"))
|
||||
SQMOD_DECL_TYPENAME(SqDpActivityButtons, _SC("SqDiscordActivityButtons"))
|
||||
SQMOD_DECL_TYPENAME(SqDpActivityAssets, _SC("SqDiscordActivityAssets"))
|
||||
SQMOD_DECL_TYPENAME(SqDpActivitySecrets, _SC("SqDiscordActivitySecrets"))
|
||||
SQMOD_DECL_TYPENAME(SqDpActivity, _SC("SqDiscordActivity"))
|
||||
SQMOD_DECL_TYPENAME(SqDpActivities, _SC("SqDiscordActivities"))
|
||||
SQMOD_DECL_TYPENAME(SqDpPresence, _SC("SqDiscordPresence"))
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void Register_Discord_Presence(HSQUIRRELVM vm, Table & ns)
|
||||
{
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ActivityButton"),
|
||||
Class< DpActivityButton, NoCopy< DpActivityButton > >(vm, SqDpActivityButton::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpActivityButton::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpActivityButton::IsValid)
|
||||
.Prop(_SC("Label"), &DpActivityButton::GetLabel, &DpActivityButton::SetLabel)
|
||||
.Prop(_SC("URL"), &DpActivityButton::GetURL, &DpActivityButton::SetURL)
|
||||
// Member Methods
|
||||
.Func(_SC("SetLabel"), &DpActivityButton::ApplyLabel)
|
||||
.Func(_SC("SetURL"), &DpActivityButton::ApplyURL)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
Register_Discord_VectorProxy< dpp::activity_button, DpActivityButton, SqDpActivityButton >(vm, ns, _SC("ActivityButtons"));
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ActivityAssets"),
|
||||
Class< DpActivityAssets, NoCopy< DpActivityAssets > >(vm, SqDpActivityAssets::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpActivityAssets::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpActivityAssets::IsValid)
|
||||
.Prop(_SC("LargeImage"), &DpActivityAssets::GetLargeImage, &DpActivityAssets::SetLargeImage)
|
||||
.Prop(_SC("LargeText"), &DpActivityAssets::GetLargeText, &DpActivityAssets::SetLargeText)
|
||||
.Prop(_SC("SmallImage"), &DpActivityAssets::GetSmallImage, &DpActivityAssets::SetSmallImage)
|
||||
.Prop(_SC("SmallText"), &DpActivityAssets::GetSmallText, &DpActivityAssets::SetSmallText)
|
||||
// Member Methods
|
||||
.Func(_SC("SetLargeImage"), &DpActivityAssets::ApplyLargeImage)
|
||||
.Func(_SC("SetLargeText"), &DpActivityAssets::ApplyLargeText)
|
||||
.Func(_SC("SetSmallImage"), &DpActivityAssets::ApplySmallImage)
|
||||
.Func(_SC("SetSmallText"), &DpActivityAssets::ApplySmallText)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("ActivitySecrets"),
|
||||
Class< DpActivitySecrets, NoCopy< DpActivitySecrets > >(vm, SqDpActivitySecrets::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpActivitySecrets::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpActivitySecrets::IsValid)
|
||||
.Prop(_SC("Join"), &DpActivitySecrets::GetJoin, &DpActivitySecrets::SetJoin)
|
||||
.Prop(_SC("Spectate"), &DpActivitySecrets::GetSpectate, &DpActivitySecrets::SetSpectate)
|
||||
.Prop(_SC("Match"), &DpActivitySecrets::GetMatch, &DpActivitySecrets::SetMatch)
|
||||
// Member Methods
|
||||
.Func(_SC("SetJoin"), &DpActivitySecrets::ApplyJoin)
|
||||
.Func(_SC("SetSpectate"), &DpActivitySecrets::ApplySpectate)
|
||||
.Func(_SC("SetMatch"), &DpActivitySecrets::ApplyMatch)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Activity"),
|
||||
Class< DpActivity, NoCopy< DpActivity > >(vm, SqDpActivity::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
.Ctor< SQInteger, StackStrF &, StackStrF &, StackStrF & >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpActivity::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpActivity::IsValid)
|
||||
.Prop(_SC("Name"), &DpActivity::GetName, &DpActivity::SetName)
|
||||
.Prop(_SC("State"), &DpActivity::GetState, &DpActivity::SetState)
|
||||
.Prop(_SC("Details"), &DpActivity::GetDetails, &DpActivity::SetDetails)
|
||||
.Prop(_SC("Assets"), &DpActivity::GetAssets)
|
||||
.Prop(_SC("Buttons"), &DpActivity::GetButtons)
|
||||
.Prop(_SC("Emoji"), &DpActivity::GetEmoji)
|
||||
.Prop(_SC("PartyID"), &DpActivity::GetPartyID)
|
||||
.Prop(_SC("CurrentPartySize"), &DpActivity::GetCurrentPartySize)
|
||||
.Prop(_SC("MaxPartySize"), &DpActivity::GetMaxPartySize)
|
||||
.Prop(_SC("Secrets"), &DpActivity::GetSecrets)
|
||||
.Prop(_SC("URL"), &DpActivity::GetURL, &DpActivity::SetURL)
|
||||
.Prop(_SC("Type"), &DpActivity::GetType, &DpActivity::SetType)
|
||||
.Prop(_SC("CreatedAt"), &DpActivity::GetCreatedAt, &DpActivity::SetCreatedAt)
|
||||
.Prop(_SC("Start"), &DpActivity::GetStart, &DpActivity::SetStart)
|
||||
.Prop(_SC("End"), &DpActivity::GetEnd, &DpActivity::SetEnd)
|
||||
.Prop(_SC("ApplicationID"), &DpActivity::GetApplicationID)
|
||||
.Prop(_SC("Flags"), &DpActivity::GetFlags, &DpActivity::SetFlags)
|
||||
.Prop(_SC("Instance"), &DpActivity::IsInstance)
|
||||
// Member Methods
|
||||
.Func(_SC("SetName"), &DpActivity::ApplyName)
|
||||
.Func(_SC("SetState"), &DpActivity::ApplyState)
|
||||
.Func(_SC("SetDetails"), &DpActivity::ApplyDetails)
|
||||
.Func(_SC("SetURL"), &DpActivity::ApplyURL)
|
||||
.Func(_SC("SetType"), &DpActivity::ApplyType)
|
||||
.Func(_SC("SetCreatedAt"), &DpActivity::ApplyCreatedAt)
|
||||
.Func(_SC("SetStart"), &DpActivity::ApplyStart)
|
||||
.Func(_SC("SetEnd"), &DpActivity::ApplyEnd)
|
||||
.Func(_SC("SetFlags"), &DpActivity::ApplyFlags)
|
||||
.Func(_SC("GetLargeAssetURL"), &DpActivity::GetLargeAssetURL)
|
||||
.Func(_SC("GetSmallAssetURL"), &DpActivity::GetSmallAssetURL)
|
||||
);
|
||||
// --------------------------------------------------------------------------------------------
|
||||
Register_Discord_VectorProxy< dpp::activity, DpActivity, SqDpActivities >(vm, ns, _SC("Activities"));
|
||||
// --------------------------------------------------------------------------------------------
|
||||
ns.Bind(_SC("Presence"),
|
||||
Class< DpPresence, NoCopy< DpPresence > >(vm, SqDpPresence::Str)
|
||||
// Constructors
|
||||
.Ctor()
|
||||
.Ctor< SQInteger, DpActivity & >()
|
||||
.Ctor< SQInteger, SQInteger, StackStrF & >()
|
||||
// Meta-methods
|
||||
.SquirrelFunc(_SC("_typename"), &SqDpPresence::Fn)
|
||||
// Member Properties
|
||||
.Prop(_SC("Valid"), &DpPresence::IsValid)
|
||||
.Prop(_SC("JSON"), &DpPresence::BuildJSON)
|
||||
.Prop(_SC("UserID"), &DpPresence::GetUserID, &DpPresence::SetUserID)
|
||||
.Prop(_SC("GuildID"), &DpPresence::GetGuildID, &DpPresence::SetGuildID)
|
||||
.Prop(_SC("Flags"), &DpPresence::GetFlags, &DpPresence::SetFlags)
|
||||
.Prop(_SC("Activities"), &DpPresence::GetActivities)
|
||||
.Prop(_SC("DesktopStatus"), &DpPresence::GetDesktopStatus)
|
||||
.Prop(_SC("WebStatus"), &DpPresence::GetWebStatus)
|
||||
.Prop(_SC("MobileStatus"), &DpPresence::GetMobileStatus)
|
||||
.Prop(_SC("Status"), &DpPresence::GetStatus)
|
||||
// Member Methods
|
||||
.Func(_SC("SetUserID"), &DpPresence::ApplyUserID)
|
||||
.Func(_SC("SetGuildID"), &DpPresence::ApplyGuildID)
|
||||
.Func(_SC("SetFlags"), &DpPresence::ApplyFlags)
|
||||
.Func(_SC("BuildJSON"), &DpVoiceState::BuildJSON_)
|
||||
);
|
||||
}
|
||||
|
||||
} // Namespace:: SqMod
|
||||
928
module/Library/Discord/Presence.hpp
Normal file
928
module/Library/Discord/Presence.hpp
Normal file
@@ -0,0 +1,928 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/Discord/Misc.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <chrono>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* An activity button is a custom button shown in the rich presence. Can be to join a game or whatever.
|
||||
*/
|
||||
struct DpActivityButton
|
||||
{
|
||||
using Ptr = std::unique_ptr< dpp::activity_button >;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Referenced activity instance.
|
||||
*/
|
||||
Ptr mPtr{nullptr};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Whether the referenced pointer is owned.
|
||||
*/
|
||||
bool mOwned{false};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Default constructor.
|
||||
*/
|
||||
DpActivityButton() noexcept
|
||||
: DpActivityButton(new Ptr::element_type(), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
explicit DpActivityButton(Ptr::pointer ptr, bool owned = false) noexcept
|
||||
: mPtr(ptr), mOwned(owned)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor.
|
||||
*/
|
||||
explicit DpActivityButton(const Ptr::element_type & o) noexcept
|
||||
: DpActivityButton(new Ptr::element_type(o), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
explicit DpActivityButton(Ptr::element_type && o) noexcept
|
||||
: DpActivityButton(new Ptr::element_type(std::forward< Ptr::element_type >(o)), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor (disabled).
|
||||
*/
|
||||
DpActivityButton(const DpActivityButton & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
DpActivityButton(DpActivityButton && o) noexcept = default;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*/
|
||||
~DpActivityButton() noexcept { Cleanup(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy assignment operator (disabled).
|
||||
*/
|
||||
DpActivityButton & operator = (const DpActivityButton & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move assignment operator.
|
||||
*/
|
||||
DpActivityButton & operator = (DpActivityButton && o) noexcept
|
||||
{
|
||||
if (this != &o) {
|
||||
Cleanup();
|
||||
// Transfer members values
|
||||
mPtr = std::move(o.mPtr);
|
||||
mOwned = o.mOwned;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Release any referenced resources and default to an empty/invalid state.
|
||||
*/
|
||||
void Cleanup()
|
||||
{
|
||||
// Do we own this to try delete it?
|
||||
if (!mOwned && mPtr) {
|
||||
// Not our job, simply forget about it
|
||||
[[maybe_unused]] auto p = mPtr.release();
|
||||
} else mPtr.reset(); // We own this so delete the instance
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle.
|
||||
*/
|
||||
void Validate() const { if (!mPtr) STHROWF("Invalid discord activity button handle"); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle and retrieve a const reference to it.
|
||||
*/
|
||||
SQMOD_NODISCARD Ptr::element_type & Valid() const { Validate(); return *mPtr; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether a valid instance is managed.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsValid() const { return static_cast< bool >(mPtr); }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the text shown on the button (1-32 characters).
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetLabel() const { return Valid().label; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the text shown on the button (1-32 characters).
|
||||
*/
|
||||
void SetLabel(StackStrF & label) const { Valid().label = label.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the text shown on the button (1-32 characters).
|
||||
*/
|
||||
DpActivityButton & ApplyLabel(StackStrF & label) { SetLabel(label); return *this; }
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the url opened when clicking the button (1-512 characters). It's may be empty.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetURL() const { return Valid().url; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the url opened when clicking the button (1-512 characters).
|
||||
*/
|
||||
void SetURL(StackStrF & url) const { Valid().url = url.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the url opened when clicking the button (1-512 characters).
|
||||
*/
|
||||
DpActivityButton & ApplyURL(StackStrF & url) { SetURL(url); return *this; }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* An activity asset are the images and the hover text displayed in the rich presence.
|
||||
*/
|
||||
struct DpActivityAssets
|
||||
{
|
||||
using Ptr = std::unique_ptr< dpp::activity_assets >;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Referenced activity instance.
|
||||
*/
|
||||
Ptr mPtr{nullptr};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Whether the referenced pointer is owned.
|
||||
*/
|
||||
bool mOwned{false};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Default constructor.
|
||||
*/
|
||||
DpActivityAssets() noexcept
|
||||
: DpActivityAssets(new Ptr::element_type(), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
explicit DpActivityAssets(Ptr::pointer ptr, bool owned = false) noexcept
|
||||
: mPtr(ptr), mOwned(owned)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor.
|
||||
*/
|
||||
explicit DpActivityAssets(const Ptr::element_type & o) noexcept
|
||||
: DpActivityAssets(new Ptr::element_type(o), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
explicit DpActivityAssets(Ptr::element_type && o) noexcept
|
||||
: DpActivityAssets(new Ptr::element_type(std::forward< Ptr::element_type >(o)), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor (disabled).
|
||||
*/
|
||||
DpActivityAssets(const DpActivityAssets & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
DpActivityAssets(DpActivityAssets && o) noexcept = default;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*/
|
||||
~DpActivityAssets() noexcept { Cleanup(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy assignment operator (disabled).
|
||||
*/
|
||||
DpActivityAssets & operator = (const DpActivityAssets & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move assignment operator.
|
||||
*/
|
||||
DpActivityAssets & operator = (DpActivityAssets && o) noexcept
|
||||
{
|
||||
if (this != &o) {
|
||||
Cleanup();
|
||||
// Transfer members values
|
||||
mPtr = std::move(o.mPtr);
|
||||
mOwned = o.mOwned;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Release any referenced resources and default to an empty/invalid state.
|
||||
*/
|
||||
void Cleanup()
|
||||
{
|
||||
// Do we own this to try delete it?
|
||||
if (!mOwned && mPtr) {
|
||||
// Not our job, simply forget about it
|
||||
[[maybe_unused]] auto p = mPtr.release();
|
||||
} else mPtr.reset(); // We own this so delete the instance
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle.
|
||||
*/
|
||||
void Validate() const { if (!mPtr) STHROWF("Invalid discord activity assets handle"); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle and retrieve a const reference to it.
|
||||
*/
|
||||
SQMOD_NODISCARD Ptr::element_type & Valid() const { Validate(); return *mPtr; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether a valid instance is managed.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsValid() const { return static_cast< bool >(mPtr); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the large asset image which usually contain snowflake ID or prefixed image ID.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetLargeImage() const { return Valid().large_image; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the large asset image.
|
||||
*/
|
||||
void SetLargeImage(StackStrF & large_image) const { Valid().large_image = large_image.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the large asset image.
|
||||
*/
|
||||
DpActivityAssets & ApplyLargeImage(StackStrF & large_image) { SetLargeImage(large_image); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the text displayed when hovering over the large image of the activity.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetLargeText() const { return Valid().large_text; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the text displayed when hovering over the large image of the activity.
|
||||
*/
|
||||
void SetLargeText(StackStrF & large_text) const { Valid().large_text = large_text.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the text displayed when hovering over the large image of the activity.
|
||||
*/
|
||||
DpActivityAssets & ApplyLargeText(StackStrF & large_text) { SetLargeText(large_text); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the small asset image which usually contain snowflake ID or prefixed image ID.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetSmallImage() const { return Valid().small_image; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the small asset image.
|
||||
*/
|
||||
void SetSmallImage(StackStrF & small_image) const { Valid().small_image = small_image.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the small asset image.
|
||||
*/
|
||||
DpActivityAssets & ApplySmallImage(StackStrF & small_image) { SetSmallImage(small_image); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the text displayed when hovering over the small image of the activity.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetSmallText() const { return Valid().small_text; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the text displayed when hovering over the small image of the activity.
|
||||
*/
|
||||
void SetSmallText(StackStrF & small_text) const { Valid().small_text = small_text.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the text displayed when hovering over the small image of the activity.
|
||||
*/
|
||||
DpActivityAssets & ApplySmallText(StackStrF & small_text) { SetSmallText(small_text); return *this; }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Secrets for Rich Presence joining and spectating.
|
||||
*/
|
||||
struct DpActivitySecrets
|
||||
{
|
||||
using Ptr = std::unique_ptr< dpp::activity_secrets >;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Referenced activity instance.
|
||||
*/
|
||||
Ptr mPtr{nullptr};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Whether the referenced pointer is owned.
|
||||
*/
|
||||
bool mOwned{false};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Default constructor.
|
||||
*/
|
||||
DpActivitySecrets() noexcept
|
||||
: DpActivitySecrets(new Ptr::element_type(), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
explicit DpActivitySecrets(Ptr::pointer ptr, bool owned = false) noexcept
|
||||
: mPtr(ptr), mOwned(owned)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor.
|
||||
*/
|
||||
explicit DpActivitySecrets(const Ptr::element_type & o) noexcept
|
||||
: DpActivitySecrets(new Ptr::element_type(o), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
explicit DpActivitySecrets(Ptr::element_type && o) noexcept
|
||||
: DpActivitySecrets(new Ptr::element_type(std::forward< Ptr::element_type >(o)), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor (disabled).
|
||||
*/
|
||||
DpActivitySecrets(const DpActivitySecrets & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
DpActivitySecrets(DpActivitySecrets && o) noexcept = default;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*/
|
||||
~DpActivitySecrets() noexcept { Cleanup(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy assignment operator (disabled).
|
||||
*/
|
||||
DpActivitySecrets & operator = (const DpActivitySecrets & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move assignment operator.
|
||||
*/
|
||||
DpActivitySecrets & operator = (DpActivitySecrets && o) noexcept
|
||||
{
|
||||
if (this != &o) {
|
||||
Cleanup();
|
||||
// Transfer members values
|
||||
mPtr = std::move(o.mPtr);
|
||||
mOwned = o.mOwned;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Release any referenced resources and default to an empty/invalid state.
|
||||
*/
|
||||
void Cleanup()
|
||||
{
|
||||
// Do we own this to try delete it?
|
||||
if (!mOwned && mPtr) {
|
||||
// Not our job, simply forget about it
|
||||
[[maybe_unused]] auto p = mPtr.release();
|
||||
} else mPtr.reset(); // We own this so delete the instance
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle.
|
||||
*/
|
||||
void Validate() const { if (!mPtr) STHROWF("Invalid discord activity secrets handle"); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle and retrieve a const reference to it.
|
||||
*/
|
||||
SQMOD_NODISCARD Ptr::element_type & Valid() const { Validate(); return *mPtr; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether a valid instance is managed.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsValid() const { return static_cast< bool >(mPtr); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the secret for joining a party.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetJoin() const { return Valid().join; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the secret for joining a party.
|
||||
*/
|
||||
void SetJoin(StackStrF & join) const { Valid().join = join.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the secret for joining a party.
|
||||
*/
|
||||
DpActivitySecrets & ApplyJoin(StackStrF & join) { SetJoin(join); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the secret for spectating a game.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetSpectate() const { return Valid().spectate; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the secret for spectating a game.
|
||||
*/
|
||||
void SetSpectate(StackStrF & spectate) const { Valid().spectate = spectate.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the secret for spectating a game.
|
||||
*/
|
||||
DpActivitySecrets & ApplySpectate(StackStrF & spectate) { SetSpectate(spectate); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the secret for a specific instanced match.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetMatch() const { return Valid().match; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the secret for a specific instanced match.
|
||||
*/
|
||||
void SetMatch(StackStrF & match) const { Valid().match = match.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the secret for a specific instanced match.
|
||||
*/
|
||||
DpActivitySecrets & ApplyMatch(StackStrF & match) { SetMatch(match); return *this; }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* An activity is a representation of what a user is doing. It might be a game, or a website, or a movie. Whatever.
|
||||
*/
|
||||
struct DpActivity
|
||||
{
|
||||
using Ptr = std::unique_ptr< dpp::activity >;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Referenced activity instance.
|
||||
*/
|
||||
Ptr mPtr{nullptr};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Whether the referenced pointer is owned.
|
||||
*/
|
||||
bool mOwned{false};
|
||||
// --------------------------------------------------------------------------------------------
|
||||
using Buttons = DpVectorProxy< dpp::activity_button, DpActivityButton >;
|
||||
// --------------------------------------------------------------------------------------------
|
||||
LightObj mSqAssets{};
|
||||
LightObj mSqButtons{};
|
||||
LightObj mSqEmoji{};
|
||||
LightObj mSqSecrets{};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Default constructor.
|
||||
*/
|
||||
DpActivity() noexcept
|
||||
: DpActivity(new Ptr::element_type(), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
explicit DpActivity(Ptr::pointer ptr, bool owned = false) noexcept
|
||||
: mPtr(ptr), mOwned(owned)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor.
|
||||
*/
|
||||
explicit DpActivity(const Ptr::element_type & o) noexcept
|
||||
: DpActivity(new Ptr::element_type(o), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
explicit DpActivity(Ptr::element_type && o) noexcept
|
||||
: DpActivity(new Ptr::element_type(std::forward< Ptr::element_type >(o)), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
DpActivity(SQInteger type, StackStrF & name, StackStrF & state, StackStrF & url)
|
||||
: DpActivity(new Ptr::element_type(static_cast< dpp::activity_type >(type), name.ToStr(), state.ToStr(), url.ToStr()), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor (disabled).
|
||||
*/
|
||||
DpActivity(const DpActivity & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
DpActivity(DpActivity && o) noexcept = default;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*/
|
||||
~DpActivity() noexcept { Cleanup(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy assignment operator (disabled).
|
||||
*/
|
||||
DpActivity & operator = (const DpActivity & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move assignment operator.
|
||||
*/
|
||||
DpActivity & operator = (DpActivity && o) noexcept
|
||||
{
|
||||
if (this != &o) {
|
||||
Cleanup();
|
||||
// Transfer members values
|
||||
mPtr = std::move(o.mPtr);
|
||||
mOwned = o.mOwned;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Release any referenced resources and default to an empty/invalid state.
|
||||
*/
|
||||
void Cleanup()
|
||||
{
|
||||
// Cleanup activity assets, if any
|
||||
if (!mSqAssets.IsNull())
|
||||
{
|
||||
mSqAssets.CastI< DpActivityAssets >()->Cleanup();
|
||||
// Release script resources
|
||||
mSqAssets.Release();
|
||||
}
|
||||
// Cleanup activity buttons, if any
|
||||
if (!mSqButtons.IsNull())
|
||||
{
|
||||
mSqButtons.CastI< Buttons >()->Cleanup();
|
||||
// Release script resources
|
||||
mSqButtons.Release();
|
||||
}
|
||||
// Cleanup activity emoji, if any
|
||||
if (!mSqEmoji.IsNull())
|
||||
{
|
||||
mSqEmoji.CastI< DpEmoji >()->Cleanup();
|
||||
// Release script resources
|
||||
mSqEmoji.Release();
|
||||
}
|
||||
// Cleanup activity secrets, if any
|
||||
if (!mSqSecrets.IsNull())
|
||||
{
|
||||
mSqSecrets.CastI< DpActivitySecrets >()->Cleanup();
|
||||
// Release script resources
|
||||
mSqSecrets.Release();
|
||||
}
|
||||
// Do we own this to try delete it?
|
||||
if (!mOwned && mPtr) {
|
||||
// Not our job, simply forget about it
|
||||
[[maybe_unused]] auto p = mPtr.release();
|
||||
} else mPtr.reset(); // We own this so delete the instance
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle.
|
||||
*/
|
||||
void Validate() const { if (!mPtr) STHROWF("Invalid discord activity handle"); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle and retrieve a const reference to it.
|
||||
*/
|
||||
SQMOD_NODISCARD Ptr::element_type & Valid() const { Validate(); return *mPtr; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether a valid instance is managed.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsValid() const { return static_cast< bool >(mPtr); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the name of the activity. e.g. "Vice City"
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetName() const { return Valid().name; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the name of the activity.
|
||||
*/
|
||||
void SetName(StackStrF & name) const { Valid().name = name.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the name of the activity.
|
||||
*/
|
||||
DpActivity & ApplyName(StackStrF & name) { SetName(name); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the state of the activity. e.g. "Waiting in lobby"
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetState() const { return Valid().state; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the state of the activity.
|
||||
*/
|
||||
void SetState(StackStrF & state) const { Valid().state = state.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the state of the activity.
|
||||
*/
|
||||
DpActivity & ApplyState(StackStrF & state) { SetState(state); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the details of the activity. What the player is currently doing.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetDetails() const { return Valid().details; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the details of the activity.
|
||||
*/
|
||||
void SetDetails(StackStrF & details) const { Valid().details = details.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the details of the activity.
|
||||
*/
|
||||
DpActivity & ApplyDetails(StackStrF & details) { SetDetails(details); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the images for the presence and their hover texts.
|
||||
*/
|
||||
SQMOD_NODISCARD LightObj & GetAssets()
|
||||
{
|
||||
if (mSqAssets.IsNull())
|
||||
{
|
||||
mSqAssets = LightObj{SqTypeIdentity< DpActivityAssets >{}, SqVM(), &Valid().assets, false};
|
||||
}
|
||||
// Return the associated script object
|
||||
return mSqAssets;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the url of the activity. Only applicable for certain sites such a YouTube.
|
||||
*/
|
||||
SQMOD_NODISCARD const std::string & GetURL() const { return Valid().url; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the url of the activity.
|
||||
*/
|
||||
void SetURL(StackStrF & url) const { Valid().url = url.ToStr(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the url of the activity.
|
||||
*/
|
||||
DpActivity & ApplyURL(StackStrF & url) { SetURL(url); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the custom buttons shown in the Rich Presence (max 2).
|
||||
*/
|
||||
SQMOD_NODISCARD LightObj & GetButtons()
|
||||
{
|
||||
if (mSqButtons.IsNull())
|
||||
{
|
||||
mSqButtons = LightObj{SqTypeIdentity< Buttons >{}, SqVM(), &Valid().buttons, false};
|
||||
}
|
||||
// Return the associated script object
|
||||
return mSqButtons;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the emoji used for the custom status.
|
||||
*/
|
||||
SQMOD_NODISCARD LightObj & GetEmoji()
|
||||
{
|
||||
if (mSqEmoji.IsNull())
|
||||
{
|
||||
mSqEmoji = LightObj{SqTypeIdentity< DpEmoji >{}, SqVM(), &Valid().emoji, false};
|
||||
}
|
||||
// Return the associated script object
|
||||
return mSqEmoji;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the ID of the party.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetPartyID() const { return Valid().party.id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the party's current size. Used to show the party's current size.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetCurrentPartySize() const { return Valid().party.current_size; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the party's maximum size. Used to show the party's maximum size.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetMaxPartySize() const { return Valid().party.maximum_size; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the secrets for rich presence joining and spectating.
|
||||
*/
|
||||
SQMOD_NODISCARD LightObj & GetSecrets()
|
||||
{
|
||||
if (mSqSecrets.IsNull())
|
||||
{
|
||||
mSqSecrets = LightObj{SqTypeIdentity< DpActivitySecrets >{}, SqVM(), &Valid().secrets, false};
|
||||
}
|
||||
// Return the associated script object
|
||||
return mSqSecrets;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the type for the activity from SqDiscordActivityType.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetType() const { return Valid().type; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the type for the activity from SqDiscordActivityType.
|
||||
*/
|
||||
void SetType(SQInteger type) const { Valid().type = static_cast< dpp::activity_type >(type); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the type for the activity from SqDiscordActivityType.
|
||||
*/
|
||||
DpActivity & ApplyType(SQInteger type) { SetType(type); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve when the activity was created.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetCreatedAt() const
|
||||
{
|
||||
return static_cast< SQInteger >(std::chrono::duration_cast< std::chrono::seconds >(std::chrono::system_clock::from_time_t(Valid().created_at).time_since_epoch()).count());
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify when the activity was created.
|
||||
*/
|
||||
void SetCreatedAt(SQInteger s) const
|
||||
{
|
||||
Valid().created_at = std::chrono::system_clock::to_time_t(std::chrono::time_point< std::chrono::system_clock >{std::chrono::seconds{s}});
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify when the activity was created.
|
||||
*/
|
||||
DpActivity & ApplyCreatedAt(SQInteger s) { SetCreatedAt(s); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve when the activity was started.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetStart() const
|
||||
{
|
||||
return static_cast< SQInteger >(std::chrono::duration_cast< std::chrono::seconds >(std::chrono::system_clock::from_time_t(Valid().start).time_since_epoch()).count());
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify when the activity was started.
|
||||
*/
|
||||
void SetStart(SQInteger s) const
|
||||
{
|
||||
Valid().start = std::chrono::system_clock::to_time_t(std::chrono::time_point< std::chrono::system_clock >{std::chrono::seconds{s}});
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify when the activity was started.
|
||||
*/
|
||||
DpActivity & ApplyStart(SQInteger s) { SetStart(s); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve when the activity was stopped.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetEnd() const
|
||||
{
|
||||
return static_cast< SQInteger >(std::chrono::duration_cast< std::chrono::seconds >(std::chrono::system_clock::from_time_t(Valid().end).time_since_epoch()).count());
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify when the activity was stopped.
|
||||
*/
|
||||
void SetEnd(SQInteger s) const
|
||||
{
|
||||
Valid().end = std::chrono::system_clock::to_time_t(std::chrono::time_point< std::chrono::system_clock >{std::chrono::seconds{s}});
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify when the activity was stopped.
|
||||
*/
|
||||
DpActivity & ApplyEnd(SQInteger s) { SetEnd(s); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the creating application (e.g. a linked account on the user's client)
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetApplicationID() const { return Valid().application_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the flags for the activity from SqDiscordActivityFlags.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetFlags() const { return Valid().flags; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the flags for the activity from SqDiscordActivityFlags.
|
||||
*/
|
||||
void SetFlags(SQInteger flags) const { Valid().flags = static_cast< uint8_t >(flags); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the flags for the activity from SqDiscordActivityFlags.
|
||||
*/
|
||||
DpActivity & ApplyFlags(SQInteger flags) { SetFlags(flags); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve whether or not the activity is an instanced game session.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsInstance() const { return Valid().is_instance; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Get the assets large image url if they have one, otherwise returns an empty string.
|
||||
* In case of prefixed image IDs (mp:{image_id}) it returns an empty string.
|
||||
* See: https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-asset-image
|
||||
*/
|
||||
SQMOD_NODISCARD std::string GetLargeAssetURL(SQInteger size, SQInteger format) const
|
||||
{ return Valid().get_large_asset_url(static_cast< uint16_t >(size), static_cast< dpp::image_type >(format)); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Get the assets small image url if they have one, otherwise returns an empty string.
|
||||
* In case of prefixed image IDs (mp:{image_id}) it returns an empty string.
|
||||
* See: https://discord.com/developers/docs/topics/gateway-events#activity-object-activity-asset-image
|
||||
*/
|
||||
SQMOD_NODISCARD std::string GetSmallAssetURL(SQInteger size, SQInteger format) const
|
||||
{ return Valid().get_small_asset_url(static_cast< uint16_t >(size), static_cast< dpp::image_type >(format)); }
|
||||
};
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
* Represents user presence, e.g. what game they are playing and if they are online.
|
||||
*/
|
||||
struct DpPresence
|
||||
{
|
||||
using Ptr = std::unique_ptr< dpp::presence >;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Referenced presence instance.
|
||||
*/
|
||||
Ptr mPtr{nullptr};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Whether the referenced pointer is owned.
|
||||
*/
|
||||
bool mOwned{false};
|
||||
// --------------------------------------------------------------------------------------------
|
||||
using Activities = DpVectorProxy< dpp::activity, DpActivity >;
|
||||
// --------------------------------------------------------------------------------------------
|
||||
LightObj mSqActivities{};
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Default constructor.
|
||||
*/
|
||||
DpPresence() noexcept
|
||||
: DpPresence(new Ptr::element_type(), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
explicit DpPresence(Ptr::pointer ptr, bool owned = false) noexcept
|
||||
: mPtr(ptr), mOwned(owned)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor.
|
||||
*/
|
||||
explicit DpPresence(const Ptr::element_type & o) noexcept
|
||||
: DpPresence(new Ptr::element_type(o), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
explicit DpPresence(Ptr::element_type && o) noexcept
|
||||
: DpPresence(new Ptr::element_type(std::forward< Ptr::element_type >(o)), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
DpPresence(SQInteger status, DpActivity & activity)
|
||||
: DpPresence(new Ptr::element_type(static_cast< dpp::presence_status >(status), activity.Valid()), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Explicit constructor.
|
||||
*/
|
||||
DpPresence(SQInteger status, SQInteger type, StackStrF & description)
|
||||
: DpPresence(new Ptr::element_type(static_cast< dpp::presence_status >(status), static_cast< dpp::activity_type >(status), description.ToStr()), true)
|
||||
{ }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy constructor (disabled).
|
||||
*/
|
||||
DpPresence(const DpPresence & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move constructor.
|
||||
*/
|
||||
DpPresence(DpPresence && o) noexcept = default;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Destructor.
|
||||
*/
|
||||
~DpPresence() noexcept { Cleanup(); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Copy assignment operator (disabled).
|
||||
*/
|
||||
DpPresence & operator = (const DpPresence & o) = delete;
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Move assignment operator.
|
||||
*/
|
||||
DpPresence & operator = (DpPresence && o) noexcept
|
||||
{
|
||||
if (this != &o) {
|
||||
Cleanup();
|
||||
// Transfer members values
|
||||
mPtr = std::move(o.mPtr);
|
||||
mOwned = o.mOwned;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Release any referenced resources and default to an empty/invalid state.
|
||||
*/
|
||||
void Cleanup()
|
||||
{
|
||||
// Cleanup presence activities, if any
|
||||
if (!mSqActivities.IsNull())
|
||||
{
|
||||
mSqActivities.CastI< Activities >()->Cleanup();
|
||||
// Release script resources
|
||||
mSqActivities.Release();
|
||||
}
|
||||
// Do we own this to try delete it?
|
||||
if (!mOwned && mPtr) {
|
||||
// Not our job, simply forget about it
|
||||
[[maybe_unused]] auto p = mPtr.release();
|
||||
} else mPtr.reset(); // We own this so delete the instance
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle.
|
||||
*/
|
||||
void Validate() const { if (!mPtr) STHROWF("Invalid discord presence handle"); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Validate the managed handle and retrieve a const reference to it.
|
||||
*/
|
||||
SQMOD_NODISCARD Ptr::element_type & Valid() const { Validate(); return *mPtr; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Check whether a valid instance is managed.
|
||||
*/
|
||||
SQMOD_NODISCARD bool IsValid() const { return static_cast< bool >(mPtr); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the user that the presence applies to.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetUserID() const { return Valid().user_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the user that the presence applies to.
|
||||
*/
|
||||
void SetUserID(dpp::snowflake id) const { Valid().user_id = id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the user that the presence applies to.
|
||||
*/
|
||||
DpPresence & ApplyUserID(dpp::snowflake id) { SetUserID(id); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the guild that the presence applies to.
|
||||
*/
|
||||
SQMOD_NODISCARD dpp::snowflake GetGuildID() const { return Valid().guild_id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the guild that the presence applies to.
|
||||
*/
|
||||
void SetGuildID(dpp::snowflake id) const { Valid().guild_id = id; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the guild that the presence applies to.
|
||||
*/
|
||||
DpPresence & ApplyGuildID(dpp::snowflake id) { SetGuildID(id); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the presence bit-mask.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetFlags() const { return static_cast< SQInteger >(Valid().flags); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the presence bit-mask.
|
||||
*/
|
||||
void SetFlags(SQInteger f) const { Valid().flags = static_cast< uint8_t >(f); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Modify the presence bit-mask.
|
||||
*/
|
||||
DpPresence & ApplyFlags(SQInteger f) { SetFlags(f); return *this; }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the list of activities.
|
||||
*/
|
||||
SQMOD_NODISCARD LightObj & GetActivities()
|
||||
{
|
||||
if (mSqActivities.IsNull())
|
||||
{
|
||||
mSqActivities = LightObj{SqTypeIdentity< Activities >{}, SqVM(), &Valid().activities, false};
|
||||
}
|
||||
// Return the associated script object
|
||||
return mSqActivities;
|
||||
}
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Build JSON string from this object.
|
||||
*/
|
||||
SQMOD_NODISCARD std::string BuildJSON() const { return Valid().build_json(); }
|
||||
SQMOD_NODISCARD std::string BuildJSON_(bool with_id) const { return Valid().build_json(with_id); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the users status on desktop.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetDesktopStatus() const { return static_cast< SQInteger >(Valid().desktop_status()); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the user's status on web.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetWebStatus() const { return static_cast< SQInteger >(Valid().web_status()); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the user's status on mobile.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetMobileStatus() const { return static_cast< SQInteger >(Valid().mobile_status()); }
|
||||
/* --------------------------------------------------------------------------------------------
|
||||
* Retrieve the user's status as shown to other users.
|
||||
*/
|
||||
SQMOD_NODISCARD SQInteger GetStatus() const { return static_cast< SQInteger >(Valid().status()); }
|
||||
};
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
||||
9
module/Library/Discord/Role.cpp
Normal file
9
module/Library/Discord/Role.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/Discord/Role.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
||||
13
module/Library/Discord/Role.hpp
Normal file
13
module/Library/Discord/Role.hpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Core/Utility.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include <dpp/dpp.h>
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
||||
9
module/Library/Discord/User.cpp
Normal file
9
module/Library/Discord/User.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#include "Library/Discord/User.hpp"
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
namespace SqMod {
|
||||
|
||||
|
||||
|
||||
} // Namespace:: SqMod
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user