discord.py 2.0 fun
Invites will not work because discord-ext-menus needs to be updated in Red
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import discord
|
||||
from redbot.core import Config, commands, checks
|
||||
from typing import Optional, Literal
|
||||
import datetime
|
||||
import re
|
||||
|
||||
IMAGE_LINKS = re.compile(r"(http[s]?:\/\/[^\"\']*\.(?:png|jpg|jpeg|gif|png))")
|
||||
@@ -37,7 +36,7 @@ class Away(commands.Cog):
|
||||
def _draw_play(self, song):
|
||||
song_start_time = song.start
|
||||
total_time = song.duration
|
||||
current_time = datetime.datetime.utcnow()
|
||||
current_time = discord.utils.utcnow()
|
||||
elapsed_time = current_time - song_start_time
|
||||
sections = 12
|
||||
loc_time = round((elapsed_time / total_time) * sections) # 10 sections
|
||||
@@ -60,7 +59,7 @@ class Away(commands.Cog):
|
||||
"""
|
||||
Makes the embed reply
|
||||
"""
|
||||
avatar = author.avatar_url_as() # This will return default avatar if no avatar is present
|
||||
avatar = author.display_avatar # This will return default avatar if no avatar is present
|
||||
color = author.color
|
||||
if message:
|
||||
link = IMAGE_LINKS.search(message)
|
||||
@@ -226,7 +225,7 @@ class Away(commands.Cog):
|
||||
return False
|
||||
|
||||
@commands.Cog.listener()
|
||||
async def on_message(self, message: discord.Message):
|
||||
async def on_message_without_command(self, message: discord.Message):
|
||||
guild = message.guild
|
||||
if not guild or not message.mentions or message.author.bot:
|
||||
return
|
||||
@@ -667,7 +666,7 @@ class Away(commands.Cog):
|
||||
|
||||
if ctx.channel.permissions_for(ctx.me).embed_links:
|
||||
em = discord.Embed(description=msg[:2048], color=author.color)
|
||||
em.set_author(name=f"{author.display_name}'s away settings", icon_url=author.avatar_url)
|
||||
em.set_author(name=f"{author.display_name}'s away settings", icon_url=author.avatar.url)
|
||||
await ctx.send(embed=em)
|
||||
else:
|
||||
await ctx.send(f"{author.display_name} away settings\n" + msg)
|
||||
|
||||
Reference in New Issue
Block a user