import discord
from discord.ext import tasks, commands
from config import settings
from discord import *
import random
bot = commands.Bot(command_prefix = settings['prefix'])
client = discord.Client()
server = bot.get_guild(742361362310627329)
@commands.cooldown(rate=1, per=5, type=commands.BucketType.user)
@bot.command()
async def sosibibu(ctx):
author = ctx.message.author
num1 = (random.randint(0,9))
num2 = (random.randint(0,9))
num3 = (random.randint(0,9))
if num3 != 1:
if num3 == num2:
if num3 == num1:
await ctx.send('Поздравляю')
role = utils.get(author.guild.roles, name="Владелец сервера(Нет)")
await author.add_roles(role)
if num3 == 1:
if num2 == 1:
if num1 == 1:
role = utils.get(author.guild.roles, name="Роль")
await author.add_roles(role)
await ctx.send('Ты выиграл роль!')
await ctx.send(f'{num1, num2, num3} {author.mention}!')
async def color():
role_1 = discord.utils.get(discord.Guild.get_role, name="Роль_color") #Здесь выдает ошибку TypeError: 'function' object is not iterable как мне получить объект role_1 здесь
await role_1.edit(color=discord.Color(0xff0000))
await role_1.edit(color=discord.Color(0xff6600))
await role_1.edit(color=discord.Color(0xffff00))
await role_1.edit(color=discord.Color(0x33cc33))
await role_1.edit(color=discord.Color(0x0099ff))
await role_1.edit(color=discord.Color(0x0000ff))
await role_1.edit(color=discord.Color(0x333399))
client.loop.create_task(color())
bot.run(settings['token'])