cool edited files

This commit is contained in:
Alex D
2023-04-23 19:01:06 +03:00
parent 6e93ae616e
commit 98edc16962
8 changed files with 304 additions and 28 deletions
+8 -6
View File
@@ -1,20 +1,22 @@
from disnake.ext import commands
import random
import asyncio
import random
from disnake.ext import commands
class coins(commands.Cog):
class Coins(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command()
@commands.slash_command(name="супер", description='Команда, которая возвращает орла или решку.')
async def coins(self, ctx):
coin = ["Орел", "Решка"]
result = random.choice(coin)
await ctx.send(f"Орел или решка? Угадайте! Результат будет через 3 секунды...")
info = await ctx.send(f"Орел или решка? Угадайте! Результат будет через 3 секунды...")
await asyncio.sleep(3)
await ctx.send(f"Результат: {result}!")
def setup(bot):
bot.add_cog(coins(bot))
bot.add_cog(Coins(bot))
+4 -3
View File
@@ -1,11 +1,11 @@
import disnake
from disnake.ext import commands
class help1(commands.Cog):
class Help1(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command()
async def commands(self, ctx):
embed = disnake.Embed(title="Помощь по командам", description="Вот список всех моих команд и их описания:")
@@ -15,5 +15,6 @@ class help1(commands.Cog):
embed.add_field(name="$mute", value="Выдает мут участнику на определенное время.")
await ctx.send(embed=embed)
def setup(bot):
bot.add_cog(help1(bot))
bot.add_cog(Help1(bot))
+5 -4
View File
@@ -2,13 +2,13 @@ import random
from disnake.ext import commands
class shar(commands.Cog):
class MagicBall(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command()
async def шар(self,ctx, *, question):
async def ask_a_ball(self, ctx, *, question):
answers = [
"Я не знаю.",
"Да.",
@@ -18,5 +18,6 @@ class shar(commands.Cog):
]
await ctx.send(f"Ваш вопрос: {question}\nМой ответ: {random.choice(answers)}")
def setup(bot):
bot.add_cog(shar(bot))
bot.add_cog(MagicBall(bot))
+1
View File
@@ -1,5 +1,6 @@
from disnake.ext import commands
class Ping(commands.Cog):
def __init__(self, bot):
self.bot = bot
+9 -8
View File
@@ -3,7 +3,8 @@ import asyncio
import disnake
from disnake.ext import commands
class mute(commands.Cog):
class Mute(commands.Cog):
def __init__(self, bot):
self.bot = bot
@@ -11,21 +12,21 @@ class mute(commands.Cog):
@commands.has_permissions(manage_roles=True)
async def mute(self, ctx, member: disnake.Member, time: int, *, reason=None):
guild = ctx.guild
mutedRole = disnake.utils.get(guild.roles, name="Muted")
muted_role = disnake.utils.get(guild.roles, name="Muted")
if not mutedRole:
mutedRole = await guild.create_role(name="Muted")
if not muted_role:
muted_role = await guild.create_role(name="Muted")
# Проверка роли на каждый чат
for channel in guild.channels:
await channel.set_permissions(mutedRole, speak=False, send_messages=False)
await channel.set_permissions(muted_role, speak=False, send_messages=False)
await member.add_roles(mutedRole, reason=reason)
await member.add_roles(muted_role, reason=reason)
await ctx.send(f"{member.mention} был замучен на {time} секунд. Причина: {reason}.")
await asyncio.sleep(time)
await member.remove_roles(mutedRole)
await member.remove_roles(muted_role)
await ctx.send(f"{member.mention} больше не замучен.")
def setup(bot):
bot.add_cog(mute(bot))
bot.add_cog(Mute(bot))