This repository has been archived by the owner on May 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add lots. yey
- Loading branch information
MrRazamataz
committed
Oct 28, 2021
1 parent
211f5f9
commit d740509
Showing
31 changed files
with
1,408 additions
and
1,552 deletions.
There are no files selected for viewing
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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,20 +1,98 @@ | ||
#MrRazamataz's RazBot | ||
#Help test command | ||
|
||
import random | ||
# MrRazamataz's RazBot | ||
# cmds command | ||
import discord | ||
from discord import reaction | ||
from discord.ext import commands | ||
from discord import reaction | ||
import asyncio | ||
import os | ||
|
||
import aiofiles | ||
# help pages | ||
page1 = discord.Embed(title="RazBot Help Page 1", description="Use the buttons below to navigate between help pages. If there are no buttons, its because there was no input for 60 seconds, and was timed out. Run the `raz!help` command again to bring up another menu.", colour=discord.Colour.orange()) | ||
page2 = discord.Embed(title="RazBot Help Page 2", description="Commands:", colour=discord.Colour.orange()) | ||
page2.set_thumbnail(url="https://www.mrrazamataz.ga/archive/RazBot.png") | ||
page2.add_field(name="Moderation:", value="\u200b", inline=False) | ||
page2.add_field(name="Ban:", value="`raz!ban [user-ping] [reason]`, bans the specified user from the server.", inline=True) | ||
page2.add_field(name="Unban: ", value="`raz!unban [user]`, unbans the specified user from the server.", inline=True) | ||
page2.add_field(name="Mute: ", value="`raz!mute [user-ping]`, adds the muted role to the user.", inline=True) | ||
page2.add_field(name="Unmute: ", value="`raz!unmute [user-ping]`, removes the muted role fron the user.", inline=True) | ||
page2.add_field(name="Temp Mute:", value="`raz!tempmute [user-ping] [Number] [s/m/h/d]`, tempmute the user for the amount of time specified. **Note: The space (` `) between `[Number]` and `[s/m/h/d]` is required.**", inline=True) | ||
page2.add_field(name="Kick:", value="`raz!kick [user-ping]`, kicks the specified user from the server.", inline=True) | ||
page2.add_field(name="Clear:", value="`raz!clear [number]`, clears the specified amount of messages.", inline=True) | ||
page2.add_field(name="Lockdown:", value="`raz!lockdown`, locks down the channel for non admins/staff.", inline=True) | ||
page2.add_field(name="Unlock:", value="`raz!unlock`, unlockdowns the channel after a `raz!lockdown`.", inline=True) | ||
page2.add_field(name="Say:", value="`raz!say [message]`, make the bot repeat the message.", inline=True) | ||
page2.add_field(name="Warn: ", value="`raz!warn [user-ping] [reason]`, add a warning to the user in that server.", inline=True) | ||
page2.add_field(name="View Warnings:", value="`raz!warnings [user-ping]`. view the warnings of the user for that server.", inline=True) | ||
page2.add_field(name="Slowmode:", value="`raz!slowmode <seconds>`, puts the channel in slowmode for the specified amount, set to 0 to disable slowmode.", inline=False) | ||
page2.add_field(name="Useful Commands:", value="\u200b", inline=True) | ||
page2.add_field(name="Add Reaction Role:", value="`raz!reactionrole [RoleName] [MessageID] [Emoji]`, adds a reaction which users can react to to give themselves the specifed role (works multiple times on the same message with differnet reactions).", inline=True) | ||
page2.add_field(name="Add Role:", value="`raz!add_role @usermention [role name]`, gives the user the role specifed. ", inline=True) | ||
page2.add_field(name="Suggest:", value="`raz!suggest <text>`, like vote, but for normal users (only adds reactions).", inline=True) | ||
page2.add_field(name="Vote:", value="`raz!vote <text>`, adds vote reactions and explanation. ", inline=True) | ||
page2.add_field(name="Version:", value="`raz!ver`, shows the version of the bot.", inline=True) | ||
page2.add_field(name="Lucky (Giveaway):", value="`raz!lucky`, adds a reaction and after 24hours, picks a random person from the reactions.", inline=True) | ||
page3 = discord.Embed(title="RazBot Help Page 3", description="Music commands:", colour=discord.Colour.orange()) | ||
page3.add_field(name="\u200b", value="`raz!p <song name or YouTube song/playlist URL>`, plays the song/playlist.", inline=True) | ||
page3.add_field(name="\u200b", value="`raz!pause` then `raz!p` to unpause.", inline=True) | ||
page3.add_field(name="\u200b", value="`raz!skip`, skip to the next track in queue.", inline=True) | ||
page3.add_field(name="\u200b", value="`raz!back`, go back to the last song in queue.", inline=True) | ||
page3.add_field(name="\u200b", value="`raz!q`, shows the queue.", inline=True) | ||
page3.add_field(name="\u200b", value="`raz!np`, shows info about the currently playing song.", inline=True) | ||
page3.add_field(name="\u200b", value="`raz!shuffle`, shuffles the queue order.", inline=True) | ||
page3.add_field(name="\u200b", value="`raz!vol`, change the volume from 0-150%.", inline=True) | ||
page3.add_field(name="\u200b", value="`raz!replay`, replay the song.", inline=True) | ||
page3.add_field(name="\u200b", value="`raz!jump`, jump to a specific timestamp in the song.", inline=True) | ||
page3.add_field(name="\u200b", value="`raz!stop`, stop the playing track and clear queue.", inline=True) | ||
page3.add_field(name="\u200b", value="`raz!loop`, loop the current queue.", inline=True) | ||
page3.add_field(name="\u200b", value="`raz!lyrics`, attempt to find the lyrics to the playing song.", inline=True) | ||
page3.add_field(name="\u200b", value="`raz!skipto`, skips to a song value that's in the queue.", inline=True) | ||
timeoutpage = discord.Embed(title="RazBot Help Page Timeout", description="This helppage has timed out after no input, please run `raz!cmds` again if you want to use it again", colour=discord.Colour.red()) | ||
class cmds(commands.Cog): | ||
def __init__(self, client): | ||
self.client = client | ||
|
||
client.help_pages = [page1, page2, page3] | ||
@commands.command(name="cmds") | ||
async def command_help(self, ctx: commands.Context): | ||
await ctx.channel.send("For commands, look on the second page of `raz!help`.") | ||
async def cmds(self, ctx: commands.Context): | ||
try: | ||
buttons = [u"\u23EA", u"\u2B05", u"\u27A1", u"\u23E9"] # skip to start, left, right, skip to end | ||
current = 0 | ||
msg = await ctx.send(embed=self.client.help_pages[current]) | ||
|
||
for button in buttons: | ||
await msg.add_reaction(button) | ||
|
||
while True: | ||
try: | ||
reaction, user = await self.client.wait_for("reaction_add", check=lambda reaction, user: user == ctx.author and reaction.emoji in buttons,timeout=60.0) | ||
|
||
except asyncio.TimeoutError: | ||
await msg.clear_reactions() | ||
return print("Cmds page timeout!") | ||
|
||
else: | ||
previous_page = current | ||
if reaction.emoji == u"\u23EA": | ||
current = 0 | ||
|
||
elif reaction.emoji == u"\u2B05": | ||
if current > 0: | ||
current -= 1 | ||
|
||
elif reaction.emoji == u"\u27A1": | ||
if current < len(self.client.help_pages) - 1: | ||
current += 1 | ||
|
||
elif reaction.emoji == u"\u23E9": | ||
current = len(self.client.help_pages) - 1 | ||
|
||
for button in buttons: | ||
await msg.remove_reaction(button, ctx.author) | ||
|
||
if current != previous_page: | ||
await msg.edit(embed=self.client.help_pages[current]) | ||
except Exception as e: | ||
await ctx.send("Hey! I don't currently have permissions to remove reactions and the like, which I *do* need to work correctly, so if you could give me those permissions, that would be lovelaay.") | ||
print(e) | ||
def setup(client): | ||
client.add_cog(cmds(client)) | ||
client.add_cog(cmds(client)) |
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,83 @@ | ||
# MrRazamataz's RazBot | ||
# Custom commands manager | ||
import discord | ||
from discord import reaction | ||
from discord.ext import commands | ||
import asyncio | ||
import os | ||
import aiofiles | ||
import json | ||
|
||
|
||
|
||
class customcommands(commands.Cog): | ||
def __init__(self, client): | ||
self.client = client | ||
|
||
@commands.group(name="cc") | ||
async def cc(self, ctx): | ||
if ctx.invoked_subcommand is None: | ||
await ctx.send("You can `create` or `del`.") | ||
|
||
@cc.command() | ||
@commands.has_permissions(manage_guild=True) | ||
async def create(self, ctx, name, *, text): | ||
global cc | ||
save = { | ||
"text": f"{text}" | ||
} | ||
with open('customcommands.json', 'r+') as f: | ||
data = json.load(f) | ||
f.seek(0) | ||
f.truncate(0) | ||
data[f'{ctx.guild.id}-{name.lower()}'] = {"text": f"{text}"} | ||
json.dump(data, f, indent=4) | ||
await ctx.send(f"Added custom command with `{name.lower()}` which contains `{text}`.") | ||
with open("customcommands.json") as f: | ||
cc = json.load(f) | ||
@cc.command(name="delete", aliases=["remove", "del"]) | ||
@commands.has_permissions(manage_guild=True) | ||
async def delete(self, ctx, name): | ||
global cc | ||
check = f"{ctx.guild.id}-{name.lower()}" | ||
with open('customcommands.json', 'r+') as f: | ||
data = json.load(f) | ||
try: | ||
data.pop(f"{check}") | ||
except Exception as e: | ||
await ctx.send(f"`{name.lower()}` was not found in the server's custom commands.") | ||
return | ||
f.seek(0) | ||
f.truncate(0) | ||
json.dump(data, f, indent=4) | ||
with open("customcommands.json") as f: | ||
cc = json.load(f) | ||
await ctx.send(f"Deleted `{name}`.") | ||
@cc.command() | ||
async def reload(self, ctx): | ||
global cc | ||
with open("customcommands.json") as f: | ||
cc = json.load(f) | ||
await ctx.send("Reloaded custom commands.") | ||
@commands.Cog.listener() | ||
async def on_ready(self): | ||
print("Loading custom commands...") | ||
global cc | ||
with open("customcommands.json") as f: | ||
cc = json.load(f) | ||
|
||
@commands.Cog.listener() | ||
async def on_message(self, message): | ||
global cc | ||
if message.guild is None: | ||
return | ||
guildid = str(message.guild.id) | ||
check = f"{guildid}-{message.content.lower()}" | ||
try: | ||
if check in cc: | ||
await message.channel.send(f'{cc[f"{check}"]["text"]}') | ||
#await message.channel.send(f'{cc[f"{check}"]}') | ||
except Exception as e: | ||
print(e) | ||
def setup(client): | ||
client.add_cog(customcommands(client)) |
Oops, something went wrong.