PythonXeno/cogs/test.py
2024-10-26 04:47:45 -05:00

78 lines
2.8 KiB
Python

import json
import discord
import time
import asyncio
from typing import Union
from discord.ext import commands
## Xeno Discord PY Bot
### Testing Commands
if __name__ == "__main__":
print("This is a cog (addon) for the Xeno Discord bot. This file cannot be run standalone.")
exit()
class Testing(commands.Cog):
def __init__(self, bot):
self.bot = bot
# args
@commands.command(name='testargs', pass_context=True)
async def testargs(self, ctx, arg1, arg2):
await ctx.send(f'{arg1} and {arg2} was sent!')
@commands.command(name='embedtest', pass_context=True)
async def embed(self, ctx):
embed=discord.Embed(title="embed testing!", description="you're a cute pone :3")
embed.set_thumbnail(url="https://iraven.net/siteimg/deioxpk-32.png")
await ctx.send(embed=embed)
@commands.command(name='botlogtest', pass_context=True)
async def botlogtest(self, ctx, arg):
print(arg)
logchnl = commands.Bot.get_channel('761854845283860531')
logchnl.send(f'test :3')
logchnl.send(f'{arg}')
@commands.command(name='ping2')
async def ping2(self, ctx, arg):
argms = (f'{arg * 100}')
await ctx.channel.send(f'Pinging {ctx.message.author.name} every {argms} ms...')
time.sleep({arg})
await ctx.channel.send(f'Tink! {commands.bot.latency * {argms}} ms')
time.sleep({arg})
await ctx.channel.send(f'Tink! {commands.bot.latency * {argms}} ms')
time.sleep({arg})
await ctx.channel.send(f'Tink! {commands.bot.latency * {argms}} ms')
@commands.command(name='uploadtest', description='tests upload')
async def uploadtest(self,ctx):
print("upload test command was run, testing upload capabilities")
await ctx.reply(file=discord.File(f'data/test/xeno_wave.gif'))
await ctx.send(f'if you see the above image, this actually fucking worked LOL')
# @commands.command(name='reactiontest', description='tests reaction for verif')
# async def reactiontest(self, ctx):
# reactions = ['\U+26A0']
# # initmsg = await ctx.send(f'{ctx.author}- react with :warning: on this message')
# for i in reactions:
# await ctx.add_reaction(i)
# @commands.Bot.event
# async def on_raw_reaction_add(payload):
# channel = commands.Bot.get_channel(payload.channel_id)
# message = await channel.fetch_message(payload.message_id)
# guild = commands.Bot.get_guild(payload.guild_id)
# member = guild.get_member(payload.user_id)
# reaction = discord.utils.get(message.reactions, emoji=payload.emoji.name)
# # only work if client
# if payload.user_id == commands.Bot.user.id:
# return
# if payload
async def setup(bot):
print(f'Cog_Testing was initialized')
await bot.add_cog(Testing(bot))