Browse Source

initial commit

master
commit
b1fff46ddb
No known key found for this signature in database GPG Key ID: DA34C790D267C164
8 changed files with 119 additions and 0 deletions
  1. +9
    -0
      .editorconfig
  2. +6
    -0
      .gitignore
  3. +1
    -0
      .travis.yml
  4. +21
    -0
      LICENSE
  5. +27
    -0
      README.md
  6. +10
    -0
      shard.lock
  7. +20
    -0
      shard.yml
  8. +25
    -0
      src/TildeyII.cr

+ 9
- 0
.editorconfig View File

@@ -0,0 +1,9 @@
root = true

[*.cr]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

+ 6
- 0
.gitignore View File

@@ -0,0 +1,6 @@
/docs/
/lib/
/bin/
/.shards/
*.dwarf
.env

+ 1
- 0
.travis.yml View File

@@ -0,0 +1 @@
language: crystal

+ 21
- 0
LICENSE View File

@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2019 deing

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

+ 27
- 0
README.md View File

@@ -0,0 +1,27 @@
# TildeyII

TODO: Write a description here

## Installation

TODO: Write installation instructions here

## Usage

TODO: Write usage instructions here

## Development

TODO: Write development instructions here

## Contributing

1. Fork it (<https://github.com/your-github-user/TildeyII/fork>)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

## Contributors

- [deing](https://github.com/your-github-user) - creator and maintainer

+ 10
- 0
shard.lock View File

@@ -0,0 +1,10 @@
version: 1.0
shards:
discordcr:
github: meew0/discordcr
commit: 1d40f5fa0c9069a817ddbb3daf26782607d69d7d

dotenv:
github: gdotdesign/cr-dotenv
version: 0.2.0


+ 20
- 0
shard.yml View File

@@ -0,0 +1,20 @@
name: TildeyII
version: 0.1.0

authors:
- deing <admin@15318.de>

targets:
TildeyII:
main: src/TildeyII.cr

dependencies:
discordcr:
github: meew0/discordcr
branch: master
dotenv:
github: gdotdesign/cr-dotenv

crystal: 0.27.2

license: MIT

+ 25
- 0
src/TildeyII.cr View File

@@ -0,0 +1,25 @@
require "dotenv"
require "discordcr"

Dotenv.load!
client = Discord::Client.new(token: "Bot #{ENV["token"]}")

bot_id = client.get_current_user.id

issue_regex = /#([0-9]+)/

client.on_message_create do |message|
next unless message.mentions.any? { |user| user.id == bot_id }
issues = message.content.scan issue_regex
output = ""
issues.each do |issue|
output += "**Issue ##{issue[1]}:** <https://gitlab.com/tildes/tildes/issues/#{issue[1]}>\n"
end
if output.size == 0
client.create_message(message.channel_id, ":exclamation: No matches.")
else
client.create_message(message.channel_id, output)
end
end

client.run

Loading…
Cancel
Save