last code from server

This commit is contained in:
Alex D
2023-04-25 04:47:00 +03:00
parent cb8fb7d359
commit 5cca85686e
12 changed files with 31 additions and 24 deletions
+2 -2
View File
@@ -6,12 +6,12 @@ class AboutCommand(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(name="about")
@commands.slash_command(name="бот", description="Показывает информацию о боте и их разработчиках")
async def about(self, ctx: disnake.AppCommandInteraction):
embed = disnake.Embed(title='О боте', description='Многофункциональный бот.', color=0x00ff00)
embed.set_author(name='Hyper Tech')
embed.add_field(name='Автор', value='<@795901895666434070> а так же <@662994219794956298>\n')
embed.add_field(name='Версия', value='v1.01.')
embed.add_field(name='Версия', value='v1.02.')
embed.add_field(name='Дата выпуска', value='23.04.2023')
await ctx.send(embed=embed)
+1 -1
View File
@@ -6,7 +6,7 @@ class AvatarCommand(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(name="avatar")
@commands.slash_command(name="аватар", description="Показывает аватар указанного пользователя")
async def avatar(self, ctx: disnake.AppCommandInteraction, member: disnake.Member = None):
if not member:
member = ctx.author
+2 -2
View File
@@ -6,7 +6,7 @@ class BanCommands(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(name="ban", description="Изгоняет указанного участника с сервера навсегда.")
@commands.slash_command(name="бан", description="Изгоняет указанного участника с сервера навсегда.")
async def ban(self, ctx: disnake.AppCommandInteraction, member: disnake.Member, *, reason=None):
if disnake.utils.get(ctx.author.roles, id=1060542125621649458):
await member.ban(reason=reason)
@@ -15,7 +15,7 @@ class BanCommands(commands.Cog):
await ctx.send(f'{ctx.author.mention}, у вас нет роли <@&1060542125621649458>.')
@commands.has_any_role(1060542125621649458)
@commands.slash_command(name="unban")
@commands.slash_command(name="унбан", description="Снимает блокировку")
async def unban(self, ctx: disnake.AppCommandInteraction, *, user: disnake.User):
if disnake.utils.get(ctx.author.roles, id=1060542125621649458):
await ctx.guild.unban(user)
+4 -1
View File
@@ -8,8 +8,11 @@ class CoinsCommand(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(name="coins")
@commands.slash_command(name="coins", description="Игра в Орел и Решку")
async def coins(self, ctx: disnake.AppCommandInteraction):
if ctx.guild.id != 1099696069257990214:
await ctx.send('Эта команда доступна только на определенном сервере')
return
coin = ["Орел", "Решка"]
result = random.choice(coin)
await ctx.send("Орел или решка? Угадайте! Результат будет через 3 секунды...")
+5 -2
View File
@@ -6,7 +6,7 @@ class HelpCommand(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(name="commands")
@commands.slash_command(name="помощь", description="Показывает все команды бота")
async def commands(self, ctx: disnake.AppCommandInteraction):
embed = disnake.Embed(title="Помощь по командам", description="Вот список всех моих команд и их описания:")
embed.add_field(name="/help", value="Показывает список всех доступных команд.")
@@ -15,7 +15,10 @@ class HelpCommand(commands.Cog):
embed.add_field(name="/ball", value="Даёт верные ответы на все ваши вопросы.")
embed.add_field(name="/math", value="Можно решить любые математические примеры.")
embed.add_field(name="/ticket", value="Создает тикет")
embed.add_field(name="/dog", value="Показывает фото случайной собаки.")
embed.add_field(name="/ban", value="Выдает бан пользователю (Использовать может только модератор)")
embed.add_field(name="/about", value="Показывает информацию о боте")
embed.add_field(name="/avatar", value="Показывает аватар выбранного пользователя.")
await ctx.send(embed=embed)
+2 -2
View File
@@ -7,11 +7,11 @@ class DogCommands(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(name="dog")
@commands.slash_command(name="собака", description="Показывает фото случайной собаки")
async def dog(self, ctx: disnake.AppCommandInteraction):
response = requests.get('https://dog.ceo/api/breeds/image/random')
img_url = response.json()['message']
embed = disnake.Embed(title='Случайная собака', color=0x00ff00)
embed = disnake.Embed(title='Случайная собака', color=0x00f8fe)
embed.set_image(url=img_url)
await ctx.send(embed=embed)
+3 -2
View File
@@ -7,14 +7,15 @@ class MagicBallCommand(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(name="ball", description="Даёт верные ответы на все ваши вопросы.")
@commands.slash_command(name="шар", description="Даёт верные ответы на все ваши вопросы.")
async def ball(self, ctx: disnake.AppCommandInteraction, *, question):
answers = [
"Я не знаю.",
"Да.",
"Нет.",
"Возможно.",
"Спроси позже."
"Спроси позже.",
"Иди нахуй."
]
await ctx.send(f"Ваш вопрос: {question}\nМой ответ: {random.choice(answers)}")
+2 -2
View File
@@ -6,11 +6,11 @@ class MathCommands(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(name="math")
@commands.slash_command(name="калькулятор", description="Помогает решить любой пример")
async def math(self, ctx: disnake.AppCommandInteraction, *, equation):
try:
result = eval(equation)
await ctx.send(f'Задача: {equation} = {result}')
await ctx.send(f'Задача: {equation} = {result}')
except:
await ctx.send('Ошибка при выполнении вычислений.')
+1 -1
View File
@@ -7,7 +7,7 @@ class PingCommands(commands.Cog):
self.bot = bot
@commands.has_any_role(1091637465858715648)
@commands.slash_command(name="ping")
@commands.slash_command(name="ping", description="Показывает состояние бота")
async def ping(self, ctx: disnake.AppCommandInteraction):
if disnake.utils.get(ctx.author.roles, id=1091637465858715648):
if ctx.channel.id == 1060544039767789639:
+2 -2
View File
@@ -8,7 +8,7 @@ class MuteCommands(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.slash_command(name="mute", description="Заглушает по всему серверу на указанное время.")
@commands.slash_command(name="мут", description="Заглушает пользователя по всему серверу на указанное время.")
@commands.has_permissions(manage_roles=True)
async def mute(self, ctx: disnake.AppCommandInteraction, member: disnake.Member, time: int, *, reason=None):
if disnake.utils.get(ctx.author.roles, id=1060541642450411560):
@@ -30,7 +30,7 @@ class MuteCommands(commands.Cog):
else:
await ctx.send(f'{ctx.author.mention}, у вас нет роли <@&1060541642450411560>.')
@commands.slash_command(name="unmute", description="Снимает мут с указанного пользователя.")
@commands.slash_command(name="унмут", description="Снимает мут с указанного пользователя.")
@commands.has_permissions(manage_roles=True)
async def unmute(self, ctx: disnake.AppCommandInteraction, member: disnake.Member):
if disnake.utils.get(ctx.author.roles, id=1060541642450411560):
+2 -2
View File
@@ -8,7 +8,7 @@ class TicketsCommand(commands.Cog):
ticket_channel = None
@commands.slash_command(name="ticket")
@commands.slash_command(name="ticket", description="Создает тикет")
@commands.has_permissions(manage_channels=True)
async def ticket(self, ctx: disnake.AppCommandInteraction):
global ticket_channel
@@ -24,7 +24,7 @@ class TicketsCommand(commands.Cog):
except:
await ctx.send('Ошибка при создании канала. Пожалуйста, попробуйте позже.')
@commands.slash_command(name="close_ticket")
@commands.slash_command(name="close_ticket", description="Закрывает тикет")
@commands.has_permissions(manage_channels=True)
async def close_ticket(self, ctx: disnake.AppCommandInteraction):
global ticket_channel
+5 -5
View File
@@ -1,6 +1,6 @@
import json
import os
import settings
import disnake
from disnake.ext import commands
@@ -28,13 +28,13 @@ async def on_ready():
print("Bot is ready")
@bot.command(name="super_secret_command")
@bot.command(name="секрет")
async def secret(ctx):
await ctx.message.delete()
await ctx.send(f'Привет, {ctx.author.mention}. Это тайное сообщение!')
@bot.command(name="news")
@bot.slash_command(name="news", description="Показывает последние новости (но это не точно...)")
async def news(ctx):
# Ваш код для получения новостей
page_news = [
@@ -58,7 +58,7 @@ async def news(ctx):
await ctx.send(embed=embed)
@bot.command(name="setmoderator")
@bot.slash_command(name="setmoderator", description="Выдает роль модератора")
@commands.has_guild_permissions(administrator=True)
async def set_moderator(ctx: disnake.AppCommandInteraction, member: disnake.Member):
member = member or ctx.message.author
@@ -69,7 +69,7 @@ async def set_moderator(ctx: disnake.AppCommandInteraction, member: disnake.Memb
await ctx.send(f"Пользователю {member.mention} была выдана роль {role.mention}")
@bot.command(name="deletemoderator")
@bot.command(name="deletemoderator", description="Снимает роль модератора")
@commands.has_guild_permissions(administrator=True)
async def delete_moderator(ctx: disnake.AppCommandInteraction, member: disnake.Member):
member = member or ctx.message.author