mirror of
https://github.com/dizedev/Main-tech.git
synced 2026-09-16 21:58:48 +00:00
added: base files
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
from disnake.ext import commands
|
||||
import random
|
||||
import asyncio
|
||||
|
||||
|
||||
class coins(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.slash_command()
|
||||
async def coins(self, ctx):
|
||||
coin = ["Орел", "Решка"]
|
||||
result = random.choice(coin)
|
||||
await ctx.send(f"Орел или решка? Угадайте! Результат будет через 3 секунды...")
|
||||
await asyncio.sleep(3)
|
||||
await ctx.send(f"Результат: {result}!")
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(coins(bot))
|
||||
@@ -0,0 +1,19 @@
|
||||
import disnake
|
||||
from disnake.ext import commands
|
||||
|
||||
class help1(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
|
||||
@commands.slash_command()
|
||||
async def commands(self, ctx):
|
||||
embed = disnake.Embed(title="Помощь по командам", description="Вот список всех моих команд и их описания:")
|
||||
embed.add_field(name="$help", value="Показывает список всех доступных команд.")
|
||||
embed.add_field(name="$ping", value="Проверка работоспособности бота.")
|
||||
embed.add_field(name="$coins", value="Игра Орел и Решка.")
|
||||
embed.add_field(name="$mute", value="Выдает мут участнику на определенное время.")
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(help1(bot))
|
||||
@@ -0,0 +1,22 @@
|
||||
import random
|
||||
|
||||
from disnake.ext import commands
|
||||
|
||||
class shar(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
|
||||
@commands.slash_command()
|
||||
async def шар(self,ctx, *, question):
|
||||
answers = [
|
||||
"Я не знаю.",
|
||||
"Да.",
|
||||
"Нет.",
|
||||
"Возможно.",
|
||||
"Спроси позже."
|
||||
]
|
||||
await ctx.send(f"Ваш вопрос: {question}\nМой ответ: {random.choice(answers)}")
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(shar(bot))
|
||||
@@ -0,0 +1,14 @@
|
||||
from disnake.ext import commands
|
||||
|
||||
class Ping(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.has_any_role(1091637465858715648)
|
||||
@commands.slash_command()
|
||||
async def ping(self, interaction):
|
||||
await interaction.response.send_message("Понг!")
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(Ping(bot))
|
||||
@@ -0,0 +1,31 @@
|
||||
import asyncio
|
||||
|
||||
import disnake
|
||||
from disnake.ext import commands
|
||||
|
||||
class mute(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.slash_command()
|
||||
@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")
|
||||
|
||||
if not mutedRole:
|
||||
mutedRole = await guild.create_role(name="Muted")
|
||||
|
||||
# Проверка роли на каждый чат
|
||||
for channel in guild.channels:
|
||||
await channel.set_permissions(mutedRole, speak=False, send_messages=False)
|
||||
|
||||
await member.add_roles(mutedRole, reason=reason)
|
||||
await ctx.send(f"{member.mention} был замучен на {time} секунд. Причина: {reason}.")
|
||||
await asyncio.sleep(time)
|
||||
await member.remove_roles(mutedRole)
|
||||
await ctx.send(f"{member.mention} больше не замучен.")
|
||||
|
||||
|
||||
def setup(bot):
|
||||
bot.add_cog(mute(bot))
|
||||
@@ -0,0 +1,39 @@
|
||||
import disnake
|
||||
from disnake.ext import commands
|
||||
import os
|
||||
|
||||
intents = disnake.Intents.all()
|
||||
bot = commands.Bot(command_prefix="$", intents=intents)
|
||||
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
print("Bot is ready")
|
||||
|
||||
|
||||
@bot.command()
|
||||
@commands.has_guild_permissions(administrator=True) # administrator=True - значит что использовать команду может человек только с правом администратора
|
||||
async def setmoderator(ctx, member: disnake.Member):
|
||||
member = member or ctx.message.author
|
||||
guild = bot.get_guild(1060537877982887957)
|
||||
role = guild.get_role(1060541642450411560)
|
||||
await member.add_roles(role)
|
||||
await ctx.send(f"Пользователю {member.mention} была выдана роль {role.mention}")
|
||||
|
||||
@bot.command()
|
||||
@commands.has_guild_permissions(administrator=True) # administrator=True - значит что использовать команду может человек только с правом администратора
|
||||
async def dellmoderator(ctx, member: disnake.Member, moder_level: int):
|
||||
member = member or ctx.message.author
|
||||
guild = bot.get_guild(1060537877982887957)
|
||||
role = guild.get_role(1060541642450411560)
|
||||
await member.remove_roles(role)
|
||||
await ctx.send(f"Пользователю {member.mention} была снята роль {role.mention}")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for filename in os.listdir("./cogs"):
|
||||
if filename.endswith(".py"):
|
||||
bot.load_extension(f"cogs.{filename[:-3]}")
|
||||
|
||||
bot.run("MTA5ODk5MzExMjI5NjE5NDA3MA.GUj8WN.16iwjYtaouRXbsfJhCi1U7fa75ehLFb7YRbEnU")
|
||||
Reference in New Issue
Block a user