-
Notifications
You must be signed in to change notification settings - Fork 1
add some plugins i wrote #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Mrs-Feathers
wants to merge
1
commit into
thedevs-network:master
Choose a base branch
from
Mrs-Feathers:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or 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,20 @@ | ||
/** | ||
* Author: Mrs Feathers ([email protected]) | ||
* Description: This example modual defines a command that is restricted to the staff. | ||
* Originally created for Furry Refuge (https://furryrefuge.com). | ||
* | ||
* License: This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. | ||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/. | ||
* Under this license, you are free to share and adapt this work for any non-commercial purpose, | ||
* provided you give appropriate credit to the original author. | ||
*/ | ||
|
||
'use strict'; | ||
const { Composer } = require("telegraf"); | ||
|
||
const adminCommand = (...args) => | ||
C.optional( | ||
ctx => ctx.state.isMaster || ctx.state.isAdmin, | ||
C.command(...args)) | ||
|
||
module.exports = adminCommand('adminonly', C.reply('Hello, This command only works for Furry Refuge staff.')); |
This file contains hidden or 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,28 @@ | ||
/** | ||
* Author: Mrs Feathers ([email protected]) | ||
* Description: This modual warns (but doesnt ban) users who upload forbidden files. | ||
* Originally created for Furry Refuge (https://furryrefuge.com). | ||
* | ||
* License: This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. | ||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/. | ||
* Under this license, you are free to share and adapt this work for any non-commercial purpose, | ||
* provided you give appropriate credit to the original author. | ||
*/ | ||
|
||
'use strict'; | ||
const { Composer } = require("telegraf"); | ||
|
||
const blacklisted_files = ['apk', 'exe', 'scr', 'bat', 'cmd', 'vbs', 'pif']; | ||
|
||
module.exports = Composer.mount('document', (ctx, next) => | ||
ctx.from.status !== 'admin' && | ||
blacklisted_files.includes( | ||
ctx.message.document.file_name.split('.').pop()) | ||
? Promise.all([ | ||
ctx.warn({ | ||
admin: ctx.botInfo, | ||
reason: 'Blacklisted file.', | ||
userToWarn: ctx.from | ||
}), | ||
ctx.deleteMessage()]) | ||
: next()); |
This file contains hidden or 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,26 @@ | ||
/** | ||
* Author: Mrs Feathers ([email protected]) | ||
* Description: Shows a reason why a user was banned if they try to message the bot. | ||
* Originally created for Furry Refuge (https://furryrefuge.com). | ||
* | ||
* License: This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. | ||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/. | ||
* Under this license, you are free to share and adapt this work for any non-commercial purpose, | ||
* provided you give appropriate credit to the original author. | ||
*/ | ||
|
||
'use strict'; | ||
const { getUser, verifyCaptcha } = require('../stores/user'); | ||
const { Composer } = require('telegraf'); | ||
const { logError } = require('../utils/log'); | ||
const { lrm } = require('../utils/html'); | ||
const { telegram } = require('../bot'); | ||
const { config } = require("../utils/config"); | ||
|
||
module.exports = Composer.on('message', async (ctx, next) => { | ||
const user = await getUser(ctx.from.id); | ||
if (user && user.status === 'banned') { | ||
return ctx.reply(`You were banned for the following reason: ${user.banReason}`); | ||
} | ||
return next(); | ||
}); |
This file contains hidden or 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,35 @@ | ||
/** | ||
* Author: Mrs Feathers ([email protected]) | ||
* Description: Super quick dice roller. | ||
* Originally created for Furry Refuge (https://furryrefuge.com). | ||
* | ||
* License: This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. | ||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/. | ||
* Under this license, you are free to share and adapt this work for any non-commercial purpose, | ||
* provided you give appropriate credit to the original author. | ||
*/ | ||
|
||
'use strict'; | ||
const { Composer } = require("telegraf"); | ||
|
||
module.exports = Composer.command('roll', (ctx, next) => { | ||
const command = ctx.message.text.trim().split(' '); | ||
if (command.length !== 2 || !/^(\d+)d(\d+)$/.test(command[1])) { | ||
return ctx.reply('Invalid command. Use /roll NdM, where N is the number of dice and M is the number of sides.'); | ||
} | ||
const [dice, sides] = command[1].split('d').map(Number); | ||
if (dice > 10) { | ||
return ctx.reply('Cannot roll more than 10 dice at once.'); | ||
} | ||
let result = 0; | ||
let rolls = []; | ||
for (let i = 0; i < dice; i++) { | ||
let roll = Math.floor(Math.random() * sides) + 1; | ||
rolls.push(roll); | ||
result += roll; | ||
} | ||
return ctx.reply(`You rolled ${rolls.join(' + ')} for a total of ${result}`); | ||
}); | ||
|
||
|
||
|
This file contains hidden or 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,16 @@ | ||
/** | ||
* Author: Mrs Feathers ([email protected]) | ||
* Description: Let people know you have a discord. could also be used for other informations. | ||
* Originally created for Furry Refuge (https://furryrefuge.com). | ||
* | ||
* License: This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. | ||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/. | ||
* Under this license, you are free to share and adapt this work for any non-commercial purpose, | ||
* provided you give appropriate credit to the original author. | ||
*/ | ||
|
||
'use strict'; | ||
const { Composer } = require("telegraf"); | ||
|
||
module.exports = Composer.command('discord', (ctx, next) => | ||
ctx.reply('Our Discord voice chat is located at http://discord.furryrefuge.com')); |
This file contains hidden or 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,25 @@ | ||
/** | ||
* Author: Mrs Feathers ([email protected]) | ||
* Description: Show HAM radio status | ||
* Originally created for Furry Refuge (https://furryrefuge.com). | ||
* | ||
* License: This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. | ||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/. | ||
* Under this license, you are free to share and adapt this work for any non-commercial purpose, | ||
* provided you give appropriate credit to the original author. | ||
*/ | ||
|
||
'use strict'; | ||
const { Composer } = require("telegraf"); | ||
|
||
const axios = require('axios'); | ||
const { Readable } = require('stream'); | ||
|
||
module.exports = Composer.command('ham', async (ctx, next) => { | ||
const response = await axios.get('https://www.hamqsl.com/solar101vhf.php', { responseType: 'arraybuffer' }); | ||
const buffer = Buffer.from(response.data, 'binary'); | ||
const stream = new Readable(); | ||
stream.push(buffer); | ||
stream.push(null); | ||
await ctx.replyWithPhoto({ source: stream }); | ||
}); |
This file contains hidden or 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,68 @@ | ||
/** | ||
* Author: Mrs Feathers ([email protected]) | ||
* Description: get user id from a message or reply. use -g switch for group info. | ||
* Originally created for Furry Refuge (https://furryrefuge.com). | ||
* | ||
* License: This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. | ||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/. | ||
* Under this license, you are free to share and adapt this work for any non-commercial purpose, | ||
* provided you give appropriate credit to the original author. | ||
*/ | ||
|
||
'use strict'; | ||
const { Composer } = require("telegraf"); | ||
|
||
module.exports = Composer.command('getid', (ctx, next) => { | ||
const args = ctx.message.text.split(' '); | ||
const includeGroupInfo = args.length > 1 && (args[1] === '-g' || args[1] === '-G'); | ||
|
||
if (ctx.from.status !== 'admin') { | ||
return ctx.reply('Admin only'); | ||
} | ||
|
||
let userId, firstName, lastName, userName, isBot, chatId, chatName, forwardDate; | ||
|
||
if (ctx.message.reply_to_message && ctx.message.reply_to_message.forward_from) { | ||
userId = ctx.message.reply_to_message.forward_from.id; | ||
firstName = ctx.message.reply_to_message.forward_from.first_name; | ||
lastName = ctx.message.reply_to_message.forward_from.last_name; | ||
userName = ctx.message.reply_to_message.forward_from.username || '-No Username-'; | ||
isBot = ctx.message.reply_to_message.forward_from.is_bot; | ||
if (includeGroupInfo) { | ||
chatId = ctx.message.reply_to_message.chat.id; | ||
chatName = ctx.message.reply_to_message.chat.title; | ||
} | ||
forwardDate = new Date(ctx.message.reply_to_message.forward_date * 1000).toUTCString(); | ||
} else if (ctx.message.reply_to_message) { | ||
userId = ctx.message.reply_to_message.from.id; | ||
firstName = ctx.message.reply_to_message.from.first_name; | ||
lastName = ctx.message.reply_to_message.from.last_name; | ||
userName = ctx.message.reply_to_message.from.username || '-No Username-'; | ||
isBot = ctx.message.reply_to_message.from.is_bot; | ||
if (includeGroupInfo) { | ||
chatId = ctx.message.reply_to_message.chat.id; | ||
chatName = ctx.message.reply_to_message.chat.title; | ||
} | ||
} else { | ||
userId = ctx.from.id; | ||
firstName = ctx.from.first_name; | ||
lastName = ctx.from.last_name; | ||
userName = ctx.from.username || '-No Username-'; | ||
isBot = ctx.from.is_bot; | ||
if (includeGroupInfo) { | ||
chatId = ctx.chat.id; | ||
chatName = ctx.chat.title; | ||
} | ||
} | ||
|
||
let replyText = `👤 User Info:\n├ id: ${userId}\n├ first_name: ${firstName}\n├ last_name: ${lastName}\n├ username: ${userName}\n└ is_bot: ${isBot}`; | ||
if (includeGroupInfo) { | ||
replyText += `\n\n👥 Group Info:\n├ id: ${chatId}\n└ group_name: ${chatName}`; | ||
} | ||
if (forwardDate) { | ||
replyText += `\n\n⏳ Other Info:\n└forward_date: ${forwardDate}`; | ||
} | ||
return ctx.reply(replyText); | ||
}); | ||
|
||
|
This file contains hidden or 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,22 @@ | ||
/** | ||
* Author: Mrs Feathers ([email protected]) | ||
* Description: Super basic roleplay command | ||
* Originally created for Furry Refuge (https://furryrefuge.com). | ||
* | ||
* License: This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. | ||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/. | ||
* Under this license, you are free to share and adapt this work for any non-commercial purpose, | ||
* provided you give appropriate credit to the original author. | ||
*/ | ||
|
||
'use strict'; | ||
const { Composer } = require("telegraf"); | ||
|
||
module.exports = Composer.command('me', async (ctx) => { | ||
const text = ctx.message.text.split(' ').slice(1).join(' '); | ||
if (ctx.message.reply_to_message) { | ||
await ctx.reply(`*${ctx.from.first_name} ${text}*`, { parse_mode: 'Markdown', reply_to_message_id: ctx.message.reply_to_message.message_id }); | ||
} else { | ||
await ctx.reply(`*${ctx.from.first_name} ${text}*`, { parse_mode: 'Markdown' }); | ||
} | ||
}); |
This file contains hidden or 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,41 @@ | ||
/** | ||
* Author: Mrs Feathers ([email protected]) | ||
* Description: Morse code encoder and decoder. | ||
* Originally created for Furry Refuge (https://furryrefuge.com). | ||
* | ||
* License: This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. | ||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/. | ||
* Under this license, you are free to share and adapt this work for any non-commercial purpose, | ||
* provided you give appropriate credit to the original author. | ||
*/ | ||
|
||
'use strict'; | ||
const { Composer } = require("telegraf"); | ||
const morse = require('./morse.json'); | ||
|
||
module.exports = Composer.command('morse', (ctx) => { | ||
const input = ctx.message.text.split(' '); | ||
const command = input[1]; | ||
const message = input.slice(2).join(' '); | ||
|
||
if (command === 'enc') { | ||
let encryptedMessage = ''; | ||
for (let i = 0; i < message.length; i++) { | ||
encryptedMessage += morse[message[i].toUpperCase()] + ' '; | ||
} | ||
ctx.reply(encryptedMessage); | ||
} else if (command === 'dec') { | ||
let decryptedMessage = ''; | ||
const morseCode = message.split(/ {3,}/); // Any number of spaces more than 2 indicate a new word in Morse code | ||
for (let i = 0; i < morseCode.length; i++) { | ||
const word = morseCode[i].split(' '); // One space indicates a new letter in Morse code | ||
for (let j = 0; j < word.length; j++) { | ||
decryptedMessage += Object.keys(morse).find(key => morse[key] === word[j]); | ||
} | ||
decryptedMessage += ' '; // Add a space after each word | ||
} | ||
ctx.reply(decryptedMessage); | ||
} else { | ||
ctx.reply('Usage: /morse enc [message] to encrypt, /morse dec [message] to decrypt'); | ||
} | ||
}); |
This file contains hidden or 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,66 @@ | ||
//currently configured for USA Morse | ||
{ | ||
"A": ".-", | ||
"B": "-...", | ||
"C": "-.-.", | ||
"D": "-..", | ||
"E": ".", | ||
"F": "..-.", | ||
"G": "--.", | ||
"H": "....", | ||
"I": "..", | ||
"J": ".---", | ||
"K": "-.-", | ||
"L": ".-..", | ||
"M": "--", | ||
"N": "-.", | ||
"O": "---", | ||
"P": ".--.", | ||
"Q": "--.-", | ||
"R": ".-.", | ||
"S": "...", | ||
"T": "-", | ||
"U": "..-", | ||
"V": "...-", | ||
"W": ".--", | ||
"X": "-..-", | ||
"Y": "-.--", | ||
"Z": "--..", | ||
"1": ".----", | ||
"2": "..---", | ||
"3": "...--", | ||
"4": "....-", | ||
"5": ".....", | ||
"6": "-....", | ||
"7": "--...", | ||
"8": "---..", | ||
"9": "----.", | ||
"0": "-----", | ||
" ": " ", | ||
".": ".-.-.-", | ||
",": "--..--", | ||
"?": "..--..", | ||
"'": ".----.", | ||
"!": "-.-.--", | ||
"/": "-..-.", | ||
"(": "-.--.", | ||
")": "-.--.-", | ||
"&": ".-...", | ||
":": "---...", | ||
";": "-.-.-.", | ||
"=": "-...-", | ||
"+": ".-.-.", | ||
"-": "-....-", | ||
"\"": ".-..-.", | ||
"@": ".--.-.", | ||
"Ä": ".-.-", | ||
"Å": ".-.-", | ||
"Ą": ".-.-", | ||
"Æ": ".-.-", | ||
"É": "..-..", | ||
"Ñ": "--.--", | ||
"Ö": "---.", | ||
"Ü": "..--", | ||
"Š": "----", | ||
" ": " " | ||
} |
This file contains hidden or 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,21 @@ | ||
/** | ||
* Author: Mrs Feathers ([email protected]) | ||
* Description: A Classic. | ||
* Originally created for Furry Refuge (https://furryrefuge.com). | ||
* | ||
* License: This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. | ||
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/. | ||
* Under this license, you are free to share and adapt this work for any non-commercial purpose, | ||
* provided you give appropriate credit to the original author. | ||
*/ | ||
|
||
'use strict'; | ||
const { Composer } = require("telegraf"); | ||
|
||
module.exports = Composer.command('ping', async (ctx, next) => { | ||
const start = new Date(); | ||
await ctx.reply('Pong!'); | ||
const end = new Date(); | ||
const ms = end - start; | ||
await ctx.reply(`Response time: ${ms} ms`); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You accidentally committed two macOS files