chluebi

Untitled

Oct 11th, 2018
654
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. Discord = require("discord.js")
  3. toml = require("toml")
  4. fs = require("fs")
  5. client = new Discord.Client()
  6.  
  7.  
  8. starttime = 0
  9.  
  10. emotes = 0
  11.  
  12.  
  13. reloadCFG = ->
  14.     emotes = toml.parse(fs.readFileSync('./emotes.toml', 'utf-8'))
  15.  
  16. reloadCFG()
  17.  
  18. logtime = ->
  19.     d = new Date()
  20.     time = d.getTime()
  21.     console.log("Current time: #{time}")
  22.     console.log("Bot has been online for #{Math.round((time - starttime)/1000)} seconds")
  23.  
  24. client.on "ready", ->
  25.     client.generateInvite().then((link) -> console.log(link)).catch(console.error)
  26.     d = new Date()
  27.     starttime = d.getTime()
  28.     console.log("Starttime: #{starttime}")
  29.  
  30.     #setInterval(logtime, 3 * 1000)
  31.  
  32. console.dir(toml)
  33.  
  34. # add message as a parameter to your callback function
  35. client.on "message", (msg) ->
  36.     # Now, you can use the message variable inside
  37.     if msg.content.match /^u\!lööp/
  38.         msg.channel.send("Set lööp")
  39.         interval = setInterval ->
  40.             # use the message's channel (TextChannel) to send a new message
  41.             msg.channel.send("Headpats for Kyu")
  42.         ,100 * 1000
  43.  
  44.     if msg.content.match /^u\!gibemotes/
  45.         #console.log(msg.channel.guild.emojis.array())
  46.         for emote in msg.channel.guild.emojis.array()
  47.             em = msg.channel.send("<:#{emote.name}:#{emote.id}>")
  48.             em.then (msg) ->
  49.                 console.log(msg.content)
  50.  
  51.     if msg.content.match /^u\!gibemotelinks/
  52.         em = ""
  53.         for emote in emotes["emotes"]["all"]
  54.             em = em + "#{emote[0]}: #{emote[1]} \n"
  55.         msg.channel.send(em)
  56.  
  57.     if v = msg.content.match /^u\!add ([\w\W]*) ([\w\W]+)$/
  58.         emotes["emotes"]["all"] += [v[2],v[1],0]
  59.         reloadCFG()
  60.  
  61. client.login('');
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×