]> git.taranathan.com Git - moo-bot.git/commitdiff
moooore main
authorroot <root@taranathan.com>
Tue, 6 Oct 2026 21:08:45 +0000 (21:08 +0000)
committerroot <root@taranathan.com>
Tue, 6 Oct 2026 21:08:45 +0000 (21:08 +0000)
bot.nimble
src/bot.nim

index 03c1fbd7273eaa3585490b53a869ad04771e0b49..6bea2ad585a1358bec042ec3b6addcdca5a0623a 100644 (file)
@@ -13,5 +13,6 @@ bin           = @["bot"]
 requires "nim >= 2.2.10"
 requires "json_serialization"
 requires "dimscord"
+requires "dimscmd"
 
 requires "dotenv >= 2.0.0"
index dc9272293694984dc527dda23e317c2646b878a3..1ec0e1dae4959eedbbe07c09e391566c83b3be36 100644 (file)
@@ -1,4 +1,5 @@
 import dimscord, asyncdispatch, times, options
+import dimscmd
 import random
 import std/sequtils
 import std/strutils
@@ -13,55 +14,114 @@ randomize()
 
 let token = getEnv("TOKEN")
 let discord = newDiscordClient(token)
-const ballsChannel = "1370453399463530496";
+var cmd = discord.newHandler()
+
+let questions = [
+"If you were to go about killing someone how would you do it?",
+"If you had to dispose of a body how would you do it?",
+"What songs would you kill someone to?",
+"Why would you kill somebody?",
+"Who do you think Taran should do?",
+"Would you want Democracy to save you?",
+"Can you count to 12?",
+"Do you want Adrian to slide into your DMs tonight?",
+"Are you a furry?",
+"Do you want side chicks with your meal?",
+"Do you want Angela’s fingers in your socks?",
+"Is a path of Sin an agreeable career choice for you?",
+"Is being a Large Language Model (like ChatGPT) an agreeable career choice for you?",
+"Would you rather meet someone trans and homophobic or gay and transphobic?",
+"How much money would you drink a quart of ketchup for?",
+"At what age would you let your kid drink alcohol unsupervised?",
+"At what age would you let your kid have sex?",
+"If you could choose one thing to be fully funded with no repercussions what would it be?",
+"What’s your favorite dubious historical fact?",
+"What’s your favorite serious ship?",
+"Predict the next species to go extinct","What’s your favorite unserious ship?",
+"What character(s) do you see yourself in?",
+"What’s the freakiest thing you’ve seen?",
+]
+
+cmd.addChat("freaky") do (m: Message):
+  discard await discord.api.sendMessage(m.channelID, questions[rand(questions.high)])
+
+cmd.addSlash("freaky") do ():
+  ## Random freaky question
+  await discord.api.interactionResponseMessage(i.id, i.token,
+    kind = irtChannelMessageWithSource,
+    response = InteractionCallbackDataMessage(
+      content: questions[rand(questions.high)]
+    )
+  )
+
+# const ballsChannel = "1370453399463530496";
+const ballsChannel = "1552441781789130884";
 const getOutBot = "1349260113717891072"
 
 # Handle event for on_ready.
 proc onReady(s: Shard, r: Ready) {.event(discord).} =
   echo "Ready as " & $r.user
+  await cmd.registerCommands()
+
+proc interactionCreate (s: Shard, i: Interaction) {.event(discord).} =
+  discard await cmd.handleInteraction(s, i)
 
 # Handle event for message_create.
 proc messageCreate(s: Shard, m: Message) {.event(discord).} =
-  let
-    channel = m.gchannel
-
-  if rand(100) < 04:
-    let messages = ["gimme balls", "balls", "more balls"]
-    echo "sending to balls channel"
-    discard await discord.api.sendMessage(ballsChannel, messages[rand(
-        messages.high)])
-
-  if m.author.username == "mooooooo0":
-    if rand(100) < 02:
-      await m.react("🫡")
-    if rand(100) < 02:
-      discard await m.reply("what that guy said", mention = true)
-
-  if m.referenced_message.isSome():
-    if m.referenced_message.get().author.username == "moo bot" and not (
-        m.author.id == getOutBot):
-      discard await m.reply("it is I", mention = true)
-
-  if m.content.contains("moo") or m.content.contains("taran"):
-    discard await m.reply("ig bro", mention = true)
-
-  if m.author.id == getOutBot and (m.referenced_message.isNone or
-      m.referenced_message.get.author.username != "moo bot"):
-    let responses = ["stfu bot", "get a load of this guy ^^", "NERD ALERT 🚨", "stfu clanker"]
-    discard await m.reply(responses[rand(responses.high)], mention = true)
-
-  if rand(100) < 05:
-    let emojis = ["🥵", "🥶", "🤯", "🤓", "🫦", "🪱", "🦧", "distorted_face:1541167187694460999"]
-    await m.react(emojis[rand(emojis.high)])
-
-  if m.mention_users.len > 0:
-    if m.mention_users[0].username == "moo bot" and not (m.author.id == getOutBot):
-      discard await m.reply("wassup", mention = true)
-
-  if m.content.contains("simon says kys"):
-    echo "killing self"
-    discard await channel.send("bye bye")
-    quit()
+  discard await cmd.handleMessage("$$", s, m)
+  try:
+    if rand(100) < 03:
+      let messages = ["gimme balls", "balls", "more balls"]
+      echo "sending to balls channel"
+      discard await discord.api.sendMessage(ballsChannel, messages[rand(
+          messages.high)])
+
+    if m.author.username == "randomduck174" and rand(100) < 10:
+      await m.react("elijahmouse:1546781069640998934")
+    if m.author.username == "grangel613" and rand(100) < 10:
+      await m.react("angelaDC:1552110132748484638")
+    if m.author.username == "lovematch13" and rand(100) < 10:
+      await m.react("Franklini:1556748528146063492")
+
+    if m.author.username == "mooooooo0":
+      if rand(100) < 01:
+        await m.react("🫡")
+      if rand(100) < 01:
+        discard await m.reply("what that guy said", mention = true)
+
+    if m.referenced_message.isSome():
+      if m.referenced_message.get().author.username == "moo bot" and not ((
+          m.author.id == getOutBot) or (m.author.username == "moo bot")):
+        discard await m.reply("it is I", mention = true)
+
+    if m.content.contains("moo") or m.content.contains("taran"):
+      discard await m.reply("ig bro", mention = true)
+
+    if m.author.id == getOutBot and (m.referenced_message.isNone or
+        m.referenced_message.get.author.username != "moo bot"):
+      if rand(100) < 02:
+        let responses = ["stfu bot", "get a load of this guy ^^",
+            "NERD ALERT 🚨", "stfu clanker"]
+        discard await m.reply(responses[rand(responses.high)], mention = true)
+
+    if rand(100) < 01:
+      let emojis = ["🥵", "🥶", "🤯", "🤓", "🫦", "🪱", "🦧", "distorted_face:1541167187694460999"]
+      await m.react(emojis[rand(emojis.high)])
+
+    if m.mention_users.len > 0:
+      if m.mention_users[0].username == "moo bot" and not ((m.author.id == getOutBot) or (m.author.username == "moo bot")):
+        discard await m.reply("wassup", mention = true)
+
+    if m.content.contains("?") and rand(100) < 30:
+      discard await m.reply("ur mom", mention = true)
+
+    if m.content.contains("simon says kys"):
+      echo "killing self"
+      discard await m.reply("bye bye")
+      quit()
+  except CatchableError as e:
+    echo "messageCreate failed: ", e.name, ": ", e.msg 
+    echo getStackTrace(e)
 
 
 
@@ -76,3 +136,4 @@ waitFor discord.startSession(gateway_intents = {
   giMessageContent
   }) # Don't forget to specify the gateway_intent argument and double check your priviliged intent
 
+