Merge remote-tracking branch 'origin/development' into development
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from discord.ext import commands
|
||||
import discord
|
||||
|
||||
class BasicCommands:
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.command()
|
||||
async def start(self, ctx):
|
||||
await ctx.send(f"Hello, {ctx.author.display_name}. Welcome to Sebi's Bot Tutorials. \nFirst off, would you like a quick walkthrough on the server channels?")
|
||||
|
||||
channel_list = {'channel-1' : self.bot.get_channel(333149949883842561).mention,
|
||||
'd.py-rewrite-start' : self.bot.get_channel(386419285439938560).mention,
|
||||
'js-klasa-start' : self.bot.get_channel(341816240186064897).mention,
|
||||
'd.js' : self.bot.get_channel(436771798303113217).mention}
|
||||
|
||||
bots_channels = (self.bot.get_channel(339112602867204097).mention,
|
||||
self.bot.get_channel(411586546551095296).mention)
|
||||
|
||||
help_channels = (self.bot.get_channel(425315253153300488).mention,
|
||||
self.bot.get_channel(392215236612194305).mention,
|
||||
self.bot.get_channel(351034776985141250).mention)
|
||||
|
||||
def check(m):
|
||||
return True if m.author.id == ctx.author.id and m.channel.id == ctx.channel.id else False
|
||||
|
||||
msg = await self.bot.wait_for('message', check = check, timeout = 15)
|
||||
|
||||
agree = ("yes", "yep", "yesn't", "ya")
|
||||
|
||||
if msg is None:
|
||||
await ctx.send("Sorry, {ctx.author.mention}, you didn't reply on time. You can run the command again when you're free :)")
|
||||
else:
|
||||
if msg.content.lower() in agree:
|
||||
async with ctx.typing():
|
||||
await ctx.send("Alrighty-Roo...")
|
||||
await ctx.send(f"""To start making your bot from scratch, you first need to head over to {channel_list['channel-1']}
|
||||
(Regardless of the language you're gonna use).""")
|
||||
await ctx.send(f"""After you have a bot account, you can either continue with {channel_list['d.py-rewrite-start']}
|
||||
if you want to make a bot in discord.py rewrite __or__ go to {channel_list['js-klasa-start']} or
|
||||
{channel_list['d.js']} for making a bot in JavaScript""")
|
||||
await ctx.send("...Read all the tutorials and still need help? You have two ways to get help.")
|
||||
await ctx.send(f"""**Method-1**\nThis is the best method of getting help. You help yourself.\n
|
||||
To do so, head over to a bots dedicated channel (either {bots_channels[0]} or {bots_channels[1]})
|
||||
and type `?rtfm rewrite thing_you_want_help_with`.\nThis will trigger the bot R.Danny Bot and will
|
||||
give you links on your query on the official discord.py rewrite docs. *PS: Let the page completely load*""")
|
||||
await ctx.send(f"""**Method-2**\nIf you haven't found anything useful with Method-1, feel free to ask your question
|
||||
in any of the related help channels. ({', '.join(help_channels)})\nMay the force be with you!!""")
|
||||
else:
|
||||
return await ctx.send("Session terminated. You can run this command again whenever you want.")
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(BasicCommands(bot))
|
||||
+32
-22
@@ -1,9 +1,10 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: <encoding name> -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from discord.ext import commands
|
||||
import discord
|
||||
import traceback
|
||||
import aiofiles
|
||||
|
||||
class Upload:
|
||||
"""
|
||||
@@ -79,30 +80,39 @@ class Upload:
|
||||
await ctx.send(f'Could not load `{extension}` -> `{e}`')
|
||||
else:
|
||||
await ctx.send(f'Loaded `{extension}`.')
|
||||
|
||||
|
||||
@commands.command()
|
||||
async def kick(self, ctx, member: discord.Member = None):
|
||||
"""
|
||||
Kick a discord member from your server.
|
||||
Only contributors can use this command
|
||||
|
||||
Usage:
|
||||
- kick <discord.member>
|
||||
|
||||
"""
|
||||
async def permunload(self, ctx, extension=None):
|
||||
"""Disables permanently a cog."""
|
||||
await ctx.trigger_typing()
|
||||
if ctx.author.id not in self.bot.ownerlist:
|
||||
return await ctx.send('Only my contributors can use me like this :blush:', delete_after=10)
|
||||
|
||||
if member is None:
|
||||
await ctx.send('Are you sure you are capable of this command?')
|
||||
try:
|
||||
await member.kick()
|
||||
await ctx.send(f'You kicked **`{member.name}`** from **`{ctx.guild.name}`**')
|
||||
|
||||
except Exception as e:
|
||||
await ctx.send('You may not use this command you do not have permission in server:\n\n**`{ctx.guild.name}`**'
|
||||
f'\n\n```py\n{e}\n```')
|
||||
|
||||
if cog is None:
|
||||
return await ctx.send("Please provide a extension. Do `help permunload` for more info")
|
||||
|
||||
extension = extension.lower()
|
||||
|
||||
async with aiofiles.open("extension.txt") as fp:
|
||||
lines=fp.readlines()
|
||||
|
||||
removed = False
|
||||
async with aiofiles.open("extension.txt", "w") as fp:
|
||||
for i in lines:
|
||||
if i.replace("\n", "") != extension:
|
||||
fp.write(i)
|
||||
else:
|
||||
removed = True
|
||||
break
|
||||
|
||||
if removed is True:
|
||||
try:
|
||||
self.bot.unload_extension(extension)
|
||||
except:
|
||||
pass
|
||||
return await ctx.send("Extension removed successfully")
|
||||
|
||||
await ctx.send("Extension not found")
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Upload(bot))
|
||||
bot.add_cog(Upload(bot))
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: <encoding name> -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from discord.ext import commands
|
||||
import discord
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: <encoding name> -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from discord.ext import commands
|
||||
import discord
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ class Git(Loggable):
|
||||
@commands.group(case_insensitive=True, invoke_without_command=True)
|
||||
async def git(self, ctx):
|
||||
"""Run help git for more info"""
|
||||
await ctx.send('https://github.com/Annihilator708/Sebi-Machine/')
|
||||
await ctx.send('https://github.com/dustinpianalto/Sebi-Machine/')
|
||||
|
||||
@commands.command(case_insensitive=True, brief='Gets the Trello link.')
|
||||
async def trello(self, ctx):
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from discord.ext import commands
|
||||
import discord
|
||||
|
||||
class Moderation:
|
||||
"""
|
||||
Moderation Commands
|
||||
"""
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.command()
|
||||
async def sar(self, ctx):
|
||||
"""Assign or remove self assigned roles."""
|
||||
pass
|
||||
|
||||
@commands.command()
|
||||
async def kick(self, ctx, member: discord.Member = None):
|
||||
"""
|
||||
Kick a discord member from your server.
|
||||
Only contributors can use this command.
|
||||
|
||||
Usage:
|
||||
- kick <discord.member>
|
||||
|
||||
"""
|
||||
await ctx.trigger_typing()
|
||||
if ctx.author.id not in self.bot.ownerlist:
|
||||
return await ctx.send('Only my contributors can use me like this :blush:', delete_after=10)
|
||||
|
||||
if member is None:
|
||||
await ctx.send('Are you sure you are capable of this command?')
|
||||
try:
|
||||
await member.kick()
|
||||
await ctx.send(f'You kicked **`{member.name}`** from **`{ctx.guild.name}`**')
|
||||
|
||||
except Exception as e:
|
||||
await ctx.send('You may not use this command you do not have permission in server:\n\n**`{ctx.guild.name}`**'
|
||||
f'\n\n```py\n{e}\n```')
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Moderation(bot))
|
||||
@@ -0,0 +1,67 @@
|
||||
const Discord = require("discord.js");
|
||||
|
||||
exports.run = async function(client, message, args) {
|
||||
|
||||
/*
|
||||
aliases: sar, selfrole, selfroles
|
||||
|
||||
examples:
|
||||
- S!selfrole get 1 (adds heroku helper role)
|
||||
- S!sar remove 3 (removes rewrite helper role)
|
||||
- S!sar list (shows all roles)
|
||||
*/
|
||||
|
||||
function roleFinder(query) {
|
||||
return message.guild.roles.find(function(r) {
|
||||
return r.name.includes(query)
|
||||
}).id;
|
||||
}
|
||||
|
||||
const type = args[0]; // can be get, remove or list
|
||||
|
||||
if (type == "list" || type == undefined) {
|
||||
|
||||
const embed = new Discord.RichEmbed()
|
||||
.setTitle("List of Self Assigned Roles")
|
||||
.setDescription("Usage: `S!sar [ get | remove | list ] [ number ]`")
|
||||
.addField("1. Heroku Helper", "S!sar get 1", true)
|
||||
.addField("2. JS Helper", "S!sar get 2", true)
|
||||
.addField("3. Rewrite Helper", "S!sar get 3", true)
|
||||
.setColor("AQUA");
|
||||
|
||||
return message.channel.send({
|
||||
embed: embed
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
const roles = [roleFinder("Heroku"), roleFinder("JS"), roleFinder("Rewrite")];
|
||||
|
||||
let choice = args[1]; // can be 1, 2 or 3
|
||||
|
||||
// if the choice is not 1, 2 or 3
|
||||
if (/^[123]$/.test(choice) == false) {
|
||||
return message.channel.send("Enter a valid role number!"); // returns error message
|
||||
} else {
|
||||
choice -= 1; // because array indexing starts from 0. when they choose 1 it should be roles[0]
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
|
||||
case "get":
|
||||
message.member.addRole(roles[choice]);
|
||||
message.channel.send("Added the role you specified!"); // confirmation message
|
||||
break;
|
||||
|
||||
case "remove":
|
||||
message.member.removeRole(roles[choice]);
|
||||
message.channel.send("Removed the role you specified!"); // confirmation message
|
||||
break;
|
||||
|
||||
default:
|
||||
return; // when it is neither get nor remove
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
import json
|
||||
import aiofiles
|
||||
import asyncio
|
||||
|
||||
class Tag:
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
with open("src/shared_libs/tags.json", "r") as fp:
|
||||
json_data = fp.read()
|
||||
global tags
|
||||
tags = json.loads(json_data)
|
||||
|
||||
@commands.group(case_insensitive=True, invoke_without_command=True)
|
||||
async def tag(self, ctx, tag=None):
|
||||
"""Gets a tag"""
|
||||
await ctx.trigger_typing()
|
||||
if tag is None:
|
||||
return await ctx.send('Please provide a argument. Do `help tag` for more info')
|
||||
|
||||
found = tags.get(tag, None)
|
||||
|
||||
if found is None:
|
||||
return await ctx.send('Tag not found')
|
||||
|
||||
await ctx.send(found)
|
||||
|
||||
@tag.command(case_insensitive=True)
|
||||
async def list(self, ctx):
|
||||
"""Lists available tags"""
|
||||
await ctx.trigger_typing()
|
||||
desc = ""
|
||||
for i in tags:
|
||||
desc = desc + i + "\n"
|
||||
|
||||
if desc == "":
|
||||
desc = "None"
|
||||
|
||||
em = discord.Embed(title='Available tags:', description=desc ,colour=discord.Colour(0x00FFFF))
|
||||
|
||||
await ctx.send(embed=em)
|
||||
|
||||
@tag.command(case_insensitive=True)
|
||||
async def add(self, ctx, tag_name=None, *, tag_info=None):
|
||||
"""Adds a new tag"""
|
||||
await ctx.trigger_typing()
|
||||
if not ctx.author.guild_permissions.manage_guild:
|
||||
return await ctx.send("You are not allowed to do this")
|
||||
|
||||
if tag_name is None or tag_info is None:
|
||||
return await ctx.send("Please provide a tag name and the tag info. Do `help tag` for more info")
|
||||
|
||||
exists = False
|
||||
for i in tags:
|
||||
if i == tag_name:
|
||||
exists = True
|
||||
|
||||
if not exists:
|
||||
tags.update({tag_name : tag_info})
|
||||
|
||||
async with aiofiles.open("src/shared_libs/tags.json", "w") as fp:
|
||||
json_data = json.dumps(tags)
|
||||
await fp.write(json_data)
|
||||
|
||||
return await ctx.send("The tag has been added")
|
||||
|
||||
await ctx.send("The tag already exists")
|
||||
|
||||
@tag.command(case_insensitive=True)
|
||||
async def remove(self, ctx, tag=None):
|
||||
"""Remove a existing tag"""
|
||||
await ctx.trigger_typing()
|
||||
if not ctx.author.guild_permissions.manage_guild:
|
||||
return await ctx.send("You are not allowed to do this")
|
||||
|
||||
if tag is None:
|
||||
return await ctx.send("Please provide a tag name and the tag info. Do `help tag` for more info")
|
||||
|
||||
found = None
|
||||
for i in tags:
|
||||
if i == tag:
|
||||
found = i
|
||||
|
||||
if found is not None:
|
||||
del tags[found]
|
||||
async with aiofiles.open("src/shared_libs/tags.json", "w") as fp:
|
||||
json_data = json.dumps(tags)
|
||||
await fp.write(json_data)
|
||||
|
||||
return await ctx.send("The tag has been removed")
|
||||
|
||||
await ctx.send("The tag has not been found")
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Tag(bot))
|
||||
Reference in New Issue
Block a user