reportlol.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* Copyright (C) All Rights Reserved
  2. ** Written by Gottem <support@gottem.nl>
  3. ** Website: https://gottem.nl/unreal
  4. ** License: https://gottem.nl/unreal/license
  5. */
  6. /*** <<<MODULE MANAGER START>>>
  7. module {
  8. documentation "https://gottem.nl/unreal/man/reportlol";
  9. troubleshooting "In case of problems, check the FAQ at https://gottem.nl/unreal/halp or e-mail me at support@gottem.nl";
  10. min-unrealircd-version "5.*";
  11. //max-unrealircd-version "5.*";
  12. post-install-text {
  13. "The module is installed, now all you need to do is add a 'loadmodule' line to your config file:";
  14. "loadmodule \"third/reportlol\";";
  15. "Then /rehash the IRCd.";
  16. "For usage information, refer to the module's documentation found at: https://gottem.nl/unreal/man/reportlol";
  17. }
  18. }
  19. *** <<<MODULE MANAGER END>>>
  20. */
  21. // One include for all cross-platform compatibility thangs
  22. #include "unrealircd.h"
  23. // Command string
  24. #define MSG_REPORT "REPORT"
  25. // Dem macros yo
  26. CMD_FUNC(reportlol); // Register command function
  27. #define CheckAPIError(apistr, apiobj) \
  28. do { \
  29. if(!(apiobj)) { \
  30. config_error("A critical error occurred on %s for %s: %s", (apistr), MOD_HEADER.name, ModuleGetErrorStr(modinfo->handle)); \
  31. return MOD_FAILED; \
  32. } \
  33. } while(0)
  34. // Dat dere module header
  35. ModuleHeader MOD_HEADER = {
  36. "third/reportlol", // Module name
  37. "2.0", // Version
  38. "Dankass /report command lol", // Description
  39. "Gottem", // Author
  40. "unrealircd-5", // Modversion
  41. };
  42. // Initialisation routine (register hooks, commands and modes or create structs etc)
  43. MOD_INIT() {
  44. CheckAPIError("CommandAdd(REPORT)", CommandAdd(modinfo->handle, MSG_REPORT, reportlol, 1, CMD_USER));
  45. MARK_AS_GLOBAL_MODULE(modinfo);
  46. return MOD_SUCCESS;
  47. }
  48. // Actually load the module here (also command overrides as they may not exist in MOD_INIT yet)
  49. MOD_LOAD() {
  50. return MOD_SUCCESS; // We good
  51. }
  52. // Called on unload/rehash obv
  53. MOD_UNLOAD() {
  54. // Clean up any structs and other shit
  55. return MOD_SUCCESS; // We good
  56. }
  57. CMD_FUNC(reportlol) {
  58. if(!IsUser(client) || BadPtr(parv[1])) // Need at least 1 word kek
  59. return; // We good
  60. sendnotice(client, "ayyy ur report will not be read so may as well kys lol");
  61. }