尝试在 Discord bot (javascript) 中发送随机消息

时间:2021-06-10 04:02:49

标签: javascript discord

基本上我想要做的是每当这个人说 # CMAKE generated file: DO NOT EDIT! # Generated by "Unix Makefiles" Generator, CMake Version 3.20 # Default target executed when no arguments are given to make. default_target: all .PHONY : default_target # Allow only one "make -f Makefile2" at a time, but pass parallelism. .NOTPARALLEL: #============================================================================= # Special targets provided by cmake. # Disable implicit rules so canonical targets will work. .SUFFIXES: # Disable VCS-based implicit rules. % : %,v # Disable VCS-based implicit rules. % : RCS/% # Disable VCS-based implicit rules. % : RCS/%,v # Disable VCS-based implicit rules. % : SCCS/s.% # Disable VCS-based implicit rules. % : s.% .SUFFIXES: .hpux_make_needs_suffix_list # Command-line flag to silence nested $(MAKE). $(VERBOSE)MAKESILENT = -s #Suppress display of executed commands. $(VERBOSE).SILENT: # A target that is always out of date. cmake_force: .PHONY : cmake_force #============================================================================= # Set environment variables for the build. # The shell in which to execute make rules. SHELL = /bin/sh # The CMake executable. CMAKE_COMMAND = /usr/bin/cmake # The command to remove a file. RM = /usr/bin/cmake -E rm -f # Escaping for special characters. EQUALS = = # The top-level source directory on which CMake was run. CMAKE_SOURCE_DIR = /home/autumn/PlayerPRO # The top-level build directory on which CMake was run. CMAKE_BINARY_DIR = /home/autumn/PlayerPRO #============================================================================= # Targets provided globally by CMake. # Special rule for the target rebuild_cache rebuild_cache: @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) .PHONY : rebuild_cache # Special rule for the target rebuild_cache rebuild_cache/fast: rebuild_cache .PHONY : rebuild_cache/fast # Special rule for the target edit_cache edit_cache: @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..." /usr/bin/ccmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) .PHONY : edit_cache # Special rule for the target edit_cache edit_cache/fast: edit_cache .PHONY : edit_cache/fast # The main all target all: cmake_check_build_system $(CMAKE_COMMAND) -E cmake_progress_start /home/autumn/PlayerPRO/CMakeFiles /home/autumn/PlayerPRO//CMakeFiles/progress.marks $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all $(CMAKE_COMMAND) -E cmake_progress_start /home/autumn/PlayerPRO/CMakeFiles 0 .PHONY : all # The main clean target clean: $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean .PHONY : clean # The main clean target clean/fast: clean .PHONY : clean/fast # Prepare targets for installation. preinstall: all $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall .PHONY : preinstall # Prepare targets for installation. preinstall/fast: $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall .PHONY : preinstall/fast # clear depends depend: $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 .PHONY : depend #============================================================================= # Target rules for targets named PlayerPROCore # Build rule for target. PlayerPROCore: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 PlayerPROCore .PHONY : PlayerPROCore # fast build rule for target. PlayerPROCore/fast: $(MAKE) $(MAKESILENT) -f MADDriver.source/CMakeFiles/PlayerPROCore.dir/build.make MADDriver.source/CMakeFiles/PlayerPROCore.dir/build .PHONY : PlayerPROCore/fast #============================================================================= # Target rules for targets named UMX # Build rule for target. UMX: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 UMX .PHONY : UMX # fast build rule for target. UMX/fast: $(MAKE) $(MAKESILENT) -f MADDriver.source/Import-Export/CMakeFiles/UMX.dir/build.make MADDriver.source/Import-Export/CMakeFiles/UMX.dir/build .PHONY : UMX/fast #============================================================================= # Target rules for targets named OKTA # Build rule for target. OKTA: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 OKTA .PHONY : OKTA # fast build rule for target. OKTA/fast: $(MAKE) $(MAKESILENT) -f MADDriver.source/Import-Export/CMakeFiles/OKTA.dir/build.make MADDriver.source/Import-Export/CMakeFiles/OKTA.dir/build .PHONY : OKTA/fast #============================================================================= # Target rules for targets named AMF # Build rule for target. AMF: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 AMF .PHONY : AMF # fast build rule for target. AMF/fast: $(MAKE) $(MAKESILENT) -f MADDriver.source/Import-Export/CMakeFiles/AMF.dir/build.make MADDriver.source/Import-Export/CMakeFiles/AMF.dir/build .PHONY : AMF/fast #============================================================================= # Target rules for targets named MTM # Build rule for target. MTM: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 MTM .PHONY : MTM # fast build rule for target. MTM/fast: $(MAKE) $(MAKESILENT) -f MADDriver.source/Import-Export/CMakeFiles/MTM.dir/build.make MADDriver.source/Import-Export/CMakeFiles/MTM.dir/build .PHONY : MTM/fast #============================================================================= # Target rules for targets named DMF # Build rule for target. DMF: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 DMF .PHONY : DMF # fast build rule for target. DMF/fast: $(MAKE) $(MAKESILENT) -f MADDriver.source/Import-Export/CMakeFiles/DMF.dir/build.make MADDriver.source/Import-Export/CMakeFiles/DMF.dir/build .PHONY : DMF/fast #============================================================================= # Target rules for targets named IT # Build rule for target. IT: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 IT .PHONY : IT # fast build rule for target. IT/fast: $(MAKE) $(MAKESILENT) -f MADDriver.source/Import-Export/CMakeFiles/IT.dir/build.make MADDriver.source/Import-Export/CMakeFiles/IT.dir/build .PHONY : IT/fast #============================================================================= # Target rules for targets named MADfg # Build rule for target. MADfg: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 MADfg .PHONY : MADfg # fast build rule for target. MADfg/fast: $(MAKE) $(MAKESILENT) -f MADDriver.source/Import-Export/CMakeFiles/MADfg.dir/build.make MADDriver.source/Import-Export/CMakeFiles/MADfg.dir/build .PHONY : MADfg/fast #============================================================================= # Target rules for targets named XM # Build rule for target. XM: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 XM .PHONY : XM # fast build rule for target. XM/fast: $(MAKE) $(MAKESILENT) -f MADDriver.source/Import-Export/CMakeFiles/XM.dir/build.make MADDriver.source/Import-Export/CMakeFiles/XM.dir/build .PHONY : XM/fast #============================================================================= # Target rules for targets named MADH # Build rule for target. MADH: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 MADH .PHONY : MADH # fast build rule for target. MADH/fast: $(MAKE) $(MAKESILENT) -f MADDriver.source/Import-Export/CMakeFiles/MADH.dir/build.make MADDriver.source/Import-Export/CMakeFiles/MADH.dir/build .PHONY : MADH/fast #============================================================================= # Target rules for targets named 669 # Build rule for target. 669: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 669 .PHONY : 669 # fast build rule for target. 669/fast: $(MAKE) $(MAKESILENT) -f MADDriver.source/Import-Export/CMakeFiles/669.dir/build.make MADDriver.source/Import-Export/CMakeFiles/669.dir/build .PHONY : 669/fast #============================================================================= # Target rules for targets named S3M # Build rule for target. S3M: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 S3M .PHONY : S3M # fast build rule for target. S3M/fast: $(MAKE) $(MAKESILENT) -f MADDriver.source/Import-Export/CMakeFiles/S3M.dir/build.make MADDriver.source/Import-Export/CMakeFiles/S3M.dir/build .PHONY : S3M/fast #============================================================================= # Target rules for targets named MOD # Build rule for target. MOD: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 MOD .PHONY : MOD # fast build rule for target. MOD/fast: $(MAKE) $(MAKESILENT) -f MADDriver.source/Import-Export/CMakeFiles/MOD.dir/build.make MADDriver.source/Import-Export/CMakeFiles/MOD.dir/build .PHONY : MOD/fast #============================================================================= # Target rules for targets named MADI # Build rule for target. MADI: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 MADI .PHONY : MADI # fast build rule for target. MADI/fast: $(MAKE) $(MAKESILENT) -f MADDriver.source/Import-Export/CMakeFiles/MADI.dir/build.make MADDriver.source/Import-Export/CMakeFiles/MADI.dir/build .PHONY : MADI/fast #============================================================================= # Target rules for targets named MED # Build rule for target. MED: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 MED .PHONY : MED # fast build rule for target. MED/fast: $(MAKE) $(MAKESILENT) -f MADDriver.source/Import-Export/CMakeFiles/MED.dir/build.make MADDriver.source/Import-Export/CMakeFiles/MED.dir/build .PHONY : MED/fast #============================================================================= # Target rules for targets named ULT # Build rule for target. ULT: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 ULT .PHONY : ULT # fast build rule for target. ULT/fast: $(MAKE) $(MAKESILENT) -f MADDriver.source/Import-Export/CMakeFiles/ULT.dir/build.make MADDriver.source/Import-Export/CMakeFiles/ULT.dir/build .PHONY : ULT/fast #============================================================================= # Target rules for targets named PPPlay # Build rule for target. PPPlay: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 PPPlay .PHONY : PPPlay # fast build rule for target. PPPlay/fast: $(MAKE) $(MAKESILENT) -f Examples/PPPlay/CMakeFiles/PPPlay.dir/build.make Examples/PPPlay/CMakeFiles/PPPlay.dir/build .PHONY : PPPlay/fast # Help Target help: @echo "The following are some of the valid targets for this Makefile:" @echo "... all (the default if no target is provided)" @echo "... clean" @echo "... depend" @echo "... edit_cache" @echo "... rebuild_cache" @echo "... 669" @echo "... AMF" @echo "... DMF" @echo "... IT" @echo "... MADH" @echo "... MADI" @echo "... MADfg" @echo "... MED" @echo "... MOD" @echo "... MTM" @echo "... OKTA" @echo "... PPPlay" @echo "... PlayerPROCore" @echo "... S3M" @echo "... ULT" @echo "... UMX" @echo "... XM" .PHONY : help #============================================================================= # Special targets to cleanup operation of make. # Special rule to run CMake to check the build system integrity. # No rule that depends on this can have commands that come from listfiles # because they might be regenerated. cmake_check_build_system: $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 .PHONY : cmake_check_build_system 时,它会从列表中随机发送一条消息。然而,它只是在向我吐槽一个数字,范围在 1-6 之间,而不是实际的消息。

我试图通过阅读类似的帖子来找出我做错了什么,但我没有任何运气。

这是我的代码:

%message

2 个答案:

答案 0 :(得分:2)

您做错的只是发送随机索引,而不是发送该随机索引处的消息值。这是修复:

const messages = ['message1', 'message2', 'message3', 'message4', 'message5', 'message6'];
const random = Math.floor(Math.random() * messages.length);
message.reply(messages[random]); // this is what changed

答案 1 :(得分:1)

Random 是您发送的整数。试试message.reply(messages[random])