Skip to content

Commit a60320f

Browse files
author
mahtoid
committed
quick_link and link removal
1 parent ccdfe4d commit a60320f

File tree

3 files changed

+1
-116
lines changed

3 files changed

+1
-116
lines changed

README.md

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -379,83 +379,6 @@ async def save(ctx: commands.Context):
379379
</details>
380380
<p align="right">(<a href="#top">back to top</a>)</p>
381381

382-
383-
---
384-
## Additional Functions
385-
386-
387-
<details><summary><b>Link Function</b></summary>
388-
Downloading exported chats can build up a bunch of unwanted files on your PC which can get annoying, additionally - not everyone wants to download content from Discord.
389-
390-
Due to these pain, and many requests - I have built a fancy PHP script which will show the transcript file within a browser.<br/>
391-
<ol>
392-
<details><summary>quick_link</summary>
393-
Similar in design to `.quick_export()` this is a bit of a demo function to produce a link and to give you an embed.
394-
395-
**Required Argument(s):**<br/>
396-
`channel`: `discord.TextChannel` object, whether `ctx.channel` or any channel you gather.<br/>
397-
`message`: The Discord message containing the transcript file
398-
399-
**Return Argument:**<br/>
400-
`discord.Message`: The message _quick_link_ will send, containing the embed.
401-
402-
**Example:**
403-
```python
404-
import chat_exporter
405-
406-
...
407-
408-
@bot.command()
409-
async def save(ctx: commands.Context):
410-
message = await chat_exporter.quick_export(ctx.channel)
411-
await chat_exporter.quick_link(ctx.channel, message)
412-
```
413-
</details>
414-
415-
<details><summary>link</summary>
416-
A simple function to return the link you will need to view the transcript online.
417-
418-
**Required Argument(s):**<br/>
419-
`message`: The Discord message containing the transcript file
420-
421-
**Return Argument:**<br/>
422-
`link`: The link to view the transcript file online
423-
424-
**Example:**
425-
```python
426-
import io
427-
428-
import chat_exporter
429-
430-
...
431-
432-
@bot.command()
433-
async def save(ctx: commands.Context):
434-
transcript = await chat_exporter.export(ctx.channel)
435-
436-
if transcript is None:
437-
return
438-
439-
transcript_file = discord.File(
440-
io.BytesIO(transcript.encode()),
441-
filename=f"transcript-{ctx.channel.name}.html",
442-
)
443-
444-
message = await ctx.send(file=transcript_file)
445-
link = await chat_exporter.link(message)
446-
447-
await ctx.send("Click this link to view the transcript online: " + link)
448-
```
449-
</details>
450-
</ol>
451-
452-
_Please note that the PHP script does NOT store any information.<br/>
453-
It simply makes a request to the given URL and echos (prints) the content for you to be able to view it._
454-
455-
</details>
456-
457-
458-
459382
---
460383
## Attributions
461384

chat_exporter/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
AttachmentToLocalFileHostHandler,
99
AttachmentToDiscordChannelHandler)
1010

11-
__version__ = "2.8.2"
11+
__version__ = "2.8.3"
1212

1313
__all__ = (
1414
export,

chat_exporter/chat_exporter.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import datetime
22
import io
3-
import warnings
43
from typing import List, Optional
54

65
from chat_exporter.construct.transcript import Transcript
@@ -143,40 +142,3 @@ async def raw_export(
143142
attachment_handler=attachment_handler
144143
).export()
145144
).html
146-
147-
148-
async def quick_link(
149-
channel: discord.TextChannel,
150-
message: discord.Message
151-
):
152-
"""
153-
Create a quick link for your transcript file.
154-
This function will return an embed with a link to view the transcript online.
155-
:param channel: discord.TextChannel
156-
:param message: discord.Message
157-
:return: discord.Message (posted link)
158-
"""
159-
warnings.warn("quick_link is deprecated and will be removed along with the site on the 31st March.", DeprecationWarning, stacklevel=2)
160-
161-
embed = discord.Embed(
162-
title="Transcript Link",
163-
description=(
164-
f"[Click here to view the transcript](https://mahto.id/chat-exporter?url={message.attachments[0].url})"
165-
),
166-
colour=discord.Colour.blurple(),
167-
)
168-
169-
return await channel.send(embed=embed)
170-
171-
172-
async def link(
173-
message: discord.Message
174-
):
175-
"""
176-
Returns a link which you can use to display in a message.
177-
This function will return a string of the link.
178-
:param message: discord.Message
179-
:return: string (link: https://mahto.id/chat-exporter?url=ATTACHMENT_URL)
180-
"""
181-
warnings.warn("link is deprecated and will be removed along with the site on the 31st March.", DeprecationWarning, stacklevel=2)
182-
return "https://mahto.id/chat-exporter?url=" + message.attachments[0].url

0 commit comments

Comments
 (0)