-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
44 changed files
with
1,438 additions
and
1,259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: RuboCop Linter | ||
|
||
on: | ||
push: | ||
branches: '*' | ||
pull_request: | ||
branches: '*' | ||
|
||
jobs: | ||
lint: | ||
if: "!contains(github.event.commits[0].message, '[skip ci]')" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: RuboCop Linter Action | ||
uses: andrewmcodes/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,3 +137,4 @@ log/* | |
logs/* | ||
log* | ||
.vscode/* | ||
!.rubocop.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
Metrics/BlockLength: | ||
Enabled: false | ||
|
||
Metrics/MethodLength: | ||
Enabled: false | ||
|
||
Metrics/ModuleLength: | ||
Enabled: false | ||
|
||
Style/Documentation: | ||
Enabled: false | ||
|
||
Security/Eval: | ||
Exclude: | ||
- "modules/owner/eval.rb" | ||
|
||
Lint/Debugger: | ||
Exclude: | ||
- "run.rb" | ||
|
||
Layout/EndOfLine: | ||
EnforcedStyle: lf | ||
|
||
Layout/LineLength: | ||
Exclude: | ||
- "config/custom/custom.sample.rb" | ||
Max: 100 | ||
|
||
Style/GlobalVars: | ||
Exclude: | ||
- "run.rb" | ||
|
||
Security/Open: | ||
Exclude: | ||
- "modules/helper/download.rb" | ||
|
||
# Keep to syntactic linting, instead of complexity. | ||
Metrics/CyclomaticComplexity: | ||
Enabled: false | ||
|
||
Metrics/AbcSize: | ||
Enabled: false | ||
|
||
Metrics/PerceivedComplexity: | ||
Enabled: false | ||
|
||
# Pending cops for RuboCop 0.80 | ||
Style/HashEachMethods: | ||
Enabled: true | ||
|
||
Style/HashTransformKeys: | ||
Enabled: true | ||
|
||
Style/HashTransformValues: | ||
Enabled: true | ||
|
||
# Pendng cops for RuboCop 0.81 | ||
Lint/RaiseException: | ||
Enabled: true | ||
|
||
Lint/StructNewOverride: | ||
Enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
source 'http://rubygems.org' | ||
gem 'commandrb', git: 'https://github.com/Yuuki-Discord/commandrb.git' | ||
gem 'discordrb', git: 'https://github.com/discordrb/discordrb.git' | ||
gem 'haste' | ||
gem 'pomf.rb' | ||
gem 'pry' | ||
gem 'rainbow' | ||
gem 'rake' | ||
gem 'redis' | ||
gem 'redis-namespace' | ||
gem 'rqrcode' | ||
gem 'rumoji' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
# Three different ways to add custom commands easy. | ||
# frozen_string_literal: true | ||
|
||
# Three different ways to add custom commands easily. | ||
|
||
#### NOTE #### | ||
# The below examples that use {user} and {userid} do not currently function. | ||
# This feature is planned for later. | ||
|
||
CUSTOM = {} | ||
CUSTOM = {}.freeze | ||
|
||
# 1. Make your own hashes! | ||
CUSTOM[:pong] = { | ||
:type => 'text', | ||
:response => 'Ping!' | ||
type: 'text', | ||
response: 'Ping!' | ||
} | ||
|
||
CUSTOM[:hi] = { | ||
:type => 'text', | ||
:response => 'Hello, {user}!' | ||
type: 'text', | ||
response: 'Hello, {user}!' | ||
} | ||
|
||
CUSTOM[:mentionme] = { | ||
:type => 'text', | ||
:response => 'Hello, <@{userid}>!' | ||
type: 'text', | ||
response: 'Hello, <@{userid}>!' | ||
} | ||
|
||
# 2. All in one hash! | ||
CUSTOM_TEXT = { | ||
:pong => 'Ping!', | ||
:hi => 'Hello, {user}!', | ||
:mentionme => 'Hello, <@{userid}>!' | ||
} | ||
pong: 'Ping!', | ||
hi: 'Hello, {user}!', | ||
mentionme: 'Hello, <@{userid}>!' | ||
}.freeze | ||
|
||
# 3. Change one variable(!) | ||
CUSTOM_TEXT[:pong] = 'Ping' | ||
CUSTOM_TEXT[:hi] = 'Hello, {user}!' | ||
CUSTOM_TEXT[:mentionme] = 'Hello, <@{userid}>!' | ||
|
||
# Don't forget images! | ||
CUSTOM_IMAGE = {} | ||
CUSTOM_IMAGE = {}.freeze | ||
|
||
CUSTOM_IMAGE[:dab] = 'custom/dab.jpg' | ||
|
||
|
||
CUSTOM_TEXT = { | ||
lenny: '( ͡° ͜ʖ ͡°)', | ||
shrug: '¯\_(ツ)_/¯', | ||
support: "⚙ **Need help?**\nYou can join the support server here:\n**https://discord.gg/PrTMrv4 **", | ||
facedesk: 'https://giphy.com/gifs/XLOsdacfjL5cI', | ||
smea: 'https://giphy.com/gifs/Sb2NkTl1oV6eI', | ||
} | ||
lenny: '( ͡° ͜ʖ ͡°)', | ||
shrug: '¯\_(ツ)_/¯', | ||
support: "⚙ **Need help?**\nYou can join the support server here:\n**https://discord.gg/PrTMrv4 **", | ||
facedesk: 'https://giphy.com/gifs/XLOsdacfjL5cI', | ||
smea: 'https://giphy.com/gifs/Sb2NkTl1oV6eI' | ||
}.freeze |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,44 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'yaml' | ||
require 'discordrb' | ||
|
||
# Load Config from YAML | ||
if File.exists?('config/maintenance.yml') | ||
@config = YAML.load_file('config/maintenance.yml') | ||
else | ||
@config = YAML.load_file('config/config.yml') | ||
end | ||
@config = if File.exist?('config/maintenance.yml') | ||
YAML.load_file('config/maintenance.yml') | ||
else | ||
YAML.load_file('config/config.yml') | ||
end | ||
|
||
@config.each do |key, value| | ||
if value.nil? | ||
puts "config.yml: #{key} is nil!" | ||
puts 'Corrupt or incorrect Yaml.' | ||
exit | ||
else | ||
puts("config.yml: Found #{key}: #{value}") if @config['verbose'] | ||
end | ||
if value.nil? | ||
puts "config.yml: #{key} is nil!" | ||
puts 'Corrupt or incorrect Yaml.' | ||
exit | ||
elsif @config['verbose'] | ||
puts("config.yml: Found #{key}: #{value}") | ||
end | ||
end | ||
|
||
bot = Discordrb::Bot.new token: @config['token'] | ||
bot.ready do |event| | ||
event.bot.dnd | ||
event.bot.game = "Down for maintenance... :(" | ||
event.bot.dnd | ||
event.bot.game = 'Down for maintenance... :(' | ||
end | ||
|
||
bot.message do |event| | ||
if event.message.content.split(' ').length > 1 | ||
@config['prefixes'].each { |x| | ||
if event.message.content.start_with? x | ||
event.respond("Hi, if you're seeing this message, it means that Yuuki-Bot is currently unavailable (Deliberately, unlike downtime) or is in maintenance due to a major bug that needs to be dealt with.\nPlease try again later, and contact `#{event.bot.user(@config['master_owner']).distinct}` if problems persist.\nSorry for any inconvenience caused!") | ||
break | ||
end | ||
} | ||
if event.message.content.split(' ').length > 1 | ||
@config['prefixes'].each do |x| | ||
next unless event.message.content.start_with? x | ||
|
||
username = event.bot.profile.name | ||
owner_distinct = event.bot.user(@config['master_owner']).distinct | ||
event.respond("Hi! It seems that #{username} is currently undergoing maintenance.\n" \ | ||
"Please try again later, and contact `#{owner_distinct}` if problems persist.\n" \ | ||
'Sorry for any inconvenience caused!') | ||
break | ||
end | ||
end | ||
end | ||
|
||
bot.run | ||
bot.run |
Oops, something went wrong.